diff --git a/.cproject b/.cproject
index ceda6fadc..1fa7dadc5 100644
--- a/.cproject
+++ b/.cproject
@@ -311,14 +311,6 @@
 				true
 				true
 			
-			
-				make
-				-j2
-				testGaussianFactor.run
-				true
-				true
-				true
-			
 			
 				make
 				-j2
@@ -345,6 +337,7 @@
 			
 			
 				make
+				
 				tests/testBayesTree.run
 				true
 				false
@@ -352,6 +345,7 @@
 			
 			
 				make
+				
 				testBinaryBayesNet.run
 				true
 				false
@@ -399,6 +393,7 @@
 			
 			
 				make
+				
 				testSymbolicBayesNet.run
 				true
 				false
@@ -406,6 +401,7 @@
 			
 			
 				make
+				
 				tests/testSymbolicFactor.run
 				true
 				false
@@ -413,6 +409,7 @@
 			
 			
 				make
+				
 				testSymbolicFactorGraph.run
 				true
 				false
@@ -428,11 +425,20 @@
 			
 			
 				make
+				
 				tests/testBayesTree
 				true
 				false
 				true
 			
+			
+				make
+				-j2
+				testGaussianFactor.run
+				true
+				true
+				true
+			
 			
 				make
 				-j2
@@ -459,7 +465,6 @@
 			
 			
 				make
-				
 				testGraph.run
 				true
 				false
@@ -531,7 +536,6 @@
 			
 			
 				make
-				
 				testInference.run
 				true
 				false
@@ -539,7 +543,6 @@
 			
 			
 				make
-				
 				testGaussianFactor.run
 				true
 				false
@@ -547,7 +550,6 @@
 			
 			
 				make
-				
 				testJunctionTree.run
 				true
 				false
@@ -555,7 +557,6 @@
 			
 			
 				make
-				
 				testSymbolicBayesNet.run
 				true
 				false
@@ -563,7 +564,6 @@
 			
 			
 				make
-				
 				testSymbolicFactorGraph.run
 				true
 				false
@@ -633,22 +633,6 @@
 				false
 				true
 			
-			
-				make
-				-j2
-				all
-				true
-				true
-				true
-			
-			
-				make
-				-j2
-				clean
-				true
-				true
-				true
-			
 			
 				make
 				-j2
@@ -665,6 +649,22 @@
 				true
 				true
 			
+			
+				make
+				-j2
+				all
+				true
+				true
+				true
+			
+			
+				make
+				-j2
+				clean
+				true
+				true
+				true
+			
 			
 				make
 				-j2
@@ -689,18 +689,26 @@
 				true
 				true
 			
-			
+			
 				make
-				-j5
-				nonlinear.testValues.run
+				-j2
+				all
 				true
 				true
 				true
 			
-			
+			
 				make
-				-j5
-				nonlinear.testOrdering.run
+				-j2
+				check
+				true
+				true
+				true
+			
+			
+				make
+				-j2
+				clean
 				true
 				true
 				true
@@ -737,26 +745,18 @@
 				true
 				true
 			
-			
+			
 				make
-				-j2
-				all
+				-j5
+				nonlinear.testValues.run
 				true
 				true
 				true
 			
-			
+			
 				make
-				-j2
-				check
-				true
-				true
-				true
-			
-			
-				make
-				-j2
-				clean
+				-j5
+				nonlinear.testOrdering.run
 				true
 				true
 				true
@@ -1067,6 +1067,7 @@
 			
 			
 				make
+				
 				testErrors.run
 				true
 				false
@@ -1522,7 +1523,6 @@
 			
 			
 				make
-				
 				testSimulated2DOriented.run
 				true
 				false
@@ -1562,7 +1562,6 @@
 			
 			
 				make
-				
 				testSimulated2D.run
 				true
 				false
@@ -1570,7 +1569,6 @@
 			
 			
 				make
-				
 				testSimulated3D.run
 				true
 				false
@@ -1770,7 +1768,6 @@
 			
 			
 				make
-				
 				tests/testGaussianISAM2
 				true
 				false
@@ -1792,102 +1789,6 @@
 				true
 				true
 			
-			
-				make
-				-j2
-				testRot3.run
-				true
-				true
-				true
-			
-			
-				make
-				-j2
-				testRot2.run
-				true
-				true
-				true
-			
-			
-				make
-				-j2
-				testPose3.run
-				true
-				true
-				true
-			
-			
-				make
-				-j2
-				timeRot3.run
-				true
-				true
-				true
-			
-			
-				make
-				-j2
-				testPose2.run
-				true
-				true
-				true
-			
-			
-				make
-				-j2
-				testCal3_S2.run
-				true
-				true
-				true
-			
-			
-				make
-				-j2
-				testSimpleCamera.run
-				true
-				true
-				true
-			
-			
-				make
-				-j2
-				testHomography2.run
-				true
-				true
-				true
-			
-			
-				make
-				-j2
-				testCalibratedCamera.run
-				true
-				true
-				true
-			
-			
-				make
-				-j2
-				check
-				true
-				true
-				true
-			
-			
-				make
-				-j2
-				clean
-				true
-				true
-				true
-			
-			
-				make
-				-j2
-				testPoint2.run
-				true
-				true
-				true
-			
 			
 				make
 				-j2
@@ -2089,6 +1990,7 @@
 			
 			
 				cpack
+				
 				-G DEB
 				true
 				false
@@ -2096,6 +1998,7 @@
 			
 			
 				cpack
+				
 				-G RPM
 				true
 				false
@@ -2103,6 +2006,7 @@
 			
 			
 				cpack
+				
 				-G TGZ
 				true
 				false
@@ -2110,6 +2014,7 @@
 			
 			
 				cpack
+				
 				--config CPackSourceConfig.cmake
 				true
 				false
@@ -2123,42 +2028,106 @@
 				true
 				true
 			
-			
+			
 				make
 				-j5
-				wrap.testSpirit.run
+				wrap_gtsam_unstable
 				true
 				true
 				true
 			
-			
+			
 				make
-				-j5
-				wrap.testWrap.run
+				-j2
+				testRot3.run
 				true
 				true
 				true
 			
-			
+			
 				make
-				-j5
-				check.wrap
+				-j2
+				testRot2.run
 				true
 				true
 				true
 			
-			
+			
 				make
-				-j5
-				wrap_gtsam
+				-j2
+				testPose3.run
 				true
 				true
 				true
 			
-			
+			
 				make
-				-j5
-				wrap
+				-j2
+				timeRot3.run
+				true
+				true
+				true
+			
+			
+				make
+				-j2
+				testPose2.run
+				true
+				true
+				true
+			
+			
+				make
+				-j2
+				testCal3_S2.run
+				true
+				true
+				true
+			
+			
+				make
+				-j2
+				testSimpleCamera.run
+				true
+				true
+				true
+			
+			
+				make
+				-j2
+				testHomography2.run
+				true
+				true
+				true
+			
+			
+				make
+				-j2
+				testCalibratedCamera.run
+				true
+				true
+				true
+			
+			
+				make
+				-j2
+				check
+				true
+				true
+				true
+			
+			
+				make
+				-j2
+				clean
+				true
+				true
+				true
+			
+			
+				make
+				-j2
+				testPoint2.run
 				true
 				true
 				true
@@ -2202,6 +2171,46 @@
 				false
 				true
 			
+			
+				make
+				-j5
+				wrap.testSpirit.run
+				true
+				true
+				true
+			
+			
+				make
+				-j5
+				wrap.testWrap.run
+				true
+				true
+				true
+			
+			
+				make
+				-j5
+				check.wrap
+				true
+				true
+				true
+			
+			
+				make
+				-j5
+				wrap_gtsam
+				true
+				true
+				true
+			
+			
+				make
+				-j5
+				wrap
+				true
+				true
+				true
+			
 		
 	
 
diff --git a/gtsam_unstable/CMakeLists.txt b/gtsam_unstable/CMakeLists.txt
index 493e0000d..dc3b2827b 100644
--- a/gtsam_unstable/CMakeLists.txt
+++ b/gtsam_unstable/CMakeLists.txt
@@ -32,7 +32,12 @@ set(gtsam_unstable_srcs
 )
 
 option (GTSAM_UNSTABLE_BUILD_SHARED_LIBRARY "Enable/Disable building of a shared version of gtsam_unstable" ON)
- 
+
+# Wrap version for gtsam_unstable
+if (GTSAM_BUILD_WRAP)
+    add_subdirectory(wrap)
+endif(GTSAM_BUILD_WRAP)
+
 # Versions - same as core gtsam library
 set(gtsam_unstable_version   ${GTSAM_VERSION_MAJOR}.${GTSAM_VERSION_MINOR}.${GTSAM_VERSION_PATCH})
 set(gtsam_unstable_soversion ${GTSAM_VERSION_MAJOR})
diff --git a/gtsam_unstable/wrap/CMakeLists.txt b/gtsam_unstable/wrap/CMakeLists.txt
index 854bf50de..538dd32b6 100644
--- a/gtsam_unstable/wrap/CMakeLists.txt
+++ b/gtsam_unstable/wrap/CMakeLists.txt
@@ -1,5 +1,3 @@
-# Find wrap
-find_package(Wrap REQUIRED)
 
 # Set up codegen
 include(GtsamMatlabWrap)
@@ -21,32 +19,13 @@ find_mexextension()
 
 # Code generation command
 add_custom_target(wrap_gtsam_unstable ALL COMMAND 
-    ${Wrap_CMD} ${GTSAM_MEX_BIN_EXTENSION} ${CMAKE_CURRENT_SOURCE_DIR}/../ ${moduleName} ${toolbox_path} "${mexFlags}")
+    ${CMAKE_BINARY_DIR}/wrap/wrap ${GTSAM_MEX_BIN_EXTENSION} ${CMAKE_CURRENT_SOURCE_DIR} ${moduleName} ${toolbox_path} "${mexFlags}"
+    DEPENDS wrap)
 
-option(gtsam_unstable_INSTALL_MATLAB_TOOLBOX  "Enable/Disable installation of matlab toolbox"  ON)
-option(gtsam_unstable_INSTALL_MATLAB_EXAMPLES "Enable/Disable installation of matlab examples" ON)
-option(gtsam_unstable_INSTALL_MATLAB_TESTS    "Enable/Disable installation of matlab tests"    ON)
-
-set(gtsam_unstable_TOOLBOX_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/borg/toolbox CACHE DOCSTRING "Path to install matlab toolbox")
-
-if (gtsam_unstable_INSTALL_MATLAB_TOOLBOX)
+if (GTSAM_INSTALL_MATLAB_TOOLBOX)
     # Primary toolbox files
-    message(STATUS "Installing Matlab Toolbox to ${gtsam_unstable_TOOLBOX_INSTALL_PATH}")
-    install(DIRECTORY DESTINATION ${gtsam_unstable_TOOLBOX_INSTALL_PATH}) # make an empty folder
+    message(STATUS "Installing Matlab Toolbox to ${GTSAM_TOOLBOX_INSTALL_PATH}")
+    install(DIRECTORY DESTINATION ${GTSAM_TOOLBOX_INSTALL_PATH}) # make an empty folder
     # exploit need for trailing slash to specify a full folder, rather than just its contents to copy
-    install(DIRECTORY ${toolbox_path} DESTINATION ${gtsam_unstable_TOOLBOX_INSTALL_PATH})
-    
-    # Examples
-    if (gtsam_unstable_INSTALL_MATLAB_EXAMPLES)
-        message(STATUS "Installing Matlab Toolbox Examples")
-        file(GLOB matlab_examples "${CMAKE_SOURCE_DIR}/examples/matlab/*.m")
-        install(FILES ${matlab_examples} DESTINATION ${gtsam_unstable_TOOLBOX_INSTALL_PATH}/gtsam_unstable/examples)
-    endif (gtsam_unstable_INSTALL_MATLAB_EXAMPLES)
-    
-    # Tests
-    if (gtsam_unstable_INSTALL_MATLAB_TESTS)
-        message(STATUS "Installing Matlab Toolbox Tests")
-        file(GLOB matlab_tests "${CMAKE_SOURCE_DIR}/tests/matlab/*.m")
-        install(FILES ${matlab_tests} DESTINATION ${gtsam_unstable_TOOLBOX_INSTALL_PATH}/gtsam_unstable/tests)
-    endif (gtsam_unstable_INSTALL_MATLAB_TESTS)
-endif (gtsam_unstable_INSTALL_MATLAB_TOOLBOX)
+    install(DIRECTORY ${toolbox_path} DESTINATION ${GTSAM_TOOLBOX_INSTALL_PATH})
+endif (GTSAM_INSTALL_MATLAB_TOOLBOX)