diff --git a/Code/Mantid/Vates/VisitPresenters/CMakeLists.txt b/Code/Mantid/Vates/VisitPresenters/CMakeLists.txt
index cdd982ede1b9c8e070008f1388d81e398b549454..356259d61da389b0c37fd75d041ab645bfb8b8b9 100644
--- a/Code/Mantid/Vates/VisitPresenters/CMakeLists.txt
+++ b/Code/Mantid/Vates/VisitPresenters/CMakeLists.txt
@@ -3,6 +3,7 @@ set ( SRC_FILES
 src/MultiDimensionalDbPresenter.cpp
 src/RebinningCutterPresenter.cpp
 src/RebinningCutterXMLDefinitions.cpp
+src/RebinningXMLGenerator.cpp
 )
 
 set ( INC_FILES inc/MantidVisitPresenters/MultiDimensionalDbPresenter.h
diff --git a/Code/Mantid/Vates/VisitPresenters/src/MultiDimensionalDbPresenter.cpp b/Code/Mantid/Vates/VisitPresenters/src/MultiDimensionalDbPresenter.cpp
index 18a3febda45431219313a88d566f6bdb0128bad7..1625d52b36e28ab6c63f6f2cd532b7348253fa76 100644
--- a/Code/Mantid/Vates/VisitPresenters/src/MultiDimensionalDbPresenter.cpp
+++ b/Code/Mantid/Vates/VisitPresenters/src/MultiDimensionalDbPresenter.cpp
@@ -27,20 +27,19 @@ void MultiDimensionalDbPresenter::execute(const std::string& fileName)
   using namespace Mantid::MDDataObjects;
   using namespace Mantid::API;
 
-  CenterpieceRebinning rebinAlg;
-
   Load_MDWorkspace wsLoaderAlg;
+  wsLoaderAlg.initialize();
+  std::string wsId = "InputMDWs";
   wsLoaderAlg.setPropertyValue("inFilename", fileName);
-  wsLoaderAlg.setPropertyValue("MDWorkspace","InputWs");
+  wsLoaderAlg.setPropertyValue("MDWorkspace",wsId);
   wsLoaderAlg.execute();
-  Workspace_sptr result=AnalysisDataService::Instance().retrieve("InputWs");
+  Workspace_sptr result=AnalysisDataService::Instance().retrieve(wsId);
   MDWorkspace_sptr inputWS = boost::dynamic_pointer_cast<MDWorkspace>(result);
 
-
+  CenterpieceRebinning rebinAlg;
   AnalysisDataService::Instance().add("inputWS", inputWS);
   rebinAlg.initialize();
   rebinAlg.setPropertyValue("Input", "inputWS");
-  rebinAlg.setPropertyValue("FileName", fileName);
   rebinAlg.setPropertyValue("Result","OutWorkspace");
 
   //HACK: this is the only way to provide slicing data for centrepiece rebinning code.
diff --git a/Code/Mantid/Vates/VisitPresenters/src/RebinningCutterPresenter.cpp b/Code/Mantid/Vates/VisitPresenters/src/RebinningCutterPresenter.cpp
index 42920c48e1dfb8a9006803c8d1f5b889e834fa8d..63924f1d41a74bdbe798f8846bd3938e43e8a652 100644
--- a/Code/Mantid/Vates/VisitPresenters/src/RebinningCutterPresenter.cpp
+++ b/Code/Mantid/Vates/VisitPresenters/src/RebinningCutterPresenter.cpp
@@ -274,10 +274,12 @@ Mantid::API::ImplicitFunction* findExistingRebinningDefinitions(
    using namespace Mantid::API;
 
    Mantid::MDAlgorithms::Load_MDWorkspace wsLoaderAlg;
+   wsLoaderAlg.initialize();
+   std::string wsId = "InputMDWs";
    wsLoaderAlg.setPropertyValue("inFilename", wsLocation);
-   wsLoaderAlg.setPropertyValue("MDWorkspace","InputWs");
+   wsLoaderAlg.setPropertyValue("MDWorkspace", wsId);
    wsLoaderAlg.execute();
-   Workspace_sptr result=AnalysisDataService::Instance().retrieve("InputWs");
+   Workspace_sptr result=AnalysisDataService::Instance().retrieve(wsId);
    MDWorkspace_sptr workspace = boost::dynamic_pointer_cast<MDWorkspace>(result);
 
    return workspace;
diff --git a/Code/Mantid/Vates/VisitPresenters/test/MultiDimensionalDbPresenterTest.h b/Code/Mantid/Vates/VisitPresenters/test/MultiDimensionalDbPresenterTest.h
index 4ee4b90761daca9982c2f8d11f1c5712587ec5e9..1c9fadff8d003ce0b873e3956dc5938563ba3914 100644
--- a/Code/Mantid/Vates/VisitPresenters/test/MultiDimensionalDbPresenterTest.h
+++ b/Code/Mantid/Vates/VisitPresenters/test/MultiDimensionalDbPresenterTest.h
@@ -18,7 +18,7 @@ public:
 void testConstruction()
 {
   MultiDimensionalDbPresenter mdPresenter;
-  mdPresenter.execute("../../../../Test/VATES/fe_demo_bin.sqw");
+  mdPresenter.execute("../../../../../Test/VATES/fe_demo_bin.sqw");
 
   vtkDataArray* data = mdPresenter.getScalarData(1);
   vtkDataSet* visData = mdPresenter.getMesh();
diff --git a/Code/Mantid/Vates/VisitPresenters/test/RebinningCutterTest.h b/Code/Mantid/Vates/VisitPresenters/test/RebinningCutterTest.h
index 0cc8a535901189003123a9e90d0b02ff5c44ba2c..0524e1b85b6d594089f250395def3de0070d1e76 100644
--- a/Code/Mantid/Vates/VisitPresenters/test/RebinningCutterTest.h
+++ b/Code/Mantid/Vates/VisitPresenters/test/RebinningCutterTest.h
@@ -90,7 +90,7 @@ std::string getComplexXMLInstructions()
     return std::string("<?xml version=\"1.0\" encoding=\"utf-8\"?>") +
 "<MDInstruction>" +
   "<MDWorkspaceName>Input</MDWorkspaceName>" +
-  "<MDWorkspaceLocation>../../../../Test/VATES/fe_demo.sqw</MDWorkspaceLocation>" +
+  "<MDWorkspaceLocation>../../../../../Test/VATES/fe_demo.sqw</MDWorkspaceLocation>" +
   "<DimensionSet>" +
     "<Dimension ID=\"en\">" +
       "<Name>Energy</Name>" +
@@ -394,7 +394,7 @@ void testFindWorkspaceLocation()
 
   std::string location = findExistingWorkspaceLocationFromXML(dataset, id.c_str());
 
-  TSM_ASSERT_EQUALS("The workspace location is differrent from the xml value.", "../../../../Test/VATES/fe_demo.sqw", location);
+  TSM_ASSERT_EQUALS("The workspace location is differrent from the xml value.", "../../../../../Test/VATES/fe_demo.sqw", location);
 }
 
 void testFindWorkspaceNameThrows()
diff --git a/Code/Mantid/Vates/VisitPresenters/test/RebinningXMLGeneratorTest.h b/Code/Mantid/Vates/VisitPresenters/test/RebinningXMLGeneratorTest.h
index 0d4021f48de46fd76ca3d3bf36b34a6f5b55b2b0..e9e39c9b903737cdfb00b3cff738a5274cc3cc5a 100644
--- a/Code/Mantid/Vates/VisitPresenters/test/RebinningXMLGeneratorTest.h
+++ b/Code/Mantid/Vates/VisitPresenters/test/RebinningXMLGeneratorTest.h
@@ -36,7 +36,7 @@ private:
 
     MOCK_CONST_METHOD0(id, const std::string());
     MOCK_CONST_METHOD0(getMemorySize, size_t());
-    MOCK_CONST_METHOD0(getNPoints,int());
+    MOCK_CONST_METHOD0(getNPoints,long unsigned int());
     MOCK_CONST_METHOD1(getPoint,const Mantid::Geometry::SignalAggregate&(int index));
     MOCK_CONST_METHOD1(getCell,const Mantid::Geometry::SignalAggregate&(int dim1Increment));
     MOCK_CONST_METHOD2(getCell,const Mantid::Geometry::SignalAggregate&(int dim1Increment, int dim2Increment));
diff --git a/Code/Mantid/Vates/VisitPresenters/test/runTests.sh b/Code/Mantid/Vates/VisitPresenters/test/runTests.sh
index bc6b2b82e0755c4c5faf4fad685965eb6cc8d780..18154f2d14ac6c46f4de0bec74f917f57d535464 100755
--- a/Code/Mantid/Vates/VisitPresenters/test/runTests.sh
+++ b/Code/Mantid/Vates/VisitPresenters/test/runTests.sh
@@ -22,22 +22,26 @@ else
     test_files=$*
 fi
 
-cxxtestgen=../../../Third_Party/src/cxxtest/cxxtestgen.py
+cxxtestgen=../../../../Third_Party/src/cxxtest/cxxtestgen.py
 python $cxxtestgen --runner=MantidPrinter -o runner.cpp $test_files
 
 
 echo "Compiling the test executable..."
 
-mantid_libpath=../../../Mantid/debug
+#TODO set path properly
+mantid_libpath=~/workspace/Mantid/bin
+#TODO set path properly
 vtk_libpath=/usr/local/2.1.1/linux-x86_64/lib
+#TODO set path properly
+gmock_libpath=../../../TestingTools/lib/ubuntu-10.10
 
-g++ -O0 -g3 -DBOOST_DATE_TIME_POSIX_TIME_STD_CONFIG  -o runner.exe runner.cpp -I../../../Mantid/Kernel/inc -I../../../Mantid/MDDataObjects/inc -I../../../Mantid/MDAlgorithms/inc -I../../../Mantid/API/inc -I../inc/VisitPlugins -I/usr/local/2.1.1/linux-x86_64/include/vtk/include/vtk-5.0 -I../../../Mantid/Geometry/inc -I ../inc \
-    -I ../../../Third_Party/src/cxxtest -I ../../../Third_Party/include -I ../../../TestingTools/include -L$vtk_libpath -L$mantid_libpath -lvtkCommon -lvtkFiltering -lMantidKernel -lMantidGeometry -lMantidAPI -lboost_date_time-mt -lgmock -lMDAlgorithms -lMantidDataObjects -lMDDataObjects -lVisitPresenters -lhdf5 -Wno-deprecated 
+g++ -O0 -g3 -DBOOST_DATE_TIME_POSIX_TIME_STD_CONFIG  -o runner.exe runner.cpp -I../../../Framework/Kernel/inc -I../../../Framework/MDDataObjects/inc -I../../../Framework/MDAlgorithms/inc -I../../../Framework/API/inc -I../inc/VisitPlugins -I/usr/local/2.1.1/linux-x86_64/include/vtk/include/vtk-5.0 -I../../../Framework/Geometry/inc -I ../inc \
+    -I ../../../../Third_Party/src/cxxtest -I ../../../../Third_Party/include -I ../../../TestingTools/include -L$vtk_libpath -L$mantid_libpath -L$gmock_libpath -lvtkCommon -lvtkFiltering -lMantidKernel -lMantidGeometry -lMantidAPI -lboost_date_time-mt -lgmock -lMantidMDAlgorithms -lMantidDataObjects -lMantidMDDataObjects -lMantidVisitPresenters -lhdf5 -Wno-deprecated 
 
 echo
 
 echo "Running the tests..."
-ln ../../../Mantid/Build/Tests/*.properties .
+ln ../../../Framework/Build/Tests/*.properties .
 LD_LIBRARY_PATH=$vtk_libpath:$mantid_libpath:$LD_LIBRARY_PATH  ./runner.exe
 #valgrind --leak-check=full --show-reachable=yes --track-origins=yes ~/mantid/Code/Vates/VisitPresenters/test/runner.exe
 echo