diff --git a/.gitignore b/.gitignore
index 8f718aea18f8228889f4966d3e05d98422a63c57..5a12c9f6778a0f6d3d7e41243a29ccdc903a43d4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -166,7 +166,7 @@ Desktop.ini
 .tags
 .tags_sorted_by_file
 
-Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/inc/MantidVatesSimpleGuiViewWidgets/LibHelper.h
+Vates/VatesSimpleGui/ViewWidgets/inc/MantidVatesSimpleGuiViewWidgets/LibHelper.h
 
 
 # Make sure Third_Party doesn't get checked into the main repository
diff --git a/Framework/API/inc/MantidAPI/AlgorithmProxy.h b/Framework/API/inc/MantidAPI/AlgorithmProxy.h
index ef45cafbbf59b8bce4303063b7ae87fb6a73fa05..cc2c06272044a8d3aee5889ffdb1da9975de73aa 100644
--- a/Framework/API/inc/MantidAPI/AlgorithmProxy.h
+++ b/Framework/API/inc/MantidAPI/AlgorithmProxy.h
@@ -116,6 +116,8 @@ public:
   void setPropertyValue(const std::string &name, const std::string &value);
   /// Do something after a property was set
   void afterPropertySet(const std::string &);
+  /// Make m_properties point to the same PropertyManager as po.
+  void copyPropertiesFrom(const PropertyManagerOwner &po);
   //@}
 
   void cancel();
diff --git a/Framework/API/inc/MantidAPI/DeprecatedAlgorithm.h b/Framework/API/inc/MantidAPI/DeprecatedAlgorithm.h
index 68c8250521e5bb0c2d476a682a009ac44c851898..f48837d236cb6925ef562a70ff597d62b28fc7db 100644
--- a/Framework/API/inc/MantidAPI/DeprecatedAlgorithm.h
+++ b/Framework/API/inc/MantidAPI/DeprecatedAlgorithm.h
@@ -52,7 +52,7 @@ private:
   /// Replacement version, -1 indicates latest
   int m_replacementVersion;
   /// The date that the algorithm was first deprecated.
-  std::string m_deprecatdDate;
+  std::string m_deprecatedDate;
 };
 
 } // namespace API
diff --git a/Framework/API/inc/MantidAPI/IFunction1D.h b/Framework/API/inc/MantidAPI/IFunction1D.h
index 61f9ea1d1b7bc85ad7f934af6978782dfa420740..f40d2b454d6d8e75e3f252fc11caffee8d9a4249 100644
--- a/Framework/API/inc/MantidAPI/IFunction1D.h
+++ b/Framework/API/inc/MantidAPI/IFunction1D.h
@@ -12,9 +12,10 @@
 namespace Mantid {
 
 namespace CurveFitting {
+namespace Algorithms {
 class Fit;
 }
-
+}
 namespace API {
 
 //----------------------------------------------------------------------
@@ -88,7 +89,7 @@ protected:
   static Kernel::Logger g_log;
 
   /// Making a friend
-  friend class CurveFitting::Fit;
+  friend class CurveFitting::Algorithms::Fit;
 };
 
 typedef boost::shared_ptr<IFunction1D> IFunction1D_sptr;
diff --git a/Framework/API/inc/MantidAPI/ITransformScale.h b/Framework/API/inc/MantidAPI/ITransformScale.h
index d13af449f046120f40869cb0f8d2208312c60088..18832392062ceba43c5749aed0ea7201681dfaab 100644
--- a/Framework/API/inc/MantidAPI/ITransformScale.h
+++ b/Framework/API/inc/MantidAPI/ITransformScale.h
@@ -8,6 +8,7 @@
 #include <boost/shared_ptr.hpp>
 #endif
 
+#include <string>
 #include <vector>
 
 #include "MantidAPI/DllConfig.h"
diff --git a/Framework/API/src/Algorithm.cpp b/Framework/API/src/Algorithm.cpp
index e95b083c084a4db9beba993a20643fbb9c1f1d85..860a17a3d66cb681fd368d2f87a4f69347f5af71 100644
--- a/Framework/API/src/Algorithm.cpp
+++ b/Framework/API/src/Algorithm.cpp
@@ -1278,11 +1278,13 @@ bool Algorithm::processGroups() {
   // ---------- Create all the output workspaces ----------------------------
   for (size_t owp = 0; owp < m_pureOutputWorkspaceProps.size(); owp++) {
     Property *prop = dynamic_cast<Property *>(m_pureOutputWorkspaceProps[owp]);
-    WorkspaceGroup_sptr outWSGrp = WorkspaceGroup_sptr(new WorkspaceGroup());
-    outGroups.push_back(outWSGrp);
-    // Put the GROUP in the ADS
-    AnalysisDataService::Instance().addOrReplace(prop->value(), outWSGrp);
-    outWSGrp->observeADSNotifications(false);
+    if (prop) {
+      WorkspaceGroup_sptr outWSGrp = WorkspaceGroup_sptr(new WorkspaceGroup());
+      outGroups.push_back(outWSGrp);
+      // Put the GROUP in the ADS
+      AnalysisDataService::Instance().addOrReplace(prop->value(), outWSGrp);
+      outWSGrp->observeADSNotifications(false);
+    }
   }
 
   // Go through each entry in the input group(s)
diff --git a/Framework/API/src/AlgorithmFactory.cpp b/Framework/API/src/AlgorithmFactory.cpp
index b208e36ca7348261cf51e35b625d0882debb3e21..c21455f254585879e0b78e04fc8916841c370a6a 100644
--- a/Framework/API/src/AlgorithmFactory.cpp
+++ b/Framework/API/src/AlgorithmFactory.cpp
@@ -1,7 +1,6 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include <iostream>
 #include <sstream>
 #include "MantidAPI/AlgorithmFactory.h"
 #include "MantidAPI/Algorithm.h"
diff --git a/Framework/API/src/AlgorithmProxy.cpp b/Framework/API/src/AlgorithmProxy.cpp
index a400d76b3943ccaab4a31a82474c523b4be6f1b9..c1a77746b23d389a16f10c89c606aaa192430d24 100644
--- a/Framework/API/src/AlgorithmProxy.cpp
+++ b/Framework/API/src/AlgorithmProxy.cpp
@@ -218,6 +218,17 @@ void AlgorithmProxy::afterPropertySet(const std::string &name) {
   copyPropertiesFrom(*m_alg);
 }
 
+/**
+ * Copy properties from another property manager
+ * Making sure that the concrete alg is kept in sync
+ * @param po :: The property manager to copy
+ */
+void AlgorithmProxy::copyPropertiesFrom(const PropertyManagerOwner &po) {
+  PropertyManagerOwner::copyPropertiesFrom(po);
+  createConcreteAlg(true);
+  m_alg->copyPropertiesFrom(*this);
+}
+
 //----------------------------------------------------------------------
 // Private methods
 //----------------------------------------------------------------------
diff --git a/Framework/API/src/Axis.cpp b/Framework/API/src/Axis.cpp
index 025e8fac19de6807b41c3ba71800e66e229f5275..6f8abc8a5af84d90791a8898728fc123952ebe21 100644
--- a/Framework/API/src/Axis.cpp
+++ b/Framework/API/src/Axis.cpp
@@ -5,8 +5,6 @@
 #include "MantidKernel/Exception.h"
 #include "MantidKernel/UnitFactory.h"
 
-#include <iostream>
-
 namespace Mantid {
 namespace API {
 
diff --git a/Framework/API/src/Column.cpp b/Framework/API/src/Column.cpp
index 2611772b53561e078740201f67477f571b6de634..1be47194e896a6b7479bdb0d87ff0fdca4feb730 100644
--- a/Framework/API/src/Column.cpp
+++ b/Framework/API/src/Column.cpp
@@ -1,9 +1,10 @@
-#include "MantidAPI/Column.h"
-#include "MantidKernel/Logger.h"
 #include <algorithm>
 #include <iostream>
 #include <stdexcept>
 
+#include "MantidAPI/Column.h"
+#include "MantidKernel/Logger.h"
+
 namespace Mantid {
 namespace API {
 
diff --git a/Framework/API/src/ColumnFactory.cpp b/Framework/API/src/ColumnFactory.cpp
index 313dc12290c22ffccf517331d7ef977ee017078e..0ccf9d87644f9eae8158c54502a796b056126038 100644
--- a/Framework/API/src/ColumnFactory.cpp
+++ b/Framework/API/src/ColumnFactory.cpp
@@ -1,4 +1,3 @@
-#include <iostream>
 #include <sstream>
 #include "MantidAPI/ColumnFactory.h"
 #include "MantidAPI/Column.h"
diff --git a/Framework/API/src/CompositeFunction.cpp b/Framework/API/src/CompositeFunction.cpp
index 1f4481e9a01d8316695b22e86fb998f5bd6fbf79..cc2c652fffb579a8086f05f21de5f029e484dbf5 100644
--- a/Framework/API/src/CompositeFunction.cpp
+++ b/Framework/API/src/CompositeFunction.cpp
@@ -11,7 +11,6 @@
 #include <boost/lexical_cast.hpp>
 #include <boost/shared_array.hpp>
 #include <sstream>
-#include <iostream>
 #include <algorithm>
 
 namespace Mantid {
diff --git a/Framework/API/src/CostFunctionFactory.cpp b/Framework/API/src/CostFunctionFactory.cpp
index 4037501fa47806b583a605dc79316dba74ac59df..ea0e131e3a024925ddd078ceea612d507ba7759f 100644
--- a/Framework/API/src/CostFunctionFactory.cpp
+++ b/Framework/API/src/CostFunctionFactory.cpp
@@ -1,7 +1,6 @@
 #include "MantidAPI/CostFunctionFactory.h"
 #include "MantidAPI/ICostFunction.h"
 #include "MantidKernel/LibraryManager.h"
-#include <iostream>
 
 namespace Mantid {
 namespace API {
diff --git a/Framework/API/src/DeprecatedAlgorithm.cpp b/Framework/API/src/DeprecatedAlgorithm.cpp
index 095b870de6dce2c5493b60e1b42277f86d52a730..804e2e0ca5c0caa89d57d3944d32415fcfd7f188 100644
--- a/Framework/API/src/DeprecatedAlgorithm.cpp
+++ b/Framework/API/src/DeprecatedAlgorithm.cpp
@@ -13,7 +13,7 @@ Kernel::Logger g_log("DeprecatedAlgorithm");
 
 /// Does nothing other than make the compiler happy.
 DeprecatedAlgorithm::DeprecatedAlgorithm()
-    : m_replacementAlgorithm(), m_replacementVersion(-1), m_deprecatdDate() {}
+    : m_replacementAlgorithm(), m_replacementVersion(-1), m_deprecatedDate() {}
 
 /// Does nothing other than make the compiler happy.
 DeprecatedAlgorithm::~DeprecatedAlgorithm() {}
@@ -37,7 +37,7 @@ void DeprecatedAlgorithm::useAlgorithm(const std::string &replacement,
 
 /// The date the algorithm was deprecated on
 void DeprecatedAlgorithm::deprecatedDate(const std::string &date) {
-  this->m_deprecatdDate = "";
+  this->m_deprecatedDate = "";
   if (date.empty()) {
     // TODO warn people that it wasn't set
     return;
@@ -46,7 +46,7 @@ void DeprecatedAlgorithm::deprecatedDate(const std::string &date) {
     // TODO warn people that it wasn't set
     return;
   }
-  this->m_deprecatdDate = date;
+  this->m_deprecatedDate = date;
 }
 
 /// This merely prints the deprecation error for people to see.
@@ -57,8 +57,8 @@ const std::string DeprecatedAlgorithm::deprecationMsg(const IAlgorithm *algo) {
 
   msg << "deprecated";
 
-  if (!this->m_deprecatdDate.empty())
-    msg << " (on " << this->m_deprecatdDate << ")";
+  if (!this->m_deprecatedDate.empty())
+    msg << " (on " << this->m_deprecatedDate << ")";
 
   if (this->m_replacementAlgorithm.empty()) {
     msg << " and has no replacement.";
diff --git a/Framework/API/src/ExperimentInfo.cpp b/Framework/API/src/ExperimentInfo.cpp
index 26a61864f6b9927aad85b761c5e985a894de8ce7..3ddd52bfdf0bbefe09fb0864bbf10fd4f1ba0e93 100644
--- a/Framework/API/src/ExperimentInfo.cpp
+++ b/Framework/API/src/ExperimentInfo.cpp
@@ -1149,7 +1149,7 @@ void ExperimentInfo::readParameterMap(const std::string &parameterStr) {
     // if( comp_name == prev_name ) continue; this blocks reading in different
     // parameters of the same component. RNT
     // prev_name = comp_name;
-    const Geometry::IComponent *comp = 0;
+    const Geometry::IComponent *comp = NULL;
     if (comp_name.find("detID:") != std::string::npos) {
       int detID = atoi(comp_name.substr(6).c_str());
       comp = instr->getDetector(detID).get();
@@ -1164,8 +1164,7 @@ void ExperimentInfo::readParameterMap(const std::string &parameterStr) {
         continue;
       }
     }
-    if (!comp)
-      continue;
+
     // create parameter's value as a sum of all tokens with index 3 or larger
     // this allow a parameter's value to contain ";"
     std::string paramValue = tokens[3];
diff --git a/Framework/API/src/Expression.cpp b/Framework/API/src/Expression.cpp
index 6343c71404475aeece8d891908fe62bacf0089a6..011dd6d1de37fb0187e93af12e4c6bdf8b95edc6 100644
--- a/Framework/API/src/Expression.cpp
+++ b/Framework/API/src/Expression.cpp
@@ -1,11 +1,11 @@
+#include <iostream>
+#include <locale>
+#include <sstream>
+
 #include "MantidAPI/Expression.h"
 
 #include <Poco/StringTokenizer.h>
 
-#include <sstream>
-#include <iostream>
-#include <locale>
-
 namespace Mantid {
 namespace API {
 
diff --git a/Framework/API/src/FileProperty.cpp b/Framework/API/src/FileProperty.cpp
index 064edc4553be3c77255fa167f621d6a2ce83321f..c7baf7b1e2c0920184154db3e92d28a60526fe1a 100644
--- a/Framework/API/src/FileProperty.cpp
+++ b/Framework/API/src/FileProperty.cpp
@@ -13,7 +13,6 @@
 #include <Poco/File.h>
 #include <cctype>
 #include <algorithm>
-#include <iostream>
 
 namespace Mantid {
 
diff --git a/Framework/API/src/FunctionDomain1D.cpp b/Framework/API/src/FunctionDomain1D.cpp
index 30f8bf1d7d62a1e804ba52781e0bbfefd1f0ccb8..bf466655d6aa17cb8f04bfd4fc5b184b239dcfde 100644
--- a/Framework/API/src/FunctionDomain1D.cpp
+++ b/Framework/API/src/FunctionDomain1D.cpp
@@ -2,7 +2,6 @@
 // Includes
 //----------------------------------------------------------------------
 #include "MantidAPI/FunctionDomain1D.h"
-#include <iostream>
 
 namespace Mantid {
 namespace API {
diff --git a/Framework/API/src/FunctionFactory.cpp b/Framework/API/src/FunctionFactory.cpp
index 5d2a0a1aad401f3cebf7326d1219a3edf99798c1..29a5ec54767c1b593c9cf2e3c028f262707968d6 100644
--- a/Framework/API/src/FunctionFactory.cpp
+++ b/Framework/API/src/FunctionFactory.cpp
@@ -192,6 +192,9 @@ CompositeFunction_sptr FunctionFactoryImpl::createComposite(
     inputError(expr.str());
   }
 
+  if (!cfun)
+    inputError(expr.str());
+
   for (; it != terms.end(); ++it) {
     const Expression &term = it->bracketsRemoved();
     IFunction_sptr fun;
diff --git a/Framework/API/src/FunctionValues.cpp b/Framework/API/src/FunctionValues.cpp
index 0cc95afbdf7ef211be473d844fa13a78fe766e0d..ac8552df041cb1594354e36b4f3c567b1ef4d501 100644
--- a/Framework/API/src/FunctionValues.cpp
+++ b/Framework/API/src/FunctionValues.cpp
@@ -2,7 +2,6 @@
 // Includes
 //----------------------------------------------------------------------
 #include "MantidAPI/FunctionValues.h"
-#include <iostream>
 #include <algorithm>
 
 namespace Mantid {
diff --git a/Framework/API/src/GridDomain.cpp b/Framework/API/src/GridDomain.cpp
index 05fafaaf9e6a04f27bfba49accdfaa3891c7f8f6..0d8ed05ee4bfc4e91790da93778e2813c2c82d58 100644
--- a/Framework/API/src/GridDomain.cpp
+++ b/Framework/API/src/GridDomain.cpp
@@ -1,7 +1,6 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include <iostream>
 #include <numeric>
 #include <stdexcept>
 
diff --git a/Framework/API/src/GridDomain1D.cpp b/Framework/API/src/GridDomain1D.cpp
index 3c9422233f79c4030a38360a040daddb41430bad..a85cf8693256fa8a2462cddaa866d4ede1f44a7c 100644
--- a/Framework/API/src/GridDomain1D.cpp
+++ b/Framework/API/src/GridDomain1D.cpp
@@ -1,7 +1,6 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include <iostream>
 #include <numeric>
 
 #include "MantidAPI/GridDomain1D.h"
diff --git a/Framework/API/src/IFunction.cpp b/Framework/API/src/IFunction.cpp
index 539b092f3158b652bdc4b3090d57174d106108d8..379ee94adba1b572e0e2f4da29316a1854c2431b 100644
--- a/Framework/API/src/IFunction.cpp
+++ b/Framework/API/src/IFunction.cpp
@@ -28,7 +28,6 @@
 
 #include <limits>
 #include <sstream>
-#include <iostream>
 #include <algorithm>
 
 namespace Mantid {
diff --git a/Framework/API/src/IFunction1D.cpp b/Framework/API/src/IFunction1D.cpp
index bbab2daccede26d7164e3695574b88a2b04a267b..17bf113464a603be78a63c4b8695f9ec361ade43 100644
--- a/Framework/API/src/IFunction1D.cpp
+++ b/Framework/API/src/IFunction1D.cpp
@@ -23,7 +23,6 @@
 #include <boost/lexical_cast.hpp>
 
 #include <sstream>
-#include <iostream>
 
 namespace Mantid {
 namespace API {
diff --git a/Framework/API/src/IFunctionMD.cpp b/Framework/API/src/IFunctionMD.cpp
index 83d2d3d433cbad0800754bac801948d0e8127376..6eaacaedfe19bf4119467d3484ee5c61e5c893b1 100644
--- a/Framework/API/src/IFunctionMD.cpp
+++ b/Framework/API/src/IFunctionMD.cpp
@@ -15,7 +15,6 @@
 #include <boost/lambda/lambda.hpp>
 
 #include <sstream>
-#include <iostream>
 #include <algorithm>
 #include <functional>
 #include <iterator>
diff --git a/Framework/API/src/IFunctionMW.cpp b/Framework/API/src/IFunctionMW.cpp
index a0c5793f76ac11db357a1182bf87982ed6b343fc..9797475d1d8a0b7a1e60d753a47c4bf2d02dc708 100644
--- a/Framework/API/src/IFunctionMW.cpp
+++ b/Framework/API/src/IFunctionMW.cpp
@@ -4,8 +4,6 @@
 #include "MantidAPI/IFunctionMW.h"
 #include "MantidAPI/MatrixWorkspace.h"
 
-#include <iostream>
-
 namespace Mantid {
 namespace API {
 using namespace Geometry;
diff --git a/Framework/API/src/LinearScale.cpp b/Framework/API/src/LinearScale.cpp
index 4d11c0fb96276eec88ab36a6ab73b0f90e16cb8f..4c44e30a040b6730956a30d724482503e512dfd6 100644
--- a/Framework/API/src/LinearScale.cpp
+++ b/Framework/API/src/LinearScale.cpp
@@ -1,7 +1,6 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include <iostream>
 
 #include "MantidAPI/LinearScale.h"
 #include "MantidAPI/TransformScaleFactory.h"
diff --git a/Framework/API/src/LogarithmScale.cpp b/Framework/API/src/LogarithmScale.cpp
index 1e4abfdd83cf4cd95d0c3f74af6ea6d478c86380..a5eda36399eb32cacca6a4269fc0d435ae948e99 100644
--- a/Framework/API/src/LogarithmScale.cpp
+++ b/Framework/API/src/LogarithmScale.cpp
@@ -1,7 +1,6 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include <iostream>
 #include <cmath>
 #include <stdexcept>
 
diff --git a/Framework/API/src/NumericAxis.cpp b/Framework/API/src/NumericAxis.cpp
index 819ad1a5445b13c0a0415db954d2b2650bfe0d60..d609325a2397082f50219cfd5610807e58ae826c 100644
--- a/Framework/API/src/NumericAxis.cpp
+++ b/Framework/API/src/NumericAxis.cpp
@@ -191,9 +191,9 @@ std::string NumericAxis::label(const std::size_t &index) const {
   auto it = numberLabel.end() - 1;
   for (; it != numberLabel.begin(); --it) {
     if (*it == '0') {
-      numberLabel.erase(it);
+      it = numberLabel.erase(it);
     } else if (*it == '.') {
-      numberLabel.erase(it);
+      it = numberLabel.erase(it);
       break;
     } else {
       break;
diff --git a/Framework/API/src/ParamFunction.cpp b/Framework/API/src/ParamFunction.cpp
index 8d58067639d218b408ffc3d5b75e281c1e5d5054..2d43466f5d74e0bdace00ac4b65d87091bca9664 100644
--- a/Framework/API/src/ParamFunction.cpp
+++ b/Framework/API/src/ParamFunction.cpp
@@ -11,7 +11,6 @@
 #include <boost/math/special_functions/fpclassify.hpp>
 
 #include <sstream>
-#include <iostream>
 #include <limits>
 
 namespace Mantid {
diff --git a/Framework/API/src/PeakFunctionIntegrator.cpp b/Framework/API/src/PeakFunctionIntegrator.cpp
index b36896423ffc1f0df2c1a70f2e2409e0d0a2737f..c2dc90a12cb3c1c3e17d42997952a70db00505c8 100644
--- a/Framework/API/src/PeakFunctionIntegrator.cpp
+++ b/Framework/API/src/PeakFunctionIntegrator.cpp
@@ -2,7 +2,6 @@
 
 #include "MantidAPI/FunctionDomain1D.h"
 #include "gsl/gsl_errno.h"
-#include <iostream>
 #include <iomanip>
 
 namespace Mantid {
diff --git a/Framework/API/src/SpectraAxis.cpp b/Framework/API/src/SpectraAxis.cpp
index ebd17d4b814863a7c485aebd7bcd53028d615b96..43db4d278296bde473f968c07439ed419dac33ca 100644
--- a/Framework/API/src/SpectraAxis.cpp
+++ b/Framework/API/src/SpectraAxis.cpp
@@ -9,7 +9,6 @@
 #include "MantidKernel/Unit.h"
 
 #include <boost/lexical_cast.hpp>
-#include <iostream>
 
 namespace Mantid {
 namespace API {
diff --git a/Framework/API/src/TempFunction.cpp b/Framework/API/src/TempFunction.cpp
index 4f95ae8ecadf1d6e4c1bd9f6ac5ed4ca09487abf..2e7e30e8f059ed54c476c3826a4a56e933d63962 100644
--- a/Framework/API/src/TempFunction.cpp
+++ b/Framework/API/src/TempFunction.cpp
@@ -8,7 +8,6 @@
 #include "MantidAPI/ParameterTie.h"
 
 #include <sstream>
-#include <iostream>
 
 namespace Mantid {
 namespace API {
diff --git a/Framework/API/src/WorkspaceOpOverloads.cpp b/Framework/API/src/WorkspaceOpOverloads.cpp
index cfd3595724a9d60b327e5565606e1b504442491d..f29bca1ca5fe27a3bd029a203c5169e2eb8c3897 100644
--- a/Framework/API/src/WorkspaceOpOverloads.cpp
+++ b/Framework/API/src/WorkspaceOpOverloads.cpp
@@ -5,11 +5,11 @@
 #include "MantidAPI/Algorithm.h"
 #include "MantidAPI/AlgorithmManager.h"
 #include "MantidKernel/Property.h"
-#include "MantidKernel/Exception.h"
+//#include "MantidKernel/Exception.h"
 #include "MantidAPI/MatrixWorkspace.h"
 #include "MantidAPI/IWorkspaceProperty.h"
 #include "MantidAPI/WorkspaceFactory.h"
-#include "MantidAPI/SpectraAxis.h"
+//#include "MantidAPI/SpectraAxis.h"
 #include "MantidAPI/IMDWorkspace.h"
 #include "MantidAPI/IMDHistoWorkspace.h"
 #include "MantidAPI/WorkspaceGroup_fwd.h"
@@ -67,30 +67,20 @@ ResultType executeBinaryOperation(const std::string &algorithmName,
 
   alg->execute();
 
-  if (alg->isExecuted()) {
-    // Get the output workspace property
-    if (child) {
-      return alg->getProperty("OutputWorkspace");
-    } else {
-      API::Workspace_sptr result =
-          API::AnalysisDataService::Instance().retrieve(
-              alg->getPropertyValue("OutputWorkspace"));
-      return boost::dynamic_pointer_cast<typename ResultType::element_type>(
-          result);
-    }
-  } else {
+  if (!alg->isExecuted()) {
     std::string message = "Error while executing operation: " + algorithmName;
     throw std::runtime_error(message);
   }
 
-  throw Kernel::Exception::NotFoundError(
-      "Required output workspace property not found on Child Algorithm",
-      "OutputWorkspace");
-
-  // Horendous code inclusion to satisfy compilers that all code paths return a
-  // value
-  // in reality the above code should either throw or return successfully.
-  return ResultType();
+  // Get the output workspace property
+  if (child) {
+    return alg->getProperty("OutputWorkspace");
+  } else {
+    API::Workspace_sptr result = API::AnalysisDataService::Instance().retrieve(
+        alg->getPropertyValue("OutputWorkspace"));
+    return boost::dynamic_pointer_cast<typename ResultType::element_type>(
+        result);
+  }
 }
 
 template DLLExport MatrixWorkspace_sptr
@@ -169,14 +159,12 @@ bool equals(const MatrixWorkspace_sptr lhs, const MatrixWorkspace_sptr rhs,
   // Rest: use default
 
   alg->execute();
-  if (alg->isExecuted()) {
-    return (alg->getPropertyValue("Result") == "Success!");
-  } else {
+  if (!alg->isExecuted()) {
     std::string message =
         "Error while executing operation: CheckWorkspacesMatch";
     throw std::runtime_error(message);
   }
-  return false;
+  return (alg->getPropertyValue("Result") == "Success!");
 }
 
 /** Creates a temporary single value workspace the error is set to zero
@@ -512,17 +500,18 @@ bool WorkspaceHelpers::matchingBins(const MatrixWorkspace_const_sptr ws1,
   if (!step)
     step = 1;
   for (size_t i = step; i < numHist; i += step) {
-    const double firstWS =
+    const double firstWSLoop =
         std::accumulate(ws1->readX(i).begin(), ws1->readX(i).end(), 0.);
-    const double secondWS =
+    const double secondWSLoop =
         std::accumulate(ws2->readX(i).begin(), ws2->readX(i).end(), 0.);
-    if (std::abs(firstWS) < 1.0E-7 && std::abs(secondWS) < 1.0E-7) {
+    if (std::abs(firstWSLoop) < 1.0E-7 && std::abs(secondWSLoop) < 1.0E-7) {
       for (size_t j = 0; j < ws1->readX(i).size(); j++) {
         if (std::abs(ws1->readX(i)[j] - ws2->readX(i)[j]) > 1.0E-7)
           return false;
       }
-    } else if (std::abs(firstWS - secondWS) /
-                   std::max<double>(std::abs(firstWS), std::abs(secondWS)) >
+    } else if (std::abs(firstWSLoop - secondWSLoop) /
+                   std::max<double>(std::abs(firstWSLoop),
+                                    std::abs(secondWSLoop)) >
                1.0E-7)
       return false;
   }
diff --git a/Framework/API/test/AlgorithmPropertyTest.h b/Framework/API/test/AlgorithmPropertyTest.h
index e4f151be0b90b3cb651f69ffbc927b4b132b67db..9d60a2b1cf91eac964a79c32e371cd85156dd2f9 100644
--- a/Framework/API/test/AlgorithmPropertyTest.h
+++ b/Framework/API/test/AlgorithmPropertyTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidAPI/AlgorithmProperty.h"
 #include "MantidAPI/AlgorithmHasProperty.h"
diff --git a/Framework/API/test/AlgorithmProxyTest.h b/Framework/API/test/AlgorithmProxyTest.h
index 8c50e2e0dcd53e09f3d9ce26df5d78dd7f952dd2..6e8cafd780007d1caedf0087baf6c4936736b8c6 100644
--- a/Framework/API/test/AlgorithmProxyTest.h
+++ b/Framework/API/test/AlgorithmProxyTest.h
@@ -212,6 +212,30 @@ public:
     }
     TS_ASSERT_EQUALS("InputWorkspace", alg->workspaceMethodInputProperty());
   }
+
+  void test_copyPropertiesFrom() {
+    IAlgorithm_sptr alg =
+        AlgorithmManager::Instance().create("ToyAlgorithmProxy");
+    alg->initialize();
+    alg->setPropertyValue("prop1", "string");
+    alg->setPropertyValue("prop2", "1");
+    IAlgorithm_sptr algCopy =
+        AlgorithmManager::Instance().create("ToyAlgorithmProxy");
+
+    auto algProxy = boost::dynamic_pointer_cast<AlgorithmProxy>(alg);
+    auto algCopyProxy = boost::dynamic_pointer_cast<AlgorithmProxy>(algCopy);
+    algCopyProxy->copyPropertiesFrom(*algProxy);
+
+    int val = boost::lexical_cast<int>(algCopy->getPropertyValue("prop2"));
+
+    TS_ASSERT_EQUALS(val, 1);
+
+    // set another value and check the other value is unaffected
+    algCopy->setPropertyValue("prop1", "A difference");
+    int val2 = boost::lexical_cast<int>(algCopy->getPropertyValue("prop2"));
+
+    TS_ASSERT_EQUALS(val, val2);
+  }
 };
 
 #endif /*ALGORITHMPROXYTEST_H_*/
diff --git a/Framework/API/test/AsynchronousTest.h b/Framework/API/test/AsynchronousTest.h
index 07d419957def311b17ae628b22ec2ad9a22d7ed2..8fa819cea2aa758d9d33218629f3817e6b526f3c 100644
--- a/Framework/API/test/AsynchronousTest.h
+++ b/Framework/API/test/AsynchronousTest.h
@@ -7,7 +7,6 @@
 #include <Poco/ActiveResult.h>
 #include <Poco/NObserver.h>
 #include <Poco/Thread.h>
-#include <iostream>
 
 using namespace Mantid::Kernel;
 using namespace Mantid::API;
diff --git a/Framework/API/test/CoordTransformTest.h b/Framework/API/test/CoordTransformTest.h
index 7ce04f333e9bb5231b87e9a69f89d92b207acd5b..8f8e2fc42a00ae3712d8fcafdfcb4b517a42fb6f 100644
--- a/Framework/API/test/CoordTransformTest.h
+++ b/Framework/API/test/CoordTransformTest.h
@@ -5,8 +5,6 @@
 #include "MantidKernel/Timer.h"
 #include "MantidAPI/CoordTransform.h"
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 
 using namespace Mantid;
 
diff --git a/Framework/API/test/DataProcessorAlgorithmTest.h b/Framework/API/test/DataProcessorAlgorithmTest.h
index 804ca82f23e26c0b7ef4be0708aaa112229e0bb4..a3c689e8603c6571ba42fca3897c00ee1b8f06c0 100644
--- a/Framework/API/test/DataProcessorAlgorithmTest.h
+++ b/Framework/API/test/DataProcessorAlgorithmTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 #include "MantidAPI/DataProcessorAlgorithm.h"
 #include "MantidTestHelpers/FakeObjects.h"
 
diff --git a/Framework/API/test/EnabledWhenWorkspaceIsTypeTest.h b/Framework/API/test/EnabledWhenWorkspaceIsTypeTest.h
index 5df2c41eb7718f0b4c700be482d9d024717d71db..790b55da1cd11f1a09fb4686ce73669a113d2c23 100644
--- a/Framework/API/test/EnabledWhenWorkspaceIsTypeTest.h
+++ b/Framework/API/test/EnabledWhenWorkspaceIsTypeTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidAPI/EnabledWhenWorkspaceIsType.h"
 #include "MantidKernel/PropertyManagerOwner.h"
diff --git a/Framework/API/test/FermiChopperModelTest.h b/Framework/API/test/FermiChopperModelTest.h
index 35e1ae34c2f93fb4fb305913f3d5185625f16489..527a4c39080c18287032ac7242f7913378380252 100644
--- a/Framework/API/test/FermiChopperModelTest.h
+++ b/Framework/API/test/FermiChopperModelTest.h
@@ -7,7 +7,6 @@
 #include "MantidTestHelpers/ComponentCreationHelper.h"
 #include <cxxtest/TestSuite.h>
 #include <boost/make_shared.hpp>
-#include <iomanip>
 
 class FermiChopperModelTest : public CxxTest::TestSuite {
   typedef boost::shared_ptr<Mantid::API::FermiChopperModel>
diff --git a/Framework/API/test/FrameworkManagerTest.h b/Framework/API/test/FrameworkManagerTest.h
index fedbaf2891fc0ba1610469fcbf937719b6c79439..3f1b01767973cf26e96b0c981b75524d6637a4cd 100644
--- a/Framework/API/test/FrameworkManagerTest.h
+++ b/Framework/API/test/FrameworkManagerTest.h
@@ -7,7 +7,6 @@
 #include "MantidAPI/Algorithm.h"
 #include "MantidAPI/AlgorithmFactory.h"
 #include <stdexcept>
-#include <iostream>
 
 using namespace Mantid::Kernel;
 using namespace Mantid::API;
diff --git a/Framework/API/test/FunctionDomainTest.h b/Framework/API/test/FunctionDomainTest.h
index 46c8dbbadf6e28456a3c968385ce00daca2d4ee8..cd9d99bfe53cc630a2ef9e7724eb54661fbb2d50 100644
--- a/Framework/API/test/FunctionDomainTest.h
+++ b/Framework/API/test/FunctionDomainTest.h
@@ -6,7 +6,6 @@
 #include "MantidAPI/WorkspaceFactory.h"
 
 #include <cxxtest/TestSuite.h>
-#include <iostream>
 
 using namespace Mantid;
 using namespace Mantid::API;
diff --git a/Framework/API/test/FunctionValuesTest.h b/Framework/API/test/FunctionValuesTest.h
index ece5090d9bd93389cef3a8c2661370baf6b9357e..30cf805f718630b56445ef5023770a961ee242af 100644
--- a/Framework/API/test/FunctionValuesTest.h
+++ b/Framework/API/test/FunctionValuesTest.h
@@ -5,7 +5,6 @@
 #include "MantidAPI/FunctionValues.h"
 
 #include <cxxtest/TestSuite.h>
-#include <iostream>
 
 using namespace Mantid;
 using namespace Mantid::API;
diff --git a/Framework/API/test/IEventListTest.h b/Framework/API/test/IEventListTest.h
index ab960042e57a6ba53e51287cc9325f68772665b8..334ed6e3fa4a86071df3fddd7fdcab48e346b52f 100644
--- a/Framework/API/test/IEventListTest.h
+++ b/Framework/API/test/IEventListTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidAPI/IEventList.h"
 
diff --git a/Framework/API/test/IFunction1DTest.h b/Framework/API/test/IFunction1DTest.h
index b2b55489f115efe91733659fbfcc976894144d12..0eabfc571e2426ff5d88daf58194b5b44b483af0 100644
--- a/Framework/API/test/IFunction1DTest.h
+++ b/Framework/API/test/IFunction1DTest.h
@@ -7,7 +7,6 @@
 #include "MantidAPI/FunctionValues.h"
 
 #include <cxxtest/TestSuite.h>
-#include <iostream>
 
 using namespace Mantid;
 using namespace Mantid::API;
diff --git a/Framework/API/test/IFunctionMDTest.h b/Framework/API/test/IFunctionMDTest.h
index 7e21a71544b6c00d753d3c84569ff0d39f030718..e3f563fc1b2ae5abf73f25c641ddd945b92231ef 100644
--- a/Framework/API/test/IFunctionMDTest.h
+++ b/Framework/API/test/IFunctionMDTest.h
@@ -3,7 +3,6 @@
 
 #include "MantidAPI/IFunctionMD.h"
 #include <cxxtest/TestSuite.h>
-#include <iostream>
 
 using namespace Mantid;
 using namespace Mantid::API;
diff --git a/Framework/API/test/ISpectrumTest.h b/Framework/API/test/ISpectrumTest.h
index fea22024ddb8eb5f10fff49c0b779e37b8847b62..625bb42f14effd62927747b787daf18bc68e7560 100644
--- a/Framework/API/test/ISpectrumTest.h
+++ b/Framework/API/test/ISpectrumTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidAPI/ISpectrum.h"
 #include "MantidTestHelpers/FakeObjects.h"
diff --git a/Framework/API/test/ImplicitFunctionFactoryTest.h b/Framework/API/test/ImplicitFunctionFactoryTest.h
index abcea3ce1f0f072d8cf59902a1c46fd0328a3130..1b1ef4b16c3edec28973ea152eac3c2d655d4662 100644
--- a/Framework/API/test/ImplicitFunctionFactoryTest.h
+++ b/Framework/API/test/ImplicitFunctionFactoryTest.h
@@ -3,7 +3,6 @@
 
 #include <cxxtest/TestSuite.h>
 #include <vector>
-#include <iostream>
 #include <gmock/gmock.h>
 #include <gtest/gtest.h>
 #include "MantidAPI/ImplicitFunctionParameterParserFactory.h"
diff --git a/Framework/API/test/ImplicitFunctionParameterParserFactoryTest.h b/Framework/API/test/ImplicitFunctionParameterParserFactoryTest.h
index 2362545a857d9eb24b4fe7c6c24a96967247ff16..976ea132f0f0f15ebe5ece1a549f9316f02503c8 100644
--- a/Framework/API/test/ImplicitFunctionParameterParserFactoryTest.h
+++ b/Framework/API/test/ImplicitFunctionParameterParserFactoryTest.h
@@ -3,7 +3,6 @@
 
 #include <cxxtest/TestSuite.h>
 #include <vector>
-#include <iostream>
 
 #include "MantidAPI/ImplicitFunctionParameterParserFactory.h"
 #include "MantidKernel/ConfigService.h"
diff --git a/Framework/API/test/ImplicitFunctionParserFactoryTest.h b/Framework/API/test/ImplicitFunctionParserFactoryTest.h
index 009e0409d808a776f71167bfeafc787c23144933..4cee2938158750b662185866d43df80864ccaee5 100644
--- a/Framework/API/test/ImplicitFunctionParserFactoryTest.h
+++ b/Framework/API/test/ImplicitFunctionParserFactoryTest.h
@@ -3,7 +3,6 @@
 
 #include <cxxtest/TestSuite.h>
 #include <vector>
-#include <iostream>
 
 #include "MantidAPI/ImplicitFunctionParserFactory.h"
 #include "MantidKernel/ConfigService.h"
diff --git a/Framework/API/test/InstrumentDataServiceTest.h b/Framework/API/test/InstrumentDataServiceTest.h
index 27b411e76d9f18c3cc391d3e442040255d443177..034b18bd9e3e82e909e45ebd6126a6385e930378 100644
--- a/Framework/API/test/InstrumentDataServiceTest.h
+++ b/Framework/API/test/InstrumentDataServiceTest.h
@@ -6,7 +6,6 @@
 #include "MantidAPI/InstrumentDataService.h"
 #include "MantidGeometry/Instrument.h"
 #include "MantidKernel/Exception.h"
-#include <iostream>
 
 using namespace Mantid::API;
 using namespace Mantid::Geometry;
diff --git a/Framework/API/test/MDGeometryTest.h b/Framework/API/test/MDGeometryTest.h
index 126b2e28d6d673775b4ad5c2846bffb305e80b67..a933cffc4b1c7135d5d45caf1c2ad7a91196e7fc 100644
--- a/Framework/API/test/MDGeometryTest.h
+++ b/Framework/API/test/MDGeometryTest.h
@@ -6,8 +6,6 @@
 #include "MantidKernel/System.h"
 #include "MantidKernel/Timer.h"
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 #include "MantidKernel/VMD.h"
 #include "MantidAPI/IMDWorkspace.h"
 #include "MantidTestHelpers/FakeObjects.h"
diff --git a/Framework/API/test/MultiDomainFunctionTest.h b/Framework/API/test/MultiDomainFunctionTest.h
index 87109b8220ae6c9f94d091b4f71d324c735d6d8e..933a23c22919bdcc74644e49d0e01380f70e581b 100644
--- a/Framework/API/test/MultiDomainFunctionTest.h
+++ b/Framework/API/test/MultiDomainFunctionTest.h
@@ -12,7 +12,6 @@
 #include <cxxtest/TestSuite.h>
 #include <boost/make_shared.hpp>
 #include <algorithm>
-#include <iostream>
 
 using namespace Mantid;
 using namespace Mantid::API;
diff --git a/Framework/API/test/MultipleExperimentInfosTest.h b/Framework/API/test/MultipleExperimentInfosTest.h
index 3fce4df593320f676185a5ae235905f31198423f..8198fa528b1dd7ba8cd6857d51b54146a5853e10 100644
--- a/Framework/API/test/MultipleExperimentInfosTest.h
+++ b/Framework/API/test/MultipleExperimentInfosTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidAPI/MultipleExperimentInfos.h"
 #include "MantidAPI/ExperimentInfo.h"
diff --git a/Framework/API/test/MultipleFilePropertyTest.h b/Framework/API/test/MultipleFilePropertyTest.h
index 2ce77d3b8b50206a702c91cd360d098b2cd8f601..77497dad7d45281d627dca5d0365d68e5122f8b9 100644
--- a/Framework/API/test/MultipleFilePropertyTest.h
+++ b/Framework/API/test/MultipleFilePropertyTest.h
@@ -8,8 +8,6 @@
 #include "MantidKernel/Logger.h"
 
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 
 #include <Poco/Path.h>
 #include <Poco/File.h>
diff --git a/Framework/API/test/PropertyManagerDataServiceTest.h b/Framework/API/test/PropertyManagerDataServiceTest.h
index 6596e9bb84d4dabe351351fdd5836b0ce35f833f..77063af16abb294dac4c712d26bf36f8a8b730a9 100644
--- a/Framework/API/test/PropertyManagerDataServiceTest.h
+++ b/Framework/API/test/PropertyManagerDataServiceTest.h
@@ -6,7 +6,6 @@
 #include "MantidAPI/PropertyManagerDataService.h"
 #include "MantidKernel/PropertyManager.h"
 #include "MantidKernel/Exception.h"
-#include <iostream>
 
 using namespace Mantid::API;
 using namespace Mantid::Kernel;
diff --git a/Framework/API/test/PropertyNexusTest.h b/Framework/API/test/PropertyNexusTest.h
index ce4c2492ec4923855f7644efb63fad97440979d1..7d21f82e8d1e445695fd63d528c71965c92a90a0 100644
--- a/Framework/API/test/PropertyNexusTest.h
+++ b/Framework/API/test/PropertyNexusTest.h
@@ -6,8 +6,6 @@
 #include "MantidKernel/System.h"
 #include "MantidKernel/Timer.h"
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 #include "MantidTestHelpers/NexusTestHelper.h"
 #include "MantidKernel/PropertyWithValue.h"
 #include "MantidKernel/TimeSeriesProperty.h"
diff --git a/Framework/API/test/WorkspaceFactoryTest.h b/Framework/API/test/WorkspaceFactoryTest.h
index a3aa58f0d0f8a116a7bdc00c70a7f382550a0b1e..8ec2978f7ba3d5ec9d557c22b7e20cce5a98939d 100644
--- a/Framework/API/test/WorkspaceFactoryTest.h
+++ b/Framework/API/test/WorkspaceFactoryTest.h
@@ -3,7 +3,6 @@
 
 #include <cxxtest/TestSuite.h>
 #include <vector>
-#include <iostream>
 
 #include "MantidAPI/MatrixWorkspace.h"
 #include "MantidAPI/WorkspaceFactory.h"
diff --git a/Framework/API/test/WorkspaceGroupTest.h b/Framework/API/test/WorkspaceGroupTest.h
index 1feaa40e635b349a92063823ee8e65be0763c03b..f14a8d18889924d490797a14eac2981f925c289d 100644
--- a/Framework/API/test/WorkspaceGroupTest.h
+++ b/Framework/API/test/WorkspaceGroupTest.h
@@ -10,8 +10,6 @@
 
 #include <boost/shared_ptr.hpp>
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 #include <gmock/gmock.h>
 #include <gtest/gtest.h>
 
diff --git a/Framework/Algorithms/src/AlignDetectors.cpp b/Framework/Algorithms/src/AlignDetectors.cpp
index de941aea91cf913e25be29eb8cb537a740f617e7..b45eade446063828c8540bdce23008dce25026f6 100644
--- a/Framework/Algorithms/src/AlignDetectors.cpp
+++ b/Framework/Algorithms/src/AlignDetectors.cpp
@@ -151,7 +151,9 @@ const std::string AlignDetectors::summary() const {
 }
 
 /// (Empty) Constructor
-AlignDetectors::AlignDetectors() { this->tofToDmap = NULL; }
+AlignDetectors::AlignDetectors() : m_numberOfSpectra(0) {
+  this->tofToDmap = NULL;
+}
 
 /// Destructor
 AlignDetectors::~AlignDetectors() { delete this->tofToDmap; }
diff --git a/Framework/Algorithms/src/ApplyDeadTimeCorr.cpp b/Framework/Algorithms/src/ApplyDeadTimeCorr.cpp
index 965faf0ceef9ded21cb212d42aabd907ce5afba8..dc16356c68ae91486b5b8bd4ef90c9de1f890ca2 100644
--- a/Framework/Algorithms/src/ApplyDeadTimeCorr.cpp
+++ b/Framework/Algorithms/src/ApplyDeadTimeCorr.cpp
@@ -10,7 +10,6 @@
 #include "MantidAPI/ITableWorkspace.h"
 #include "MantidAPI/TableRow.h"
 
-#include <iostream>
 #include <cmath>
 
 using std::string;
diff --git a/Framework/Algorithms/src/ApplyDetailedBalance.cpp b/Framework/Algorithms/src/ApplyDetailedBalance.cpp
index 2b90b823acdeba3ed5cc7c0bbef913a6ce99822f..c5fdf2865461f3cc9e980fff8852b5752c050111 100644
--- a/Framework/Algorithms/src/ApplyDetailedBalance.cpp
+++ b/Framework/Algorithms/src/ApplyDetailedBalance.cpp
@@ -3,7 +3,6 @@
 #include "MantidKernel/TimeSeriesProperty.h"
 #include "MantidKernel/PropertyWithValue.h"
 #include "boost/lexical_cast.hpp"
-#include <iostream>
 #include <cmath>
 #include "MantidAPI/WorkspaceValidators.h"
 #include "MantidKernel/PhysicalConstants.h"
diff --git a/Framework/Algorithms/src/ConvertUnits.cpp b/Framework/Algorithms/src/ConvertUnits.cpp
index d2148cfe5d8abd26e8e9700d57ca93b2369ef7aa..5a3012b50bf12fd6d09b9c2ec60fa77d618e4450 100644
--- a/Framework/Algorithms/src/ConvertUnits.cpp
+++ b/Framework/Algorithms/src/ConvertUnits.cpp
@@ -12,7 +12,6 @@
 #include <boost/bind.hpp>
 #include <boost/math/special_functions/fpclassify.hpp>
 #include <cfloat>
-#include <iostream>
 #include <limits>
 #include "MantidKernel/BoundedValidator.h"
 #include "MantidKernel/ListValidator.h"
diff --git a/Framework/Algorithms/src/ConvertUnitsUsingDetectorTable.cpp b/Framework/Algorithms/src/ConvertUnitsUsingDetectorTable.cpp
index d358c6406bce6bfd00151a615d4660cae9e9e663..33c06ad4900fe13d0916b6ad17ddba9f0de2b792 100644
--- a/Framework/Algorithms/src/ConvertUnitsUsingDetectorTable.cpp
+++ b/Framework/Algorithms/src/ConvertUnitsUsingDetectorTable.cpp
@@ -20,7 +20,6 @@
 #include <boost/bind.hpp>
 #include <boost/math/special_functions/fpclassify.hpp>
 #include <cfloat>
-#include <iostream>
 #include <limits>
 #include <vector>
 #include <algorithm>
diff --git a/Framework/Algorithms/src/CopyInstrumentParameters.cpp b/Framework/Algorithms/src/CopyInstrumentParameters.cpp
index bef54b26b61d390de90d3235d31ca33e96ed63fa..2eacc15ba853740c203f3637ffc7799c849f1eb8 100644
--- a/Framework/Algorithms/src/CopyInstrumentParameters.cpp
+++ b/Framework/Algorithms/src/CopyInstrumentParameters.cpp
@@ -3,7 +3,6 @@
 //----------------------------------------------------------------------
 #include "MantidAlgorithms/CopyInstrumentParameters.h"
 #include "MantidAPI/WorkspaceValidators.h"
-#include <iostream>
 #include "MantidAPI/MemoryManager.h"
 #include "MantidGeometry/Instrument/ParameterMap.h"
 
diff --git a/Framework/Algorithms/src/CorelliCrossCorrelate.cpp b/Framework/Algorithms/src/CorelliCrossCorrelate.cpp
index a6e0cb33adfc00ecba56d322c2c4855662b143b7..8a499988135764aab495cdd5a00cc597532619eb 100644
--- a/Framework/Algorithms/src/CorelliCrossCorrelate.cpp
+++ b/Framework/Algorithms/src/CorelliCrossCorrelate.cpp
@@ -168,6 +168,11 @@ void CorelliCrossCorrelate::exec() {
   // Determine period from chopper frequency.
   auto motorSpeed = dynamic_cast<TimeSeriesProperty<double> *>(
       inputWS->run().getProperty("BL9:Chop:Skf4:MotorSpeed"));
+  if (!motorSpeed) {
+    throw Exception::NotFoundError(
+        "Could not find a log value for the motor speed",
+        "BL9:Chop:Skf4:MotorSpeed");
+  }
   double period = 1e9 / static_cast<double>(motorSpeed->timeAverageValue());
   g_log.information() << "Frequency = " << 1e9 / period
                       << "Hz Period = " << period << "ns\n";
diff --git a/Framework/Algorithms/src/CreateCalFileByNames.cpp b/Framework/Algorithms/src/CreateCalFileByNames.cpp
index 2f4abb226ec85f5aef08cc5223318f131eb40ab7..67e006535d12ca43b1fb4eafdb6e54221b0039fc 100644
--- a/Framework/Algorithms/src/CreateCalFileByNames.cpp
+++ b/Framework/Algorithms/src/CreateCalFileByNames.cpp
@@ -11,7 +11,6 @@
 #include <boost/algorithm/string/detail/classification.hpp>
 #include <boost/algorithm/string/split.hpp>
 #include <fstream>
-#include <iomanip>
 #include <queue>
 
 using namespace Mantid::API;
diff --git a/Framework/Algorithms/src/CreateDummyCalFile.cpp b/Framework/Algorithms/src/CreateDummyCalFile.cpp
index f64c069ce29a67747a3be06f9851b44958b5ea43..a13e9ba5626e143f39053f6c44d5f3dea6f87ca6 100644
--- a/Framework/Algorithms/src/CreateDummyCalFile.cpp
+++ b/Framework/Algorithms/src/CreateDummyCalFile.cpp
@@ -10,7 +10,6 @@
 
 #include <queue>
 #include <fstream>
-#include <iomanip>
 #include <Poco/DOM/DOMParser.h>
 #include <Poco/DOM/Document.h>
 #include <Poco/DOM/Element.h>
@@ -112,7 +111,7 @@ void CreateDummyCalFile::exec() {
   std::string filename = getProperty("CalFilename");
 
   // Plan to overwrite file, so do not check if it exists
-  bool overwrite = false;
+  const bool overwrite = false;
 
   int number = 0;
   Progress prog(this, 0.0, 0.8, assemblies.size());
diff --git a/Framework/Algorithms/src/CreateLogTimeCorrection.cpp b/Framework/Algorithms/src/CreateLogTimeCorrection.cpp
index 7bab28c41c75aeadf727acba8ff964ee218bc009..61264770e98c0f19d4d10fa338cb55089cdc61cc 100644
--- a/Framework/Algorithms/src/CreateLogTimeCorrection.cpp
+++ b/Framework/Algorithms/src/CreateLogTimeCorrection.cpp
@@ -5,7 +5,6 @@
 #include "MantidAPI/WorkspaceValidators.h"
 
 #include <fstream>
-#include <iomanip>
 
 using namespace Mantid;
 using namespace Mantid::API;
diff --git a/Framework/Algorithms/src/CropWorkspace.cpp b/Framework/Algorithms/src/CropWorkspace.cpp
index c37de109ab25f84bed0ed13def1e260481e364ec..3107951ca432f29feac24ceccab5fc3f58e8f14e 100644
--- a/Framework/Algorithms/src/CropWorkspace.cpp
+++ b/Framework/Algorithms/src/CropWorkspace.cpp
@@ -7,7 +7,6 @@
 #include "MantidAPI/NumericAxis.h"
 #include "MantidAPI/TextAxis.h"
 #include "MantidKernel/VectorHelper.h"
-#include <iostream>
 #include "MantidAPI/MemoryManager.h"
 #include "MantidKernel/BoundedValidator.h"
 
diff --git a/Framework/Algorithms/src/DiffractionEventCalibrateDetectors.cpp b/Framework/Algorithms/src/DiffractionEventCalibrateDetectors.cpp
index e27473a81d6a40dc83dbd48e4ffa764a9ae6c76b..050b93edf61f6f0828e8575212e2fef0bb6385f9 100644
--- a/Framework/Algorithms/src/DiffractionEventCalibrateDetectors.cpp
+++ b/Framework/Algorithms/src/DiffractionEventCalibrateDetectors.cpp
@@ -16,7 +16,6 @@
 #include "MantidKernel/Exception.h"
 #include "MantidKernel/UnitFactory.h"
 #include <cmath>
-#include <iomanip>
 #include <numeric>
 #include <Poco/File.h>
 #include <sstream>
diff --git a/Framework/Algorithms/src/ExtractSpectra.cpp b/Framework/Algorithms/src/ExtractSpectra.cpp
index d342b94ce3d687354bc9e51ab1dd04b73aa0c595..c797b9b7bcc98937545883f26f19445063a055fe 100644
--- a/Framework/Algorithms/src/ExtractSpectra.cpp
+++ b/Framework/Algorithms/src/ExtractSpectra.cpp
@@ -9,7 +9,6 @@
 #include "MantidKernel/VectorHelper.h"
 
 #include <algorithm>
-#include <iostream>
 
 namespace {
 /// The percentage 'fuzziness' to use when comparing to bin boundaries
diff --git a/Framework/Algorithms/src/FFT.cpp b/Framework/Algorithms/src/FFT.cpp
index f8e6db3c74314b67a7c712256543b0733b55e805..1d6f94e2bf38fe60405370cd002df6453f65d240 100644
--- a/Framework/Algorithms/src/FFT.cpp
+++ b/Framework/Algorithms/src/FFT.cpp
@@ -172,7 +172,7 @@ void FFT::exec() {
   // centerShift == true means that the zero on the x axis is assumed to be in
   // the data centre
   // at point with index i = ySize/2. If shift == false the zero is at i = 0
-  bool centerShift = true;
+  const bool centerShift = true;
 
   API::TextAxis *tAxis = new API::TextAxis(nOut);
   int iRe = 0;
diff --git a/Framework/Algorithms/src/FFTSmooth.cpp b/Framework/Algorithms/src/FFTSmooth.cpp
index 9069be1a52b98c0c5a031aaaa63f29c3ab59f907..6f7291d1a208763a3da79b6080807cfb5159a19a 100644
--- a/Framework/Algorithms/src/FFTSmooth.cpp
+++ b/Framework/Algorithms/src/FFTSmooth.cpp
@@ -4,7 +4,6 @@
 #include "MantidAlgorithms/FFTSmooth.h"
 #include "MantidKernel/Exception.h"
 
-#include <iostream>
 #include "MantidKernel/BoundedValidator.h"
 #include "MantidKernel/ListValidator.h"
 
diff --git a/Framework/Algorithms/src/FFTSmooth2.cpp b/Framework/Algorithms/src/FFTSmooth2.cpp
index 745441a1a978f70d2bb620b9aef5093fd7987b93..88c68e75e13ed5e324dfa660dd30ee2f716587e9 100644
--- a/Framework/Algorithms/src/FFTSmooth2.cpp
+++ b/Framework/Algorithms/src/FFTSmooth2.cpp
@@ -6,7 +6,6 @@
 #include <boost/algorithm/string/split.hpp>
 #include <boost/algorithm/string/detail/classification.hpp>
 
-#include <iostream>
 #include "MantidKernel/BoundedValidator.h"
 #include "MantidKernel/ListValidator.h"
 
diff --git a/Framework/Algorithms/src/FindCenterOfMassPosition.cpp b/Framework/Algorithms/src/FindCenterOfMassPosition.cpp
index 726ed0e305dc1fd1dffe4db680eb579e1ea90248..20964f31e5edb860cb8fe394702e34a10fd2bf40 100644
--- a/Framework/Algorithms/src/FindCenterOfMassPosition.cpp
+++ b/Framework/Algorithms/src/FindCenterOfMassPosition.cpp
@@ -10,7 +10,6 @@
 #include "MantidAPI/WorkspaceValidators.h"
 #include "MantidAPI/ITableWorkspace.h"
 #include "MantidAPI/TableRow.h"
-#include <iostream>
 #include <vector>
 #include "MantidKernel/BoundedValidator.h"
 #include "MantidKernel/NullValidator.h"
diff --git a/Framework/Algorithms/src/FindCenterOfMassPosition2.cpp b/Framework/Algorithms/src/FindCenterOfMassPosition2.cpp
index 3a69693e0496f0caf17d79596191e88b393c4816..76bb448c085867c580f713ca6f2cac06bf06b5d0 100644
--- a/Framework/Algorithms/src/FindCenterOfMassPosition2.cpp
+++ b/Framework/Algorithms/src/FindCenterOfMassPosition2.cpp
@@ -10,7 +10,6 @@
 #include "MantidAPI/WorkspaceValidators.h"
 #include "MantidAPI/ITableWorkspace.h"
 #include "MantidAPI/TableRow.h"
-#include <iostream>
 #include <vector>
 #include "MantidDataObjects/EventWorkspace.h"
 #include "MantidDataObjects/EventList.h"
diff --git a/Framework/Algorithms/src/FindPeakBackground.cpp b/Framework/Algorithms/src/FindPeakBackground.cpp
index f5de226028bff2fb6f34e25ccc26c37f68d85f66..047bb0748a29536e74291b11089fd189ca149331 100644
--- a/Framework/Algorithms/src/FindPeakBackground.cpp
+++ b/Framework/Algorithms/src/FindPeakBackground.cpp
@@ -157,7 +157,7 @@ void FindPeakBackground::exec() {
     Statistics stats = getStatistics(maskedY);
     Ymean = stats.mean;
     Yvariance = stats.standard_deviation * stats.standard_deviation;
-    Ysigma = std::sqrt((moment4(maskedY, n - l0, Ymean) -
+    Ysigma = std::sqrt((moment4(maskedY, static_cast<size_t>(xn), Ymean) -
                         (xn - 3.0) / (xn - 1.0) * Yvariance) /
                        xn);
     MantidVec::const_iterator it =
diff --git a/Framework/Algorithms/src/FindPeaks.cpp b/Framework/Algorithms/src/FindPeaks.cpp
index d352b14d85dc025fc8fdf57b416c08c3286f20f5..5273c255ad5a789f30717cbfeeecadd6d5e8a8ba 100644
--- a/Framework/Algorithms/src/FindPeaks.cpp
+++ b/Framework/Algorithms/src/FindPeaks.cpp
@@ -15,7 +15,6 @@
 #include "MantidKernel/VectorHelper.h"
 
 #include <boost/algorithm/string.hpp>
-#include <iostream>
 #include <numeric>
 #include "MantidKernel/BoundedValidator.h"
 #include "MantidKernel/ListValidator.h"
diff --git a/Framework/Algorithms/src/GetDetOffsetsMultiPeaks.cpp b/Framework/Algorithms/src/GetDetOffsetsMultiPeaks.cpp
index 871287bc800a8a738f7b1fa3df3092281f236a9d..07e9673ba2151c55e0ce2beec63f3c18a07106b6 100644
--- a/Framework/Algorithms/src/GetDetOffsetsMultiPeaks.cpp
+++ b/Framework/Algorithms/src/GetDetOffsetsMultiPeaks.cpp
@@ -18,7 +18,6 @@
 #include "MantidKernel/Statistics.h"
 #include <boost/math/special_functions/fpclassify.hpp>
 #include <fstream>
-#include <iomanip>
 #include <ostream>
 #include <sstream>
 
diff --git a/Framework/Algorithms/src/GetDetectorOffsets.cpp b/Framework/Algorithms/src/GetDetectorOffsets.cpp
index 0739b7dcb86840ed71bd514ddc3f68474ef34b40..86b595c4c5f14faae0dbdcaa28a8cc7e20b7390b 100644
--- a/Framework/Algorithms/src/GetDetectorOffsets.cpp
+++ b/Framework/Algorithms/src/GetDetectorOffsets.cpp
@@ -9,7 +9,6 @@
 #include "MantidDataObjects/MaskWorkspace.h"
 #include <boost/math/special_functions/fpclassify.hpp>
 #include <fstream>
-#include <iomanip>
 #include <ostream>
 #include <sstream>
 #include "MantidKernel/BoundedValidator.h"
diff --git a/Framework/Algorithms/src/MaskDetectorsIf.cpp b/Framework/Algorithms/src/MaskDetectorsIf.cpp
index e1000af59a0619c255f70bb0fb43a623f8df18d3..209f7a9873e4ecf268d92c43d65b3c901946a116 100644
--- a/Framework/Algorithms/src/MaskDetectorsIf.cpp
+++ b/Framework/Algorithms/src/MaskDetectorsIf.cpp
@@ -5,7 +5,6 @@
 #include "MantidAPI/FileProperty.h"
 #include "MantidAPI/WorkspaceValidators.h"
 #include <fstream>
-#include <iomanip>
 #include "MantidKernel/ListValidator.h"
 
 namespace Mantid {
diff --git a/Framework/Algorithms/src/MonitorEfficiencyCorUser.cpp b/Framework/Algorithms/src/MonitorEfficiencyCorUser.cpp
index 6b04c6163b6b0eb648f952a3611da0105d343efd..cd05823acf6c0f4b34c652dfc084c6bd9bd37545 100644
--- a/Framework/Algorithms/src/MonitorEfficiencyCorUser.cpp
+++ b/Framework/Algorithms/src/MonitorEfficiencyCorUser.cpp
@@ -19,7 +19,8 @@ DECLARE_ALGORITHM(MonitorEfficiencyCorUser)
 //----------------------------------------------------------------------------------------------
 /** Constructor
  */
-MonitorEfficiencyCorUser::MonitorEfficiencyCorUser() {}
+MonitorEfficiencyCorUser::MonitorEfficiencyCorUser()
+    : m_inputWS(), m_outputWS(), m_Ei(.0), m_monitorCounts(0) {}
 
 //----------------------------------------------------------------------------------------------
 /** Destructor
diff --git a/Framework/Algorithms/src/MultipleScatteringCylinderAbsorption.cpp b/Framework/Algorithms/src/MultipleScatteringCylinderAbsorption.cpp
index 8196bf18e08d6754edea5470996e378104f0ff87..5008df1b96ebf2bd8e1614d101794a1e297f951d 100644
--- a/Framework/Algorithms/src/MultipleScatteringCylinderAbsorption.cpp
+++ b/Framework/Algorithms/src/MultipleScatteringCylinderAbsorption.cpp
@@ -7,7 +7,6 @@
 #include "MantidKernel/Exception.h"
 #include "MantidKernel/PhysicalConstants.h"
 
-#include <iostream>
 #include <stdexcept>
 
 namespace Mantid {
diff --git a/Framework/Algorithms/src/NormaliseToMonitor.cpp b/Framework/Algorithms/src/NormaliseToMonitor.cpp
index 82031ba8347b9eb2ddd7937f7cf2cb77187c3407..d870469b1b28ec7a149c662388c9c2b5a19582f4 100644
--- a/Framework/Algorithms/src/NormaliseToMonitor.cpp
+++ b/Framework/Algorithms/src/NormaliseToMonitor.cpp
@@ -11,7 +11,6 @@
 #include "MantidKernel/BoundedValidator.h"
 
 #include <cfloat>
-#include <iomanip>
 #include "MantidDataObjects/EventWorkspace.h"
 #include "MantidKernel/IPropertyManager.h"
 
diff --git a/Framework/Algorithms/src/Q1DTOF.cpp b/Framework/Algorithms/src/Q1DTOF.cpp
index 955a8a9fccf0cf05d4b31a9d545874766024681f..50108eb2adb7980284588e2ae4b304820d968277 100644
--- a/Framework/Algorithms/src/Q1DTOF.cpp
+++ b/Framework/Algorithms/src/Q1DTOF.cpp
@@ -9,7 +9,6 @@
 #include "MantidKernel/VectorHelper.h"
 #include "MantidAPI/WorkspaceValidators.h"
 #include "MantidDataObjects/Histogram1D.h"
-#include <iostream>
 #include <vector>
 
 namespace Mantid {
diff --git a/Framework/Algorithms/src/Q1DWeighted.cpp b/Framework/Algorithms/src/Q1DWeighted.cpp
index dcae515bf495122405f6551b330227e5e7004369..daa445af929575b29064d677926b51b6809aef40 100644
--- a/Framework/Algorithms/src/Q1DWeighted.cpp
+++ b/Framework/Algorithms/src/Q1DWeighted.cpp
@@ -9,7 +9,6 @@
 #include "MantidKernel/VectorHelper.h"
 #include "MantidAPI/WorkspaceValidators.h"
 #include "MantidDataObjects/Histogram1D.h"
-#include <iostream>
 #include <vector>
 #include "MantidKernel/BoundedValidator.h"
 
diff --git a/Framework/Algorithms/src/RealFFT.cpp b/Framework/Algorithms/src/RealFFT.cpp
index dd320924de112004568649095472b726f0a27175..db2466098cdddc8f484617e71753980efc541489 100644
--- a/Framework/Algorithms/src/RealFFT.cpp
+++ b/Framework/Algorithms/src/RealFFT.cpp
@@ -20,7 +20,6 @@
 #include <functional>
 #include <cmath>
 
-#include <iostream>
 #include "MantidKernel/BoundedValidator.h"
 #include "MantidKernel/ListValidator.h"
 
diff --git a/Framework/Algorithms/src/Regroup.cpp b/Framework/Algorithms/src/Regroup.cpp
index 6d966fdc523f27770b3b91f94ba667295a878c57..b3997f78f68c2899f31e85d3f23a45da697091dc 100644
--- a/Framework/Algorithms/src/Regroup.cpp
+++ b/Framework/Algorithms/src/Regroup.cpp
@@ -12,8 +12,6 @@
 #include <functional>
 #include <cmath>
 
-#include <iostream>
-
 namespace Mantid {
 namespace Algorithms {
 
diff --git a/Framework/Algorithms/src/RemovePromptPulse.cpp b/Framework/Algorithms/src/RemovePromptPulse.cpp
index ceaecb85d4746b238478623d474eab6efed925c3..a5f338a5942b2314618d3c8f065e6214de340a89 100644
--- a/Framework/Algorithms/src/RemovePromptPulse.cpp
+++ b/Framework/Algorithms/src/RemovePromptPulse.cpp
@@ -72,7 +72,7 @@ void getTofRange(MatrixWorkspace_const_sptr wksp, double &tmin, double &tmax) {
   DataObjects::EventWorkspace_const_sptr eventWksp =
       boost::dynamic_pointer_cast<const DataObjects::EventWorkspace>(wksp);
 
-  bool isEvent = false;
+  const bool isEvent = false;
   if (isEvent) {
     eventWksp->getEventXMinMax(tmin, tmax);
   } else {
diff --git a/Framework/Algorithms/src/SANSDirectBeamScaling.cpp b/Framework/Algorithms/src/SANSDirectBeamScaling.cpp
index a9fb178f996daab9131644466dbc848194ccc28d..f603aaed91cd7ed1293125ae4dbe3e8ff5713713 100644
--- a/Framework/Algorithms/src/SANSDirectBeamScaling.cpp
+++ b/Framework/Algorithms/src/SANSDirectBeamScaling.cpp
@@ -9,7 +9,6 @@
 #include "MantidKernel/VectorHelper.h"
 #include "MantidAPI/WorkspaceValidators.h"
 #include "MantidDataObjects/Histogram1D.h"
-#include <iostream>
 #include <vector>
 #include "MantidKernel/BoundedValidator.h"
 
diff --git a/Framework/Algorithms/src/SaveGSASInstrumentFile.cpp b/Framework/Algorithms/src/SaveGSASInstrumentFile.cpp
index 4416295a73bb03f8bb68cd77b2462f3793be2672..8fc922fe4b86c0cb05f950d0b1c1e4dcb56f8633 100644
--- a/Framework/Algorithms/src/SaveGSASInstrumentFile.cpp
+++ b/Framework/Algorithms/src/SaveGSASInstrumentFile.cpp
@@ -7,7 +7,6 @@
 #include "MantidAPI/TableRow.h"
 
 #include <stdio.h>
-#include <iomanip>
 
 using namespace Mantid;
 using namespace Mantid::API;
diff --git a/Framework/Algorithms/src/SolidAngle.cpp b/Framework/Algorithms/src/SolidAngle.cpp
index e5d33e7c4ea19d7e870f3e8dab416de32957dcaf..43b76ee1ee8f49476722d268e6d5b66e4a705ed5 100644
--- a/Framework/Algorithms/src/SolidAngle.cpp
+++ b/Framework/Algorithms/src/SolidAngle.cpp
@@ -6,7 +6,6 @@
 #include "MantidAPI/AlgorithmFactory.h"
 #include "MantidKernel/UnitFactory.h"
 #include <cfloat>
-#include <iostream>
 #include "MantidKernel/BoundedValidator.h"
 
 namespace Mantid {
diff --git a/Framework/Algorithms/src/SpatialGrouping.cpp b/Framework/Algorithms/src/SpatialGrouping.cpp
index 4d53df627419b0f09deb592e119f74a57722f2b5..bfc5744a0057e65726562e3ea35f78cf57fdcaea 100644
--- a/Framework/Algorithms/src/SpatialGrouping.cpp
+++ b/Framework/Algorithms/src/SpatialGrouping.cpp
@@ -12,7 +12,6 @@
 #include <map>
 
 #include <fstream>
-#include <iostream>
 
 #include <algorithm>
 #include "MantidAPI/ISpectrum.h"
diff --git a/Framework/Algorithms/test/AddLogDerivativeTest.h b/Framework/Algorithms/test/AddLogDerivativeTest.h
index 696e229ef732202944c3ca59c3ee35e4cf802bab..4d83e735cc5a6c71f92b432f70c620b418e92612 100644
--- a/Framework/Algorithms/test/AddLogDerivativeTest.h
+++ b/Framework/Algorithms/test/AddLogDerivativeTest.h
@@ -6,8 +6,6 @@
 #include "MantidKernel/System.h"
 #include "MantidKernel/Timer.h"
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
 #include "MantidKernel/TimeSeriesProperty.h"
 #include "MantidAPI/Run.h"
diff --git a/Framework/Algorithms/test/AddPeakTest.h b/Framework/Algorithms/test/AddPeakTest.h
index b534469ba4a7dd882a055477a1723d877e767a89..230ff5a306dd0ad8b440eafb01b6a138a7eb6636 100644
--- a/Framework/Algorithms/test/AddPeakTest.h
+++ b/Framework/Algorithms/test/AddPeakTest.h
@@ -9,8 +9,6 @@
 #include "MantidKernel/Timer.h"
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 
 using namespace Mantid::Algorithms;
 using namespace Mantid::API;
diff --git a/Framework/Algorithms/test/ApplyDetailedBalanceTest.h b/Framework/Algorithms/test/ApplyDetailedBalanceTest.h
index da83e4b77c51d3251aa5d34e9371ce4946ff9528..e3880bcc1be4d6bd7fdb4ecb90d162340e6ef62f 100644
--- a/Framework/Algorithms/test/ApplyDetailedBalanceTest.h
+++ b/Framework/Algorithms/test/ApplyDetailedBalanceTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 #include "MantidAPI/AlgorithmManager.h"
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
 #include "MantidDataObjects/Workspace2D.h"
diff --git a/Framework/Algorithms/test/BinaryOperateMasksTest.h b/Framework/Algorithms/test/BinaryOperateMasksTest.h
index f60456beac5c99231392d52d9992c7f7a7228317..3218fb7d2004334ffd9924da9dcb0f329759f3be 100644
--- a/Framework/Algorithms/test/BinaryOperateMasksTest.h
+++ b/Framework/Algorithms/test/BinaryOperateMasksTest.h
@@ -9,8 +9,6 @@
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
 #include "MantidGeometry/Instrument.h"
 #include <cxxtest/TestSuite.h>
-#include <iostream>
-#include <iomanip>
 
 using namespace Mantid;
 using namespace Mantid::Algorithms;
diff --git a/Framework/Algorithms/test/ChangeBinOffsetTest.h b/Framework/Algorithms/test/ChangeBinOffsetTest.h
index faa21e602c8c705beaa8618303f3a9614946623a..04c89a554fa00f98635771a6689eede83947a549 100644
--- a/Framework/Algorithms/test/ChangeBinOffsetTest.h
+++ b/Framework/Algorithms/test/ChangeBinOffsetTest.h
@@ -3,7 +3,6 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include <iostream>
 #include <sstream>
 #include <string>
 
diff --git a/Framework/Algorithms/test/ChangePulsetimeTest.h b/Framework/Algorithms/test/ChangePulsetimeTest.h
index 17f8e42eecfb1a142f4ffadb772318c09f3ba037..b7a80e0d95fd2d025637be98fac7a12db7d7a441 100644
--- a/Framework/Algorithms/test/ChangePulsetimeTest.h
+++ b/Framework/Algorithms/test/ChangePulsetimeTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidAlgorithms/ChangePulsetime.h"
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
diff --git a/Framework/Algorithms/test/ConvertToEventWorkspaceTest.h b/Framework/Algorithms/test/ConvertToEventWorkspaceTest.h
index d37652d9f1e0785210cf4725324aea08bdf5aae1..f32dac5f19a814a9a4a18cd6cffcaf96b7f63aa3 100644
--- a/Framework/Algorithms/test/ConvertToEventWorkspaceTest.h
+++ b/Framework/Algorithms/test/ConvertToEventWorkspaceTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidAlgorithms/ConvertToEventWorkspace.h"
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
diff --git a/Framework/Algorithms/test/CountEventsInPulsesTest.h b/Framework/Algorithms/test/CountEventsInPulsesTest.h
index b3db88e1ac1097e93eed54b00efe117180c76f45..1b49e7ebe0b8ab3575d0a3216ade2182ffcd87f4 100644
--- a/Framework/Algorithms/test/CountEventsInPulsesTest.h
+++ b/Framework/Algorithms/test/CountEventsInPulsesTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidAlgorithms/CountEventsInPulses.h"
 #include "MantidKernel/TimeSeriesProperty.h"
diff --git a/Framework/Algorithms/test/CreateGroupingWorkspaceTest.h b/Framework/Algorithms/test/CreateGroupingWorkspaceTest.h
index 2854070451cbc5344e3a04442d38b0ad323de981..2b4f978934c39683d39cf19fa83376d8392b353e 100644
--- a/Framework/Algorithms/test/CreateGroupingWorkspaceTest.h
+++ b/Framework/Algorithms/test/CreateGroupingWorkspaceTest.h
@@ -7,8 +7,6 @@
 #include "MantidKernel/Timer.h"
 #include "MantidAPI/FrameworkManager.h"
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 
 using namespace Mantid::Algorithms;
 using namespace Mantid::API;
diff --git a/Framework/Algorithms/test/CreatePeaksWorkspaceTest.h b/Framework/Algorithms/test/CreatePeaksWorkspaceTest.h
index 7d8e9eebeb17f66a2b2402c349ee3e0a54cdf5bc..fb822c6164ebbbadbabd9a0d2122949994cd6cc2 100644
--- a/Framework/Algorithms/test/CreatePeaksWorkspaceTest.h
+++ b/Framework/Algorithms/test/CreatePeaksWorkspaceTest.h
@@ -9,8 +9,6 @@
 #include "MantidKernel/Timer.h"
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 
 using namespace Mantid::Algorithms;
 using namespace Mantid::API;
diff --git a/Framework/Algorithms/test/DetectorEfficiencyVariationTest.h b/Framework/Algorithms/test/DetectorEfficiencyVariationTest.h
index d7fee9f63a94238ce292056e2639e3645b26fe0e..182decc0f49d5d126bac8e09d779e1700a1e2b0d 100644
--- a/Framework/Algorithms/test/DetectorEfficiencyVariationTest.h
+++ b/Framework/Algorithms/test/DetectorEfficiencyVariationTest.h
@@ -14,8 +14,6 @@
 #include <boost/lexical_cast.hpp>
 #include <Poco/Path.h>
 #include <cmath>
-#include <iomanip>
-#include <iostream>
 #include <sstream>
 #include <fstream>
 #include <ios>
diff --git a/Framework/Algorithms/test/DiffractionEventCalibrateDetectorsTest.h b/Framework/Algorithms/test/DiffractionEventCalibrateDetectorsTest.h
index 0823a4f301089d49f318dabca7f530a59011d876..41a0dfbd9d22b7841d0f5f01d9509ae410ba25e5 100644
--- a/Framework/Algorithms/test/DiffractionEventCalibrateDetectorsTest.h
+++ b/Framework/Algorithms/test/DiffractionEventCalibrateDetectorsTest.h
@@ -6,8 +6,6 @@
 #include "MantidKernel/Timer.h"
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 #include <fstream>
 #include <Poco/File.h>
 
diff --git a/Framework/Algorithms/test/EditInstrumentGeometryTest.h b/Framework/Algorithms/test/EditInstrumentGeometryTest.h
index d801edecc2755a6cd031a6cc9c6e3f5692c9f4da..f0ba68a4ee1ab17000994576f0c510f38bb09431 100644
--- a/Framework/Algorithms/test/EditInstrumentGeometryTest.h
+++ b/Framework/Algorithms/test/EditInstrumentGeometryTest.h
@@ -10,8 +10,6 @@
 
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 using namespace Mantid;
 using namespace Mantid::Algorithms;
diff --git a/Framework/Algorithms/test/ElasticWindowTest.h b/Framework/Algorithms/test/ElasticWindowTest.h
index babe4b95bd131a07883da6bb3c49af63cfb9c7fd..6d9d4c8ecd9a58b3940de945b0cfd37f2a6632bf 100644
--- a/Framework/Algorithms/test/ElasticWindowTest.h
+++ b/Framework/Algorithms/test/ElasticWindowTest.h
@@ -3,8 +3,6 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include <iostream>
-#include <iomanip>
 #include "MantidAPI/FrameworkManager.h"
 #include "MantidKernel/System.h"
 
diff --git a/Framework/Algorithms/test/ExportTimeSeriesLogTest.h b/Framework/Algorithms/test/ExportTimeSeriesLogTest.h
index 2d2f8e21e48afd6d1f8b2b897271d0245c072f91..95ffd2e77abaebfd73a6528e367e4f30676c2239 100644
--- a/Framework/Algorithms/test/ExportTimeSeriesLogTest.h
+++ b/Framework/Algorithms/test/ExportTimeSeriesLogTest.h
@@ -5,8 +5,6 @@
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
 #include <cmath>
-#include <iostream>
-#include <iomanip>
 #include <fstream>
 #include <Poco/File.h>
 
diff --git a/Framework/Algorithms/test/FilterEventsTest.h b/Framework/Algorithms/test/FilterEventsTest.h
index 4de2165a833de3082420c1ed531c733531d794ce..ab3c1343d287cc4a5da8bbe0f354604f32d8b52b 100644
--- a/Framework/Algorithms/test/FilterEventsTest.h
+++ b/Framework/Algorithms/test/FilterEventsTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidAlgorithms/FilterEvents.h"
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
diff --git a/Framework/Algorithms/test/GenerateEventsFilterTest.h b/Framework/Algorithms/test/GenerateEventsFilterTest.h
index abdd7afa091f1ed4bec2897bd740b9ccc842012e..c6520fbca5c429f4dacae7cedffd1fd28824c626 100644
--- a/Framework/Algorithms/test/GenerateEventsFilterTest.h
+++ b/Framework/Algorithms/test/GenerateEventsFilterTest.h
@@ -5,8 +5,6 @@
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
 #include <cmath>
-#include <iostream>
-#include <iomanip>
 #include <fstream>
 #include <Poco/File.h>
 
diff --git a/Framework/Algorithms/test/GenerateIPythonNotebookTest.h b/Framework/Algorithms/test/GenerateIPythonNotebookTest.h
index 0e3d5fbe3ed31a075123e48bc6085c1ccebb0ed1..290f11a2dde2d1022382acc6b9b11c5479a24338 100644
--- a/Framework/Algorithms/test/GenerateIPythonNotebookTest.h
+++ b/Framework/Algorithms/test/GenerateIPythonNotebookTest.h
@@ -4,9 +4,7 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
 #include <fstream>
-#include <iomanip>
 #include <boost/regex.hpp>
 
 #include "MantidAlgorithms/GenerateIPythonNotebook.h"
diff --git a/Framework/Algorithms/test/GeneratePeaksTest.h b/Framework/Algorithms/test/GeneratePeaksTest.h
index b524ac99fbf283cf9d626a279e271cf19f213357..d25985d93b0d30d9da5e043e24d5532b50dc78b4 100644
--- a/Framework/Algorithms/test/GeneratePeaksTest.h
+++ b/Framework/Algorithms/test/GeneratePeaksTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidAlgorithms/GeneratePeaks.h"
 #include "MantidDataObjects/TableWorkspace.h"
diff --git a/Framework/Algorithms/test/GeneratePythonScriptTest.h b/Framework/Algorithms/test/GeneratePythonScriptTest.h
index 9d8c2860adcf9b5e32dcef36837da5169f075c3a..48234f28bf76ae0973f0b87bf6de72455c33a770 100644
--- a/Framework/Algorithms/test/GeneratePythonScriptTest.h
+++ b/Framework/Algorithms/test/GeneratePythonScriptTest.h
@@ -4,9 +4,7 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
 #include <fstream>
-#include <iomanip>
 #include <boost/regex.hpp>
 
 #include "MantidAlgorithms/GeneratePythonScript.h"
diff --git a/Framework/Algorithms/test/GetTimeSeriesLogInformationTest.h b/Framework/Algorithms/test/GetTimeSeriesLogInformationTest.h
index ea6f2cfff30bf446081f1c588035cc29d0baf815..237f5ab7a6d2120a3b044afe31bec41c4b9f5244 100644
--- a/Framework/Algorithms/test/GetTimeSeriesLogInformationTest.h
+++ b/Framework/Algorithms/test/GetTimeSeriesLogInformationTest.h
@@ -5,8 +5,6 @@
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
 #include <cmath>
-#include <iostream>
-#include <iomanip>
 #include <fstream>
 #include <Poco/File.h>
 
diff --git a/Framework/Algorithms/test/InvertMaskTest.h b/Framework/Algorithms/test/InvertMaskTest.h
index 2ddb4be78ec41d6ac821ad8b1d6162c4e2aa32ba..422422e53fdcd67113f75685e0eab062da2e5194 100644
--- a/Framework/Algorithms/test/InvertMaskTest.h
+++ b/Framework/Algorithms/test/InvertMaskTest.h
@@ -8,8 +8,6 @@
 #include "MantidTestHelpers/ComponentCreationHelper.h"
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
 #include "MantidGeometry/Instrument.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidAlgorithms/InvertMask.h"
 
diff --git a/Framework/Algorithms/test/MaskBinsFromTableTest.h b/Framework/Algorithms/test/MaskBinsFromTableTest.h
index fbac8eab834ab98d99d81c807c1248b247d67dae..72e265cbfa7753823d58d3d0ef7efeb67295b2f9 100644
--- a/Framework/Algorithms/test/MaskBinsFromTableTest.h
+++ b/Framework/Algorithms/test/MaskBinsFromTableTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
 #include "MantidAlgorithms/MaskBinsFromTable.h"
diff --git a/Framework/Algorithms/test/MedianDetectorTestTest.h b/Framework/Algorithms/test/MedianDetectorTestTest.h
index bb69f74a2f355cfe7663e2660abb31faaf5b4d79..da4fd49def2968c6cf2742c9571cc59ceaa87625 100644
--- a/Framework/Algorithms/test/MedianDetectorTestTest.h
+++ b/Framework/Algorithms/test/MedianDetectorTestTest.h
@@ -16,7 +16,6 @@
 #include <Poco/File.h>
 #include <Poco/Path.h>
 #include <cmath>
-#include <iostream>
 #include <sstream>
 #include <fstream>
 #include <ios>
diff --git a/Framework/Algorithms/test/NormaliseByDetectorTest.h b/Framework/Algorithms/test/NormaliseByDetectorTest.h
index 8f32e4747e6c06e27e88597805d1acae3868273a..f2a3086001076a8dca7a2a65983ec9d8db19a8d0 100644
--- a/Framework/Algorithms/test/NormaliseByDetectorTest.h
+++ b/Framework/Algorithms/test/NormaliseByDetectorTest.h
@@ -16,7 +16,6 @@
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
 #include "MantidTestHelpers/ScopedFileHelper.h"
 #include "MantidKernel/ConfigService.h"
-#include <iomanip>
 
 using namespace Mantid;
 using namespace Mantid::Algorithms;
diff --git a/Framework/Algorithms/test/PDFFourierTransformTest.h b/Framework/Algorithms/test/PDFFourierTransformTest.h
index 6b72b4f7b4bc04a2a8d48d2510f7214e49288f1d..724358a188011d84ec7c9458369957a1ccd9127e 100644
--- a/Framework/Algorithms/test/PDFFourierTransformTest.h
+++ b/Framework/Algorithms/test/PDFFourierTransformTest.h
@@ -11,8 +11,6 @@
 #include "MantidAPI/WorkspaceFactory.h"
 #include "MantidAPI/AnalysisDataService.h"
 #include "MantidAPI/IAlgorithm.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidAlgorithms/PDFFourierTransform.h"
 
diff --git a/Framework/Algorithms/test/PauseTest.h b/Framework/Algorithms/test/PauseTest.h
index 8ab460600349ef0b98e5448294325f6ca1571a16..4caceae6c1f902c4d78c72ef2b68c61640ddec3e 100644
--- a/Framework/Algorithms/test/PauseTest.h
+++ b/Framework/Algorithms/test/PauseTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidAlgorithms/Pause.h"
 
diff --git a/Framework/Algorithms/test/PlotAsymmetryByLogValueTest.h b/Framework/Algorithms/test/PlotAsymmetryByLogValueTest.h
index e7ab84fb34d0e17577abdc42ba07fb9d7120d377..8f7648d74fcc93ee8ff291a8fc0dec5f5eab191f 100644
--- a/Framework/Algorithms/test/PlotAsymmetryByLogValueTest.h
+++ b/Framework/Algorithms/test/PlotAsymmetryByLogValueTest.h
@@ -13,7 +13,6 @@
 #include "MantidDataHandling/LoadInstrument.h"
 #include "MantidDataHandling/SaveNexus.h"
 
-#include <iostream>
 #include <Poco/File.h>
 
 using namespace Mantid::API;
diff --git a/Framework/Algorithms/test/Q1DWeightedTest.h b/Framework/Algorithms/test/Q1DWeightedTest.h
index 0555cf4adf2287754dec61f27212f0db4644a0ae..6abd0718970d3084d54eb7a1695b75f939d050f6 100644
--- a/Framework/Algorithms/test/Q1DWeightedTest.h
+++ b/Framework/Algorithms/test/Q1DWeightedTest.h
@@ -5,7 +5,6 @@
 #include "MantidAlgorithms/Q1DWeighted.h"
 #include "MantidDataHandling/LoadSpice2D.h"
 #include "MantidDataHandling/MoveInstrumentComponent.h"
-#include <iostream>
 
 using namespace Mantid::API;
 using namespace Mantid::Kernel;
diff --git a/Framework/Algorithms/test/RayTracerTesterTest.h b/Framework/Algorithms/test/RayTracerTesterTest.h
index 5b643f7871c08f35a427b55bacf6a21a9bae3662..9f9e6972af7bfd70bb5d5e1e30f5f10381a34025 100644
--- a/Framework/Algorithms/test/RayTracerTesterTest.h
+++ b/Framework/Algorithms/test/RayTracerTesterTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidAlgorithms/RayTracerTester.h"
 
diff --git a/Framework/Algorithms/test/RegroupTest.h b/Framework/Algorithms/test/RegroupTest.h
index 3c49bc8e7738146b1e260b04f0ff3bb2de8046c9..fd329c37d4f9aa5b7bda8685ced9616a9f72bbfd 100644
--- a/Framework/Algorithms/test/RegroupTest.h
+++ b/Framework/Algorithms/test/RegroupTest.h
@@ -8,8 +8,6 @@
 #include "MantidAlgorithms/Regroup.h"
 #include "MantidAPI/WorkspaceProperty.h"
 
-#include <iostream>
-
 using namespace Mantid::Kernel;
 using namespace Mantid::DataObjects;
 using namespace Mantid::API;
diff --git a/Framework/Algorithms/test/RemoveBinsTest.h b/Framework/Algorithms/test/RemoveBinsTest.h
index 0eb0444239da3c9b5f3b915f1b6e65b0bf2fc005..e4dd7d4d22f3bff0e8e02d9fbef41d0656ab7c4a 100644
--- a/Framework/Algorithms/test/RemoveBinsTest.h
+++ b/Framework/Algorithms/test/RemoveBinsTest.h
@@ -3,7 +3,6 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include <iostream>
 #include <sstream>
 #include <string>
 #include <stdexcept>
diff --git a/Framework/Algorithms/test/RemoveLowResTOFTest.h b/Framework/Algorithms/test/RemoveLowResTOFTest.h
index 2c4117254f2a41c4f33f1f8a86d2a032ad0e8fd0..151e8c9694c50d2ec363a9f1f3a743e29edce805 100644
--- a/Framework/Algorithms/test/RemoveLowResTOFTest.h
+++ b/Framework/Algorithms/test/RemoveLowResTOFTest.h
@@ -9,8 +9,6 @@
 #include "MantidKernel/UnitFactory.h"
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
 #include "MantidTestHelpers/ComponentCreationHelper.h"
-#include <iostream>
-#include <iomanip>
 #include <set>
 #include <string>
 
diff --git a/Framework/Algorithms/test/RemovePromptPulseTest.h b/Framework/Algorithms/test/RemovePromptPulseTest.h
index f4500225d70fac0a2bb46474f99b8d21476e00ba..0675bf25926ce6292f20fc27f6f5628dc8c71c73 100644
--- a/Framework/Algorithms/test/RemovePromptPulseTest.h
+++ b/Framework/Algorithms/test/RemovePromptPulseTest.h
@@ -2,8 +2,6 @@
 #define MANTID_ALGORITHMS_REMOVEPROMPTPULSETEST_H_
 
 #include <cxxtest/TestSuite.h>
-#include <iostream>
-#include <iomanip>
 #include "MantidAPI/AnalysisDataService.h"
 #include "MantidDataObjects/EventWorkspace.h"
 #include "MantidKernel/System.h"
diff --git a/Framework/Algorithms/test/ResetNegativesTest.h b/Framework/Algorithms/test/ResetNegativesTest.h
index 7db37fd2283726a289b11cc0b4ccd62dbcac5104..f9bbbec67ed1105b96ec17e832db47687be348b4 100644
--- a/Framework/Algorithms/test/ResetNegativesTest.h
+++ b/Framework/Algorithms/test/ResetNegativesTest.h
@@ -7,8 +7,6 @@
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
-#include <iostream>
-#include <iomanip>
 #include <string>
 
 #include "MantidAlgorithms/ResetNegatives.h"
diff --git a/Framework/Algorithms/test/ResizeRectangularDetectorTest.h b/Framework/Algorithms/test/ResizeRectangularDetectorTest.h
index 588a827ad4f94710b79f6aa659218e6e4752c8b0..c7fe587a3bfa55887dae0542fa7f95393fd08a16 100644
--- a/Framework/Algorithms/test/ResizeRectangularDetectorTest.h
+++ b/Framework/Algorithms/test/ResizeRectangularDetectorTest.h
@@ -11,8 +11,6 @@
 #include "MantidKernel/V3D.h"
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 #include "MantidGeometry/Instrument/RectangularDetectorPixel.h"
 
 using namespace Mantid;
diff --git a/Framework/Algorithms/test/ShiftLogTimeTest.h b/Framework/Algorithms/test/ShiftLogTimeTest.h
index 45b0ceee013cf535d849a0d51302e29fbba270bb..fff95c4817c5a2e86af7c5f655a9ff06c96e53f0 100644
--- a/Framework/Algorithms/test/ShiftLogTimeTest.h
+++ b/Framework/Algorithms/test/ShiftLogTimeTest.h
@@ -7,8 +7,6 @@
 #include "MantidKernel/System.h"
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/TimeSeriesProperty.h"
-#include <iostream>
-#include <iomanip>
 
 using namespace Mantid;
 using namespace Mantid::Algorithms;
diff --git a/Framework/Algorithms/test/SignalOverErrorTest.h b/Framework/Algorithms/test/SignalOverErrorTest.h
index 7887d9c45237c7c66cdb9a20d0ebf0c77a97b779..be31dec152265817744963a41cde36f70e33be81 100644
--- a/Framework/Algorithms/test/SignalOverErrorTest.h
+++ b/Framework/Algorithms/test/SignalOverErrorTest.h
@@ -7,8 +7,6 @@
 #include "MantidKernel/Timer.h"
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 
 using namespace Mantid;
 using namespace Mantid::Algorithms;
diff --git a/Framework/Algorithms/test/SmoothNeighboursTest.h b/Framework/Algorithms/test/SmoothNeighboursTest.h
index 9fc602a9e04a335675c26068e739adec4f19cf58..2dab29faed28f25443c5bb139b8985b5d841c44f 100644
--- a/Framework/Algorithms/test/SmoothNeighboursTest.h
+++ b/Framework/Algorithms/test/SmoothNeighboursTest.h
@@ -14,8 +14,6 @@
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
 
 #include <cxxtest/TestSuite.h>
-#include <iostream>
-#include <iomanip>
 
 using namespace Mantid;
 using namespace Mantid::Kernel;
diff --git a/Framework/Algorithms/test/UnwrapSNSTest.h b/Framework/Algorithms/test/UnwrapSNSTest.h
index 68ae1ed6d58a699380332052430270414097e040..7fa34a7772f2b1c1c67b2c3f96d12360c5711b5d 100644
--- a/Framework/Algorithms/test/UnwrapSNSTest.h
+++ b/Framework/Algorithms/test/UnwrapSNSTest.h
@@ -9,8 +9,6 @@
 #include "MantidKernel/UnitFactory.h"
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
 #include "MantidTestHelpers/ComponentCreationHelper.h"
-#include <iostream>
-#include <iomanip>
 #include <string>
 
 #include "MantidAlgorithms/UnwrapSNS.h"
diff --git a/Framework/Algorithms/test/WeightingStrategyTest.h b/Framework/Algorithms/test/WeightingStrategyTest.h
index 01c8b69bc460004398f4b0727d04e2cc8d83cf96..c3515c98c80ec431cecbe579476037ee5b8a799d 100644
--- a/Framework/Algorithms/test/WeightingStrategyTest.h
+++ b/Framework/Algorithms/test/WeightingStrategyTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidAlgorithms/WeightingStrategy.h"
 
diff --git a/Framework/Algorithms/test/WorkspaceCreationHelperTest.h b/Framework/Algorithms/test/WorkspaceCreationHelperTest.h
index 3cc5b4bc7968cb9606cb0d5ae3f8611cab17f8fe..a1c3804687da72b281ab281d8f95d8d425f72a42 100644
--- a/Framework/Algorithms/test/WorkspaceCreationHelperTest.h
+++ b/Framework/Algorithms/test/WorkspaceCreationHelperTest.h
@@ -5,8 +5,6 @@
 #include "MantidKernel/Timer.h"
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 #include "MantidAPI/SpectraDetectorTypes.h"
 
 using namespace Mantid;
diff --git a/Framework/Crystal/src/FilterPeaks.cpp b/Framework/Crystal/src/FilterPeaks.cpp
index 8e398c2b0de67a54cfba1205285caa2be5a0808c..f60acecea9586ca7449801c11b174ecdbefd7e16 100644
--- a/Framework/Crystal/src/FilterPeaks.cpp
+++ b/Framework/Crystal/src/FilterPeaks.cpp
@@ -98,6 +98,8 @@ void FilterPeaks::exec() {
     filterFunction = &intensity;
   else if (FilterVariable == "Signal/Noise")
     filterFunction = &SN;
+  else
+    throw std::invalid_argument("Unknown FilterVariable: " + FilterVariable);
 
   const double FilterValue = getProperty("FilterValue");
   const std::string Operator = getProperty("Operator");
diff --git a/Framework/Crystal/src/IntegratePeakTimeSlices.cpp b/Framework/Crystal/src/IntegratePeakTimeSlices.cpp
index 70e398ef3d65ea8c30d3b112373b7e929153f56e..9828bea2f54bfa54db588459eca4c19b2d772842 100644
--- a/Framework/Crystal/src/IntegratePeakTimeSlices.cpp
+++ b/Framework/Crystal/src/IntegratePeakTimeSlices.cpp
@@ -587,6 +587,12 @@ void IntegratePeakTimeSlices::exec() {
 
             // Now set up the center for this peak
             int i = find("Mrow", names);
+            if (i < 0) {
+              throw std::runtime_error("Inconsistency found in algorithm "
+                                       "execution. The index for the parameter "
+                                       "Mrow is negative.");
+            }
+
             lastRow = (int)(params[i] + .5);
             i = find("Mcol", names);
             lastCol = (int)(params[i] + .5);
@@ -2220,7 +2226,16 @@ bool IntegratePeakTimeSlices::isGoodFit(std::vector<double> const &params,
                                         std::vector<std::string> const &names,
                                         double chisqOverDOF) {
   int Ibk = find("Background", names);
+  if (Ibk < 0)
+    throw std::runtime_error(
+        "Irrecoverable inconsistency found. The index for the "
+        "parameter 'Background' is lower than zero.");
+
   int IIntensity = find("Intensity", names);
+  if (IIntensity < 0)
+    throw std::runtime_error(
+        "Irrecoverable inconsistency found. The index for the "
+        "parameter 'Intensity' is lower than zero.");
 
   if (chisqOverDOF < 0) {
 
@@ -2498,6 +2513,15 @@ int IntegratePeakTimeSlices::UpdateOutputWS(
   int Irow = find("Mrow", names);
   int Icol = find("Mcol", names);
 
+  if (Ibk < 0 || IIntensity < 0 || IVx < 0 || IVy < 0 || IVxy < 0 || Irow < 0 ||
+      Icol < 0) {
+    throw std::runtime_error("Inconsistency found when updating output "
+                             "workspace. None of the indices for the "
+                             "parameters 'Background', 'Intensity', 'SScol', "
+                             "'SSrow', 'SSrc', 'Mrow', 'Mcol' can be "
+                             "negative.");
+  }
+
   int newRowIndex = 0;
 
   if (dir > 0)
diff --git a/Framework/Crystal/src/LoadIsawSpectrum.cpp b/Framework/Crystal/src/LoadIsawSpectrum.cpp
index 1020210a59d8f48c1c261685b9a4e787d7427f38..20e26e01cda8e944690d35d46093fef418e917bf 100644
--- a/Framework/Crystal/src/LoadIsawSpectrum.cpp
+++ b/Framework/Crystal/src/LoadIsawSpectrum.cpp
@@ -69,38 +69,24 @@ void LoadIsawSpectrum::exec() {
   std::vector<std::vector<double>> spectra;
   std::vector<std::vector<double>> time;
   int iSpec = 0;
-  if (iSpec == 1) {
-    while (!infile.eof()) // To get you all the lines.
-    {
-      // Set up sizes. (HEIGHT x WIDTH)
-      spectra.resize(a + 1);
-      getline(infile, STRING); // Saves the line in STRING.
-      infile >> spec[0] >> spec[1] >> spec[2] >> spec[3] >> spec[4] >>
-          spec[5] >> spec[6] >> spec[7] >> spec[8] >> spec[9] >> spec[10];
-      for (int i = 0; i < 11; i++)
-        spectra[a].push_back(spec[i]);
-      a++;
-    }
-  } else {
-    for (int wi = 0; wi < 8; wi++)
-      getline(infile, STRING); // Saves the line in STRING.
-    while (!infile.eof())      // To get you all the lines.
-    {
-      time.resize(a + 1);
-      spectra.resize(a + 1);
-      getline(infile, STRING); // Saves the line in STRING.
-      if (infile.eof())
-        break;
-      std::stringstream ss(STRING);
-      if (STRING.find("Bank") == std::string::npos) {
-        double time0, spectra0;
-        ss >> time0 >> spectra0;
-        time[a].push_back(time0);
-        spectra[a].push_back(spectra0);
+  for (int wi = 0; wi < 8; wi++)
+    getline(infile, STRING); // Saves the line in STRING.
+  while (!infile.eof())      // To get you all the lines.
+  {
+    time.resize(a + 1);
+    spectra.resize(a + 1);
+    getline(infile, STRING); // Saves the line in STRING.
+    if (infile.eof())
+      break;
+    std::stringstream ss(STRING);
+    if (STRING.find("Bank") == std::string::npos) {
+      double time0, spectra0;
+      ss >> time0 >> spectra0;
+      time[a].push_back(time0);
+      spectra[a].push_back(spectra0);
 
-      } else {
-        a++;
-      }
+    } else {
+      a++;
     }
   }
   infile.close();
diff --git a/Framework/Crystal/src/SaveHKL.cpp b/Framework/Crystal/src/SaveHKL.cpp
index 531893ebf5181eaacb538ee2eb25602000c59645..3129a148080f65782324bc85faa06dc5f2a05247 100644
--- a/Framework/Crystal/src/SaveHKL.cpp
+++ b/Framework/Crystal/src/SaveHKL.cpp
@@ -230,37 +230,23 @@ void SaveHKL::exec() {
     infile.open(spectraFile.c_str());
     if (infile.is_open()) {
       size_t a = 0;
-      if (iSpec == 1) {
-        while (!infile.eof()) // To get you all the lines.
-        {
-          // Set up sizes. (HEIGHT x WIDTH)
-          spectra.resize(a + 1);
-          getline(infile, STRING); // Saves the line in STRING.
-          infile >> spec[0] >> spec[1] >> spec[2] >> spec[3] >> spec[4] >>
-              spec[5] >> spec[6] >> spec[7] >> spec[8] >> spec[9] >> spec[10];
-          for (int i = 0; i < 11; i++)
-            spectra[a].push_back(spec[i]);
+      for (int wi = 0; wi < 8; wi++)
+        getline(infile, STRING); // Saves the line in STRING.
+      while (!infile.eof())      // To get you all the lines.
+      {
+        time.resize(a + 1);
+        spectra.resize(a + 1);
+        getline(infile, STRING); // Saves the line in STRING.
+        std::stringstream ss(STRING);
+        if (STRING.find("Bank") == std::string::npos) {
+          double time0, spectra0;
+          ss >> time0 >> spectra0;
+          time[a].push_back(time0);
+          spectra[a].push_back(spectra0);
+
+        } else {
           a++;
         }
-      } else {
-        for (int wi = 0; wi < 8; wi++)
-          getline(infile, STRING); // Saves the line in STRING.
-        while (!infile.eof())      // To get you all the lines.
-        {
-          time.resize(a + 1);
-          spectra.resize(a + 1);
-          getline(infile, STRING); // Saves the line in STRING.
-          std::stringstream ss(STRING);
-          if (STRING.find("Bank") == std::string::npos) {
-            double time0, spectra0;
-            ss >> time0 >> spectra0;
-            time[a].push_back(time0);
-            spectra[a].push_back(spectra0);
-
-          } else {
-            a++;
-          }
-        }
       }
       infile.close();
     }
diff --git a/Framework/Crystal/test/AnvredCorrectionTest.h b/Framework/Crystal/test/AnvredCorrectionTest.h
index 860322223cd3d9069b2b7ba7157628520ba40927..6b5b5376fbc6c3bb25c93fdb5c1fce93fea15048 100644
--- a/Framework/Crystal/test/AnvredCorrectionTest.h
+++ b/Framework/Crystal/test/AnvredCorrectionTest.h
@@ -18,8 +18,6 @@
 #include <boost/random/variate_generator.hpp>
 #include <math.h>
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 
 using namespace Mantid;
 using namespace Mantid::Crystal;
diff --git a/Framework/Crystal/test/CalculateUMatrixTest.h b/Framework/Crystal/test/CalculateUMatrixTest.h
index bfd583addb80341f5c25371d86ffd9ad75188f17..1541caefccd4b15bb0934c9ec5cbe1c425cc7bb5 100644
--- a/Framework/Crystal/test/CalculateUMatrixTest.h
+++ b/Framework/Crystal/test/CalculateUMatrixTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidCrystal/CalculateUMatrix.h"
 #include "MantidGeometry/Crystal/OrientedLattice.h"
diff --git a/Framework/Crystal/test/CentroidPeaksTest.h b/Framework/Crystal/test/CentroidPeaksTest.h
index 653179954cc0cb0ea0a7b1fcbd2cdcba15332487..4843512cbdbc6a34455cc9ff7325eae9e53e0db2 100644
--- a/Framework/Crystal/test/CentroidPeaksTest.h
+++ b/Framework/Crystal/test/CentroidPeaksTest.h
@@ -18,8 +18,6 @@
 #include <boost/random/variate_generator.hpp>
 #include <math.h>
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 
 using namespace Mantid;
 using namespace Mantid::Crystal;
diff --git a/Framework/Crystal/test/FindUBUsingFFTTest.h b/Framework/Crystal/test/FindUBUsingFFTTest.h
index 0c9e5c5dc851658279d0a0b2ad6818a45361a9b2..ecc480cb46709c11f98e9c56a7f3309337b6b7dc 100644
--- a/Framework/Crystal/test/FindUBUsingFFTTest.h
+++ b/Framework/Crystal/test/FindUBUsingFFTTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidCrystal/FindUBUsingFFT.h"
 #include "MantidCrystal/LoadIsawPeaks.h"
diff --git a/Framework/Crystal/test/FindUBUsingIndexedPeaksTest.h b/Framework/Crystal/test/FindUBUsingIndexedPeaksTest.h
index 3c3da2ce273a44cfcaeef89d1b7cef2614c3a0f1..843071413a8854b218c2cc42ae14f0e755c17c85 100644
--- a/Framework/Crystal/test/FindUBUsingIndexedPeaksTest.h
+++ b/Framework/Crystal/test/FindUBUsingIndexedPeaksTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidCrystal/FindUBUsingIndexedPeaks.h"
 #include "MantidCrystal/LoadIsawPeaks.h"
diff --git a/Framework/Crystal/test/FindUBUsingLatticeParametersTest.h b/Framework/Crystal/test/FindUBUsingLatticeParametersTest.h
index 1cef9de875a70cd6be271b68fa70ec16f8a872f4..4f25945262e0acc68bbcbe1fd00b9e785d40db7a 100644
--- a/Framework/Crystal/test/FindUBUsingLatticeParametersTest.h
+++ b/Framework/Crystal/test/FindUBUsingLatticeParametersTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidCrystal/FindUBUsingLatticeParameters.h"
 #include "MantidCrystal/LoadIsawPeaks.h"
diff --git a/Framework/Crystal/test/FindUBUsingMinMaxDTest.h b/Framework/Crystal/test/FindUBUsingMinMaxDTest.h
index 63ffb2254a1bf0f45c5fed7d46340ab4cbf23b89..58934d00d7f2ce538c78d234b033e0b0602a673c 100644
--- a/Framework/Crystal/test/FindUBUsingMinMaxDTest.h
+++ b/Framework/Crystal/test/FindUBUsingMinMaxDTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidCrystal/FindUBUsingMinMaxD.h"
 #include "MantidCrystal/LoadIsawPeaks.h"
diff --git a/Framework/Crystal/test/IndexPeaksTest.h b/Framework/Crystal/test/IndexPeaksTest.h
index 748bc85b78c3dddf16585b10339378d79b3ab042..a9085df9d0e9019931da7e44ce518d0aa235bf81 100644
--- a/Framework/Crystal/test/IndexPeaksTest.h
+++ b/Framework/Crystal/test/IndexPeaksTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidCrystal/IndexPeaks.h"
 #include "MantidCrystal/LoadIsawPeaks.h"
diff --git a/Framework/Crystal/test/LoadHKLTest.h b/Framework/Crystal/test/LoadHKLTest.h
index b4a255d7e268ccd191ea211e896dfa0270534afe..df8f5eb183b6a486e89612b400f13ec2734ced36 100644
--- a/Framework/Crystal/test/LoadHKLTest.h
+++ b/Framework/Crystal/test/LoadHKLTest.h
@@ -10,8 +10,6 @@
 #include "MantidKernel/Timer.h"
 #include "MantidTestHelpers/ComponentCreationHelper.h"
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 #include <fstream>
 #include <Poco/File.h>
 
diff --git a/Framework/Crystal/test/LoadIsawPeaksTest.h b/Framework/Crystal/test/LoadIsawPeaksTest.h
index 8d40b021e447a87c99a6c8af8c9efafc79a2f793..57cde40ffec075c23623f56444c411f44be551db 100644
--- a/Framework/Crystal/test/LoadIsawPeaksTest.h
+++ b/Framework/Crystal/test/LoadIsawPeaksTest.h
@@ -9,8 +9,6 @@
 #include "MantidKernel/System.h"
 #include "MantidKernel/Timer.h"
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 
 using namespace Mantid::API;
 using namespace Mantid::Crystal;
diff --git a/Framework/Crystal/test/LoadIsawSpectrumTest.h b/Framework/Crystal/test/LoadIsawSpectrumTest.h
index 1beed81dcc2d6e53ccef1d212425f33b52098954..2754a7760068ff0e86673ed3dcf6a2b43799c0f8 100644
--- a/Framework/Crystal/test/LoadIsawSpectrumTest.h
+++ b/Framework/Crystal/test/LoadIsawSpectrumTest.h
@@ -10,8 +10,6 @@
 #include "MantidGeometry/Crystal/OrientedLattice.h"
 #include "MantidAPI/FrameworkManager.h"
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 
 using namespace Mantid::Crystal;
 using namespace Mantid::API;
diff --git a/Framework/Crystal/test/LoadIsawUBTest.h b/Framework/Crystal/test/LoadIsawUBTest.h
index a15fb23b6785e498c4fe034ca3107ea796b19240..8123d2272b27415eb9f57b951e60f41fd30ed14c 100644
--- a/Framework/Crystal/test/LoadIsawUBTest.h
+++ b/Framework/Crystal/test/LoadIsawUBTest.h
@@ -11,8 +11,6 @@
 #include "MantidGeometry/Crystal/OrientedLattice.h"
 #include "MantidAPI/FrameworkManager.h"
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 
 using namespace Mantid::Crystal;
 using namespace Mantid::API;
diff --git a/Framework/Crystal/test/NormaliseVanadiumTest.h b/Framework/Crystal/test/NormaliseVanadiumTest.h
index ddda1f89f4852bfe05e6e000a2bbb981fd17e04b..4d52925b22f4b7abfd7d3f2680330949a3af7ac5 100644
--- a/Framework/Crystal/test/NormaliseVanadiumTest.h
+++ b/Framework/Crystal/test/NormaliseVanadiumTest.h
@@ -16,8 +16,6 @@
 #include <boost/random/variate_generator.hpp>
 #include <math.h>
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 
 using namespace Mantid;
 using namespace Mantid::Crystal;
diff --git a/Framework/Crystal/test/OptimizeLatticeForCellTypeTest.h b/Framework/Crystal/test/OptimizeLatticeForCellTypeTest.h
index 52d91d88e90b58e3868ebca7030f0af2fa119802..cfb878810325628d3fbc91d0004c44d8f4653f20 100644
--- a/Framework/Crystal/test/OptimizeLatticeForCellTypeTest.h
+++ b/Framework/Crystal/test/OptimizeLatticeForCellTypeTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidCrystal/OptimizeLatticeForCellType.h"
 #include "MantidCrystal/FindUBUsingFFT.h"
diff --git a/Framework/Crystal/test/PeakIntegrationTest.h b/Framework/Crystal/test/PeakIntegrationTest.h
index 2801488ecac725c61137663b6dacd2a8aa0fc87b..a34be8927d45e43d347563d18dba877f998dba4d 100644
--- a/Framework/Crystal/test/PeakIntegrationTest.h
+++ b/Framework/Crystal/test/PeakIntegrationTest.h
@@ -18,8 +18,6 @@
 #include <boost/random/variate_generator.hpp>
 #include <math.h>
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 
 using namespace Mantid;
 using namespace Mantid::Crystal;
diff --git a/Framework/Crystal/test/PeakIntensityVsRadiusTest.h b/Framework/Crystal/test/PeakIntensityVsRadiusTest.h
index 5e560b92b22c143754b9d7557b7a489c9194d749..e9b5733569bbc94b772a1aff5d7e1d2a74ff7659 100644
--- a/Framework/Crystal/test/PeakIntensityVsRadiusTest.h
+++ b/Framework/Crystal/test/PeakIntensityVsRadiusTest.h
@@ -11,8 +11,6 @@
 #include "MantidTestHelpers/ComponentCreationHelper.h"
 #include "MantidAPI/FrameworkManager.h"
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 
 using namespace Mantid;
 using namespace Mantid::Crystal;
diff --git a/Framework/Crystal/test/PredictPeaksTest.h b/Framework/Crystal/test/PredictPeaksTest.h
index 6234ee18989727368dec0b5576f51c237cd0eff3..01401b993b2c54838c5b49dc96a73cb2e3c19fc5 100644
--- a/Framework/Crystal/test/PredictPeaksTest.h
+++ b/Framework/Crystal/test/PredictPeaksTest.h
@@ -9,8 +9,6 @@
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
 #include "MantidTestHelpers/ComponentCreationHelper.h"
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 #include "MantidKernel/V3D.h"
 #include "MantidGeometry/IDTypes.h"
 
diff --git a/Framework/Crystal/test/SaveHKLTest.h b/Framework/Crystal/test/SaveHKLTest.h
index a7dba0a6a1328c62c10f5bf97d1213bcfe297a1e..80b747709416c8be4aa158ec3e213bc4d1509530 100644
--- a/Framework/Crystal/test/SaveHKLTest.h
+++ b/Framework/Crystal/test/SaveHKLTest.h
@@ -9,8 +9,6 @@
 #include "MantidKernel/Timer.h"
 #include "MantidTestHelpers/ComponentCreationHelper.h"
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 #include <fstream>
 #include <Poco/File.h>
 
diff --git a/Framework/Crystal/test/SaveIsawPeaksTest.h b/Framework/Crystal/test/SaveIsawPeaksTest.h
index 62766e5826a417130ffb9681505de2c2c68858b8..53bd33d0cb1fc07e55af1de26a442cf828a183ec 100644
--- a/Framework/Crystal/test/SaveIsawPeaksTest.h
+++ b/Framework/Crystal/test/SaveIsawPeaksTest.h
@@ -9,8 +9,6 @@
 #include "MantidKernel/Timer.h"
 #include "MantidTestHelpers/ComponentCreationHelper.h"
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 #include <Poco/File.h>
 
 using namespace Mantid;
diff --git a/Framework/Crystal/test/SaveIsawUBTest.h b/Framework/Crystal/test/SaveIsawUBTest.h
index 3e781524bb32a81e067402bff791a35dbaac31a9..77b9ce5e690cf6b1e5d5e6a432459dacf592f8b3 100644
--- a/Framework/Crystal/test/SaveIsawUBTest.h
+++ b/Framework/Crystal/test/SaveIsawUBTest.h
@@ -19,7 +19,6 @@
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
 
 #include <cxxtest/TestSuite.h>
-#include <iostream>
 #include <fstream>
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/Framework/Crystal/test/SaveLauenormTest.h b/Framework/Crystal/test/SaveLauenormTest.h
index ffa2ff24f389c393a234867e749cda2cde13c6c3..d5c88b526cd20cd496abfe6b1bdcf71589bdd1de 100644
--- a/Framework/Crystal/test/SaveLauenormTest.h
+++ b/Framework/Crystal/test/SaveLauenormTest.h
@@ -9,8 +9,6 @@
 #include "MantidKernel/Timer.h"
 #include "MantidTestHelpers/ComponentCreationHelper.h"
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 #include <fstream>
 #include <Poco/File.h>
 
diff --git a/Framework/Crystal/test/SavePeaksFileTest.h b/Framework/Crystal/test/SavePeaksFileTest.h
index f6fe4353c75cdaec961e6b6f4d600ce80d454bd9..4de6a339657af611b9f3b9d3becdd5ca8d568ff6 100644
--- a/Framework/Crystal/test/SavePeaksFileTest.h
+++ b/Framework/Crystal/test/SavePeaksFileTest.h
@@ -8,8 +8,6 @@
 #include "MantidKernel/System.h"
 #include "MantidKernel/Timer.h"
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 #include <Poco/File.h>
 
 using namespace Mantid::Kernel;
diff --git a/Framework/Crystal/test/SelectCellOfTypeTest.h b/Framework/Crystal/test/SelectCellOfTypeTest.h
index 918286b3bd1d21e993e630fc72b94e2f4c4d4827..0e67f114ccc4a50c097399ad188f45503fbfdb9d 100644
--- a/Framework/Crystal/test/SelectCellOfTypeTest.h
+++ b/Framework/Crystal/test/SelectCellOfTypeTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidCrystal/SelectCellOfType.h"
 #include "MantidCrystal/LoadIsawPeaks.h"
diff --git a/Framework/Crystal/test/SelectCellWithFormTest.h b/Framework/Crystal/test/SelectCellWithFormTest.h
index a711dd4f7fd32a9ffb170eb5afd11f5b383850a3..77cc15c40b3f37000f743a6ce37d8dd305a95e3b 100644
--- a/Framework/Crystal/test/SelectCellWithFormTest.h
+++ b/Framework/Crystal/test/SelectCellWithFormTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidCrystal/SelectCellWithForm.h"
 #include "MantidCrystal/LoadIsawPeaks.h"
diff --git a/Framework/Crystal/test/SetGoniometerTest.h b/Framework/Crystal/test/SetGoniometerTest.h
index dfd07fce6c8c666e7fda9d61ddaf2547f9138679..7380082ff01a431c1cb76887ca0fecbdb95b610f 100644
--- a/Framework/Crystal/test/SetGoniometerTest.h
+++ b/Framework/Crystal/test/SetGoniometerTest.h
@@ -9,8 +9,6 @@
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
 #include "MantidAPI/FrameworkManager.h"
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 #include "MantidKernel/V3D.h"
 #include "MantidKernel/Matrix.h"
 
diff --git a/Framework/Crystal/test/SetUBTest.h b/Framework/Crystal/test/SetUBTest.h
index 801dc6bb3bece6803265013f11a166036ef1be6b..2b86a2180d31de449324674e7dec10710cbb3ef3 100644
--- a/Framework/Crystal/test/SetUBTest.h
+++ b/Framework/Crystal/test/SetUBTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidCrystal/SetUB.h"
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
diff --git a/Framework/Crystal/test/ShowPossibleCellsTest.h b/Framework/Crystal/test/ShowPossibleCellsTest.h
index 5a623a0cbaf17f5480f968415cff8afc7bd61968..4e731455a5261df21112de0eb0ee34d70c26551a 100644
--- a/Framework/Crystal/test/ShowPossibleCellsTest.h
+++ b/Framework/Crystal/test/ShowPossibleCellsTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidCrystal/ShowPossibleCells.h"
 #include "MantidCrystal/LoadIsawPeaks.h"
diff --git a/Framework/Crystal/test/SortHKLTest.h b/Framework/Crystal/test/SortHKLTest.h
index 72b6ea2fd61b7309e23e253e3bed34941b2acdb8..656a41076d7319f6bfd9da2db2c6aece29f6839d 100644
--- a/Framework/Crystal/test/SortHKLTest.h
+++ b/Framework/Crystal/test/SortHKLTest.h
@@ -10,8 +10,6 @@
 #include "MantidTestHelpers/ComponentCreationHelper.h"
 #include "MantidGeometry/Crystal/OrientedLattice.h"
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 #include <fstream>
 #include <Poco/File.h>
 
diff --git a/Framework/Crystal/test/StatisticsOfPeaksWorkspaceTest.h b/Framework/Crystal/test/StatisticsOfPeaksWorkspaceTest.h
index 0499b1711c84e9da0b538df8e963d2a5121bda9c..ee57d99bb1738c40f9ab25d9c29d932e4665f7e7 100644
--- a/Framework/Crystal/test/StatisticsOfPeaksWorkspaceTest.h
+++ b/Framework/Crystal/test/StatisticsOfPeaksWorkspaceTest.h
@@ -10,8 +10,6 @@
 #include "MantidTestHelpers/ComponentCreationHelper.h"
 #include "MantidGeometry/Crystal/OrientedLattice.h"
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 #include <fstream>
 #include <Poco/File.h>
 
diff --git a/Framework/Crystal/test/TransformHKLTest.h b/Framework/Crystal/test/TransformHKLTest.h
index c958842c007a17729ecc54da3d52c7fee8337da6..05acb7732de32b10683693ac24dcfb77255638ee 100644
--- a/Framework/Crystal/test/TransformHKLTest.h
+++ b/Framework/Crystal/test/TransformHKLTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidCrystal/TransformHKL.h"
 #include "MantidCrystal/LoadIsawPeaks.h"
diff --git a/Framework/CurveFitting/CMakeLists.txt b/Framework/CurveFitting/CMakeLists.txt
index c7be58f1e72176eed23025ebda88c4a7e00aec8a..dfbff31c86c754d00670840aa2275393a8de0276 100644
--- a/Framework/CurveFitting/CMakeLists.txt
+++ b/Framework/CurveFitting/CMakeLists.txt
@@ -3,118 +3,119 @@ set ( SRC_FILES
 	#	src/SCDPanelErrors.cpp
 	# src/ChebyshevPolynomialBackground.cpp
 	#src/RefinePowderInstrumentParameters.cpp
-	src/Abragam.cpp
+	src/Algorithms/CalculateChiSquared.cpp
+	src/Algorithms/CalculateGammaBackground.cpp
+	src/Algorithms/CalculateMSVesuvio.cpp
+	src/Algorithms/ConvertToYSpace.cpp
+	src/Algorithms/ConvolveWorkspaces.cpp
+	src/Algorithms/EstimatePeakErrors.cpp
+	src/Algorithms/EvaluateFunction.cpp
+	src/Algorithms/Fit.cpp
+	src/Algorithms/Fit1D.cpp
+	src/Algorithms/FitPowderDiffPeaks.cpp
+	src/Algorithms/LeBailFit.cpp
+	src/Algorithms/LeBailFunction.cpp
+	src/Algorithms/NormaliseByPeakArea.cpp
+	src/Algorithms/PawleyFit.cpp
+	src/Algorithms/PlotPeakByLogValue.cpp
+	src/Algorithms/RefinePowderInstrumentParameters.cpp
+	src/Algorithms/RefinePowderInstrumentParameters3.cpp
+	src/Algorithms/SplineBackground.cpp
+	src/Algorithms/SplineInterpolation.cpp
+	src/Algorithms/SplineSmoothing.cpp
 	src/AugmentedLagrangianOptimizer.cpp
-	src/BFGS_Minimizer.cpp
-	src/BSpline.cpp
-	src/BackToBackExponential.cpp
-	src/BackgroundFunction.cpp
-	src/BivariateNormal.cpp
-	src/Bk2BkExpConvPV.cpp
-	src/BoundaryConstraint.cpp
-	src/CalculateChiSquared.cpp
-	src/CalculateGammaBackground.cpp
-	src/CalculateMSVesuvio.cpp
-	src/ChebfunBase.cpp
-	src/Chebyshev.cpp
-	src/ComptonPeakProfile.cpp
-	src/ComptonProfile.cpp
-	src/ComptonScatteringCountRate.cpp
-	src/ConvertToYSpace.cpp
-	src/Convolution.cpp
-	src/ConvolveWorkspaces.cpp
-	src/CostFuncFitting.cpp
-	src/CostFuncLeastSquares.cpp
-	src/CostFuncRwp.cpp
-	src/CostFuncUnweightedLeastSquares.cpp
-	src/CubicSpline.cpp
-	src/DampingMinimizer.cpp
-	src/DeltaFunction.cpp
-	src/DerivMinimizer.cpp
-	src/DiffRotDiscreteCircle.cpp
-	src/DiffSphere.cpp
-	src/DynamicKuboToyabe.cpp
-	src/EndErfc.cpp
-	src/EstimatePeakErrors.cpp
-	src/EvaluateFunction.cpp
-	src/ExpDecay.cpp
-	src/ExpDecayMuon.cpp
-	src/ExpDecayOsc.cpp
-	src/FABADAMinimizer.cpp
-	src/FRConjugateGradientMinimizer.cpp
-	src/Fit.cpp
-	src/Fit1D.cpp
+	src/Constraints/BoundaryConstraint.cpp
+	src/CostFunctions/CostFuncFitting.cpp
+	src/CostFunctions/CostFuncLeastSquares.cpp
+	src/CostFunctions/CostFuncRwp.cpp
+	src/CostFunctions/CostFuncUnweightedLeastSquares.cpp
 	src/FitMW.cpp
-	src/FitPowderDiffPeaks.cpp
-	src/FlatBackground.cpp
-	src/FullprofPolynomial.cpp
+	src/FuncMinimizers/BFGS_Minimizer.cpp
+	src/FuncMinimizers/DampingMinimizer.cpp
+	src/FuncMinimizers/DerivMinimizer.cpp
+	src/FuncMinimizers/FABADAMinimizer.cpp
+	src/FuncMinimizers/FRConjugateGradientMinimizer.cpp
+	src/FuncMinimizers/LevenbergMarquardtMDMinimizer.cpp
+	src/FuncMinimizers/LevenbergMarquardtMinimizer.cpp
+	src/FuncMinimizers/PRConjugateGradientMinimizer.cpp
+	src/FuncMinimizers/SimplexMinimizer.cpp
+	src/FuncMinimizers/SteepestDescentMinimizer.cpp
 	src/FunctionDomain1DSpectrumCreator.cpp
+	src/Functions/Abragam.cpp
+	src/Functions/BSpline.cpp
+	src/Functions/BackToBackExponential.cpp
+	src/Functions/BackgroundFunction.cpp
+	src/Functions/BivariateNormal.cpp
+	src/Functions/Bk2BkExpConvPV.cpp
+	src/Functions/ChebfunBase.cpp
+	src/Functions/Chebyshev.cpp
+	src/Functions/ComptonPeakProfile.cpp
+	src/Functions/ComptonProfile.cpp
+	src/Functions/ComptonScatteringCountRate.cpp
+	src/Functions/Convolution.cpp
+	src/Functions/CubicSpline.cpp
+	src/Functions/DeltaFunction.cpp
+	src/Functions/DiffRotDiscreteCircle.cpp
+	src/Functions/DiffSphere.cpp
+	src/Functions/DynamicKuboToyabe.cpp
+	src/Functions/EndErfc.cpp
+	src/Functions/ExpDecay.cpp
+	src/Functions/ExpDecayMuon.cpp
+	src/Functions/ExpDecayOsc.cpp
+	src/Functions/FlatBackground.cpp
+	src/Functions/FullprofPolynomial.cpp
+	src/Functions/GausDecay.cpp
+	src/Functions/GausOsc.cpp
+	src/Functions/Gaussian.cpp
+	src/Functions/GaussianComptonProfile.cpp
+	src/Functions/GramCharlierComptonProfile.cpp
+	src/Functions/IkedaCarpenterPV.cpp
+	src/Functions/LinearBackground.cpp
+	src/Functions/LogNormal.cpp
+	src/Functions/Lorentzian.cpp
+	src/Functions/Lorentzian1D.cpp
+	src/Functions/MuonFInteraction.cpp
+	src/Functions/NeutronBk2BkExpConvPVoigt.cpp
+	src/Functions/PawleyFunction.cpp
+	src/Functions/PeakParameterFunction.cpp
+	src/Functions/Polynomial.cpp
+	src/Functions/ProcessBackground.cpp
+	src/Functions/ProductFunction.cpp
+	src/Functions/ProductLinearExp.cpp
+	src/Functions/ProductQuadraticExp.cpp
+	src/Functions/PseudoVoigt.cpp
+	src/Functions/Quadratic.cpp
+	src/Functions/ReflectivityMulf.cpp
+	src/Functions/Resolution.cpp
+	src/Functions/SimpleChebfun.cpp
+	src/Functions/StaticKuboToyabe.cpp
+	src/Functions/StaticKuboToyabeTimesExpDecay.cpp
+	src/Functions/StaticKuboToyabeTimesGausDecay.cpp
+	src/Functions/StretchExp.cpp
+	src/Functions/StretchExpMuon.cpp
+	src/Functions/TabulatedFunction.cpp
+	src/Functions/ThermalNeutronBk2BkExpAlpha.cpp
+	src/Functions/ThermalNeutronBk2BkExpBeta.cpp
+	src/Functions/ThermalNeutronBk2BkExpConvPVoigt.cpp
+	src/Functions/ThermalNeutronBk2BkExpSigma.cpp
+	src/Functions/ThermalNeutronDtoTOFFunction.cpp
+	src/Functions/UserFunction.cpp
+	src/Functions/UserFunction1D.cpp
+	src/Functions/VesuvioResolution.cpp
+	src/Functions/Voigt.cpp
 	src/GSLFunctions.cpp
 	src/GSLMatrix.cpp
 	src/GSLVector.cpp
-	src/GausDecay.cpp
-	src/GausOsc.cpp
-	src/Gaussian.cpp
-	src/GaussianComptonProfile.cpp
-	src/GramCharlierComptonProfile.cpp
 	src/IFittingAlgorithm.cpp
-	src/IkedaCarpenterPV.cpp
 	src/LatticeDomainCreator.cpp
 	src/LatticeFunction.cpp
-	src/LeBailFit.cpp
-	src/LeBailFunction.cpp
-	src/LevenbergMarquardtMDMinimizer.cpp
-	src/LevenbergMarquardtMinimizer.cpp
-	src/LinearBackground.cpp
-	src/LogNormal.cpp
-	src/Lorentzian.cpp
-	src/Lorentzian1D.cpp
 	src/MSVesuvioHelpers.cpp
 	src/MultiDomainCreator.cpp
-	src/MuonFInteraction.cpp
-	src/NeutronBk2BkExpConvPVoigt.cpp
-	src/NormaliseByPeakArea.cpp
-	src/PRConjugateGradientMinimizer.cpp
 	src/ParDomain.cpp
 	src/ParameterEstimator.cpp
-	src/PawleyFit.cpp
-	src/PawleyFunction.cpp
-	src/PeakParameterFunction.cpp
-	src/PlotPeakByLogValue.cpp
-	src/Polynomial.cpp
-	src/ProcessBackground.cpp
-	src/ProductFunction.cpp
-	src/ProductLinearExp.cpp
-	src/ProductQuadraticExp.cpp
-	src/PseudoVoigt.cpp
-	src/Quadratic.cpp
-	src/RefinePowderInstrumentParameters3.cpp
-	src/ReflectivityMulf.cpp
-	src/Resolution.cpp
 	src/SeqDomain.cpp
 	src/SeqDomainSpectrumCreator.cpp
-	src/SimpleChebfun.cpp
-	src/SimplexMinimizer.cpp
 	src/SpecialFunctionHelper.cpp
-	src/SplineBackground.cpp
-	src/SplineInterpolation.cpp
-	src/SplineSmoothing.cpp
-	src/StaticKuboToyabe.cpp
-	src/StaticKuboToyabeTimesExpDecay.cpp
-	src/StaticKuboToyabeTimesGausDecay.cpp
-	src/SteepestDescentMinimizer.cpp
-	src/StretchExp.cpp
-	src/StretchExpMuon.cpp
-	src/TabulatedFunction.cpp
-	src/ThermalNeutronBk2BkExpAlpha.cpp
-	src/ThermalNeutronBk2BkExpBeta.cpp
-	src/ThermalNeutronBk2BkExpConvPVoigt.cpp
-	src/ThermalNeutronBk2BkExpSigma.cpp
-	src/ThermalNeutronDtoTOFFunction.cpp
-	src/UserFunction.cpp
-	src/UserFunction1D.cpp
-	src/VesuvioResolution.cpp
-	src/Voigt.cpp
 )
 
 set ( SRC_UNITY_IGNORE_FILES src/Fit1D.cpp src/GSLFunctions.cpp )
@@ -124,235 +125,237 @@ set ( INC_FILES
 	#	inc/MantidCurveFitting/SCDPanelErrors.h
 	# inc/MantidCurveFitting/ChebyshevPolynomialBackground.h
 	#inc/MantidCurveFitting/RefinePowderInstrumentParameters.h
-	inc/MantidCurveFitting/Abragam.h
+	inc/MantidCurveFitting/Algorithms/CalculateChiSquared.h
+	inc/MantidCurveFitting/Algorithms/CalculateGammaBackground.h
+	inc/MantidCurveFitting/Algorithms/CalculateMSVesuvio.h
+	inc/MantidCurveFitting/Algorithms/ConvertToYSpace.h
+	inc/MantidCurveFitting/Algorithms/ConvolveWorkspaces.h
+	inc/MantidCurveFitting/Algorithms/EstimatePeakErrors.h
+	inc/MantidCurveFitting/Algorithms/EvaluateFunction.h
+	inc/MantidCurveFitting/Algorithms/Fit.h
+	inc/MantidCurveFitting/Algorithms/Fit1D.h
+	inc/MantidCurveFitting/Algorithms/FitPowderDiffPeaks.h
+	inc/MantidCurveFitting/Algorithms/LeBailFit.h
+	inc/MantidCurveFitting/Algorithms/LeBailFunction.h
+	inc/MantidCurveFitting/Algorithms/NormaliseByPeakArea.h
+	inc/MantidCurveFitting/Algorithms/PawleyFit.h
+	inc/MantidCurveFitting/Algorithms/PlotPeakByLogValue.h
+	inc/MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters.h
+	inc/MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters3.h
+	inc/MantidCurveFitting/Algorithms/SplineBackground.h
+	inc/MantidCurveFitting/Algorithms/SplineInterpolation.h
+	inc/MantidCurveFitting/Algorithms/SplineSmoothing.h
 	inc/MantidCurveFitting/AugmentedLagrangianOptimizer.h
-	inc/MantidCurveFitting/BFGS_Minimizer.h
-	inc/MantidCurveFitting/BSpline.h
-	inc/MantidCurveFitting/BackToBackExponential.h
-	inc/MantidCurveFitting/BackgroundFunction.h
-	inc/MantidCurveFitting/BivariateNormal.h
-	inc/MantidCurveFitting/Bk2BkExpConvPV.h
-	inc/MantidCurveFitting/BoundaryConstraint.h
-	inc/MantidCurveFitting/CalculateChiSquared.h
-	inc/MantidCurveFitting/CalculateGammaBackground.h
-	inc/MantidCurveFitting/CalculateMSVesuvio.h
-	inc/MantidCurveFitting/ChebfunBase.h
-	inc/MantidCurveFitting/Chebyshev.h
-	inc/MantidCurveFitting/ComptonPeakProfile.h
-	inc/MantidCurveFitting/ComptonProfile.h
-	inc/MantidCurveFitting/ComptonScatteringCountRate.h
-	inc/MantidCurveFitting/ConvertToYSpace.h
-	inc/MantidCurveFitting/Convolution.h
-	inc/MantidCurveFitting/ConvolveWorkspaces.h
-	inc/MantidCurveFitting/CostFuncFitting.h
-	inc/MantidCurveFitting/CostFuncLeastSquares.h
-	inc/MantidCurveFitting/CostFuncRwp.h
-	inc/MantidCurveFitting/CostFuncUnweightedLeastSquares.h
-	inc/MantidCurveFitting/CubicSpline.h
-	inc/MantidCurveFitting/DampingMinimizer.h
-	inc/MantidCurveFitting/DeltaFunction.h
-	inc/MantidCurveFitting/DerivMinimizer.h
-	inc/MantidCurveFitting/DiffRotDiscreteCircle.h
-	inc/MantidCurveFitting/DiffSphere.h
+	inc/MantidCurveFitting/Constraints/BoundaryConstraint.h
+	inc/MantidCurveFitting/CostFunctions/CostFuncFitting.h
+	inc/MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h
+	inc/MantidCurveFitting/CostFunctions/CostFuncRwp.h
+	inc/MantidCurveFitting/CostFunctions/CostFuncUnweightedLeastSquares.h
 	inc/MantidCurveFitting/DllConfig.h
-	inc/MantidCurveFitting/DynamicKuboToyabe.h
-	inc/MantidCurveFitting/EndErfc.h
-	inc/MantidCurveFitting/EstimatePeakErrors.h
-	inc/MantidCurveFitting/EvaluateFunction.h
-	inc/MantidCurveFitting/ExpDecay.h
-	inc/MantidCurveFitting/ExpDecayMuon.h
-	inc/MantidCurveFitting/ExpDecayOsc.h
-	inc/MantidCurveFitting/FABADAMinimizer.h
-	inc/MantidCurveFitting/FRConjugateGradientMinimizer.h
-	inc/MantidCurveFitting/Fit.h
-	inc/MantidCurveFitting/Fit1D.h
 	inc/MantidCurveFitting/FitMW.h
-	inc/MantidCurveFitting/FitPowderDiffPeaks.h
-	inc/MantidCurveFitting/FlatBackground.h
-	inc/MantidCurveFitting/FullprofPolynomial.h
+	inc/MantidCurveFitting/FuncMinimizers/BFGS_Minimizer.h
+	inc/MantidCurveFitting/FuncMinimizers/DampingMinimizer.h
+	inc/MantidCurveFitting/FuncMinimizers/DerivMinimizer.h
+	inc/MantidCurveFitting/FuncMinimizers/FABADAMinimizer.h
+	inc/MantidCurveFitting/FuncMinimizers/FRConjugateGradientMinimizer.h
+	inc/MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMDMinimizer.h
+	inc/MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMinimizer.h
+	inc/MantidCurveFitting/FuncMinimizers/PRConjugateGradientMinimizer.h
+	inc/MantidCurveFitting/FuncMinimizers/SimplexMinimizer.h
+	inc/MantidCurveFitting/FuncMinimizers/SteepestDescentMinimizer.h
 	inc/MantidCurveFitting/FunctionDomain1DSpectrumCreator.h
+	inc/MantidCurveFitting/Functions/Abragam.h
+	inc/MantidCurveFitting/Functions/BSpline.h
+	inc/MantidCurveFitting/Functions/BackToBackExponential.h
+	inc/MantidCurveFitting/Functions/BackgroundFunction.h
+	inc/MantidCurveFitting/Functions/BivariateNormal.h
+	inc/MantidCurveFitting/Functions/Bk2BkExpConvPV.h
+	inc/MantidCurveFitting/Functions/ChebfunBase.h
+	inc/MantidCurveFitting/Functions/Chebyshev.h
+	inc/MantidCurveFitting/Functions/ComptonPeakProfile.h
+	inc/MantidCurveFitting/Functions/ComptonProfile.h
+	inc/MantidCurveFitting/Functions/ComptonScatteringCountRate.h
+	inc/MantidCurveFitting/Functions/Convolution.h
+	inc/MantidCurveFitting/Functions/CubicSpline.h
+	inc/MantidCurveFitting/Functions/DeltaFunction.h
+	inc/MantidCurveFitting/Functions/DiffRotDiscreteCircle.h
+	inc/MantidCurveFitting/Functions/DiffSphere.h
+	inc/MantidCurveFitting/Functions/DynamicKuboToyabe.h
+	inc/MantidCurveFitting/Functions/EndErfc.h
+	inc/MantidCurveFitting/Functions/ExpDecay.h
+	inc/MantidCurveFitting/Functions/ExpDecayMuon.h
+	inc/MantidCurveFitting/Functions/ExpDecayOsc.h
+	inc/MantidCurveFitting/Functions/FlatBackground.h
+	inc/MantidCurveFitting/Functions/FullprofPolynomial.h
+	inc/MantidCurveFitting/Functions/GausDecay.h
+	inc/MantidCurveFitting/Functions/GausOsc.h
+	inc/MantidCurveFitting/Functions/Gaussian.h
+	inc/MantidCurveFitting/Functions/GaussianComptonProfile.h
+	inc/MantidCurveFitting/Functions/GramCharlierComptonProfile.h
+	inc/MantidCurveFitting/Functions/IkedaCarpenterPV.h
+	inc/MantidCurveFitting/Functions/LinearBackground.h
+	inc/MantidCurveFitting/Functions/LogNormal.h
+	inc/MantidCurveFitting/Functions/Lorentzian.h
+	inc/MantidCurveFitting/Functions/Lorentzian1D.h
+	inc/MantidCurveFitting/Functions/MuonFInteraction.h
+	inc/MantidCurveFitting/Functions/NeutronBk2BkExpConvPVoigt.h
+	inc/MantidCurveFitting/Functions/PawleyFunction.h
+	inc/MantidCurveFitting/Functions/PeakParameterFunction.h
+	inc/MantidCurveFitting/Functions/Polynomial.h
+	inc/MantidCurveFitting/Functions/ProcessBackground.h
+	inc/MantidCurveFitting/Functions/ProductFunction.h
+	inc/MantidCurveFitting/Functions/ProductLinearExp.h
+	inc/MantidCurveFitting/Functions/ProductQuadraticExp.h
+	inc/MantidCurveFitting/Functions/PseudoVoigt.h
+	inc/MantidCurveFitting/Functions/Quadratic.h
+	inc/MantidCurveFitting/Functions/ReflectivityMulf.h
+	inc/MantidCurveFitting/Functions/Resolution.h
+	inc/MantidCurveFitting/Functions/SimpleChebfun.h
+	inc/MantidCurveFitting/Functions/StaticKuboToyabe.h
+	inc/MantidCurveFitting/Functions/StaticKuboToyabeTimesExpDecay.h
+	inc/MantidCurveFitting/Functions/StaticKuboToyabeTimesGausDecay.h
+	inc/MantidCurveFitting/Functions/StretchExp.h
+	inc/MantidCurveFitting/Functions/StretchExpMuon.h
+	inc/MantidCurveFitting/Functions/TabulatedFunction.h
+	inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpAlpha.h
+	inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpBeta.h
+	inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpConvPVoigt.h
+	inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpSigma.h
+	inc/MantidCurveFitting/Functions/ThermalNeutronDtoTOFFunction.h
+	inc/MantidCurveFitting/Functions/UserFunction.h
+	inc/MantidCurveFitting/Functions/UserFunction1D.h
+	inc/MantidCurveFitting/Functions/VesuvioResolution.h
+	inc/MantidCurveFitting/Functions/Voigt.h
 	inc/MantidCurveFitting/GSLFunctions.h
 	inc/MantidCurveFitting/GSLJacobian.h
 	inc/MantidCurveFitting/GSLMatrix.h
 	inc/MantidCurveFitting/GSLVector.h
-	inc/MantidCurveFitting/GausDecay.h
-	inc/MantidCurveFitting/GausOsc.h
-	inc/MantidCurveFitting/Gaussian.h
-	inc/MantidCurveFitting/GaussianComptonProfile.h
-	inc/MantidCurveFitting/GramCharlierComptonProfile.h
 	inc/MantidCurveFitting/HalfComplex.h
 	inc/MantidCurveFitting/IFittingAlgorithm.h
-	inc/MantidCurveFitting/IkedaCarpenterPV.h
 	inc/MantidCurveFitting/Jacobian.h
 	inc/MantidCurveFitting/LatticeDomainCreator.h
 	inc/MantidCurveFitting/LatticeFunction.h
-	inc/MantidCurveFitting/LeBailFit.h
-	inc/MantidCurveFitting/LeBailFunction.h
-	inc/MantidCurveFitting/LevenbergMarquardtMDMinimizer.h
-	inc/MantidCurveFitting/LevenbergMarquardtMinimizer.h
-	inc/MantidCurveFitting/LinearBackground.h
-	inc/MantidCurveFitting/LogNormal.h
-	inc/MantidCurveFitting/Lorentzian.h
-	inc/MantidCurveFitting/Lorentzian1D.h
 	inc/MantidCurveFitting/MSVesuvioHelpers.h
 	inc/MantidCurveFitting/MultiDomainCreator.h
-	inc/MantidCurveFitting/MuonFInteraction.h
-	inc/MantidCurveFitting/NeutronBk2BkExpConvPVoigt.h
-	inc/MantidCurveFitting/NormaliseByPeakArea.h
-	inc/MantidCurveFitting/PRConjugateGradientMinimizer.h
 	inc/MantidCurveFitting/ParDomain.h
 	inc/MantidCurveFitting/ParameterEstimator.h
-	inc/MantidCurveFitting/PawleyFit.h
-	inc/MantidCurveFitting/PawleyFunction.h
-	inc/MantidCurveFitting/PeakParameterFunction.h
-	inc/MantidCurveFitting/PlotPeakByLogValue.h
-	inc/MantidCurveFitting/Polynomial.h
-	inc/MantidCurveFitting/ProcessBackground.h
-	inc/MantidCurveFitting/ProductFunction.h
-	inc/MantidCurveFitting/ProductLinearExp.h
-	inc/MantidCurveFitting/ProductQuadraticExp.h
-	inc/MantidCurveFitting/PseudoVoigt.h
-	inc/MantidCurveFitting/Quadratic.h
-	inc/MantidCurveFitting/RefinePowderInstrumentParameters3.h
-	inc/MantidCurveFitting/ReflectivityMulf.h
-	inc/MantidCurveFitting/Resolution.h
 	inc/MantidCurveFitting/SeqDomain.h
 	inc/MantidCurveFitting/SeqDomainSpectrumCreator.h
-	inc/MantidCurveFitting/SimpleChebfun.h
-	inc/MantidCurveFitting/SimplexMinimizer.h
 	inc/MantidCurveFitting/SpecialFunctionSupport.h
-	inc/MantidCurveFitting/SplineBackground.h
-	inc/MantidCurveFitting/SplineInterpolation.h
-	inc/MantidCurveFitting/SplineSmoothing.h
-	inc/MantidCurveFitting/StaticKuboToyabe.h
-	inc/MantidCurveFitting/StaticKuboToyabeTimesExpDecay.h
-	inc/MantidCurveFitting/StaticKuboToyabeTimesGausDecay.h
-	inc/MantidCurveFitting/SteepestDescentMinimizer.h
-	inc/MantidCurveFitting/StretchExp.h
-	inc/MantidCurveFitting/StretchExpMuon.h
-	inc/MantidCurveFitting/TabulatedFunction.h
-	inc/MantidCurveFitting/ThermalNeutronBk2BkExpAlpha.h
-	inc/MantidCurveFitting/ThermalNeutronBk2BkExpBeta.h
-	inc/MantidCurveFitting/ThermalNeutronBk2BkExpConvPVoigt.h
-	inc/MantidCurveFitting/ThermalNeutronBk2BkExpSigma.h
-	inc/MantidCurveFitting/ThermalNeutronDtoTOFFunction.h
-	inc/MantidCurveFitting/UserFunction.h
-	inc/MantidCurveFitting/UserFunction1D.h
-	inc/MantidCurveFitting/VesuvioResolution.h
-	inc/MantidCurveFitting/Voigt.h
 )
 
 set ( TEST_FILES
 	# ChebyshevPolynomialBackgroundTest.h
 	# RefinePowderInstrumentParametersTest.h
 	#SCDPanelErrorsTest.h
-	AbragamTest.h
+	Algorithms/CalculateChiSquaredTest.h
+	Algorithms/CalculateGammaBackgroundTest.h
+	Algorithms/CalculateMSVesuvioTest.h
+	Algorithms/ConvertToYSpaceTest.h
+	Algorithms/ConvolveWorkspacesTest.h
+	Algorithms/EstimatePeakErrorsTest.h
+	Algorithms/EvaluateFunctionTest.h
+	Algorithms/FitPowderDiffPeaksTest.h
+	Algorithms/FitTest.h
+	Algorithms/LeBailFitTest.h
+	Algorithms/LeBailFunctionTest.h
+	Algorithms/NormaliseByPeakAreaTest.h
+	Algorithms/PawleyFitTest.h
+	Algorithms/PlotPeakByLogValueTest.h
+	Algorithms/RefinePowderInstrumentParameters3Test.h
+	Algorithms/RefinePowderInstrumentParametersTest.h
+	Algorithms/SeqDomainSpectrumCreatorTest.h
+	Algorithms/SplineBackgroundTest.h
+	Algorithms/SplineInterpolationTest.h
+	Algorithms/SplineSmoothingTest.h
 	AugmentedLagrangianOptimizerTest.h
-	BFGSTest.h
-	BSplineTest.h
-	BackToBackExponentialTest.h
-	BivariateNormalTest.h
-	Bk2BkExpConvPVTest.h
-	BoundaryConstraintTest.h
-	CalculateChiSquaredTest.h
-	CalculateGammaBackgroundTest.h
-	CalculateMSVesuvioTest.h
-	ChebfunBaseTest.h
-	ChebyshevTest.h
 	CompositeFunctionTest.h
-	ComptonPeakProfileTest.h
-	ComptonProfileTest.h
-	ComptonScatteringCountRateTest.h
-	ConvertToYSpaceTest.h
-	ConvolutionTest.h
-	ConvolveWorkspacesTest.h
-	CostFuncUnweightedLeastSquaresTest.h
-	CubicSplineTest.h
-	DampingMinimizerTest.h
-	DeltaFunctionTest.h
-	DiffRotDiscreteCircleTest.h
-	DiffSphereTest.h
-	DynamicKuboToyabeTest.h
-	EndErfcTest.h
-	EstimatePeakErrorsTest.h
-	EvaluateFunctionTest.h
-	ExpDecayMuonTest.h
-	ExpDecayOscTest.h
-	ExpDecayTest.h
-	FABADAMinimizerTest.h
-	FRConjugateGradientTest.h
+	Constraints/BoundaryConstraintTest.h
+	CostFunctions/CostFuncUnweightedLeastSquaresTest.h
+	CostFunctions/LeastSquaresTest.h
 	FitMWTest.h
-	FitPowderDiffPeaksTest.h
-	FitTest.h
-	FlatBackgroundTest.h
-	FullprofPolynomialTest.h
+	FuncMinimizers/BFGSTest.h
+	FuncMinimizers/DampingMinimizerTest.h
+	FuncMinimizers/FABADAMinimizerTest.h
+	FuncMinimizers/FRConjugateGradientTest.h
+	FuncMinimizers/LevenbergMarquardtMDTest.h
+	FuncMinimizers/LevenbergMarquardtTest.h
+	FuncMinimizers/PRConjugateGradientTest.h
+	FuncMinimizers/SimplexTest.h
 	FunctionDomain1DSpectrumCreatorTest.h
 	FunctionFactoryConstraintTest.h
 	FunctionParameterDecoratorFitTest.h
+	Functions/AbragamTest.h
+	Functions/BSplineTest.h
+	Functions/BackToBackExponentialTest.h
+	Functions/BivariateNormalTest.h
+	Functions/Bk2BkExpConvPVTest.h
+	Functions/ChebfunBaseTest.h
+	Functions/ChebyshevTest.h
+	Functions/ComptonPeakProfileTest.h
+	Functions/ComptonProfileTest.h
+	Functions/ComptonScatteringCountRateTest.h
+	Functions/ConvolutionTest.h
+	Functions/CubicSplineTest.h
+	Functions/DeltaFunctionTest.h
+	Functions/DiffRotDiscreteCircleTest.h
+	Functions/DiffSphereTest.h
+	Functions/DynamicKuboToyabeTest.h
+	Functions/EndErfcTest.h
+	Functions/ExpDecayMuonTest.h
+	Functions/ExpDecayOscTest.h
+	Functions/ExpDecayTest.h
+	Functions/FlatBackgroundTest.h
+	Functions/FullprofPolynomialTest.h
+	Functions/GausDecayTest.h
+	Functions/GausOscTest.h
+	Functions/GaussianComptonProfileTest.h
+	Functions/GaussianTest.h
+	Functions/GramCharlierComptonProfileTest.h
+	Functions/IkedaCarpenterPVTest.h
+	Functions/LinearBackgroundTest.h
+	Functions/LogNormalTest.h
+	Functions/Lorentzian1DTest.h
+	Functions/LorentzianTest.h
+	Functions/MuonFInteractionTest.h
+	Functions/NeutronBk2BkExpConvPVoigtTest.h
+	Functions/PawleyFunctionTest.h
+	Functions/PeakParameterFunctionTest.h
+	Functions/PolynomialTest.h
+	Functions/ProcessBackgroundTest.h
+	Functions/ProductFunctionTest.h
+	Functions/ProductLinearExpTest.h
+	Functions/ProductQuadraticExpTest.h
+	Functions/PseudoVoigtTest.h
+	Functions/QuadraticTest.h
+	Functions/ReflectivityMulfTest.h
+	Functions/ResolutionTest.h
+	Functions/SimpleChebfunTest.h
+	Functions/StaticKuboToyabeTest.h
+	Functions/StaticKuboToyabeTimesExpDecayTest.h
+	Functions/StaticKuboToyabeTimesGausDecayTest.h
+	Functions/StretchExpMuonTest.h
+	Functions/StretchExpTest.h
+	Functions/TabulatedFunctionTest.h
+	Functions/ThermalNeutronBk2BkExpAlphaTest.h
+	Functions/ThermalNeutronBk2BkExpBetaTest.h
+	Functions/ThermalNeutronBk2BkExpConvPVoigtTest.h
+	Functions/ThermalNeutronBk2BkExpSigmaTest.h
+	Functions/ThermalNeutronDtoTOFFunctionTest.h
+	Functions/UserFunction1DTest.h
+	Functions/UserFunctionTest.h
+	Functions/VesuvioResolutionTest.h
+	Functions/VoigtTest.h
 	GSLMatrixTest.h
 	GSLVectorTest.h
-	GausDecayTest.h
-	GausOscTest.h
-	GaussianComptonProfileTest.h
-	GaussianTest.h
-	GramCharlierComptonProfileTest.h
 	IPeakFunctionCentreParameterNameTest.h
 	IPeakFunctionIntensityTest.h
-	IkedaCarpenterPVTest.h
 	LatticeDomainCreatorTest.h
 	LatticeFunctionTest.h
-	LeBailFitTest.h
-	LeBailFunctionTest.h
-	LeastSquaresTest.h
-	LevenbergMarquardtMDTest.h
-	LevenbergMarquardtTest.h
-	LinearBackgroundTest.h
-	LogNormalTest.h
-	Lorentzian1DTest.h
-	LorentzianTest.h
 	MultiDomainCreatorTest.h
 	MultiDomainFunctionTest.h
-	MuonFInteractionTest.h
-	NeutronBk2BkExpConvPVoigtTest.h
-	NormaliseByPeakAreaTest.h
-	PRConjugateGradientTest.h
 	ParameterEstimatorTest.h
-	PawleyFitTest.h
-	PawleyFunctionTest.h
-	PeakParameterFunctionTest.h
-	PlotPeakByLogValueTest.h
-	PolynomialTest.h
-	ProcessBackgroundTest.h
-	ProductFunctionTest.h
-	ProductLinearExpTest.h
-	ProductQuadraticExpTest.h
-	PseudoVoigtTest.h
-	QuadraticTest.h
-	RefinePowderInstrumentParameters3Test.h
-	ReflectivityMulfTest.h
-	ResolutionTest.h
-	SeqDomainSpectrumCreatorTest.h
-	SimpleChebfunTest.h
-	SimplexTest.h
 	SpecialFunctionSupportTest.h
-	SplineBackgroundTest.h
-	SplineInterpolationTest.h
-	SplineSmoothingTest.h
-	StaticKuboToyabeTest.h
-	StaticKuboToyabeTimesExpDecayTest.h
-	StaticKuboToyabeTimesGausDecayTest.h
-	StretchExpMuonTest.h
-	StretchExpTest.h
-	TabulatedFunctionTest.h
-	ThermalNeutronBk2BkExpAlphaTest.h
-	ThermalNeutronBk2BkExpBetaTest.h
-	ThermalNeutronBk2BkExpConvPVoigtTest.h
-	ThermalNeutronBk2BkExpSigmaTest.h
-	ThermalNeutronDtoTOFFunctionTest.h
-	UserFunction1DTest.h
-	UserFunctionTest.h
-	VesuvioResolutionTest.h
-	VoigtTest.h
 )
 
 if (COVERALLS)
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/CalculateChiSquared.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/CalculateChiSquared.h
similarity index 97%
rename from Framework/CurveFitting/inc/MantidCurveFitting/CalculateChiSquared.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/CalculateChiSquared.h
index 34d50d67839be92218d2d149aad8272f7c9ce575..867ec832b324d9ad2353e516c3235fc791d48ed4 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/CalculateChiSquared.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/CalculateChiSquared.h
@@ -6,6 +6,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Algorithms {
 
 /**
 
@@ -51,6 +52,7 @@ private:
   std::vector<size_t> m_fixedParameters;
 };
 
+} // namespace Algorithms
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/CalculateGammaBackground.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/CalculateGammaBackground.h
similarity index 87%
rename from Framework/CurveFitting/inc/MantidCurveFitting/CalculateGammaBackground.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/CalculateGammaBackground.h
index 4cf7ebc54a20af54e0396148ebdf74ccbca95d21..ac575bb8035a120fd8e0e3cc51739cd693b26f2d 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/CalculateGammaBackground.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/CalculateGammaBackground.h
@@ -7,11 +7,14 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+struct ResolutionParams;
+}
+namespace Algorithms {
 //---------------------------------------------------------------------------
 // Forward declarations
 //---------------------------------------------------------------------------
 struct DetectorParams;
-struct ResolutionParams;
 
 /**
 
@@ -75,17 +78,17 @@ private:
   void calculateBackgroundFromFoils(const size_t inputIndex,
                                     const size_t outputIndex);
   /// Compute expected background from single foil for spectrum at wsIndex
-  void calculateBackgroundSingleFoil(std::vector<double> &ctfoil,
-                                     const size_t wsIndex,
-                                     const FoilInfo &foilInfo,
-                                     const Kernel::V3D &detPos,
-                                     const DetectorParams &detPar,
-                                     const ResolutionParams &detRes);
+  void calculateBackgroundSingleFoil(
+      std::vector<double> &ctfoil, const size_t wsIndex,
+      const FoilInfo &foilInfo, const Kernel::V3D &detPos,
+      const DetectorParams &detPar,
+      const CurveFitting::Functions::ResolutionParams &detRes);
   /// Compute a TOF spectrum for the given inputs & spectrum
-  void calculateTofSpectrum(std::vector<double> &result,
-                            std::vector<double> &tmpWork, const size_t wsIndex,
-                            const DetectorParams &detpar,
-                            const ResolutionParams &respar);
+  void
+  calculateTofSpectrum(std::vector<double> &result,
+                       std::vector<double> &tmpWork, const size_t wsIndex,
+                       const DetectorParams &detpar,
+                       const CurveFitting::Functions::ResolutionParams &respar);
 
   /// Check and store appropriate input data
   void retrieveInputs();
@@ -133,6 +136,7 @@ private:
   API::Progress *m_progress;
 };
 
+} // namespace Algorithms
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/CalculateMSVesuvio.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/CalculateMSVesuvio.h
similarity index 93%
rename from Framework/CurveFitting/inc/MantidCurveFitting/CalculateMSVesuvio.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/CalculateMSVesuvio.h
index 71b9767435f032f9d4564ec8ef53d4dd5ee160a6..96d84d452dadbbff40e58b32c09184768055420b 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/CalculateMSVesuvio.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/CalculateMSVesuvio.h
@@ -9,16 +9,16 @@
 
 namespace Mantid {
 namespace CurveFitting {
-//-----------------------------------------------------------------------------
-// CurveFitting forward declarations
-//-----------------------------------------------------------------------------
-struct DetectorParams;
-struct ResolutionParams;
 namespace MSVesuvioHelper {
 class RandomNumberGenerator;
 struct Simulation;
 struct SimulationWithErrors;
 }
+namespace Functions {
+struct ResolutionParams;
+}
+namespace Algorithms {
+struct DetectorParams;
 
 /**
   Calculates the multiple scattering & total scattering contributions
@@ -88,12 +88,13 @@ private:
   void cacheInputs();
   void calculateMS(const size_t wsIndex, API::ISpectrum &totalsc,
                    API::ISpectrum &multsc) const;
-  void simulate(const DetectorParams &detpar, const ResolutionParams &respar,
+  void simulate(const DetectorParams &detpar,
+                const Functions::ResolutionParams &respar,
                 MSVesuvioHelper::Simulation &simulCounts) const;
   void assignToOutput(const MSVesuvioHelper::SimulationWithErrors &avgCounts,
                       API::ISpectrum &totalsc, API::ISpectrum &multsc) const;
   double calculateCounts(const DetectorParams &detpar,
-                         const ResolutionParams &respar,
+                         const Functions::ResolutionParams &respar,
                          MSVesuvioHelper::Simulation &simulation) const;
 
   // single-event helpers
@@ -116,7 +117,8 @@ private:
                     const double e1res) const;
 
   // Member Variables
-  MSVesuvioHelper::RandomNumberGenerator *m_randgen; // random number generator
+  CurveFitting::MSVesuvioHelper::RandomNumberGenerator *
+      m_randgen; // random number generator
 
   size_t m_acrossIdx, m_upIdx, m_beamIdx; // indices of each direction
   Kernel::V3D m_beamDir;                  // Directional vector for beam
@@ -136,6 +138,7 @@ private:
   API::MatrixWorkspace_sptr m_inputWS;
 };
 
+} // namespace Algorithms
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ConvertToYSpace.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/ConvertToYSpace.h
similarity index 98%
rename from Framework/CurveFitting/inc/MantidCurveFitting/ConvertToYSpace.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/ConvertToYSpace.h
index c548e60ad362f48487a0dfdb134dc85c73cfccdd..6ed4648408a367518609fab46670ec8d4c4dbe18 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/ConvertToYSpace.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/ConvertToYSpace.h
@@ -5,6 +5,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Algorithms {
 
 /// Simple data structure to store nominal detector values
 /// It avoids some functions taking a huge number of arguments
@@ -101,6 +102,7 @@ private:
   API::MatrixWorkspace_sptr m_qOutputWS;
 };
 
+} // namespace Algorithms
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ConvolveWorkspaces.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/ConvolveWorkspaces.h
similarity index 95%
rename from Framework/CurveFitting/inc/MantidCurveFitting/ConvolveWorkspaces.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/ConvolveWorkspaces.h
index 30ad9f3f040bf284b2274e08dbd3753b665eff41..19fa08127b0e1a54c8fdd6a0a6594e1faba251ec 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/ConvolveWorkspaces.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/ConvolveWorkspaces.h
@@ -9,12 +9,13 @@
 #include "MantidAPI/MatrixWorkspace_fwd.h"
 #include "MantidDataObjects/EventWorkspace.h"
 #include "MantidDataObjects/Workspace2D.h"
-#include "MantidCurveFitting/CubicSpline.h"
+#include "MantidCurveFitting/Functions/CubicSpline.h"
 #include "MantidAPI/ParamFunction.h"
 #include "MantidAPI/IFunction1D.h"
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Algorithms {
 /** Convolution of two workspaces
 
     Copyright &copy; 2012 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge
@@ -65,6 +66,7 @@ private:
   API::Progress *prog;
 };
 
+} // namespace Algorithms
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/EstimatePeakErrors.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/EstimatePeakErrors.h
similarity index 96%
rename from Framework/CurveFitting/inc/MantidCurveFitting/EstimatePeakErrors.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/EstimatePeakErrors.h
index fa886873c50b189aa5aab1cb5bc594f5b5a98c5b..c16a6b037959f973eed6c93204d73d11ed92ac45 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/EstimatePeakErrors.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/EstimatePeakErrors.h
@@ -5,6 +5,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Algorithms {
 //---------------------------------------------------------------------------
 /**
 
@@ -44,6 +45,7 @@ private:
   void exec();
 };
 
+} // namespace Algorithms
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/EvaluateFunction.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/EvaluateFunction.h
similarity index 97%
rename from Framework/CurveFitting/inc/MantidCurveFitting/EvaluateFunction.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/EvaluateFunction.h
index 48bfd7abe57983d68d45b5c817c6361fb06313fa..55be4b63901ced996a404c85b2980f8702f52d29 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/EvaluateFunction.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/EvaluateFunction.h
@@ -6,6 +6,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Algorithms {
 
 /**
 
@@ -44,6 +45,7 @@ private:
   void execConcrete();
 };
 
+} // namespace Algorithms
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Fit.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/Fit.h
similarity index 98%
rename from Framework/CurveFitting/inc/MantidCurveFitting/Fit.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/Fit.h
index baaf264d06d012cfa0efda8169d7ae9181d28c68..20c76810d8a5affe143d42be189d9fd0b77ca9d6 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/Fit.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/Fit.h
@@ -20,6 +20,7 @@ class IFuncMinimizer;
 }
 
 namespace CurveFitting {
+namespace Algorithms {
 /**
 
 A generic fitting algorithm. It fits a function to some data in a workspace.
@@ -114,6 +115,7 @@ protected:
   void copyMinimizerOutput(const API::IFuncMinimizer &minimizer);
 };
 
+} // namespace Algorithms
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Fit1D.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/Fit1D.h
similarity index 99%
rename from Framework/CurveFitting/inc/MantidCurveFitting/Fit1D.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/Fit1D.h
index 132ce49ede9e9ea965ca0537a32b2925355d4b0c..9cfc546a20c3023fc0d609560b8d3eece550cf72 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/Fit1D.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/Fit1D.h
@@ -10,6 +10,7 @@
 namespace Mantid {
 
 namespace CurveFitting {
+namespace Algorithms {
 /**
 Deprecation notice: instead of using this algorithm please use the Fit algorithm
 instead.
@@ -140,6 +141,7 @@ protected:
   friend struct FitData;
 };
 
+} // namespace Algorithms
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/FitPowderDiffPeaks.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/FitPowderDiffPeaks.h
similarity index 77%
rename from Framework/CurveFitting/inc/MantidCurveFitting/FitPowderDiffPeaks.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/FitPowderDiffPeaks.h
index 1fe1d2551ebe75f32516f0077b138a6c153f8fc3..5436f304f29d3fd7a7076d4dcfca9dab48dd0b03 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/FitPowderDiffPeaks.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/FitPowderDiffPeaks.h
@@ -8,13 +8,14 @@
 #include "MantidAPI/ITableWorkspace_fwd.h"
 #include "MantidDataObjects/TableWorkspace.h"
 #include "MantidDataObjects/Workspace2D.h"
-#include "MantidCurveFitting/BackgroundFunction.h"
-#include "MantidCurveFitting/Polynomial.h"
-#include "MantidCurveFitting/BackToBackExponential.h"
+#include "MantidCurveFitting/Functions/BackgroundFunction.h"
+#include "MantidCurveFitting/Functions/Polynomial.h"
+#include "MantidCurveFitting/Functions/BackToBackExponential.h"
 #include "MantidGeometry/Crystal/UnitCell.h"
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Algorithms {
 
 /** FitPowderDiffPeaks : Fit peaks in powder diffraction pattern.
 
@@ -88,7 +89,7 @@ private:
   void genPeaksFromTable(DataObjects::TableWorkspace_sptr peakparamws);
 
   /// Generate a peak
-  BackToBackExponential_sptr
+  Functions::BackToBackExponential_sptr
   genPeak(std::map<std::string, int> hklmap,
           std::map<std::string, double> parammap,
           std::map<std::string, std::string> bk2bk2braggmap, bool &good,
@@ -114,62 +115,66 @@ private:
   void fitPeaksRobust();
 
   /// Fit a single peak
-  bool fitPeak(BackToBackExponential_sptr peak,
-               BackgroundFunction_sptr background, double leftdev,
+  bool fitPeak(Functions::BackToBackExponential_sptr peak,
+               Functions::BackgroundFunction_sptr background, double leftdev,
                double rightdev, size_t m_wsIndex, double &chi2);
 
   //---------------------------------------------------------------------------
 
   /// Fit single peak in robust mode (no hint)
-  bool fitSinglePeakRobust(BackToBackExponential_sptr peak,
-                           BackgroundFunction_sptr background, double leftdev,
-                           double rightdev,
-                           std::map<std::string, double> rightpeakparammap,
-                           double &finalchi2);
+  bool
+  fitSinglePeakRobust(Functions::BackToBackExponential_sptr peak,
+                      Functions::BackgroundFunction_sptr backgroundfunction,
+                      double leftdev, double rightdev,
+                      std::map<std::string, double> rightpeakparammap,
+                      double &finalchi2);
 
   /// Fit signle peak by Monte Carlo/simulated annealing
-  bool fitSinglePeakSimulatedAnnealing(BackToBackExponential_sptr peak,
-                                       std::vector<std::string> paramtodomc);
+  bool
+  fitSinglePeakSimulatedAnnealing(Functions::BackToBackExponential_sptr peak,
+                                  std::vector<std::string> paramtodomc);
 
   /// Fit peak with confidence of the centre
-  bool fitSinglePeakConfidentX(BackToBackExponential_sptr peak);
+  bool fitSinglePeakConfidentX(Functions::BackToBackExponential_sptr peak);
 
   /// Fit peak with trustful peak parameters
-  bool fitSinglePeakConfident(BackToBackExponential_sptr peak,
-                              BackgroundFunction_sptr backgroundfunction,
-                              double leftbound, double rightbound, double &chi2,
-                              bool &annhilatedpeak);
+  bool
+  fitSinglePeakConfident(Functions::BackToBackExponential_sptr peak,
+                         Functions::BackgroundFunction_sptr backgroundfunction,
+                         double leftbound, double rightbound, double &chi2,
+                         bool &annhilatedpeak);
 
   /// Fit peak with confident parameters
   bool fitSinglePeakConfidentY(DataObjects::Workspace2D_sptr dataws,
-                               BackToBackExponential_sptr peak,
+                               Functions::BackToBackExponential_sptr peak,
                                double dampingfactor);
 
   /// Fit peaks with confidence in fwhm and etc.
-  bool fitOverlappedPeaks(std::vector<BackToBackExponential_sptr> peaks,
-                          BackgroundFunction_sptr backgroundfunction,
-                          double gfwhm);
+  bool
+  fitOverlappedPeaks(std::vector<Functions::BackToBackExponential_sptr> peaks,
+                     Functions::BackgroundFunction_sptr backgroundfunction,
+                     double gfwhm);
 
   /// Fit multiple (overlapped) peaks
-  bool doFitMultiplePeaks(DataObjects::Workspace2D_sptr dataws, size_t wsindex,
-                          API::CompositeFunction_sptr peaksfunc,
-                          std::vector<BackToBackExponential_sptr> peakfuncs,
-                          std::vector<bool> &vecfitgood,
-                          std::vector<double> &vecchi2s);
+  bool doFitMultiplePeaks(
+      DataObjects::Workspace2D_sptr dataws, size_t wsindex,
+      API::CompositeFunction_sptr peaksfunc,
+      std::vector<Functions::BackToBackExponential_sptr> peakfuncs,
+      std::vector<bool> &vecfitgood, std::vector<double> &vecchi2s);
 
   /// Use Le Bail method to estimate and set the peak heights
-  void estimatePeakHeightsLeBail(DataObjects::Workspace2D_sptr dataws,
-                                 size_t wsindex,
-                                 std::vector<BackToBackExponential_sptr> peaks);
+  void estimatePeakHeightsLeBail(
+      DataObjects::Workspace2D_sptr dataws, size_t wsindex,
+      std::vector<Functions::BackToBackExponential_sptr> peaks);
 
   /// Set constraints on a group of overlapped peaks for fitting
-  void
-  setOverlappedPeaksConstraints(std::vector<BackToBackExponential_sptr> peaks);
+  void setOverlappedPeaksConstraints(
+      std::vector<Functions::BackToBackExponential_sptr> peaks);
 
   /// Fit 1 peak by 1 minimizer of 1 call of minimzer (simple version)
   bool doFit1PeakSimple(DataObjects::Workspace2D_sptr dataws,
                         size_t workspaceindex,
-                        BackToBackExponential_sptr peakfunction,
+                        Functions::BackToBackExponential_sptr peakfunction,
                         std::string minimzername, size_t maxiteration,
                         double &chi2);
 
@@ -181,25 +186,26 @@ private:
   // string minimzername, size_t maxiteration, double &chi2);
 
   /// Fit single peak with background to raw data
-  bool doFit1PeakBackground(DataObjects::Workspace2D_sptr dataws,
-                            size_t wsindex, BackToBackExponential_sptr peak,
-                            BackgroundFunction_sptr backgroundfunction,
-                            double &chi2);
+  bool
+  doFit1PeakBackground(DataObjects::Workspace2D_sptr dataws, size_t wsindex,
+                       Functions::BackToBackExponential_sptr peak,
+                       Functions::BackgroundFunction_sptr backgroundfunction,
+                       double &chi2);
 
   /// Fit 1 peak by using a sequential of minimizer
   bool doFit1PeakSequential(DataObjects::Workspace2D_sptr dataws,
                             size_t workspaceindex,
-                            BackToBackExponential_sptr peakfunction,
+                            Functions::BackToBackExponential_sptr peakfunction,
                             std::vector<std::string> minimzernames,
                             std::vector<size_t> maxiterations,
                             std::vector<double> dampfactors, double &chi2);
 
   /// Fit N overlapped peaks in a simple manner
-  bool doFitNPeaksSimple(DataObjects::Workspace2D_sptr dataws, size_t wsindex,
-                         API::CompositeFunction_sptr peaksfunc,
-                         std::vector<BackToBackExponential_sptr> peakfuncs,
-                         std::string minimizername, size_t maxiteration,
-                         double &chi2);
+  bool doFitNPeaksSimple(
+      DataObjects::Workspace2D_sptr dataws, size_t wsindex,
+      API::CompositeFunction_sptr peaksfunc,
+      std::vector<Functions::BackToBackExponential_sptr> peakfuncs,
+      std::string minimizername, size_t maxiteration, double &chi2);
 
   /// Store the function's parameter values to a map
   void storeFunctionParameters(API::IFunction_sptr function,
@@ -241,15 +247,15 @@ private:
   // double leftbound, double rightbound);
 
   /// Estimate the range of a single peak
-  bool estimateSinglePeakRange(BackToBackExponential_sptr peak,
-                               BackgroundFunction_sptr background,
-                               BackToBackExponential_sptr rightpeak,
+  bool estimateSinglePeakRange(Functions::BackToBackExponential_sptr peak,
+                               Functions::BackgroundFunction_sptr background,
+                               Functions::BackToBackExponential_sptr rightpeak,
                                double fwhm, bool ismostright, size_t m_wsIndex,
                                double &chi2);
 
   /// Observe peak range with hint from right peak's properties
-  void observePeakRange(BackToBackExponential_sptr thispeak,
-                        BackToBackExponential_sptr rightpeak,
+  void observePeakRange(Functions::BackToBackExponential_sptr thispeak,
+                        Functions::BackToBackExponential_sptr rightpeak,
                         double refpeakshift, double &peakleftbound,
                         double &peakrightbound);
 
@@ -266,17 +272,19 @@ private:
 
   /// Fit background function by removing the peak properly
   bool doFitBackground(DataObjects::Workspace2D_sptr dataws,
-                       BackgroundFunction_sptr background, double leftpeakbound,
-                       double rightpeakbound);
+                       Functions::BackgroundFunction_sptr background,
+                       double leftpeakbound, double rightpeakbound);
 
   /// Fit single peak without background
-  std::pair<bool, double> doFitPeak_Old(DataObjects::Workspace2D_sptr dataws,
-                                        BackToBackExponential_sptr peak,
-                                        double guessedfwhm, bool calchi2);
+  std::pair<bool, double>
+  doFitPeak_Old(DataObjects::Workspace2D_sptr dataws,
+                Functions::BackToBackExponential_sptr peak, double guessedfwhm,
+                bool calchi2);
 
-  std::pair<bool, double> doFitPeak(DataObjects::Workspace2D_sptr dataws,
-                                    BackToBackExponential_sptr peakfunction,
-                                    double guessedfwhm);
+  std::pair<bool, double>
+  doFitPeak(DataObjects::Workspace2D_sptr dataws,
+            Functions::BackToBackExponential_sptr peakfunction,
+            double guessedfwhm);
 
   /// Fit background-removed peak by Gaussian
   bool doFitGaussianPeak(DataObjects::Workspace2D_sptr dataws, size_t m_wsIndex,
@@ -289,7 +297,7 @@ private:
 
   /// Calcualte the value of a single peak in a given range.
   void calculate1PeakGroup(std::vector<size_t> peakindexes,
-                           BackgroundFunction_sptr background);
+                           Functions::BackgroundFunction_sptr background);
 
   /// Parse the fitting result
   std::string parseFitResult(API::IAlgorithm_sptr fitalg, double &chi2,
@@ -312,7 +320,7 @@ private:
 
   /// Plot a single peak to output vector
   void plotFunction(API::IFunction_sptr peakfunction,
-                    BackgroundFunction_sptr background,
+                    Functions::BackgroundFunction_sptr background,
                     API::FunctionDomain1DVector domain);
 
   //-----------------------------------------------------------------------------------------------
@@ -331,8 +339,9 @@ private:
   // CurveFitting::BackToBackExponential_sptr> m_peaksmap;
 
   /// Sorted vector for peaks.  double = d_h, vector = (HKL), peak
-  std::vector<std::pair<
-      double, std::pair<std::vector<int>, BackToBackExponential_sptr>>>
+  std::vector<
+      std::pair<double, std::pair<std::vector<int>,
+                                  Functions::BackToBackExponential_sptr>>>
       m_vecPeakFunctions;
 
   /// Peak fitting information
@@ -415,7 +424,7 @@ inline double linearInterpolateY(double x0, double xf, double y0, double yf,
 
 /// Estimate background for a pattern in a coarse mode
 void estimateBackgroundCoarse(DataObjects::Workspace2D_sptr dataws,
-                              BackgroundFunction_sptr background,
+                              Functions::BackgroundFunction_sptr background,
                               size_t wsindexraw, size_t wsindexbkgd,
                               size_t wsindexpeak);
 
@@ -434,6 +443,7 @@ size_t findMaxValue(API::MatrixWorkspace_sptr dataws, size_t wsindex,
 /// Get function parameter name, value and etc information in string
 std::string getFunctionInfo(API::IFunction_sptr function);
 
+} // namespace Algorithms
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/LeBailFit.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/LeBailFit.h
similarity index 96%
rename from Framework/CurveFitting/inc/MantidCurveFitting/LeBailFit.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/LeBailFit.h
index cd60219519794d3d0e53e12965233f4402904dfb..dd92a572da7db455acf9c7552bbc80132b9fb799 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/LeBailFit.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/LeBailFit.h
@@ -3,19 +3,20 @@
 
 #include "MantidKernel/System.h"
 #include "MantidAPI/Algorithm.h"
-#include "MantidCurveFitting/LeBailFunction.h"
+#include "MantidCurveFitting/Algorithms/LeBailFunction.h"
 #include "MantidDataObjects/TableWorkspace.h"
 #include "MantidDataObjects/Workspace2D.h"
 #include "MantidAPI/MatrixWorkspace_fwd.h"
-#include "MantidCurveFitting/ThermalNeutronBk2BkExpConvPVoigt.h"
+#include "MantidCurveFitting/Functions/ThermalNeutronBk2BkExpConvPVoigt.h"
 #include "MantidAPI/CompositeFunction.h"
-#include "MantidCurveFitting/BackgroundFunction.h"
+#include "MantidCurveFitting/Functions/BackgroundFunction.h"
 #include "MantidAPI/ITableWorkspace_fwd.h"
 #include "MantidAPI/IFunction.h"
 #include <gsl/gsl_sf_erf.h>
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Algorithms {
 
 /** LeBailFit : Algorithm to do Le Bail Fit.
   The workflow and architecture of this algorithm is different from LeBailFit,
@@ -136,7 +137,7 @@ private:
   /// Examine whether the insturment parameter set to a peak can cause a valid
   /// set of peak profile of that peak
   bool examinInstrumentParameterValid(
-      CurveFitting::ThermalNeutronBk2BkExpConvPVoigt_sptr peak, double &d_h,
+      Functions::ThermalNeutronBk2BkExpConvPVoigt_sptr peak, double &d_h,
       double &tof_h, std::string &errmsg);
 
   /// Set parameters to each peak
@@ -161,14 +162,13 @@ private:
 
   /// Group peaks together
   void groupPeaks(std::vector<std::vector<
-      std::pair<double, CurveFitting::ThermalNeutronBk2BkExpConvPVoigt_sptr>>> &
+      std::pair<double, Functions::ThermalNeutronBk2BkExpConvPVoigt_sptr>>> &
                       peakgroupvec);
 
   /// Calcualate the peak heights of a group of overlapped peaks
   bool calculateGroupPeakIntensities(
       std::vector<std::pair<
-          double, CurveFitting::ThermalNeutronBk2BkExpConvPVoigt_sptr>>
-          peakgroup,
+          double, Functions::ThermalNeutronBk2BkExpConvPVoigt_sptr>> peakgroup,
       API::MatrixWorkspace_sptr dataws, size_t wsindex, bool zerobackground,
       std::vector<double> &allpeaksvalues);
 
@@ -343,7 +343,7 @@ private:
   -------------------------------*/
 
   /// Background function
-  CurveFitting::BackgroundFunction_sptr m_backgroundFunction;
+  Functions::BackgroundFunction_sptr m_backgroundFunction;
 
   /// Function parameters updated by fit
   std::map<std::string, Parameter>
@@ -474,6 +474,7 @@ void convertTableWorkspaceToMaps(
     std::vector<std::map<std::string, std::string>> strmaps,
     std::vector<std::map<std::string, double>> dblmaps);
 
+} // namespace Algorithms
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/LeBailFunction.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/LeBailFunction.h
similarity index 96%
rename from Framework/CurveFitting/inc/MantidCurveFitting/LeBailFunction.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/LeBailFunction.h
index 3b46dfb4dd6b4312a2783cad39b6ece8344d76e7..656bdc5066bd66ef1a1f9d93a07be215c3e1447c 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/LeBailFunction.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/LeBailFunction.h
@@ -5,14 +5,17 @@
 #include "MantidAPI/CompositeFunction.h"
 #include "MantidAPI/MatrixWorkspace_fwd.h"
 #include "MantidAPI/IPowderDiffPeakFunction.h"
-#include "MantidCurveFitting/BackgroundFunction.h"
+#include "MantidCurveFitting/Functions/BackgroundFunction.h"
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Algorithms {
 
 /** LeBailFunction : LeBailFunction is to calculate peak intensities in a
  composite
  *                   function including neutron peak and background functions.
+ *                   Note: This is not a Mantid Fit Function, just a helper
+ *                   class to the algorithm
 
   @date 2013-04-26 : original LeBailFunction is not used by any other functions.
  And thus
@@ -174,7 +177,7 @@ private:
   /// Composite functions for all peaks and background
   API::CompositeFunction_sptr m_compsiteFunction;
   /// Background function
-  BackgroundFunction_sptr m_background;
+  Functions::BackgroundFunction_sptr m_background;
 
   /// Parameters
   std::map<std::string, double> m_functionParameters;
@@ -212,6 +215,7 @@ private:
 
 typedef boost::shared_ptr<LeBailFunction> LeBailFunction_sptr;
 
+} // namespace Algorithms
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/NormaliseByPeakArea.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/NormaliseByPeakArea.h
similarity index 98%
rename from Framework/CurveFitting/inc/MantidCurveFitting/NormaliseByPeakArea.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/NormaliseByPeakArea.h
index 56ae1b98d345e495576ea53cf04931ecaebae29d..4cfac079922ccc7d1b7579199dad4aae0f9fc293 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/NormaliseByPeakArea.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/NormaliseByPeakArea.h
@@ -6,6 +6,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Algorithms {
 
 /**
 
@@ -87,6 +88,7 @@ private:
   API::Progress *m_progress;
 };
 
+} // namespace Algorithms
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/PawleyFit.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/PawleyFit.h
similarity index 87%
rename from Framework/CurveFitting/inc/MantidCurveFitting/PawleyFit.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/PawleyFit.h
index c1c78b1044cd34e7e7a24c9d3277b1ae0b9098ba..7bddf3ec39884df67505bda3e8c5f800eda0ed2e 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/PawleyFit.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/PawleyFit.h
@@ -5,11 +5,12 @@
 #include "MantidAPI/Algorithm.h"
 #include "MantidAPI/ITableWorkspace_fwd.h"
 #include "MantidAPI/TableRow.h"
-#include "MantidCurveFitting/PawleyFunction.h"
+#include "MantidCurveFitting/Functions/PawleyFunction.h"
 #include "MantidKernel/Unit.h"
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Algorithms {
 
 /** @class V3DFromHKLColumnExtractor
 
@@ -76,18 +77,18 @@ public:
 protected:
   double getTransformedCenter(double d, const Kernel::Unit_sptr &unit) const;
 
-  void addHKLsToFunction(PawleyFunction_sptr &pawleyFn,
+  void addHKLsToFunction(Functions::PawleyFunction_sptr &pawleyFn,
                          const API::ITableWorkspace_sptr &tableWs,
                          const Kernel::Unit_sptr &unit, double startX,
                          double endX) const;
 
   API::ITableWorkspace_sptr
-  getLatticeFromFunction(const PawleyFunction_sptr &pawleyFn) const;
-  API::ITableWorkspace_sptr
-  getPeakParametersFromFunction(const PawleyFunction_sptr &pawleyFn) const;
+  getLatticeFromFunction(const Functions::PawleyFunction_sptr &pawleyFn) const;
+  API::ITableWorkspace_sptr getPeakParametersFromFunction(
+      const Functions::PawleyFunction_sptr &pawleyFn) const;
 
   API::IFunction_sptr
-  getCompositeFunction(const PawleyFunction_sptr &pawleyFn) const;
+  getCompositeFunction(const Functions::PawleyFunction_sptr &pawleyFn) const;
 
   void init();
   void exec();
@@ -95,6 +96,7 @@ protected:
   Kernel::Unit_sptr m_dUnit;
 };
 
+} // namespace Algorithms
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/PlotPeakByLogValue.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/PlotPeakByLogValue.h
similarity index 98%
rename from Framework/CurveFitting/inc/MantidCurveFitting/PlotPeakByLogValue.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/PlotPeakByLogValue.h
index 891f455c6e78482bd644cc1a74e8a563730eded7..0c0acc74d34543a09c5202729c92f1c91aebdfaf 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/PlotPeakByLogValue.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/PlotPeakByLogValue.h
@@ -9,6 +9,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Algorithms {
 /**
 
 Takes a workspace group and fits the same spectrum in all workspaces with
@@ -119,6 +120,7 @@ private:
   std::map<std::string, std::vector<std::string>> m_minimizerWorkspaces;
 };
 
+} // namespace Algorithms
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/RefinePowderInstrumentParameters.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters.h
similarity index 88%
rename from Framework/CurveFitting/inc/MantidCurveFitting/RefinePowderInstrumentParameters.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters.h
index debe7054a8bbfc3ff26d11c0638cd687034fec87..9d3eeba57a4f02f257190c767a07f51f4f6f6df0 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/RefinePowderInstrumentParameters.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters.h
@@ -8,15 +8,16 @@
 #include "MantidAPI/ITableWorkspace_fwd.h"
 #include "MantidDataObjects/TableWorkspace.h"
 #include "MantidDataObjects/Workspace2D.h"
-#include "MantidCurveFitting/BackgroundFunction.h"
-#include "MantidCurveFitting/Polynomial.h"
-#include "MantidCurveFitting/BackToBackExponential.h"
-#include "MantidCurveFitting/ThermalNeutronDtoTOFFunction.h"
+#include "MantidCurveFitting/Functions/BackgroundFunction.h"
+#include "MantidCurveFitting/Functions/Polynomial.h"
+#include "MantidCurveFitting/Functions/BackToBackExponential.h"
+#include "MantidCurveFitting/Functions/ThermalNeutronDtoTOFFunction.h"
 #include "MantidAPI/FunctionDomain.h"
 #include "MantidAPI/FunctionValues.h"
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Algorithms {
 
 /** RefinePowderInstrumentParameters : Algorithm to refine instrument geometry
   parameters only.
@@ -151,43 +152,43 @@ private:
 
   //--------------- Class Variables -------------------
   /// Output Workspace containing the dspacing ~ TOF peak positions
-  DataObjects::Workspace2D_sptr dataWS;
+  DataObjects::Workspace2D_sptr m_dataWS;
 
   /// Map for all peaks to fit individually
-  std::map<std::vector<int>, CurveFitting::BackToBackExponential_sptr> mPeaks;
+  std::map<std::vector<int>, Functions::BackToBackExponential_sptr> m_Peaks;
 
   /// Map for all peaks' error (fitted vs. experimental): [HKL]: Chi^2
-  std::map<std::vector<int>, double> mPeakErrors;
+  std::map<std::vector<int>, double> m_PeakErrors;
 
   /// Map for function (instrument parameter)
-  std::map<std::string, double> mFuncParameters;
+  std::map<std::string, double> m_FuncParameters;
   /// Map to store the original (input) parameters
-  std::map<std::string, double> mOrigParameters;
+  std::map<std::string, double> m_OrigParameters;
 
   /// Peak function parameter names
-  std::vector<std::string> mPeakFunctionParameterNames;
+  std::vector<std::string> m_PeakFunctionParameterNames;
   /// N sets of the peak parameter values for the best N chi2 for MC.  It is
   /// paired with mPeakFunctionParameterNames
-  std::vector<std::pair<double, std::vector<double>>> mBestMCParameters;
+  std::vector<std::pair<double, std::vector<double>>> m_BestMCParameters;
   /// N sets of the peak parameter values for the best N chi2 for MC.  It is
   /// paired with mPeakFunctionParameterNames
-  std::vector<std::pair<double, std::vector<double>>> mBestFitParameters;
+  std::vector<std::pair<double, std::vector<double>>> m_BestFitParameters;
   /// N sets of the homemade chi2 and gsl chi2
-  std::vector<std::pair<double, double>> mBestFitChi2s;
+  std::vector<std::pair<double, double>> m_BestFitChi2s;
   /// Best Chi2 ever
-  double mBestGSLChi2;
+  double m_BestGSLChi2;
 
   /// Minimum allowed sigma of a peak
-  double mMinSigma;
+  double m_MinSigma;
 
   /// Minimum number of fitted peaks for refinement
-  size_t mMinNumFittedPeaks;
+  size_t m_MinNumFittedPeaks;
 
   /// Maximum number of data stored
-  size_t mMaxNumberStoredParameters;
+  size_t m_MaxNumberStoredParameters;
 
   /// Modelling function
-  CurveFitting::ThermalNeutronDtoTOFFunction_sptr mFunction;
+  Functions::ThermalNeutronDtoTOFFunction_sptr m_Function;
 };
 
 /** Formular for linear iterpolation: X = [(xf-x0)*Y - (xf*y0-x0*yf)]/(yf-y0)
@@ -206,6 +207,7 @@ inline double linearInterpolateY(double x0, double xf, double y0, double yf,
   return y;
 }
 
+} // namespace Algorithms
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/RefinePowderInstrumentParameters3.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters3.h
similarity index 96%
rename from Framework/CurveFitting/inc/MantidCurveFitting/RefinePowderInstrumentParameters3.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters3.h
index 3af13a083e66cdfd186c9115c029b3ade0b6a252..56875c6c88568c1c49d67c13d29018a34627fb3b 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/RefinePowderInstrumentParameters3.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters3.h
@@ -8,12 +8,13 @@
 #include "MantidDataObjects/Workspace2D.h"
 #include "MantidDataObjects/TableWorkspace.h"
 
-#include "MantidCurveFitting/LeBailFit.h"
-#include "MantidCurveFitting/ThermalNeutronDtoTOFFunction.h"
-#include "MantidCurveFitting/BoundaryConstraint.h"
+#include "MantidCurveFitting/Algorithms/LeBailFit.h"
+#include "MantidCurveFitting/Functions/ThermalNeutronDtoTOFFunction.h"
+#include "MantidCurveFitting/Constraints/BoundaryConstraint.h"
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Algorithms {
 
 /** RefinePowderInstrumentParameters3 :
 
@@ -183,7 +184,7 @@ private:
   std::map<std::string, Parameter> m_profileParameters;
 
   /// My function for peak positions
-  ThermalNeutronDtoTOFFunction_sptr m_positionFunc;
+  Functions::ThermalNeutronDtoTOFFunction_sptr m_positionFunc;
 
   /// Damping factor
   double m_dampingFactor;
@@ -226,6 +227,7 @@ double calculateFunctionChiSquare(const std::vector<double> &modelY,
                                   const std::vector<double> &dataY,
                                   const std::vector<double> &dataE);
 
+} // namespace Algorithms
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/SplineBackground.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/SplineBackground.h
similarity index 97%
rename from Framework/CurveFitting/inc/MantidCurveFitting/SplineBackground.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/SplineBackground.h
index 53d877e613b3670c049e7683fa8f5c8c83114ca1..9aa91c96228c809036a56bac61cf5da9e9e01a36 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/SplineBackground.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/SplineBackground.h
@@ -9,6 +9,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Algorithms {
 
 /** SplineBackground
 
@@ -61,6 +62,7 @@ private:
   void exec();
 };
 
+} // namespace Algorithms
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/SplineInterpolation.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/SplineInterpolation.h
similarity index 95%
rename from Framework/CurveFitting/inc/MantidCurveFitting/SplineInterpolation.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/SplineInterpolation.h
index b75259124c0cd45b1a657154a0b15d23a784cbe2..fbb797729d6c07784b7d6fa7efed53a4bfec8d2f 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/SplineInterpolation.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/SplineInterpolation.h
@@ -3,10 +3,11 @@
 
 #include "MantidKernel/System.h"
 #include "MantidAPI/Algorithm.h"
-#include "MantidCurveFitting/CubicSpline.h"
+#include "MantidCurveFitting/Functions/CubicSpline.h"
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Algorithms {
 
 /** Takes two workspaces as input. One contain a set of points which define a
   spline,
@@ -62,7 +63,7 @@ private:
   void exec();
 
   /// CubicSpline member used to perform interpolation
-  boost::shared_ptr<CubicSpline> m_cspline;
+  boost::shared_ptr<Functions::CubicSpline> m_cspline;
 
   /// setup an output workspace using meta data from inws and taking a number of
   /// spectra
@@ -91,6 +92,7 @@ private:
                             int order) const;
 };
 
+} // namespace Algorithms
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/SplineSmoothing.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/SplineSmoothing.h
similarity index 96%
rename from Framework/CurveFitting/inc/MantidCurveFitting/SplineSmoothing.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/SplineSmoothing.h
index 3c95fe4d0f927d458811de8854ffba1ab3ea2b70..ee17aa3dca0fb55f9ece30aee9b9fb5fc0cc8503 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/SplineSmoothing.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/SplineSmoothing.h
@@ -4,10 +4,11 @@
 #include "MantidKernel/System.h"
 #include "MantidAPI/Algorithm.h"
 #include "MantidAPI/WorkspaceFactory.h"
-#include "MantidCurveFitting/BSpline.h"
+#include "MantidCurveFitting/Functions/BSpline.h"
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Algorithms {
 
 /** Takes a 2D workspace and produces an output workspace containing a smoothed
   version of the data by selecting
@@ -106,7 +107,7 @@ private:
   void performAdditionalFitting(API::MatrixWorkspace_sptr ws, const int row);
 
   /// CubicSpline member used to perform smoothing
-  boost::shared_ptr<BSpline> m_cspline;
+  boost::shared_ptr<Functions::BSpline> m_cspline;
   /// pointer to the input workspace
   API::MatrixWorkspace_sptr m_inputWorkspace;
   /// pointer to the input workspace converted to point data
@@ -117,6 +118,7 @@ private:
   API::MatrixWorkspace_sptr m_outputWorkspace;
 };
 
+} // namespace Algorithms
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/BoundaryConstraint.h b/Framework/CurveFitting/inc/MantidCurveFitting/Constraints/BoundaryConstraint.h
similarity index 98%
rename from Framework/CurveFitting/inc/MantidCurveFitting/BoundaryConstraint.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Constraints/BoundaryConstraint.h
index 2b3301fa8ea844eea8951a2583b47df936d45c83..ef798c50e1afbe87ad21d94ee77fdd088c0bfa47 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/BoundaryConstraint.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Constraints/BoundaryConstraint.h
@@ -8,6 +8,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Constraints {
 //----------------------------------------------------------------------
 // Forward Declaration
 //----------------------------------------------------------------------
@@ -142,6 +143,7 @@ private:
   double m_upperBound;
 };
 
+} // namespace Constraints
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/CostFuncFitting.h b/Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncFitting.h
similarity index 98%
rename from Framework/CurveFitting/inc/MantidCurveFitting/CostFuncFitting.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncFitting.h
index 7bbc76c8bb8e07885624d8244efddb334a28d9d0..41cc8170906b0b63a589a46c417aa0fb4442a974 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/CostFuncFitting.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncFitting.h
@@ -12,6 +12,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace CostFunctions {
 /** A semi-abstract class for a cost function for fitting functions.
     Implement val(), deriv(), and valAndDeriv() methods in a concrete class.
 
@@ -100,6 +101,7 @@ protected:
   mutable bool m_dirtyHessian; /// dirty hessian flag
 };
 
+} // namespace CostFunctions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/CostFuncIgnorePosPeaks.h b/Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncIgnorePosPeaks.h
similarity index 97%
rename from Framework/CurveFitting/inc/MantidCurveFitting/CostFuncIgnorePosPeaks.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncIgnorePosPeaks.h
index ffef9d6666730776e3cc435975acfafa650cf799..2a38310ecf35d42be1781cc744f35b342ffdfbb6 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/CostFuncIgnorePosPeaks.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncIgnorePosPeaks.h
@@ -8,6 +8,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace CostFunctions {
 /** Cost function which allows positive peaks to be ignored and is suitable
     for e.g. fitting the background
 
@@ -61,6 +62,7 @@ private:
   const std::string m_name;
 };
 
+} // namespace CostFunctions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/CostFuncLeastSquares.h b/Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h
similarity index 94%
rename from Framework/CurveFitting/inc/MantidCurveFitting/CostFuncLeastSquares.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h
index be05dae8779b0db76f5cd7ba9060ae7850cb4e99..9478d2ab3be0dd7fc4ee4b47e5d147f139741c96 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/CostFuncLeastSquares.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h
@@ -4,7 +4,7 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/CostFuncFitting.h"
+#include "MantidCurveFitting/CostFunctions/CostFuncFitting.h"
 #include "MantidCurveFitting/GSLMatrix.h"
 #include "MantidCurveFitting/GSLVector.h"
 
@@ -13,6 +13,7 @@ namespace CurveFitting {
 class SeqDomain;
 class ParDomain;
 
+namespace CostFunctions {
 /** Cost function for least squares
 
     @author Anders Markvardsen, ISIS, RAL
@@ -101,12 +102,13 @@ protected:
   mutable double m_pushedValue;
   mutable GSLVector m_pushedParams;
 
-  friend class SeqDomain;
-  friend class ParDomain;
+  friend class CurveFitting::SeqDomain;
+  friend class CurveFitting::ParDomain;
 
   double m_factor;
 };
 
+} // namespace CostFunctions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/CostFuncRwp.h b/Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncRwp.h
similarity index 94%
rename from Framework/CurveFitting/inc/MantidCurveFitting/CostFuncRwp.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncRwp.h
index a58da7c674ccf477b2ff508921c8a133308e392d..4c5b04e99c27543c1150e0f06421ed9d57d418fb 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/CostFuncRwp.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncRwp.h
@@ -4,7 +4,7 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/CostFuncLeastSquares.h"
+#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h"
 #include "MantidCurveFitting/GSLMatrix.h"
 #include "MantidCurveFitting/GSLVector.h"
 
@@ -16,6 +16,8 @@ namespace CurveFitting {
 class SeqDomain;
 class ParDomain;
 
+namespace CostFunctions {
+
 /** Cost function for Rwp = (sum_i (( obs_i - cal_i )/sigma_i)**2 ) / (sum_i
    (obs_i/sigma_i)**2)
 
@@ -68,6 +70,7 @@ private:
   double calSqrtW(API::FunctionValues_sptr values) const;
 };
 
+} // namespace CostFunctions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/CostFuncUnweightedLeastSquares.h b/Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncUnweightedLeastSquares.h
similarity index 94%
rename from Framework/CurveFitting/inc/MantidCurveFitting/CostFuncUnweightedLeastSquares.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncUnweightedLeastSquares.h
index 17fc016bb426d6e2c37c534c89f796124d3bb7a5..85f979e8876e3206414b27f2a3173d1c7f0f20bf 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/CostFuncUnweightedLeastSquares.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncUnweightedLeastSquares.h
@@ -2,10 +2,11 @@
 #define MANTID_CURVEFITTING_COSTFUNCUNWEIGHTEDLEASTSQUARES_H_
 
 #include "MantidKernel/System.h"
-#include "MantidCurveFitting/CostFuncLeastSquares.h"
+#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h"
 
 namespace Mantid {
 namespace CurveFitting {
+namespace CostFunctions {
 
 /** @class CostFuncUnweightedLeastSquares
  *
@@ -53,6 +54,7 @@ protected:
   double getResidualVariance() const;
 };
 
+} // namespace CostFunctions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/BFGS_Minimizer.h b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/BFGS_Minimizer.h
similarity index 94%
rename from Framework/CurveFitting/inc/MantidCurveFitting/BFGS_Minimizer.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/BFGS_Minimizer.h
index dbafd43e1a5452b7c3d9efdf9a74de52dbb6a3aa..137e3f2f08b1f4fd5f36f13a801eda26cb229bf1 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/BFGS_Minimizer.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/BFGS_Minimizer.h
@@ -5,10 +5,11 @@
 // Includes
 //----------------------------------------------------------------------
 #include "MantidCurveFitting/DllConfig.h"
-#include "MantidCurveFitting/DerivMinimizer.h"
+#include "MantidCurveFitting/FuncMinimizers/DerivMinimizer.h"
 
 namespace Mantid {
 namespace CurveFitting {
+namespace FuncMinimisers {
 /** Implementing Broyden-Fletcher-Goldfarb-Shanno (BFGS) algorithm
     by wrapping the IFuncMinimizer interface around the GSL implementation of
    this algorithm.
@@ -52,6 +53,7 @@ protected:
   static Kernel::Logger &g_log;
 };
 
+} // namespace FuncMinimisers
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/DampingMinimizer.h b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/DampingMinimizer.h
similarity index 92%
rename from Framework/CurveFitting/inc/MantidCurveFitting/DampingMinimizer.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/DampingMinimizer.h
index 4c8be89a8f28e194246585da2ad52351ad28abb4..a09325d17a0556d65ff8fe3c8f925ccfd394c18d 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/DampingMinimizer.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/DampingMinimizer.h
@@ -10,8 +10,10 @@
 
 namespace Mantid {
 namespace CurveFitting {
-
+namespace CostFunctions {
 class CostFuncLeastSquares;
+} // namespace CostFunctions
+namespace FuncMinimisers {
 
 /**
     Implements a least squares minimization algorithm with damping.
@@ -56,13 +58,13 @@ public:
 
 private:
   /// Pointer to the cost function. Must be the least squares.
-  boost::shared_ptr<CostFuncLeastSquares> m_leastSquares;
+  boost::shared_ptr<CostFunctions::CostFuncLeastSquares> m_leastSquares;
   /// Relative tolerance.
   double m_relTol;
   /// The damping mu parameter in the Levenberg-Marquardt method.
   // double m_damping;
 };
-
+} // namespace FuncMinimisers
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/DerivMinimizer.h b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/DerivMinimizer.h
similarity index 98%
rename from Framework/CurveFitting/inc/MantidCurveFitting/DerivMinimizer.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/DerivMinimizer.h
index f894626253e6974c47a3a924af6c6d0923f3c67a..2da8b40ba41cf1e55c5a3a9fe27ba0822cc7e428 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/DerivMinimizer.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/DerivMinimizer.h
@@ -12,6 +12,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace FuncMinimisers {
 /** A wrapper around the GSL functions implementing a minimizer using
    derivatives.
     Concrete classes must implement the getGSLMinimizerType() method.
@@ -94,6 +95,7 @@ private:
   void initGSLMMin();
 };
 
+} // namespace FuncMinimisers
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/FABADAMinimizer.h b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/FABADAMinimizer.h
similarity index 93%
rename from Framework/CurveFitting/inc/MantidCurveFitting/FABADAMinimizer.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/FABADAMinimizer.h
index 751e195e233676fd8a9f8be9af86c8a123189af1..c2c5b5ebfb75a997919a933003aff9b3beee60ea 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/FABADAMinimizer.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/FABADAMinimizer.h
@@ -10,7 +10,16 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace CostFunctions {
+/// Forward Declaration
 class CostFuncLeastSquares;
+}
+}
+}
+
+namespace Mantid {
+namespace CurveFitting {
+namespace FuncMinimisers {
 
 /** FABADA : TODO: DESCRIPTION
 
@@ -56,7 +65,7 @@ private:
   /// Pointer to the cost function. Must be the least squares.
   /// Intentar encontrar una manera de sacar aqui el numero de parametros  que
   /// no sea necesaria la cost function
-  boost::shared_ptr<CostFuncLeastSquares> m_leastSquares;
+  boost::shared_ptr<CostFunctions::CostFuncLeastSquares> m_leastSquares;
   /// The number of iterations done.
   size_t m_counter;
   ///
@@ -88,6 +97,8 @@ private:
   /// Maximum number of iterations
   size_t m_max_iter;
 };
+
+} // namespace FuncMinimisers
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/FRConjugateGradientMinimizer.h b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/FRConjugateGradientMinimizer.h
similarity index 94%
rename from Framework/CurveFitting/inc/MantidCurveFitting/FRConjugateGradientMinimizer.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/FRConjugateGradientMinimizer.h
index cbe9ac8d9d7f1af2789f5a2aa0a1377a517d15ed..683b3a8c3b0521ab38b2be2e29d0831b84f844a3 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/FRConjugateGradientMinimizer.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/FRConjugateGradientMinimizer.h
@@ -5,10 +5,11 @@
 // Includes
 //----------------------------------------------------------------------
 #include "MantidCurveFitting/DllConfig.h"
-#include "MantidCurveFitting/DerivMinimizer.h"
+#include "MantidCurveFitting/FuncMinimizers/DerivMinimizer.h"
 
 namespace Mantid {
 namespace CurveFitting {
+namespace FuncMinimisers {
 /** Implementing Fletcher-Reeves flavour of the conjugate gradient algorithm
     by wrapping the IFuncMinimizer interface around the GSL implementation of
    this algorithm.
@@ -51,6 +52,7 @@ protected:
   virtual const gsl_multimin_fdfminimizer_type *getGSLMinimizerType();
 };
 
+} // namespace FuncMinimisers
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/LevenbergMarquardtMDMinimizer.h b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMDMinimizer.h
similarity index 93%
rename from Framework/CurveFitting/inc/MantidCurveFitting/LevenbergMarquardtMDMinimizer.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMDMinimizer.h
index 5d39606ed1f013a8041f9abb79ea943fe2c3f2c1..139b82aff0229675b5193519173860073e388008 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/LevenbergMarquardtMDMinimizer.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMDMinimizer.h
@@ -10,9 +10,11 @@
 
 namespace Mantid {
 namespace CurveFitting {
-
+namespace CostFunctions {
 class CostFuncLeastSquares;
+} // namespace CostFunctions
 
+namespace FuncMinimisers {
 /** Implementing Levenberg-Marquardt algorithm. Uses the normal system calculate
     the corrections to the parameters. Expects a cost function that can evaluate
     the value, the derivatives and the hessian matrix.
@@ -57,7 +59,7 @@ public:
 
 private:
   /// Pointer to the cost function. Must be the least squares.
-  boost::shared_ptr<CostFuncLeastSquares> m_leastSquares;
+  boost::shared_ptr<CostFunctions::CostFuncLeastSquares> m_leastSquares;
   /// The tau parameter in the Levenberg-Marquardt method.
   double m_tau;
   /// The damping mu parameter in the Levenberg-Marquardt method.
@@ -71,6 +73,7 @@ private:
   std::vector<double> m_D;
 };
 
+} // namespace FuncMinimisers
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/LevenbergMarquardtMinimizer.h b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMinimizer.h
similarity index 98%
rename from Framework/CurveFitting/inc/MantidCurveFitting/LevenbergMarquardtMinimizer.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMinimizer.h
index a5af8ed98820db924555df0d58ef32974ad5c18c..e2c786adb32c18a7f1b32bb90f7d2813405df4c3 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/LevenbergMarquardtMinimizer.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMinimizer.h
@@ -11,6 +11,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace FuncMinimisers {
 /** Implementing Levenberg-Marquardt by wrapping the IFuncMinimizer interface
     around the GSL implementation of this algorithm.
 
@@ -79,6 +80,7 @@ private:
   double m_relError;
 };
 
+} // namespace FuncMinimisers
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/PRConjugateGradientMinimizer.h b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/PRConjugateGradientMinimizer.h
similarity index 94%
rename from Framework/CurveFitting/inc/MantidCurveFitting/PRConjugateGradientMinimizer.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/PRConjugateGradientMinimizer.h
index 80d5feaf207f6260087c35404fed96b97c6de952..99f37e47c2b7f46d35eb3fb2e36c7b0b9040e846 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/PRConjugateGradientMinimizer.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/PRConjugateGradientMinimizer.h
@@ -5,10 +5,11 @@
 // Includes
 //----------------------------------------------------------------------
 #include "MantidCurveFitting/DllConfig.h"
-#include "MantidCurveFitting/DerivMinimizer.h"
+#include "MantidCurveFitting/FuncMinimizers/DerivMinimizer.h"
 
 namespace Mantid {
 namespace CurveFitting {
+namespace FuncMinimisers {
 /** Implementing Polak-Ribiere flavour of the conjugate gradient algorithm
     by wrapping the IFuncMinimizer interface around the GSL implementation of
    this algorithm.
@@ -49,6 +50,7 @@ protected:
   virtual const gsl_multimin_fdfminimizer_type *getGSLMinimizerType();
 };
 
+} // namespace FuncMinimisers
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/SimplexMinimizer.h b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/SimplexMinimizer.h
similarity index 98%
rename from Framework/CurveFitting/inc/MantidCurveFitting/SimplexMinimizer.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/SimplexMinimizer.h
index 5ca099ae2b281a22b1d70aecade9fea5fb4a732f..14e637fd956804ea8580a0ebd7a6cc656b9c1942 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/SimplexMinimizer.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/SimplexMinimizer.h
@@ -10,6 +10,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace FuncMinimisers {
 /** Implementing Simplex by wrapping the IFuncMinimizer interface
     around the GSL implementation of this algorithm.
 
@@ -87,6 +88,7 @@ private:
   gsl_multimin_function gslContainer;
 };
 
+} // namespace FuncMinimisers
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/SteepestDescentMinimizer.h b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/SteepestDescentMinimizer.h
similarity index 94%
rename from Framework/CurveFitting/inc/MantidCurveFitting/SteepestDescentMinimizer.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/SteepestDescentMinimizer.h
index 7e319e65c8427794ee1d1ee9eefac848983f0e82..a251a9eae3b7ec077233b9ce66b96812aead1e81 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/SteepestDescentMinimizer.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/FuncMinimizers/SteepestDescentMinimizer.h
@@ -5,10 +5,11 @@
 // Includes
 //----------------------------------------------------------------------
 #include "MantidCurveFitting/DllConfig.h"
-#include "MantidCurveFitting/DerivMinimizer.h"
+#include "MantidCurveFitting/FuncMinimizers/DerivMinimizer.h"
 
 namespace Mantid {
 namespace CurveFitting {
+namespace FuncMinimisers {
 /** Implementing the steepest descent algorithm
     by wrapping the IFuncMinimizer interface around the GSL implementation of
    this algorithm.
@@ -51,6 +52,7 @@ protected:
   static Kernel::Logger &g_log;
 };
 
+} // namespace FuncMinimisers
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Abragam.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Abragam.h
similarity index 98%
rename from Framework/CurveFitting/inc/MantidCurveFitting/Abragam.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/Abragam.h
index 426c69d337e2ee0bc9964f7d04a401f4aca6fcaf..0bfcade021dcda28e4a3e875a4fcb048d8bc1c48 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/Abragam.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Abragam.h
@@ -12,6 +12,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 /**
 Provide Abragam fitting function for muon scientists
 
@@ -64,6 +65,7 @@ protected:
   virtual void init();
 };
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/BSpline.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/BSpline.h
similarity index 96%
rename from Framework/CurveFitting/inc/MantidCurveFitting/BSpline.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/BSpline.h
index a2a59dad6354494d31ddefa4cb73735db5244192..b45302749aaad9b49e7ca5082d9f4dbe64c7afc5 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/BSpline.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/BSpline.h
@@ -4,7 +4,7 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/BackgroundFunction.h"
+#include "MantidCurveFitting/Functions/BackgroundFunction.h"
 
 #include <boost/shared_ptr.hpp>
 #include <gsl/gsl_errno.h>
@@ -12,6 +12,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 /**
 
 A wrapper around GSL functions implementing a B-spline.
@@ -75,6 +76,7 @@ private:
       m_bsplineDerivWorkspace;
 };
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/BackToBackExponential.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/BackToBackExponential.h
similarity index 98%
rename from Framework/CurveFitting/inc/MantidCurveFitting/BackToBackExponential.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/BackToBackExponential.h
index 103d8679b413e23627156e4151a577b52331b48b..83910c281dbe962f7dcfabaad1d381c90f90ffcf 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/BackToBackExponential.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/BackToBackExponential.h
@@ -8,6 +8,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 /**
 Provide BackToBackExponential peak shape function interface to IPeakFunction.
 That is the function:
@@ -87,6 +88,7 @@ protected:
 
 typedef boost::shared_ptr<BackToBackExponential> BackToBackExponential_sptr;
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/BackgroundFunction.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/BackgroundFunction.h
similarity index 98%
rename from Framework/CurveFitting/inc/MantidCurveFitting/BackgroundFunction.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/BackgroundFunction.h
index 46f9f2f25c32946dd9b517e80a2f24b58f67ecff..fc373fc1331bff0219d8f2d477db154ef6c9c97b 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/BackgroundFunction.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/BackgroundFunction.h
@@ -13,6 +13,7 @@ class Parser;
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 /**
 A background function. Functions that are intended to be used as backgrounds
 should inherit from this class to enable certain features. E.g. querying
@@ -74,6 +75,7 @@ public:
 
 typedef boost::shared_ptr<BackgroundFunction> BackgroundFunction_sptr;
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/BivariateNormal.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/BivariateNormal.h
similarity index 97%
rename from Framework/CurveFitting/inc/MantidCurveFitting/BivariateNormal.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/BivariateNormal.h
index 5404e669d06fa3f1f9909bf8350dfd6d46f01481..59fd0db97239581ebaa53d4a3a430e70b2536390 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/BivariateNormal.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/BivariateNormal.h
@@ -4,15 +4,16 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/UserFunction.h"
+#include "MantidCurveFitting/Functions/UserFunction.h"
 #include "MantidAPI/IFunctionMW.h"
 #include "MantidAPI/IFunction1D.h"
 #include "MantidAPI/ParamFunction.h"
 #include "MantidKernel/cow_ptr.h"
-#include "MantidCurveFitting/BoundaryConstraint.h"
+#include "MantidCurveFitting/Constraints/BoundaryConstraint.h"
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 
 /**
   * Provide peak shape function interface a Peak shape on one time slice of a
@@ -176,6 +177,7 @@ protected:
       expCoeffxy; //<Other common values used in calculating values and
                   //<derivatives
 };
+} // namespace Functions
 }
 }
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Bk2BkExpConvPV.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Bk2BkExpConvPV.h
similarity index 98%
rename from Framework/CurveFitting/inc/MantidCurveFitting/Bk2BkExpConvPV.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/Bk2BkExpConvPV.h
index f7511c3810a8eda9e2cdd4fda957c04f9d581253..be7ed03f4ad95d00407a788af69241ca74bbe386 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/Bk2BkExpConvPV.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Bk2BkExpConvPV.h
@@ -8,6 +8,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 
 /** Bk2BkExpConvPV : Peak profile as tback-to-back exponential convoluted with
   pseudo-Voigt.
@@ -92,6 +93,7 @@ private:
 
 typedef boost::shared_ptr<Bk2BkExpConvPV> Bk2BkExpConvPV_sptr;
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ChebfunBase.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ChebfunBase.h
similarity index 98%
rename from Framework/CurveFitting/inc/MantidCurveFitting/ChebfunBase.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ChebfunBase.h
index 37eafa709eb65aa33d783d805ca48f5ed320a53d..92dd84b3ddf1deda279dc2435e33092d12c71afa 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/ChebfunBase.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ChebfunBase.h
@@ -1,8 +1,8 @@
 #ifndef MANTID_CURVEFITTING_CHEBFUNBASE_H
 #define MANTID_CURVEFITTING_CHEBFUNBASE_H
 
-#include "DllConfig.h"
-#include "GSLMatrix.h"
+#include "MantidCurveFitting/DllConfig.h"
+#include "MantidCurveFitting/GSLMatrix.h"
 
 #include <boost/shared_ptr.hpp>
 #include <vector>
@@ -15,6 +15,7 @@ class IFunction;
 }
 
 namespace CurveFitting {
+namespace Functions {
 
 /// Type of the approximated function
 typedef std::function<double(double)> ChebfunFunctionType;
@@ -213,6 +214,7 @@ boost::shared_ptr<ChebfunBase> ChebfunBase::bestFitAnyTolerance(
   return ChebfunBase_sptr();
 }
 
+} // namespace Functions
 } // CurveFitting
 } // Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Chebyshev.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Chebyshev.h
similarity index 95%
rename from Framework/CurveFitting/inc/MantidCurveFitting/Chebyshev.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/Chebyshev.h
index 100a00197e1a218cf4d7016a7c45d16e38430f72..0b4209636d5883ea7112815e5e7d0e2369da0144 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/Chebyshev.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Chebyshev.h
@@ -4,11 +4,12 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/BackgroundFunction.h"
+#include "MantidCurveFitting/Functions/BackgroundFunction.h"
 #include <valarray>
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 /**
 Implements Chebyshev polynomial expansion.
 
@@ -72,6 +73,7 @@ private:
 
 typedef boost::shared_ptr<Chebyshev> Chebyshev_sptr;
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ComptonPeakProfile.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ComptonPeakProfile.h
similarity index 98%
rename from Framework/CurveFitting/inc/MantidCurveFitting/ComptonPeakProfile.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ComptonPeakProfile.h
index 22d9514f8f6749ea7e5a5d9d6153613673be7005..a3a8d2dfb1853fa9ef4fa58a698c0702fc809f7d 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/ComptonPeakProfile.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ComptonPeakProfile.h
@@ -8,6 +8,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 /**
   This implements a resolution function for fitting a single mass in a compton
   scattering spectrum. The
@@ -81,6 +82,7 @@ private:
   double m_hwhmLorentz;
 };
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ComptonProfile.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ComptonProfile.h
similarity index 94%
rename from Framework/CurveFitting/inc/MantidCurveFitting/ComptonProfile.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ComptonProfile.h
index c533219940a0172149577792504bae5ea9c88330..58f9e65ab1ff2aaad49b01da28636e012b8158dd 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/ComptonProfile.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ComptonProfile.h
@@ -2,18 +2,21 @@
 #define MANTID_CURVEFITTING_COMPTONPROFILE_H_
 
 #include "MantidCurveFitting/DllConfig.h"
-#include "MantidCurveFitting/VesuvioResolution.h"
+#include "MantidCurveFitting/Functions/VesuvioResolution.h"
 #include "MantidAPI/IPeakFunction.h"
 #include "MantidAPI/MatrixWorkspace_fwd.h"
 #include "MantidAPI/ParamFunction.h"
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Algorithms {
 //---------------------------------------------------------------------------
 // Forward declarations
 //---------------------------------------------------------------------------
 struct DetectorParams;
+}
 
+namespace Functions {
 /**
   This class serves as a base-class for ComptonProfile type functions. @see
   GaussianComptonProfile, GramCharlierComptonProfile
@@ -59,13 +62,14 @@ public:
 
   /// Pre-calculate the Y-space values with specified resolution parameters
   void cacheYSpaceValues(const std::vector<double> &tseconds,
-                         const bool isHistogram, const DetectorParams &detpar,
+                         const bool isHistogram,
+                         const Algorithms::DetectorParams &detpar,
                          const ResolutionParams &respar);
 
   /// Pre-calculate the Y-space values
   virtual void cacheYSpaceValues(const std::vector<double> &tseconds,
                                  const bool isHistogram,
-                                 const DetectorParams &detpar);
+                                 const Algorithms::DetectorParams &detpar);
   /// Turn off logger
   void disableLogging() { m_log.setEnabled(false); }
   ///@}
@@ -133,6 +137,7 @@ protected:
   ///@}
 };
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ComptonScatteringCountRate.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ComptonScatteringCountRate.h
similarity index 97%
rename from Framework/CurveFitting/inc/MantidCurveFitting/ComptonScatteringCountRate.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ComptonScatteringCountRate.h
index 1b3c42cfd9cf84997e60c8a747676fe23bfe542f..a34ee169656166cbcd099378c4ca6a7214c248cc 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/ComptonScatteringCountRate.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ComptonScatteringCountRate.h
@@ -2,12 +2,13 @@
 #define MANTID_CURVEFITTING_COMPTONSCATTERINGCOUNTRATE_H_
 
 #include "MantidAPI/CompositeFunction.h"
-#include "MantidCurveFitting/ComptonProfile.h"
+#include "MantidCurveFitting/Functions/ComptonProfile.h"
 #include "MantidKernel/ClassMacros.h"
 #include "MantidKernel/Matrix.h"
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 
 /**
   Implements a specialized function that encapsulates the combination of
@@ -92,6 +93,7 @@ private:
   std::vector<double> m_dataErrorRatio;
 };
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Convolution.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Convolution.h
similarity index 99%
rename from Framework/CurveFitting/inc/MantidCurveFitting/Convolution.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/Convolution.h
index 499d426d8bbcccc70ac5f21e8e8c68a572c651b9..b1e5791269a82fcdc5fbef17b757ab8b22b24a85 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/Convolution.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Convolution.h
@@ -11,6 +11,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 /**
 Performes convolution of two functions.
 
@@ -151,6 +152,7 @@ private:
   mutable std::vector<double> m_resolution;
 };
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/CubicSpline.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/CubicSpline.h
similarity index 97%
rename from Framework/CurveFitting/inc/MantidCurveFitting/CubicSpline.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/CubicSpline.h
index 0ad0f34ccc00de17b46e5f28653f5e07a34d4ccc..3dbaa2c4dc2cbae2236fac99393de0856a271c1d 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/CubicSpline.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/CubicSpline.h
@@ -4,7 +4,7 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/BackgroundFunction.h"
+#include "MantidCurveFitting/Functions/BackgroundFunction.h"
 
 #include <boost/scoped_array.hpp>
 #include <gsl/gsl_errno.h>
@@ -13,6 +13,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 /**
 
 A wrapper around GSL functions implementing cubic spline interpolation.
@@ -117,6 +118,7 @@ private:
 typedef boost::shared_ptr<CubicSpline> CubicSpline_sptr;
 typedef const boost::shared_ptr<CubicSpline> CubicSpline_const_sptr;
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/DeltaFunction.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/DeltaFunction.h
similarity index 98%
rename from Framework/CurveFitting/inc/MantidCurveFitting/DeltaFunction.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/DeltaFunction.h
index 1f0b682f088492ab13765438ac147bfd7f53aecb..9f98b9cafbcffd02ce3fa9281323ae05918054c5 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/DeltaFunction.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/DeltaFunction.h
@@ -10,6 +10,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 /**
 
 Delta function. Makes sence in Convolution only.
@@ -78,6 +79,7 @@ protected:
   }
 };
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/DiffRotDiscreteCircle.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/DiffRotDiscreteCircle.h
similarity index 98%
rename from Framework/CurveFitting/inc/MantidCurveFitting/DiffRotDiscreteCircle.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/DiffRotDiscreteCircle.h
index 8b1c38f194acfe816aa5e15788132eb720c86413..0157a963217c46f6cc209ebef4c09d2e9e195b5d 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/DiffRotDiscreteCircle.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/DiffRotDiscreteCircle.h
@@ -10,6 +10,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 /**
 @author Jose Borreguero, NScD
 @date December 02 2013
@@ -125,6 +126,7 @@ private:
   boost::shared_ptr<InelasticDiffRotDiscreteCircle> m_inelastic;
 };
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/DiffSphere.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/DiffSphere.h
similarity index 99%
rename from Framework/CurveFitting/inc/MantidCurveFitting/DiffSphere.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/DiffSphere.h
index 7db3b4e805332c1280f709fc4f2da9b277e82a66..b7eeb4b57e017333dd7ac416b11752691c7693f2 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/DiffSphere.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/DiffSphere.h
@@ -14,6 +14,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 /**
 @author Jose Borreguero, NScD
 @date 11/14/2011
@@ -172,6 +173,7 @@ private:
       m_inelastic; // inelastic intensity of the DiffSphere structure factor
 };
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/DynamicKuboToyabe.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/DynamicKuboToyabe.h
similarity index 98%
rename from Framework/CurveFitting/inc/MantidCurveFitting/DynamicKuboToyabe.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/DynamicKuboToyabe.h
index 7b24a53770f71e84d18c280f07f50843b2764987..9865dd6b967b0f8104c7d4c385ac8fe4a9265fb9 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/DynamicKuboToyabe.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/DynamicKuboToyabe.h
@@ -11,6 +11,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 /**
  Provide Dynamic Kubo Toyabe function interface to IFunction1D for muon
  scientists.
@@ -87,6 +88,7 @@ private:
   double m_minEps, m_maxEps;
 };
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/EndErfc.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/EndErfc.h
similarity index 97%
rename from Framework/CurveFitting/inc/MantidCurveFitting/EndErfc.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/EndErfc.h
index 490ab7dba3c2a0c120b0f083e356e2437ebca4f7..1519739ca40c79dbaa5616264e928a7407fed088 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/EndErfc.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/EndErfc.h
@@ -9,6 +9,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 /**
 Provide Errore function erfc()for calibrating the end of a tube.
 
@@ -57,6 +58,7 @@ protected:
   virtual void init();
 };
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ExpDecay.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ExpDecay.h
similarity index 97%
rename from Framework/CurveFitting/inc/MantidCurveFitting/ExpDecay.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ExpDecay.h
index 60ccb117530cc9b2da7b49617b9eb27e012aa7e6..45732a7d1124801438877998d3b7e6b93e8df03a 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/ExpDecay.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ExpDecay.h
@@ -9,6 +9,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 /**
 Provide exponential decay function: h*exp(-(x-c)/t)
 
@@ -56,6 +57,7 @@ protected:
                                const size_t nData);
 };
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ExpDecayMuon.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ExpDecayMuon.h
similarity index 97%
rename from Framework/CurveFitting/inc/MantidCurveFitting/ExpDecayMuon.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ExpDecayMuon.h
index b12e4e30a1224464520fb86898ae1df7dda76562..7a42e6a9aaf3058eda3bf8a9ab9877feb10150c4 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/ExpDecayMuon.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ExpDecayMuon.h
@@ -9,6 +9,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 /**
 Provide exponential decay function: h*exp(-lambda.x)
 
@@ -59,6 +60,7 @@ protected:
   virtual void init();
 };
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ExpDecayOsc.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ExpDecayOsc.h
similarity index 98%
rename from Framework/CurveFitting/inc/MantidCurveFitting/ExpDecayOsc.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ExpDecayOsc.h
index 9f896924044cb2578fda36b0e6a93e150e60d760..07d3ad4d03a47a66ed337c142a60e9cf21012683 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/ExpDecayOsc.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ExpDecayOsc.h
@@ -9,6 +9,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 /**
 Provide oscillating exponential decay function:
 h*exp(-lambda.x)*(cos(2pi*f*x+phi))
@@ -61,6 +62,7 @@ protected:
   virtual void init();
 };
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/FlatBackground.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/FlatBackground.h
similarity index 93%
rename from Framework/CurveFitting/inc/MantidCurveFitting/FlatBackground.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/FlatBackground.h
index 1de1aba3bd9ee7a9c61ee04dd1151e4e9381fa3b..cb1add3374562c945fe024946ec3079fdb382742 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/FlatBackground.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/FlatBackground.h
@@ -1,11 +1,12 @@
 #ifndef MANTID_CURVEFITTING_FLATBACKGROUND_H_
 #define MANTID_CURVEFITTING_FLATBACKGROUND_H_
 
-#include "MantidCurveFitting/BackgroundFunction.h"
+#include "MantidCurveFitting/Functions/BackgroundFunction.h"
 #include "MantidKernel/System.h"
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 
 /** FlatBackground : TODO: DESCRIPTION
 
@@ -47,6 +48,7 @@ private:
   void init();
 };
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/FullprofPolynomial.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/FullprofPolynomial.h
similarity index 96%
rename from Framework/CurveFitting/inc/MantidCurveFitting/FullprofPolynomial.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/FullprofPolynomial.h
index 114437e08a4a6e6aee0465c1d92866fd9822b91e..8a5f52c3953d950f5b62cf7a0b981b4f84c2e7ad 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/FullprofPolynomial.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/FullprofPolynomial.h
@@ -2,10 +2,11 @@
 #define MANTID_CURVEFITTING_FULLPROFPOLYNOMIAL_H_
 
 #include "MantidKernel/System.h"
-#include "MantidCurveFitting/BackgroundFunction.h"
+#include "MantidCurveFitting/Functions/BackgroundFunction.h"
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 
 /** FullprofPolynomial : Polynomial background defined in Fullprof
 
@@ -75,6 +76,7 @@ private:
 
 typedef boost::shared_ptr<FullprofPolynomial> FullprofPolynomial_sptr;
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/GausDecay.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/GausDecay.h
similarity index 97%
rename from Framework/CurveFitting/inc/MantidCurveFitting/GausDecay.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/GausDecay.h
index ac17d7122184a9f52292a9c78d746ff4437fde4f..053d65163a9f60a0e561be628579b227d1035913 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/GausDecay.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/GausDecay.h
@@ -9,6 +9,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 /**
 Provide gaussian decay function: A*exp(-(sigma.x)^2))
 
@@ -59,6 +60,7 @@ protected:
   virtual void init();
 };
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/GausOsc.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/GausOsc.h
similarity index 97%
rename from Framework/CurveFitting/inc/MantidCurveFitting/GausOsc.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/GausOsc.h
index a80e5df087e7bc3e06fb5704268eab30bfc6731d..b54279a77ada4db8cfb55bbf53a1d1fe9b482049 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/GausOsc.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/GausOsc.h
@@ -9,6 +9,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 /**
 Provide gaussian decay function: A*exp(-(sigma.x)^2))
 
@@ -59,6 +60,7 @@ protected:
   virtual void init();
 };
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Gaussian.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Gaussian.h
similarity index 98%
rename from Framework/CurveFitting/inc/MantidCurveFitting/Gaussian.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/Gaussian.h
index da8d2b4914c7e01e33c5ef83cd1e7e2944a40f29..c56f8618d54c3feca5e7bbc3937ae6456b771c58 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/Gaussian.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Gaussian.h
@@ -9,6 +9,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 /**
 Provide gaussian peak shape function interface to IPeakFunction.
 I.e. the function: Height*exp(-0.5*((x-PeakCentre)/Sigma)^2).
@@ -79,6 +80,7 @@ protected:
   virtual void init();
 };
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/GaussianComptonProfile.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/GaussianComptonProfile.h
similarity index 96%
rename from Framework/CurveFitting/inc/MantidCurveFitting/GaussianComptonProfile.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/GaussianComptonProfile.h
index 4030a64cac4039f4307b3b07fd9ed045985d06dc..60c6ffe5f6266ade00fef84d9785ab66e12588ea 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/GaussianComptonProfile.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/GaussianComptonProfile.h
@@ -2,10 +2,11 @@
 #define MANTID_CURVEFITTING_GAUSSIANCOMPTONPROFILE_H_
 
 #include "MantidCurveFitting/DllConfig.h"
-#include "MantidCurveFitting/ComptonProfile.h"
+#include "MantidCurveFitting/Functions/ComptonProfile.h"
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 
 /**
   Implements a function to calculate the Compton profile of a nucleus using a
@@ -64,6 +65,7 @@ private:
                    const double amplitude) const;
 };
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/GramCharlierComptonProfile.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/GramCharlierComptonProfile.h
similarity index 94%
rename from Framework/CurveFitting/inc/MantidCurveFitting/GramCharlierComptonProfile.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/GramCharlierComptonProfile.h
index bc8e1b4fd01d4ac647b5c2afd8812084adbd850b..14cbb33b841dfca79fb96e8da8705c1d25da2012 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/GramCharlierComptonProfile.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/GramCharlierComptonProfile.h
@@ -2,10 +2,11 @@
 #define MANTID_CURVEFITTING_GRAMCHARLIERCOMPTONPROFILE_H_
 
 #include "MantidCurveFitting/DllConfig.h"
-#include "MantidCurveFitting/ComptonProfile.h"
+#include "MantidCurveFitting/Functions/ComptonProfile.h"
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 /**
 
   Implements a function to calculate the Compton profile of a nucleus using a
@@ -75,7 +76,8 @@ private:
                      size_t wi, double startX, double endX);
   /// Pre-calculate the Y-space values
   void cacheYSpaceValues(const std::vector<double> &tseconds,
-                         const bool isHistogram, const DetectorParams &detpar);
+                         const bool isHistogram,
+                         const Algorithms::DetectorParams &detpar);
 
   /// The active hermite coefficents
   std::vector<short> m_hermite;
@@ -95,6 +97,7 @@ private:
   bool m_userFixedFSE;
 };
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/IkedaCarpenterPV.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/IkedaCarpenterPV.h
similarity index 98%
rename from Framework/CurveFitting/inc/MantidCurveFitting/IkedaCarpenterPV.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/IkedaCarpenterPV.h
index ecb2f57bc9166e4d8232bfdd9bc90ef2208496eb..bc8cc43f3e66a697a9e61977a4b8c037736306bb 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/IkedaCarpenterPV.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/IkedaCarpenterPV.h
@@ -9,6 +9,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 /**
 Provide Ikeda-Carpenter-pseudo-Voigt peak shape function interface to
 IPeakFunction. See wiki
@@ -96,6 +97,7 @@ private:
                             double &eta) const;
 };
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/LinearBackground.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/LinearBackground.h
similarity index 95%
rename from Framework/CurveFitting/inc/MantidCurveFitting/LinearBackground.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/LinearBackground.h
index 3919c08b16233c0625e92ec5e7496e8280a9ce86..e8ba0edd4443cd9bf9277159cf528a001dd62fb9 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/LinearBackground.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/LinearBackground.h
@@ -4,10 +4,11 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/BackgroundFunction.h"
+#include "MantidCurveFitting/Functions/BackgroundFunction.h"
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 /**
 Provide linear function interface to IFunction.
 I.e. the function: A0+A1*x.
@@ -61,6 +62,7 @@ protected:
   virtual void init();
 };
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/LogNormal.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/LogNormal.h
similarity index 97%
rename from Framework/CurveFitting/inc/MantidCurveFitting/LogNormal.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/LogNormal.h
index 6816b53db955c049ce4ae2e8d83230f99e43eb47..90273384e73961fbff8ab34e0fea5f01e0bb5adf 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/LogNormal.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/LogNormal.h
@@ -9,6 +9,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 /**
 Provide Log Normal function: h*exp(-(log(x)-t)^2 / (2*b^2) )/x
 
@@ -54,6 +55,7 @@ protected:
                                const size_t nData);
 };
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Lorentzian.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Lorentzian.h
similarity index 98%
rename from Framework/CurveFitting/inc/MantidCurveFitting/Lorentzian.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/Lorentzian.h
index b6b816d9d1fbd762e8d01d271bfa37ed305b06e3..132408dee74bf59f15c532d86ac917d00b2d32da 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/Lorentzian.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Lorentzian.h
@@ -8,6 +8,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 /**
 Provide lorentzian peak shape function interface to IPeakFunction.
 I.e. the function: \f$ \frac{A}{\pi}( \Gamma/2((x-PeakCentre)^2+(\Gamma/2)^2)
@@ -69,6 +70,7 @@ protected:
   virtual void init();
 };
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Lorentzian1D.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Lorentzian1D.h
similarity index 95%
rename from Framework/CurveFitting/inc/MantidCurveFitting/Lorentzian1D.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/Lorentzian1D.h
index 66fb65e18476ca6e7ad6bb53eb9cd19e8b8b7bc0..6211f2d053b617abcf03f5084cc31ee7966ec979 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/Lorentzian1D.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Lorentzian1D.h
@@ -4,10 +4,11 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/Fit1D.h"
+#include "MantidCurveFitting/Algorithms/Fit1D.h"
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 /**
 Deprecation notice: instead of using this algorithm please use the Fit algorithm
 where the Function parameter of this algorithm is used
@@ -50,7 +51,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 File change history is stored at: <https://github.com/mantidproject/mantid>
 Code Documentation is available at: <http://doxygen.mantidproject.org>
 */
-class DLLExport Lorentzian1D : public Fit1D {
+class DLLExport Lorentzian1D : public Algorithms::Fit1D {
 public:
   /// Destructor
   virtual ~Lorentzian1D(){};
@@ -80,6 +81,7 @@ private:
                      const double *xValues, const size_t nData);
 };
 
+} // namespace Functions
 } // namespace Algorithm
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/MuonFInteraction.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/MuonFInteraction.h
similarity index 97%
rename from Framework/CurveFitting/inc/MantidCurveFitting/MuonFInteraction.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/MuonFInteraction.h
index 508ea9d2279cf4635302d25f6a90425c4bb7a156..f474266b5605ce12a87c96a79e392d5410ac75dc 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/MuonFInteraction.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/MuonFInteraction.h
@@ -9,6 +9,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 /**
 Provide Muon F Interaction fitting function
 
@@ -57,6 +58,7 @@ protected:
   virtual void init();
 };
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/NeutronBk2BkExpConvPVoigt.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/NeutronBk2BkExpConvPVoigt.h
similarity index 98%
rename from Framework/CurveFitting/inc/MantidCurveFitting/NeutronBk2BkExpConvPVoigt.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/NeutronBk2BkExpConvPVoigt.h
index 93933ea8871a7327b1b0ceee740fc07591c25cc5..7ddc907fdabb05231397f386d2bff50dab3e7d54 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/NeutronBk2BkExpConvPVoigt.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/NeutronBk2BkExpConvPVoigt.h
@@ -6,6 +6,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 
 /** NeutronBk2BkExpConvPVoigt : Back-to-back exponential function convoluted
   with pseudo-voigt
@@ -128,6 +129,7 @@ private:
   mutable double m_N;
 };
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/PawleyFunction.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/PawleyFunction.h
similarity index 99%
rename from Framework/CurveFitting/inc/MantidCurveFitting/PawleyFunction.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/PawleyFunction.h
index a9e3214fd494c581db6725e82b1b4c62cd5ca66d..a56373b31075af5abccf29966b2c68b123f557a1 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/PawleyFunction.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/PawleyFunction.h
@@ -13,6 +13,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 
 /** @class PawleyParameterFunction
 
@@ -173,6 +174,7 @@ protected:
 
 typedef boost::shared_ptr<PawleyFunction> PawleyFunction_sptr;
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/PeakParameterFunction.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/PeakParameterFunction.h
similarity index 98%
rename from Framework/CurveFitting/inc/MantidCurveFitting/PeakParameterFunction.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/PeakParameterFunction.h
index 22621031ef1242d457f5d30003eb08aeec097836..e0d34610fbf5f7bd3b948b584c0691614dc68058 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/PeakParameterFunction.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/PeakParameterFunction.h
@@ -8,6 +8,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 
 /** PeakParameterFunction :
 
@@ -62,6 +63,7 @@ protected:
   API::IPeakFunction_sptr m_peakFunction;
 };
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Polynomial.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Polynomial.h
similarity index 95%
rename from Framework/CurveFitting/inc/MantidCurveFitting/Polynomial.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/Polynomial.h
index 94cfa29b53e326a109883a9d444bfd66183698fc..fcb944652788d7d91509eb50452853cf582f13ea 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/Polynomial.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Polynomial.h
@@ -2,11 +2,12 @@
 #define MANTID_CURVEFITTING_POLYNOMIAL_H_
 
 #include "MantidKernel/System.h"
-#include "MantidCurveFitting/BackgroundFunction.h"
+#include "MantidCurveFitting/Functions/BackgroundFunction.h"
 #include <cmath>
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 
 /** Polynomial : N-th polynomial background function.
 
@@ -73,6 +74,7 @@ private:
 
 typedef boost::shared_ptr<Polynomial> Polynomial_sptr;
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ProcessBackground.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ProcessBackground.h
similarity index 97%
rename from Framework/CurveFitting/inc/MantidCurveFitting/ProcessBackground.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ProcessBackground.h
index 3b9c09886fefe4018ceac089427213d4f95f24a2..e5b8e1dd27201ed2404d63fb88e4992e592dcea6 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/ProcessBackground.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ProcessBackground.h
@@ -3,7 +3,7 @@
 
 #include "MantidKernel/System.h"
 #include "MantidAPI/Algorithm.h"
-#include "MantidCurveFitting/BackgroundFunction.h"
+#include "MantidCurveFitting/Functions/BackgroundFunction.h"
 #include "MantidDataObjects/Workspace2D.h"
 #include "MantidDataObjects/TableWorkspace.h"
 #include "MantidKernel/ArrayProperty.h"
@@ -13,6 +13,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 
 class RemovePeaks {
 public:
@@ -141,6 +142,7 @@ private:
   void fitBackgroundFunction(std::string bkgdfunctiontype);
 };
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ProductFunction.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ProductFunction.h
similarity index 98%
rename from Framework/CurveFitting/inc/MantidCurveFitting/ProductFunction.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ProductFunction.h
index 83ca1c3239d57117d8822d75ee2ed884e5f1adc7..cef21a282322ecfe74c8250d2db5ac344b69a72f 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/ProductFunction.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ProductFunction.h
@@ -10,6 +10,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 /**
 Allow user to create a fit function which is the product of two or
 more other fit functions.
@@ -62,6 +63,7 @@ protected:
   virtual void init(){};
 };
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ProductLinearExp.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ProductLinearExp.h
similarity index 97%
rename from Framework/CurveFitting/inc/MantidCurveFitting/ProductLinearExp.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ProductLinearExp.h
index b49be7f9b1dfbc992b354277ca51ef82959c2d33..2e54ad0d69c2253c092fe8008ab60508fb24dd51 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/ProductLinearExp.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ProductLinearExp.h
@@ -7,6 +7,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 
 /** ProductLinearExp : Function that evauates the product of an exponential and
   linear function.
@@ -49,6 +50,7 @@ protected:
                           const size_t nData) const;
 };
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ProductQuadraticExp.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ProductQuadraticExp.h
similarity index 97%
rename from Framework/CurveFitting/inc/MantidCurveFitting/ProductQuadraticExp.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ProductQuadraticExp.h
index 257482ed18ecc744075382591895133bad6913d8..ac047a16d192d738949c4ad1af2bc1485e970f4f 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/ProductQuadraticExp.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ProductQuadraticExp.h
@@ -7,6 +7,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 
 /** ProductQuadraticExp : Function that evauates the product of an exponential
   and quadratic function.
@@ -49,6 +50,7 @@ protected:
                           const size_t nData) const;
 };
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/PseudoVoigt.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/PseudoVoigt.h
similarity index 98%
rename from Framework/CurveFitting/inc/MantidCurveFitting/PseudoVoigt.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/PseudoVoigt.h
index 6c970c4b17c2b18b4f6ae5c6e8780428e36b3164..53a3f331d2bd26ced8e7eca0260cb55ed230009f 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/PseudoVoigt.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/PseudoVoigt.h
@@ -6,6 +6,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 
 /** PseudoVoigt
 
@@ -71,6 +72,7 @@ protected:
   void init();
 };
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Quadratic.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Quadratic.h
similarity index 95%
rename from Framework/CurveFitting/inc/MantidCurveFitting/Quadratic.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/Quadratic.h
index 0e1e6f08553667bcb36cc7f9f922da615d2d5cbd..41eb1812f44767733cd18005bc0c6b2a9147a8c1 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/Quadratic.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Quadratic.h
@@ -4,10 +4,11 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/BackgroundFunction.h"
+#include "MantidCurveFitting/Functions/BackgroundFunction.h"
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 /**
 Provide quadratic function interface to IFunction.
 I.e. the function: A0+A1*x+A2*x^2
@@ -60,6 +61,7 @@ protected:
   virtual void init();
 };
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ReflectivityMulf.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ReflectivityMulf.h
similarity index 97%
rename from Framework/CurveFitting/inc/MantidCurveFitting/ReflectivityMulf.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ReflectivityMulf.h
index 0ccf77e23f6d2639013ba29334afbcaa7794d71c..b1c6fb99b986b55055e602d648be001b8ab03b76 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/ReflectivityMulf.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ReflectivityMulf.h
@@ -10,6 +10,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 
 /** ReflectivityMulf : Calculate the ReflectivityMulf from a simple layer model.
 
@@ -59,6 +60,7 @@ private:
 
 typedef boost::shared_ptr<ReflectivityMulf> ReflectivityMulf_sptr;
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Resolution.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Resolution.h
similarity index 96%
rename from Framework/CurveFitting/inc/MantidCurveFitting/Resolution.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/Resolution.h
index fd7237629dd03edb73858578fc5fa931afc2ab55..bfb2f49bc06f0f68c352223eca731199f136b809 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/Resolution.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Resolution.h
@@ -4,10 +4,11 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/TabulatedFunction.h"
+#include "MantidCurveFitting/Functions/TabulatedFunction.h"
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 /**
 Resolution function. It is implemented in terms of TabulatedFunction but doesn't
 inherit form it.
@@ -67,6 +68,7 @@ private:
   TabulatedFunction m_fun;
 };
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/SimpleChebfun.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/SimpleChebfun.h
similarity index 97%
rename from Framework/CurveFitting/inc/MantidCurveFitting/SimpleChebfun.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/SimpleChebfun.h
index 5da29131ea0bbc5f41d67d8e7ef924dde747f6a2..e05bfbcd112c0541933de0e440b03217a2e6d67c 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/SimpleChebfun.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/SimpleChebfun.h
@@ -2,10 +2,11 @@
 #define MANTID_CURVEFITTING_SIMPLECHEBFUN_H_
 
 #include "MantidKernel/System.h"
-#include "MantidCurveFitting/ChebfunBase.h"
+#include "MantidCurveFitting/Functions/ChebfunBase.h"
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 
 /** SimpleChebfun : approximates smooth 1d functions and
   provides methods to manipulate them.
@@ -94,6 +95,7 @@ private:
   bool m_badFit;
 };
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/StaticKuboToyabe.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/StaticKuboToyabe.h
similarity index 97%
rename from Framework/CurveFitting/inc/MantidCurveFitting/StaticKuboToyabe.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/StaticKuboToyabe.h
index b959aa5ecf47e81356d1188da75598381b6fe764..b6beff8a18a795ef96eb64ab6cc427a7f5336910 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/StaticKuboToyabe.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/StaticKuboToyabe.h
@@ -9,6 +9,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 /**
 Provide static Kubo Toyabe fitting function
 
@@ -57,6 +58,7 @@ protected:
   virtual void init();
 };
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/StaticKuboToyabeTimesExpDecay.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/StaticKuboToyabeTimesExpDecay.h
similarity index 97%
rename from Framework/CurveFitting/inc/MantidCurveFitting/StaticKuboToyabeTimesExpDecay.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/StaticKuboToyabeTimesExpDecay.h
index 143973e3c742846f82b86e3963db8aa2314f8173..0ceebf0aa2ecec4259996780b29d09d45a8dc251 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/StaticKuboToyabeTimesExpDecay.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/StaticKuboToyabeTimesExpDecay.h
@@ -6,6 +6,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 
 /**
   StaticKuboToyabeTimesExpDecay fitting function
@@ -51,6 +52,7 @@ protected:
   virtual void init();
 };
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/StaticKuboToyabeTimesGausDecay.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/StaticKuboToyabeTimesGausDecay.h
similarity index 97%
rename from Framework/CurveFitting/inc/MantidCurveFitting/StaticKuboToyabeTimesGausDecay.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/StaticKuboToyabeTimesGausDecay.h
index 0b4d63300dcb6c717fbc06db0986a5ace4c70838..6f9370af94cadbeff4d3fa1b48fd050e2d6901d3 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/StaticKuboToyabeTimesGausDecay.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/StaticKuboToyabeTimesGausDecay.h
@@ -6,6 +6,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 
 /**
   StaticKuboToyabeTimesGausDecay fitting function.
@@ -51,6 +52,7 @@ protected:
   virtual void init();
 };
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/StretchExp.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/StretchExp.h
similarity index 97%
rename from Framework/CurveFitting/inc/MantidCurveFitting/StretchExp.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/StretchExp.h
index 7f61f545b008744c2e7a173de94ea3ad86e473cc..43677513e130aeb2df4d37dcc7753d5f06b417f3 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/StretchExp.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/StretchExp.h
@@ -9,6 +9,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 /**
 Provide Streteched Exponential fitting function: h*exp(-(x/t)^b )
 
@@ -55,6 +56,7 @@ protected:
                                const size_t nData);
 };
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/StretchExpMuon.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/StretchExpMuon.h
similarity index 97%
rename from Framework/CurveFitting/inc/MantidCurveFitting/StretchExpMuon.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/StretchExpMuon.h
index 433965a34874a6ce489df33ee7a2d1317bd2711b..4816212d1a4a8840e2538c9e249c829f96f39e43 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/StretchExpMuon.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/StretchExpMuon.h
@@ -8,6 +8,7 @@
 #include "MantidAPI/IFunction1D.h"
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 /**
 Provide stetch exponential function for Muon scientists
 
@@ -52,6 +53,7 @@ protected:
   virtual void init();
 };
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/TabulatedFunction.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/TabulatedFunction.h
similarity index 98%
rename from Framework/CurveFitting/inc/MantidCurveFitting/TabulatedFunction.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/TabulatedFunction.h
index 2fe8d9ae5d15127e1e7f3e2687d4dfe2a3b0fcc9..a4e4812efbeb5b7ca51bc888c8f604f1af4503da 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/TabulatedFunction.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/TabulatedFunction.h
@@ -19,6 +19,7 @@ class MatrixWorkspace;
 }
 
 namespace CurveFitting {
+namespace Functions {
 /**
 
 A function which takes its values from a file or a workspace. The values atr
@@ -124,6 +125,7 @@ private:
   mutable bool m_setupFinished;
 };
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ThermalNeutronBk2BkExpAlpha.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpAlpha.h
similarity index 98%
rename from Framework/CurveFitting/inc/MantidCurveFitting/ThermalNeutronBk2BkExpAlpha.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpAlpha.h
index a8b2aee386cb1ee75b40be77b19b5085fd089919..5ee5b6e50b500c5dfa5e7a0c9b76294195214587 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/ThermalNeutronBk2BkExpAlpha.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpAlpha.h
@@ -7,6 +7,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 
 /** ThermalNeutronBk2BkExpAlpha : Function to calculate Alpha of Bk2Bk
   Exponential function from
@@ -71,6 +72,7 @@ private:
 typedef boost::shared_ptr<ThermalNeutronBk2BkExpAlpha>
     ThermalNeutronBk2BkExpAlpha_sptr;
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ThermalNeutronBk2BkExpBeta.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpBeta.h
similarity index 98%
rename from Framework/CurveFitting/inc/MantidCurveFitting/ThermalNeutronBk2BkExpBeta.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpBeta.h
index f88f29f5001131df88a7b0030389647467642562..31e1d7efd7975e0257a0fab7d6865f37a9225fa5 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/ThermalNeutronBk2BkExpBeta.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpBeta.h
@@ -7,6 +7,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 
 /** ThermalNeutronBk2BkExpBETA : Function to calculate Beta of Bk2Bk Exponential
   function from
@@ -71,6 +72,7 @@ private:
 typedef boost::shared_ptr<ThermalNeutronBk2BkExpBeta>
     ThermalNeutronBk2BkExpBeta_sptr;
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ThermalNeutronBk2BkExpConvPVoigt.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpConvPVoigt.h
similarity index 99%
rename from Framework/CurveFitting/inc/MantidCurveFitting/ThermalNeutronBk2BkExpConvPVoigt.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpConvPVoigt.h
index e36a938cb9b8f0b12cad3306ff2d0a6112d73ba2..267f3ab7819f647cbdf717fe422fcc9a1315e0a1 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/ThermalNeutronBk2BkExpConvPVoigt.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpConvPVoigt.h
@@ -8,6 +8,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 
 /** ThermalNeutronBk2BkExpConvPVoigt :
     Back-to-back exponential convoluted with pseudo Voigt for thermal neutron
@@ -196,6 +197,7 @@ inline double calCubicDSpace(double a, int h, int k, int l)
 /// Integral for Gamma
 // std::complex<double> E1X(std::complex<double> z);
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ThermalNeutronBk2BkExpSigma.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpSigma.h
similarity index 98%
rename from Framework/CurveFitting/inc/MantidCurveFitting/ThermalNeutronBk2BkExpSigma.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpSigma.h
index c4534681d1b727069a4d88299628dae824655d1e..412ea0d44021b1cacac2edfdc884cf7a9b61e604 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/ThermalNeutronBk2BkExpSigma.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronBk2BkExpSigma.h
@@ -7,6 +7,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 
 /** ThermalNeutronBk2BkExpSIGMA : Function to calculate Sigma of Bk2Bk
   Exponential function from
@@ -70,6 +71,7 @@ private:
 typedef boost::shared_ptr<ThermalNeutronBk2BkExpSigma>
     ThermalNeutronBk2BkExpSigma_sptr;
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ThermalNeutronDtoTOFFunction.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronDtoTOFFunction.h
similarity index 98%
rename from Framework/CurveFitting/inc/MantidCurveFitting/ThermalNeutronDtoTOFFunction.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronDtoTOFFunction.h
index 0fef3abbf8c1175838de6a4166e51d3bc25ea1f2..8d0c4a2ed846b5bcd0b3636a287ceb33606ef2a5 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/ThermalNeutronDtoTOFFunction.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronDtoTOFFunction.h
@@ -14,6 +14,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 
 /** ThermalNeutronDtoTOFFunction : TODO: DESCRIPTION
 
@@ -98,6 +99,7 @@ inline double calThermalNeutronTOF(double dh, double dtt1, double dtt1t,
   return tof_h;
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/UserFunction.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/UserFunction.h
similarity index 98%
rename from Framework/CurveFitting/inc/MantidCurveFitting/UserFunction.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/UserFunction.h
index ca9c41550d92e490dab933ad1a5f55767af82f58..cd6e468fee151c7a2463f3e30729b01f0a54bcb3 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/UserFunction.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/UserFunction.h
@@ -14,6 +14,7 @@ class Parser;
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 /**
 A user defined function.
 
@@ -95,6 +96,7 @@ private:
   static double *AddVariable(const char *varName, void *pufun);
 };
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/UserFunction1D.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/UserFunction1D.h
similarity index 97%
rename from Framework/CurveFitting/inc/MantidCurveFitting/UserFunction1D.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/UserFunction1D.h
index 1c27d36a0a15df1a6b5f40eae0db12c9faefbef0..fefde7f6549aa277abcce768ea6d1d2a5f6d7a43 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/UserFunction1D.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/UserFunction1D.h
@@ -4,12 +4,13 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/Fit1D.h"
+#include "MantidCurveFitting/Algorithms/Fit1D.h"
 #include "MantidGeometry/muParser_Silent.h"
 #include <boost/shared_array.hpp>
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 /**
 Deprecation notice: instead of using this algorithm please use the Fit algorithm
 where the Function parameter of this algorithm is used
@@ -70,7 +71,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 File change history is stored at: <https://github.com/mantidproject/mantid>
 Code Documentation is available at: <http://doxygen.mantidproject.org>
 */
-class UserFunction1D : public Fit1D {
+class UserFunction1D : public Algorithms::Fit1D {
 public:
   /// Constructor
   UserFunction1D()
@@ -121,6 +122,7 @@ private:
   boost::shared_array<double> m_tmp1;
 };
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/VesuvioResolution.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/VesuvioResolution.h
similarity index 96%
rename from Framework/CurveFitting/inc/MantidCurveFitting/VesuvioResolution.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/VesuvioResolution.h
index 02f62fb838f4303c62d893c1d86b769f6dedb560..18576a11ca4f5a8cbb79c07d2bd034470e901cd3 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/VesuvioResolution.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/VesuvioResolution.h
@@ -8,10 +8,13 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Algorithms {
 //---------------------------------------------------------------------------
 // Forward declarations
 //---------------------------------------------------------------------------
 struct DetectorParams;
+}
+namespace Functions {
 
 //---------------------------------------------------------------------------
 /// Simple data structure to store resolution parameter values
@@ -81,7 +84,7 @@ public:
   setMatrixWorkspace(boost::shared_ptr<const API::MatrixWorkspace> workspace,
                      size_t wi, double startX, double endX);
   /// Pre-calculate the resolution components values
-  void cacheResolutionComponents(const DetectorParams &detpar,
+  void cacheResolutionComponents(const Algorithms::DetectorParams &detpar,
                                  const ResolutionParams &respar);
   /// Turn off logger
   void disableLogging() { m_log.setEnabled(false); }
@@ -118,6 +121,7 @@ private:
   ///@}
 };
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Voigt.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Voigt.h
similarity index 98%
rename from Framework/CurveFitting/inc/MantidCurveFitting/Voigt.h
rename to Framework/CurveFitting/inc/MantidCurveFitting/Functions/Voigt.h
index 192bcb12d02833b47a6b2e1defb1d34e1f80c41f..780771239cdf771d7854ff0918fab2af18cf2ab4 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/Voigt.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/Voigt.h
@@ -6,6 +6,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
 
 /**
   Implements an analytical approximation to the Voigt function.
@@ -66,6 +67,7 @@ private:
   void setFwhm(const double value);
 };
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/GSLFunctions.h b/Framework/CurveFitting/inc/MantidCurveFitting/GSLFunctions.h
index 259599a19010f6dc76c6e803aef871e5763c01d4..bde389d04c861786ba31393bf215c6d456523b21 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/GSLFunctions.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/GSLFunctions.h
@@ -7,7 +7,7 @@
 #include <gsl/gsl_blas.h>
 #include "MantidAPI/IFunction.h"
 #include "MantidAPI/ICostFunction.h"
-#include "MantidCurveFitting/CostFuncLeastSquares.h"
+#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h"
 
 namespace Mantid {
 namespace CurveFitting {
@@ -85,7 +85,7 @@ public:
 /// Structure to contain least squares data and used by GSL
 struct GSL_FitData {
   /// Constructor
-  GSL_FitData(boost::shared_ptr<CostFuncLeastSquares> cf);
+  GSL_FitData(boost::shared_ptr<CostFunctions::CostFuncLeastSquares> cf);
   /// Destructor
   ~GSL_FitData();
   /// number of points to be fitted (size of X, Y and sqrtWeightData arrays)
@@ -94,14 +94,14 @@ struct GSL_FitData {
   size_t p;
   /// Pointer to the function
   API::IFunction_sptr function;
-  boost::shared_ptr<CostFuncLeastSquares> costFunction;
+  boost::shared_ptr<CostFunctions::CostFuncLeastSquares> costFunction;
   /// Initial function parameters
   gsl_vector *initFuncParams;
   /// Jacobi matrix interface
   JacobianImpl1 J;
 
   // this is presently commented out in the implementation
-  // gsl_matrix *holdCalculatedJacobian; ///< cache of the claculated jacobian
+  // gsl_matrix *holdCalculatedJacobian; ///< cache of the calculated jacobian
 };
 
 int gsl_f(const gsl_vector *x, void *params, gsl_vector *f);
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/GSLMatrix.h b/Framework/CurveFitting/inc/MantidCurveFitting/GSLMatrix.h
index e9e35f7ac6e9d915984bba1aa8a17d91f7c10955..9add0ff7f666e5946222020673c31a24eb6c58d6 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/GSLMatrix.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/GSLMatrix.h
@@ -241,6 +241,7 @@ inline GSLMatrixMult3 operator*(const GSLMatrixMult2 &mm, const Tr &m) {
 
 /// The << operator. Prints a matrix in rows.
 inline std::ostream &operator<<(std::ostream &ostr, const GSLMatrix &m) {
+  std::ios::fmtflags fflags(ostr.flags());
   ostr << std::scientific << std::setprecision(6);
   for (size_t i = 0; i < m.size1(); ++i) {
     for (size_t j = 0; j < m.size2(); ++j) {
@@ -248,6 +249,7 @@ inline std::ostream &operator<<(std::ostream &ostr, const GSLMatrix &m) {
     }
     ostr << std::endl;
   }
+  ostr.flags(fflags);
   return ostr;
 }
 
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/LatticeFunction.h b/Framework/CurveFitting/inc/MantidCurveFitting/LatticeFunction.h
index dda2fcf1d8358f0e60023c855a4eb5080a758447..3c8886b0b648fe6475b0312904f2987fe694581e 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/LatticeFunction.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/LatticeFunction.h
@@ -4,7 +4,7 @@
 #include "MantidKernel/System.h"
 #include "MantidAPI/ILatticeFunction.h"
 
-#include "MantidCurveFitting/PawleyFunction.h"
+#include "MantidCurveFitting/Functions/PawleyFunction.h"
 
 namespace Mantid {
 namespace CurveFitting {
@@ -61,7 +61,7 @@ protected:
   void beforeDecoratedFunctionSet(const API::IFunction_sptr &fn);
 
 private:
-  PawleyParameterFunction_sptr m_cellParameters;
+  Functions::PawleyParameterFunction_sptr m_cellParameters;
 };
 
 typedef boost::shared_ptr<LatticeFunction> LatticeFunction_sptr;
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/MultiBG.h b/Framework/CurveFitting/inc/MantidCurveFitting/MultiBG.h
deleted file mode 100644
index 506d7e7f047a3cc6dccba054d32ed6ec93e21e94..0000000000000000000000000000000000000000
--- a/Framework/CurveFitting/inc/MantidCurveFitting/MultiBG.h
+++ /dev/null
@@ -1,110 +0,0 @@
-#ifndef MANTID_CURVEFITTING_MULTIBG_H_
-#define MANTID_CURVEFITTING_MULTIBG_H_
-
-//----------------------------------------------------------------------
-// Includes
-//----------------------------------------------------------------------
-#include "MantidAPI/CompositeFunction.h"
-#include "MantidAPI/IFunctionMW.h"
-#include "MantidAPI/MatrixWorkspace_fwd.h"
-
-#ifdef _WIN32
-#pragma warning(disable : 4250)
-#endif
-
-namespace Mantid {
-
-namespace API {
-class WorkspaceGroup;
-}
-
-namespace CurveFitting {
-/** A composite function.
-
-    @author Roman Tolchenov, Tessella Support Services plc
-    @date 19/08/2011
-
-    Copyright &copy; 2009 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge
-   National Laboratory & European Spallation Source
-
-    This file is part of Mantid.
-
-    Mantid is free software; you can 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.
-
-    Mantid is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU 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/>.
-
-    File change history is stored at: <https://github.com/mantidproject/mantid>.
-    Code Documentation is available at: <http://doxygen.mantidproject.org>
-*/
-class DLLExport MultiBG : public API::CompositeFunction {
-public:
-  /// Default constructor
-  MultiBG() : API::CompositeFunction() {}
-  /// Destructor
-  virtual ~MultiBG();
-
-  /* Overriden methods */
-
-  using CompositeFunction::setWorkspace;
-  virtual void setWorkspace(boost::shared_ptr<const API::Workspace>) {}
-  /// Set the workspace
-  void setWorkspace(boost::shared_ptr<const API::Workspace> ws, bool copyData);
-  void setSlicing(const std::string &slicing);
-  virtual boost::shared_ptr<const API::Workspace> getWorkspace() const {
-    return m_spectra[0].first;
-  }
-  /// Returns the function's name
-  std::string name() const { return "MultiBG"; }
-  /// Returns the function's category
-  virtual const std::string category() const { return "Background"; }
-
-  virtual void function(API::FunctionDomain &) const {}
-
-  /// Returns the size of the fitted data (number of double values returned by
-  /// the function)
-  virtual size_t dataSize() const { return m_data.size(); }
-  /// Returns a reference to the fitted data. These data are taken from the
-  /// workspace set by setWorkspace() method.
-  virtual const double *getData() const { return &m_data[0]; }
-  virtual const double *getWeights() const { return &m_weights[0]; }
-  /// Function you want to fit to.
-  void function(double *out) const;
-  /// Derivatives of function with respect to active parameters
-  void functionDeriv(API::Jacobian *out);
-  void functionDeriv(API::FunctionDomain &domain, API::Jacobian &jacobian) {
-    API::IFunction::functionDeriv(domain, jacobian);
-  }
-
-protected:
-  boost::shared_ptr<API::WorkspaceGroup> createCalculatedWorkspaceGroup(
-      const std::vector<double> &sd = std::vector<double>());
-
-  boost::shared_ptr<const API::MatrixWorkspace> m_workspace;
-
-  /// to collect different workspaces found in child functions
-  std::vector<std::pair<boost::shared_ptr<const API::MatrixWorkspace>, size_t>>
-      m_spectra;
-  /// to store function indices to workspaces: m_funIndex[i] gives vector of
-  /// indexes of m_spectra for function i
-  std::vector<std::vector<size_t>> m_funIndex;
-  /// the data vector which is a composition of all fitted spectra
-  std::vector<double> m_data;
-  /// the vector of fitting weights, one for each value in m_data
-  std::vector<double> m_weights;
-  /// offsets of particular workspaces in the m_data and m_weights arrays
-  std::vector<size_t> m_offset;
-};
-
-} // namespace CurveFitting
-} // namespace Mantid
-
-#endif /*MANTID_CURVEFITTING_MULTIBG_H_*/
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/ParDomain.h b/Framework/CurveFitting/inc/MantidCurveFitting/ParDomain.h
index bda5ec1da7cc7a89ee1a20eeb634b7eca1a483a7..c695e7c06bdb07dae06f7888c0898215e8318819 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/ParDomain.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/ParDomain.h
@@ -43,12 +43,13 @@ public:
   virtual void getDomainAndValues(size_t i, API::FunctionDomain_sptr &domain,
                                   API::FunctionValues_sptr &values) const;
   /// Calculate the value of a least squares cost function
-  virtual void leastSquaresVal(const CostFuncLeastSquares &leastSquares);
+  virtual void
+  leastSquaresVal(const CostFunctions::CostFuncLeastSquares &leastSquares);
   /// Calculate the value, first and second derivatives of a least squares cost
   /// function
-  virtual void
-  leastSquaresValDerivHessian(const CostFuncLeastSquares &leastSquares,
-                              bool evalDeriv, bool evalHessian);
+  virtual void leastSquaresValDerivHessian(
+      const CostFunctions::CostFuncLeastSquares &leastSquares, bool evalDeriv,
+      bool evalHessian);
 };
 
 } // namespace CurveFitting
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/SeqDomain.h b/Framework/CurveFitting/inc/MantidCurveFitting/SeqDomain.h
index 5e451efdf3324c3b6d47fd4e9a35f32f9550336f..7066b276f113f0883a8e7dc08376f473dfead9ec 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/SeqDomain.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/SeqDomain.h
@@ -8,8 +8,8 @@
 #include "MantidAPI/FunctionDomain.h"
 #include "MantidAPI/FunctionValues.h"
 #include "MantidAPI/IDomainCreator.h"
-#include "MantidCurveFitting/CostFuncLeastSquares.h"
-#include "MantidCurveFitting/CostFuncRwp.h"
+#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h"
+#include "MantidCurveFitting/CostFunctions/CostFuncRwp.h"
 
 #include <stdexcept>
 #include <vector>
@@ -57,16 +57,17 @@ public:
   /// Add new domain creator
   void addCreator(API::IDomainCreator_sptr creator);
   /// Calculate the value of a least squares cost function
-  virtual void leastSquaresVal(const CostFuncLeastSquares &leastSquares);
+  virtual void
+  leastSquaresVal(const CostFunctions::CostFuncLeastSquares &leastSquares);
   /// Calculate the value, first and second derivatives of a least squares cost
   /// function
-  virtual void
-  leastSquaresValDerivHessian(const CostFuncLeastSquares &leastSquares,
-                              bool evalDeriv, bool evalHessian);
+  virtual void leastSquaresValDerivHessian(
+      const CostFunctions::CostFuncLeastSquares &leastSquares, bool evalDeriv,
+      bool evalHessian);
   /// Calculate the value of a Rwp cost function
-  void rwpVal(const CostFuncRwp &rwp);
+  void rwpVal(const CostFunctions::CostFuncRwp &rwp);
   /// Calculate the value, first and second derivatives of a RWP cost function
-  void rwpValDerivHessian(const CostFuncRwp &rwp, bool evalDeriv,
+  void rwpValDerivHessian(const CostFunctions::CostFuncRwp &rwp, bool evalDeriv,
                           bool evalHessian);
 
   /// Create an instance of SeqDomain in one of two forms: either SeqDomain for
diff --git a/Framework/CurveFitting/src/CalculateChiSquared.cpp b/Framework/CurveFitting/src/Algorithms/CalculateChiSquared.cpp
similarity index 98%
rename from Framework/CurveFitting/src/CalculateChiSquared.cpp
rename to Framework/CurveFitting/src/Algorithms/CalculateChiSquared.cpp
index 0f65e00127775c1c352363f77ef26f0476887d81..17104a9e4b23dd8223a42f8cc5647bc397ee9d10 100644
--- a/Framework/CurveFitting/src/CalculateChiSquared.cpp
+++ b/Framework/CurveFitting/src/Algorithms/CalculateChiSquared.cpp
@@ -1,16 +1,18 @@
-#include "MantidCurveFitting/CalculateChiSquared.h"
+#include "MantidCurveFitting/Algorithms/CalculateChiSquared.h"
 #include "MantidAPI/ITableWorkspace.h"
 #include "MantidAPI/WorkspaceFactory.h"
 #include "MantidAPI/Column.h"
 #include "MantidAPI/TableRow.h"
-#include "MantidCurveFitting/ChebfunBase.h"
+#include "MantidCurveFitting/Functions/ChebfunBase.h"
 #include "MantidCurveFitting/GSLJacobian.h"
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Algorithms {
 
-using namespace Mantid::Kernel;
-using namespace Mantid::API;
+using namespace Kernel;
+using namespace API;
+using namespace Functions;
 
 // Register the algorithm into the AlgorithmFactory
 DECLARE_ALGORITHM(CalculateChiSquared)
@@ -651,5 +653,6 @@ void CalculateChiSquared::refixParameters() {
   }
 }
 
+} // namespace Algorithms
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/CalculateGammaBackground.cpp b/Framework/CurveFitting/src/Algorithms/CalculateGammaBackground.cpp
similarity index 95%
rename from Framework/CurveFitting/src/CalculateGammaBackground.cpp
rename to Framework/CurveFitting/src/Algorithms/CalculateGammaBackground.cpp
index d4dfeb2503d74d64dcf47b5655128fc95fc281c3..a6281e12576ea6a561de2189adf28c38e98ac59f 100644
--- a/Framework/CurveFitting/src/CalculateGammaBackground.cpp
+++ b/Framework/CurveFitting/src/Algorithms/CalculateGammaBackground.cpp
@@ -1,7 +1,7 @@
-#include "MantidCurveFitting/CalculateGammaBackground.h"
-#include "MantidCurveFitting/ComptonProfile.h"
-#include "MantidCurveFitting/ConvertToYSpace.h"
-#include "MantidCurveFitting/VesuvioResolution.h"
+#include "MantidCurveFitting/Algorithms/CalculateGammaBackground.h"
+#include "MantidCurveFitting/Algorithms/ConvertToYSpace.h"
+#include "MantidCurveFitting/Functions/ComptonProfile.h"
+#include "MantidCurveFitting/Functions/VesuvioResolution.h"
 
 #include "MantidAPI/CompositeFunction.h"
 #include "MantidAPI/FunctionProperty.h"
@@ -16,8 +16,12 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Algorithms {
 using namespace API;
 using namespace Kernel;
+using namespace CurveFitting;
+using namespace CurveFitting::Functions;
+using namespace BOOST_FUNCTION_STD_NS;
 using namespace std;
 
 // Subscription
@@ -227,8 +231,9 @@ void CalculateGammaBackground::calculateSpectrumFromDetector(
   // -- Setup detector & resolution parameters --
   DetectorParams detPar =
       ConvertToYSpace::getDetectorParameters(m_inputWS, inputIndex);
-  ResolutionParams detRes =
-      VesuvioResolution::getResolutionParameters(m_inputWS, inputIndex);
+  CurveFitting::Functions::ResolutionParams detRes =
+      CurveFitting::Functions::VesuvioResolution::getResolutionParameters(
+          m_inputWS, inputIndex);
 
   // Compute a time of flight spectrum convolved with a Voigt resolution
   // function for each mass
@@ -254,8 +259,9 @@ void CalculateGammaBackground::calculateBackgroundFromFoils(
   // -- Setup detector & resolution parameters --
   DetectorParams detPar =
       ConvertToYSpace::getDetectorParameters(m_inputWS, inputIndex);
-  ResolutionParams detRes =
-      VesuvioResolution::getResolutionParameters(m_inputWS, inputIndex);
+  CurveFitting::Functions::ResolutionParams detRes =
+      CurveFitting::Functions::VesuvioResolution::getResolutionParameters(
+          m_inputWS, inputIndex);
 
   const size_t nxvalues = m_backgroundWS->blocksize();
   std::vector<double> foilSpectrum(nxvalues);
@@ -320,7 +326,7 @@ void CalculateGammaBackground::calculateBackgroundSingleFoil(
   // Structs to hold geometry & resolution information
   DetectorParams foilPar = detPar; // copy
   foilPar.t0 = 0.0;
-  ResolutionParams foilRes = detRes; // copy
+  CurveFitting::Functions::ResolutionParams foilRes = detRes; // copy
   foilRes.dEnGauss = foilInfo.gaussWidth;
   foilRes.dEnLorentz = foilInfo.lorentzWidth;
 
@@ -388,8 +394,9 @@ void CalculateGammaBackground::calculateTofSpectrum(
       FunctionFactory::Instance().createInitialized(m_profileFunction));
 
   for (size_t i = 0; i < m_npeaks; ++i) {
-    auto profile = boost::dynamic_pointer_cast<ComptonProfile>(
-        profileFunction->getFunction(i));
+    auto profile =
+        boost::dynamic_pointer_cast<CurveFitting::Functions::ComptonProfile>(
+            profileFunction->getFunction(i));
     profile->disableLogging();
     profile->setUpForFit();
     profile->cacheYSpaceValues(tseconds, false, detpar, respar);
@@ -422,8 +429,9 @@ void CalculateGammaBackground::retrieveInputs() {
           boost::dynamic_pointer_cast<CompositeFunction>(profileFunction)) {
     m_npeaks = composite->nFunctions();
     for (size_t i = 0; i < m_npeaks; ++i) {
-      auto single = boost::dynamic_pointer_cast<ComptonProfile>(
-          composite->getFunction(i));
+      auto single =
+          boost::dynamic_pointer_cast<CurveFitting::Functions::ComptonProfile>(
+              composite->getFunction(i));
       if (!single) {
         throw std::invalid_argument("Invalid function. Composite must contain "
                                     "only ComptonProfile functions");
@@ -595,5 +603,6 @@ std::pair<double, double> CalculateGammaBackground::calculateThetaRange(
   return std::make_pair(theta - dtheta, theta + dtheta);
 }
 
+} // namespace Algorithms
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/CalculateMSVesuvio.cpp b/Framework/CurveFitting/src/Algorithms/CalculateMSVesuvio.cpp
similarity index 96%
rename from Framework/CurveFitting/src/CalculateMSVesuvio.cpp
rename to Framework/CurveFitting/src/Algorithms/CalculateMSVesuvio.cpp
index 1b9aea72dde7c708db9ec294cd7861830a9b50c6..c34d6b66b7caf69f416a7fb04af6a6f341c9a881 100644
--- a/Framework/CurveFitting/src/CalculateMSVesuvio.cpp
+++ b/Framework/CurveFitting/src/Algorithms/CalculateMSVesuvio.cpp
@@ -1,11 +1,11 @@
 //-----------------------------------------------------------------------------
 // Includes
 //-----------------------------------------------------------------------------
-#include "MantidCurveFitting/CalculateMSVesuvio.h"
+#include "MantidCurveFitting/Algorithms/CalculateMSVesuvio.h"
 // Use helpers for storing detector/resolution parameters
-#include "MantidCurveFitting/ConvertToYSpace.h"
+#include "MantidCurveFitting/Algorithms/ConvertToYSpace.h"
 #include "MantidCurveFitting/MSVesuvioHelpers.h"
-#include "MantidCurveFitting/VesuvioResolution.h"
+#include "MantidCurveFitting/Functions/VesuvioResolution.h"
 
 #include "MantidAPI/SampleShapeValidator.h"
 #include "MantidAPI/WorkspaceValidators.h"
@@ -25,8 +25,11 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Algorithms {
 using namespace API;
 using namespace Kernel;
+using namespace CurveFitting;
+using namespace CurveFitting::Functions;
 using Geometry::Link;
 using Geometry::ParameterMap;
 using Geometry::Track;
@@ -137,7 +140,8 @@ void CalculateMSVesuvio::exec() {
   MatrixWorkspace_sptr multsc = WorkspaceFactory::Instance().create(m_inputWS);
 
   // Initialize random number generator
-  m_randgen = new MSVesuvioHelper::RandomNumberGenerator(getProperty("Seed"));
+  m_randgen = new CurveFitting::MSVesuvioHelper::RandomNumberGenerator(
+      getProperty("Seed"));
 
   // Setup progress
   const size_t nhist = m_inputWS->getNumberHistograms();
@@ -319,11 +323,11 @@ void CalculateMSVesuvio::calculateMS(const size_t wsIndex,
   DetectorParams detpar =
       ConvertToYSpace::getDetectorParameters(m_inputWS, wsIndex);
   detpar.t0 *= 1e6; // t0 in microseconds here
-  ResolutionParams respar =
-      VesuvioResolution::getResolutionParameters(m_inputWS, wsIndex);
+  Functions::ResolutionParams respar =
+      Functions::VesuvioResolution::getResolutionParameters(m_inputWS, wsIndex);
 
   // Final counts averaged over all simulations
-  MSVesuvioHelper::SimulationAggregator accumulator(m_nruns);
+  CurveFitting::MSVesuvioHelper::SimulationAggregator accumulator(m_nruns);
   for (size_t i = 0; i < m_nruns; ++i) {
     m_progress->report("MS calculation: idx=" +
                        boost::lexical_cast<std::string>(wsIndex) + ", run=" +
@@ -338,7 +342,8 @@ void CalculateMSVesuvio::calculateMS(const size_t wsIndex,
   }
 
   // Average over all runs and assign to output workspaces
-  MSVesuvioHelper::SimulationWithErrors avgCounts = accumulator.average();
+  CurveFitting::MSVesuvioHelper::SimulationWithErrors avgCounts =
+      accumulator.average();
   avgCounts.normalise();
   assignToOutput(avgCounts, totalsc, multsc);
 }
@@ -354,7 +359,7 @@ void CalculateMSVesuvio::calculateMS(const size_t wsIndex,
  */
 void CalculateMSVesuvio::simulate(
     const DetectorParams &detpar, const ResolutionParams &respar,
-    MSVesuvioHelper::Simulation &simulCounts) const {
+    CurveFitting::MSVesuvioHelper::Simulation &simulCounts) const {
   for (size_t i = 0; i < m_nevents; ++i) {
     calculateCounts(detpar, respar, simulCounts);
   }
@@ -369,7 +374,7 @@ void CalculateMSVesuvio::simulate(
  * scattering contribution
  */
 void CalculateMSVesuvio::assignToOutput(
-    const MSVesuvioHelper::SimulationWithErrors &avgCounts,
+    const CurveFitting::MSVesuvioHelper::SimulationWithErrors &avgCounts,
     API::ISpectrum &totalsc, API::ISpectrum &multsc) const {
   // Sum up all multiple scatter events
   auto &msscatY = multsc.dataY();
@@ -404,7 +409,7 @@ void CalculateMSVesuvio::assignToOutput(
  */
 double CalculateMSVesuvio::calculateCounts(
     const DetectorParams &detpar, const ResolutionParams &respar,
-    MSVesuvioHelper::Simulation &simulation) const {
+    CurveFitting::MSVesuvioHelper::Simulation &simulation) const {
   double weightSum(0.0);
 
   // moderator coord in lab frame
@@ -785,13 +790,14 @@ double CalculateMSVesuvio::generateE1(const double angle, const double e1nom,
   const double randv = m_randgen->flat();
   if (e1nom < 5000.0) {
     if (angle > 90.0)
-      return MSVesuvioHelper::finalEnergyAuDD(randv);
+      return CurveFitting::MSVesuvioHelper::finalEnergyAuDD(randv);
     else
-      return MSVesuvioHelper::finalEnergyAuYap(randv);
+      return CurveFitting::MSVesuvioHelper::finalEnergyAuYap(randv);
   } else {
-    return MSVesuvioHelper::finalEnergyUranium(randv);
+    return CurveFitting::MSVesuvioHelper::finalEnergyUranium(randv);
   }
 }
 
 } // namespace Algorithms
+} // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/ConvertToYSpace.cpp b/Framework/CurveFitting/src/Algorithms/ConvertToYSpace.cpp
similarity index 98%
rename from Framework/CurveFitting/src/ConvertToYSpace.cpp
rename to Framework/CurveFitting/src/Algorithms/ConvertToYSpace.cpp
index e7c099c6f5d44cb04c4c958dc3115f5c79776928..1124ff0504e39bf341dc6e2d45f958ec507eeda8 100644
--- a/Framework/CurveFitting/src/ConvertToYSpace.cpp
+++ b/Framework/CurveFitting/src/Algorithms/ConvertToYSpace.cpp
@@ -1,4 +1,4 @@
-#include "MantidCurveFitting/ConvertToYSpace.h"
+#include "MantidCurveFitting/Algorithms/ConvertToYSpace.h"
 
 #include "MantidAPI/WorkspaceValidators.h"
 #include "MantidGeometry/Instrument/DetectorGroup.h"
@@ -8,6 +8,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Algorithms {
 
 // Register the algorithm into the AlgorithmFactory
 DECLARE_ALGORITHM(ConvertToYSpace)
@@ -299,5 +300,6 @@ void ConvertToYSpace::cacheInstrumentGeometry() {
   m_samplePos = sample->getPos();
 }
 
+} // namespace Algorithms
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/ConvolveWorkspaces.cpp b/Framework/CurveFitting/src/Algorithms/ConvolveWorkspaces.cpp
similarity index 92%
rename from Framework/CurveFitting/src/ConvolveWorkspaces.cpp
rename to Framework/CurveFitting/src/Algorithms/ConvolveWorkspaces.cpp
index c8bc4034617b52b04c993398b9051a33012d4ca1..860d527201a1ef0c1501070ca0fb35f7b680b631 100644
--- a/Framework/CurveFitting/src/ConvolveWorkspaces.cpp
+++ b/Framework/CurveFitting/src/Algorithms/ConvolveWorkspaces.cpp
@@ -1,9 +1,9 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/ConvolveWorkspaces.h"
-#include "MantidCurveFitting/Convolution.h"
-#include "MantidCurveFitting/TabulatedFunction.h"
+#include "MantidCurveFitting/Algorithms/ConvolveWorkspaces.h"
+#include "MantidCurveFitting/Functions/Convolution.h"
+#include "MantidCurveFitting/Functions/TabulatedFunction.h"
 #include <sstream>
 #include <gsl/gsl_errno.h>
 #include <gsl/gsl_fft_real.h>
@@ -11,6 +11,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Algorithms {
 
 // Register the algorithm into the AlgorithmFactory
 DECLARE_ALGORITHM(ConvolveWorkspaces)
@@ -25,6 +26,7 @@ using namespace Kernel;
 using namespace API;
 using namespace DataObjects;
 using namespace Geometry;
+using namespace Functions;
 
 void ConvolveWorkspaces::init() {
   declareProperty(
@@ -96,4 +98,5 @@ void ConvolveWorkspaces::exec() {
 }
 
 } // namespace Algorithms
+} // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/EstimatePeakErrors.cpp b/Framework/CurveFitting/src/Algorithms/EstimatePeakErrors.cpp
similarity index 97%
rename from Framework/CurveFitting/src/EstimatePeakErrors.cpp
rename to Framework/CurveFitting/src/Algorithms/EstimatePeakErrors.cpp
index f9f0903ea3654a519c2d13286627ca44b6275f50..3990ef3fbabf9c2d809877eac4c9ca43622d12b0 100644
--- a/Framework/CurveFitting/src/EstimatePeakErrors.cpp
+++ b/Framework/CurveFitting/src/Algorithms/EstimatePeakErrors.cpp
@@ -1,6 +1,6 @@
-#include "MantidCurveFitting/EstimatePeakErrors.h"
+#include "MantidCurveFitting/Algorithms/EstimatePeakErrors.h"
 #include "MantidCurveFitting/GSLMatrix.h"
-#include "MantidCurveFitting/PeakParameterFunction.h"
+#include "MantidCurveFitting/Functions/PeakParameterFunction.h"
 
 #include "MantidAPI/CompositeFunction.h"
 #include "MantidAPI/FunctionProperty.h"
@@ -12,6 +12,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Algorithms {
 using namespace API;
 using namespace Kernel;
 using namespace std;
@@ -164,5 +165,6 @@ void EstimatePeakErrors::exec() {
   setProperty("OutputWorkspace", results);
 }
 
+} // namespace Algorithms
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/EvaluateFunction.cpp b/Framework/CurveFitting/src/Algorithms/EvaluateFunction.cpp
similarity index 94%
rename from Framework/CurveFitting/src/EvaluateFunction.cpp
rename to Framework/CurveFitting/src/Algorithms/EvaluateFunction.cpp
index d5c5e9e7099de52de4bcca1fd6203f2ed22cc061..9e072bd88875299e3e259ac3f7b024717c91d27e 100644
--- a/Framework/CurveFitting/src/EvaluateFunction.cpp
+++ b/Framework/CurveFitting/src/Algorithms/EvaluateFunction.cpp
@@ -1,7 +1,8 @@
-#include "MantidCurveFitting/EvaluateFunction.h"
+#include "MantidCurveFitting/Algorithms/EvaluateFunction.h"
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Algorithms {
 
 using namespace Mantid::Kernel;
 using namespace Mantid::API;
@@ -55,5 +56,6 @@ void EvaluateFunction::execConcrete() {
   setProperty("OutputWorkspace", outputWS);
 }
 
+} // namespace Algorithms
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/Fit.cpp b/Framework/CurveFitting/src/Algorithms/Fit.cpp
similarity index 97%
rename from Framework/CurveFitting/src/Fit.cpp
rename to Framework/CurveFitting/src/Algorithms/Fit.cpp
index c37debe935c3074b8cce0224b27cff1c2ae5a4a2..b10b66a8a918dca32327fc32d80a04a0136e399e 100644
--- a/Framework/CurveFitting/src/Fit.cpp
+++ b/Framework/CurveFitting/src/Algorithms/Fit.cpp
@@ -1,8 +1,8 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/Fit.h"
-#include "MantidCurveFitting/CostFuncFitting.h"
+#include "MantidCurveFitting/Algorithms/Fit.h"
+#include "MantidCurveFitting/CostFunctions/CostFuncFitting.h"
 
 #include "MantidAPI/CostFunctionFactory.h"
 #include "MantidAPI/FuncMinimizerFactory.h"
@@ -18,6 +18,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Algorithms {
 
 // Register the class into the algorithm factory
 DECLARE_ALGORITHM(Fit)
@@ -63,7 +64,7 @@ void Fit::initConcrete() {
       API::CostFunctionFactory::Instance().getKeys();
   // select only CostFuncFitting variety
   for (auto it = costFuncOptions.begin(); it != costFuncOptions.end(); ++it) {
-    auto costFunc = boost::dynamic_pointer_cast<CostFuncFitting>(
+    auto costFunc = boost::dynamic_pointer_cast<CostFunctions::CostFuncFitting>(
         API::CostFunctionFactory::Instance().create(*it));
     if (!costFunc) {
       *it = "";
@@ -152,8 +153,8 @@ void Fit::execConcrete() {
   const size_t maxIterations = static_cast<size_t>(intMaxIterations);
 
   // get the cost function which must be a CostFuncFitting
-  boost::shared_ptr<CostFuncFitting> costFunc =
-      boost::dynamic_pointer_cast<CostFuncFitting>(
+  boost::shared_ptr<CostFunctions::CostFuncFitting> costFunc =
+      boost::dynamic_pointer_cast<CostFunctions::CostFuncFitting>(
           API::CostFunctionFactory::Instance().create(
               getPropertyValue("CostFunction")));
 
@@ -362,5 +363,6 @@ void Fit::execConcrete() {
   progress(1.0);
 }
 
-} // namespace Algorithm
+} // namespace Algorithms
+} // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/Fit1D.cpp b/Framework/CurveFitting/src/Algorithms/Fit1D.cpp
similarity index 99%
rename from Framework/CurveFitting/src/Fit1D.cpp
rename to Framework/CurveFitting/src/Algorithms/Fit1D.cpp
index f4c054ddc095e1976d0812b46d7c2373ed6bc562..3f3db8ff573c4ba24d9da29b069138b950125401 100644
--- a/Framework/CurveFitting/src/Fit1D.cpp
+++ b/Framework/CurveFitting/src/Algorithms/Fit1D.cpp
@@ -1,11 +1,10 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/Fit1D.h"
+#include "MantidCurveFitting/Algorithms/Fit1D.h"
 #include <sstream>
 #include <numeric>
 #include <cmath>
-#include <iomanip>
 #include "MantidKernel/Exception.h"
 #include "MantidAPI/ITableWorkspace.h"
 #include "MantidAPI/TableRow.h"
@@ -21,6 +20,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Algorithms {
 
 using namespace Kernel;
 using API::WorkspaceProperty;
@@ -777,5 +777,6 @@ FitData::FitData(Fit1D *fit, const std::string &fixed)
       J.m_map[i] = -1;
 }
 
-} // namespace Algorithm
+} // namespace Algorithms
+} // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/FitPowderDiffPeaks.cpp b/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp
similarity index 99%
rename from Framework/CurveFitting/src/FitPowderDiffPeaks.cpp
rename to Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp
index b5ad39301ddcb5b6156ab72e7ec20a3482d7e7c8..87801460543315e7aaccd4501e43e74facf27e8f 100644
--- a/Framework/CurveFitting/src/FitPowderDiffPeaks.cpp
+++ b/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp
@@ -1,4 +1,4 @@
-#include "MantidCurveFitting/FitPowderDiffPeaks.h"
+#include "MantidCurveFitting/Algorithms/FitPowderDiffPeaks.h"
 
 #include "MantidKernel/ListValidator.h"
 #include "MantidKernel/ArrayProperty.h"
@@ -16,22 +16,21 @@
 #include "MantidAPI/FunctionFactory.h"
 #include "MantidAPI/TextAxis.h"
 
-#include "MantidCurveFitting/Fit.h"
-#include "MantidCurveFitting/BackgroundFunction.h"
-#include "MantidCurveFitting/ThermalNeutronDtoTOFFunction.h"
-#include "MantidCurveFitting/Polynomial.h"
-#include "MantidCurveFitting/BoundaryConstraint.h"
-#include "MantidCurveFitting/Gaussian.h"
-#include "MantidCurveFitting/BackToBackExponential.h"
-#include "MantidCurveFitting/ThermalNeutronBk2BkExpConvPVoigt.h"
-#include "MantidCurveFitting/DampingMinimizer.h"
-#include "MantidCurveFitting/CostFuncFitting.h"
+#include "MantidCurveFitting/Algorithms/Fit.h"
+#include "MantidCurveFitting/Constraints/BoundaryConstraint.h"
+#include "MantidCurveFitting/Functions/BackgroundFunction.h"
+#include "MantidCurveFitting/Functions/ThermalNeutronDtoTOFFunction.h"
+#include "MantidCurveFitting/Functions/Polynomial.h"
+#include "MantidCurveFitting/Functions/Gaussian.h"
+#include "MantidCurveFitting/Functions/BackToBackExponential.h"
+#include "MantidCurveFitting/Functions/ThermalNeutronBk2BkExpConvPVoigt.h"
+#include "MantidCurveFitting/FuncMinimizers/DampingMinimizer.h"
+#include "MantidCurveFitting/CostFunctions/CostFuncFitting.h"
 
 #include <boost/algorithm/string.hpp>
 #include <boost/algorithm/string/split.hpp>
 
 #include <fstream>
-#include <iomanip>
 
 #include <gsl/gsl_sf_erf.h>
 #include <cmath>
@@ -51,11 +50,14 @@ using namespace Mantid;
 using namespace Mantid::API;
 using namespace Mantid::Kernel;
 using namespace Mantid::DataObjects;
+using namespace Mantid::CurveFitting::Functions;
+using namespace Mantid::CurveFitting::Constraints;
 
 using namespace std;
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Algorithms {
 
 DECLARE_ALGORITHM(FitPowderDiffPeaks)
 
@@ -591,7 +593,7 @@ void FitPowderDiffPeaks::observePeakRange(BackToBackExponential_sptr thispeak,
   * Assumption:
   * 1. peak must be in the range of [input peak center - leftdev, + rightdev]
   *
-  * Prerequisit:
+  * Prerequisites:
   * ---- NONE!
   *
   * Algorithms:
@@ -1854,10 +1856,9 @@ bool FitPowderDiffPeaks::doFitGaussianPeak(DataObjects::Workspace2D_sptr dataws,
   // b) Constraint
   double centerleftend = in_center - leftfwhm * 0.5;
   double centerrightend = in_center + rightfwhm * 0.5;
-  CurveFitting::BoundaryConstraint *centerbound =
-      new CurveFitting::BoundaryConstraint(gaussianpeak.get(), "PeakCentre",
-                                           centerleftend, centerrightend,
-                                           false);
+  Constraints::BoundaryConstraint *centerbound =
+      new Constraints::BoundaryConstraint(gaussianpeak.get(), "PeakCentre",
+                                          centerleftend, centerrightend, false);
   gaussianpeak->addConstraint(centerbound);
 
   // 3. Fit
@@ -2020,7 +2021,6 @@ bool FitPowderDiffPeaks::doFitMultiplePeaks(
   // 1. Fit peaks intensities first
   const size_t numpeaks = peakfuncs.size();
   map<string, double> peaksfuncparams;
-  bool evergood = true;
 
   // a) Set up fit/fix
   vector<string> peakparnames = peakfuncs[0]->getParameterNames();
@@ -2044,7 +2044,7 @@ bool FitPowderDiffPeaks::doFitMultiplePeaks(
   double chi2;
   bool fitgood = doFitNPeaksSimple(dataws, wsindex, peaksfunc, peakfuncs,
                                    "Levenberg-MarquardtMD", 1000, chi2);
-  evergood = evergood || fitgood;
+  bool evergood = fitgood;
 
   // c) Process result
   if (!fitgood) {
@@ -2812,7 +2812,7 @@ FitPowderDiffPeaks::genPeak(map<string, int> hklmap,
                             map<string, string> bk2bk2braggmap, bool &good,
                             vector<int> &hkl, double &d_h) {
   // Generate a peak function
-  CurveFitting::BackToBackExponential newpeak;
+  BackToBackExponential newpeak;
   newpeak.initialize();
   BackToBackExponential_sptr newpeakptr =
       boost::make_shared<BackToBackExponential>(newpeak);
@@ -3448,5 +3448,6 @@ size_t findMaxValue(MatrixWorkspace_sptr dataws, size_t wsindex,
   return imax;
 }
 
+} // namespace Algorithms
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/LeBailFit.cpp b/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp
similarity index 99%
rename from Framework/CurveFitting/src/LeBailFit.cpp
rename to Framework/CurveFitting/src/Algorithms/LeBailFit.cpp
index 0ea5ae09288890fe5860669c91f206aa621a0f9d..21d6e9af3d6c32ae3b6a07aa2cd14487ad0aac60 100644
--- a/Framework/CurveFitting/src/LeBailFit.cpp
+++ b/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp
@@ -4,20 +4,19 @@
 
  * COMMIT NOTES */
 
-#include "MantidCurveFitting/LeBailFit.h"
+#include "MantidCurveFitting/Algorithms/LeBailFit.h"
 #include "MantidKernel/ListValidator.h"
 #include "MantidAPI/TableRow.h"
 #include "MantidAPI/FunctionFactory.h"
 #include "MantidAPI/FuncMinimizerFactory.h"
-#include "MantidCurveFitting/Fit.h"
+#include "MantidCurveFitting/Algorithms/Fit.h"
 #include "MantidKernel/ArrayProperty.h"
 #include "MantidKernel/VisibleWhenProperty.h"
-#include "MantidCurveFitting/BackgroundFunction.h"
+#include "MantidCurveFitting/Functions/BackgroundFunction.h"
 #include "MantidAPI/TextAxis.h"
 
 #include <boost/algorithm/string.hpp>
 #include <boost/algorithm/string/split.hpp>
-#include <iomanip>
 
 #include <fstream>
 
@@ -44,6 +43,7 @@ using namespace std;
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Algorithms {
 
 const Rfactor badR(DBL_MAX, DBL_MAX);
 
@@ -341,7 +341,7 @@ void LeBailFit::exec() {
   case FIT:
     // LeBail Fit
     g_log.notice() << "Function: Do LeBail Fit ==> Monte Carlo.\n";
-
+  // fall through
   case MONTECARLO:
     // Monte carlo Le Bail refinement
     g_log.notice("Function: Do LeBail Fit By Monte Carlo Random Walk.");
@@ -2692,5 +2692,6 @@ void writeRfactorsToFile(vector<double> vecX, vector<Rfactor> vecR,
   return;
 }
 
+} // namespace Algorithms
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/LeBailFunction.cpp b/Framework/CurveFitting/src/Algorithms/LeBailFunction.cpp
similarity index 99%
rename from Framework/CurveFitting/src/LeBailFunction.cpp
rename to Framework/CurveFitting/src/Algorithms/LeBailFunction.cpp
index bed2bfd968fe5c19504ed0b82621c91502ef595e..0d9ee16925a41aaa4efb24ce3524080ca49365b9 100644
--- a/Framework/CurveFitting/src/LeBailFunction.cpp
+++ b/Framework/CurveFitting/src/Algorithms/LeBailFunction.cpp
@@ -1,9 +1,9 @@
 #include "MantidAPI/Algorithm.h"
-#include "MantidCurveFitting/LeBailFunction.h"
+#include "MantidCurveFitting/Algorithms/LeBailFunction.h"
 #include "MantidKernel/System.h"
 #include "MantidAPI/FunctionFactory.h"
-#include "MantidCurveFitting/BoundaryConstraint.h"
-#include "MantidCurveFitting/Fit.h"
+#include "MantidCurveFitting/Constraints/BoundaryConstraint.h"
+#include "MantidCurveFitting/Algorithms/Fit.h"
 
 #include <sstream>
 
@@ -18,6 +18,7 @@ const double NEG_DBL_MAX(-1. * DBL_MAX);
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Algorithms {
 namespace {
 const double PEAKRANGECONSTANT = 5.0;
 
@@ -894,7 +895,8 @@ void LeBailFunction::addBackgroundFunction(
 
   // Create background function from factory
   auto background = FunctionFactory::Instance().createFunction(backgroundtype);
-  m_background = boost::dynamic_pointer_cast<BackgroundFunction>(background);
+  m_background =
+      boost::dynamic_pointer_cast<Functions::BackgroundFunction>(background);
 
   // Set order and initialize
   m_background->setAttributeValue("n", static_cast<int>(order));
@@ -946,7 +948,7 @@ void LeBailFunction::setFitProfileParameter(string paramname, double minvalue,
   std::stringstream parss;
   parss << "f0." << paramname;
   string parnamef0 = parss.str();
-  CurveFitting::BoundaryConstraint *bc = new BoundaryConstraint(
+  Constraints::BoundaryConstraint *bc = new Constraints::BoundaryConstraint(
       m_compsiteFunction.get(), parnamef0, minvalue, maxvalue);
   m_compsiteFunction->addConstraint(bc);
 
@@ -1153,4 +1155,5 @@ double LeBailFunction::getPeakMaximumValue(std::vector<int> hkl,
 }
 
 } // namespace Mantid
+} // namespace Algorithms
 } // namespace CurveFitting
diff --git a/Framework/CurveFitting/src/NormaliseByPeakArea.cpp b/Framework/CurveFitting/src/Algorithms/NormaliseByPeakArea.cpp
similarity index 99%
rename from Framework/CurveFitting/src/NormaliseByPeakArea.cpp
rename to Framework/CurveFitting/src/Algorithms/NormaliseByPeakArea.cpp
index f3a7522bbfac8b7f93e12d9980b70f9c502b4814..780f0feb4261bf251d0c137fae577124e818ec44 100644
--- a/Framework/CurveFitting/src/NormaliseByPeakArea.cpp
+++ b/Framework/CurveFitting/src/Algorithms/NormaliseByPeakArea.cpp
@@ -1,4 +1,4 @@
-#include "MantidCurveFitting/NormaliseByPeakArea.h"
+#include "MantidCurveFitting/Algorithms/NormaliseByPeakArea.h"
 
 #include "MantidAPI/IFunction.h"
 #include "MantidAPI/FunctionFactory.h"
@@ -10,6 +10,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Algorithms {
 
 /// Starting value of peak position in y-space for fit
 double PEAK_POS_GUESS = -0.1;
@@ -381,5 +382,6 @@ void NormaliseByPeakArea::symmetriseYSpace() {
   }
 }
 
+} // namespace Algorithms
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/PawleyFit.cpp b/Framework/CurveFitting/src/Algorithms/PawleyFit.cpp
similarity index 94%
rename from Framework/CurveFitting/src/PawleyFit.cpp
rename to Framework/CurveFitting/src/Algorithms/PawleyFit.cpp
index 19cfd18fd2cbb7d9e1c079d6d2aa2c33ddde2979..22b87ff3efafd815630d8527b13152414abfe9cc 100644
--- a/Framework/CurveFitting/src/PawleyFit.cpp
+++ b/Framework/CurveFitting/src/Algorithms/PawleyFit.cpp
@@ -1,7 +1,7 @@
-#include "MantidCurveFitting/PawleyFit.h"
+#include "MantidCurveFitting/Algorithms/PawleyFit.h"
 
 #include "MantidAPI/FunctionFactory.h"
-#include "MantidCurveFitting/PawleyFunction.h"
+#include "MantidCurveFitting/Functions/PawleyFunction.h"
 #include "MantidAPI/ITableWorkspace.h"
 #include "MantidAPI/TableRow.h"
 
@@ -14,6 +14,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Algorithms {
 
 using namespace API;
 using namespace Kernel;
@@ -62,7 +63,7 @@ double PawleyFit::getTransformedCenter(double d, const Unit_sptr &unit) const {
  * @param startX :: Lowest allowed x-value for reflection position.
  * @param endX :: Highest allowed x-value for reflection position.
  */
-void PawleyFit::addHKLsToFunction(PawleyFunction_sptr &pawleyFn,
+void PawleyFit::addHKLsToFunction(Functions::PawleyFunction_sptr &pawleyFn,
                                   const ITableWorkspace_sptr &tableWs,
                                   const Unit_sptr &unit, double startX,
                                   double endX) const {
@@ -105,8 +106,8 @@ void PawleyFit::addHKLsToFunction(PawleyFunction_sptr &pawleyFn,
 
 /// Creates a table containing the cell parameters stored in the supplied
 /// function.
-ITableWorkspace_sptr
-PawleyFit::getLatticeFromFunction(const PawleyFunction_sptr &pawleyFn) const {
+ITableWorkspace_sptr PawleyFit::getLatticeFromFunction(
+    const Functions::PawleyFunction_sptr &pawleyFn) const {
   if (!pawleyFn) {
     throw std::invalid_argument(
         "Cannot extract lattice parameters from null function.");
@@ -119,7 +120,7 @@ PawleyFit::getLatticeFromFunction(const PawleyFunction_sptr &pawleyFn) const {
   latticeParameterTable->addColumn("double", "Value");
   latticeParameterTable->addColumn("double", "Error");
 
-  PawleyParameterFunction_sptr parameters =
+  Functions::PawleyParameterFunction_sptr parameters =
       pawleyFn->getPawleyParameterFunction();
 
   for (size_t i = 0; i < parameters->nParams(); ++i) {
@@ -133,7 +134,7 @@ PawleyFit::getLatticeFromFunction(const PawleyFunction_sptr &pawleyFn) const {
 
 /// Extracts all profile parameters from the supplied function.
 ITableWorkspace_sptr PawleyFit::getPeakParametersFromFunction(
-    const PawleyFunction_sptr &pawleyFn) const {
+    const Functions::PawleyFunction_sptr &pawleyFn) const {
   if (!pawleyFn) {
     throw std::invalid_argument(
         "Cannot extract peak parameters from null function.");
@@ -167,8 +168,8 @@ ITableWorkspace_sptr PawleyFit::getPeakParametersFromFunction(
 
 /// Returns a composite function consisting of the Pawley function and Chebyshev
 /// background if enabled in the algorithm.
-IFunction_sptr
-PawleyFit::getCompositeFunction(const PawleyFunction_sptr &pawleyFn) const {
+IFunction_sptr PawleyFit::getCompositeFunction(
+    const Functions::PawleyFunction_sptr &pawleyFn) const {
   CompositeFunction_sptr composite = boost::make_shared<CompositeFunction>();
   composite->addFunction(pawleyFn);
 
@@ -271,8 +272,9 @@ void PawleyFit::init() {
 /// Execution of algorithm.
 void PawleyFit::exec() {
   // Setup PawleyFunction with cell from input parameters
-  PawleyFunction_sptr pawleyFn = boost::dynamic_pointer_cast<PawleyFunction>(
-      FunctionFactory::Instance().createFunction("PawleyFunction"));
+  Functions::PawleyFunction_sptr pawleyFn =
+      boost::dynamic_pointer_cast<Functions::PawleyFunction>(
+          FunctionFactory::Instance().createFunction("PawleyFunction"));
   g_log.information() << "Setting up Pawley function..." << std::endl;
 
   std::string profileFunction = getProperty("PeakProfileFunction");
@@ -286,7 +288,7 @@ void PawleyFit::exec() {
                       << std::endl;
 
   pawleyFn->setUnitCell(getProperty("InitialCell"));
-  PawleyParameterFunction_sptr pawleyParameterFunction =
+  Functions::PawleyParameterFunction_sptr pawleyParameterFunction =
       pawleyFn->getPawleyParameterFunction();
   g_log.information()
       << "  Initial unit cell: "
@@ -416,5 +418,6 @@ V3D V3DFromHKLColumnExtractor::getHKLFromString(
   return hkl;
 }
 
+} // namespace Algorithms
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/PlotPeakByLogValue.cpp b/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp
similarity index 99%
rename from Framework/CurveFitting/src/PlotPeakByLogValue.cpp
rename to Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp
index f380f15c43c792e136b2fa2f5451103819fb68b2..1478d845126c02fd1f1acc413dd612f3e9d521e8 100644
--- a/Framework/CurveFitting/src/PlotPeakByLogValue.cpp
+++ b/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp
@@ -3,7 +3,6 @@
 //----------------------------------------------------------------------
 #include <cmath>
 #include <vector>
-#include <iostream>
 #include <fstream>
 #include <sstream>
 #include <algorithm>
@@ -11,7 +10,7 @@
 #include <boost/lexical_cast.hpp>
 #include <boost/algorithm/string/replace.hpp>
 
-#include "MantidCurveFitting/PlotPeakByLogValue.h"
+#include "MantidCurveFitting/Algorithms/PlotPeakByLogValue.h"
 #include "MantidAPI/IFuncMinimizer.h"
 #include "MantidAPI/AlgorithmManager.h"
 #include "MantidAPI/FuncMinimizerFactory.h"
@@ -36,6 +35,7 @@ Mantid::Kernel::Logger g_log("PlotPeakByLogValue");
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Algorithms {
 
 using namespace Kernel;
 using namespace API;
@@ -619,5 +619,6 @@ PlotPeakByLogValue::getMinimizerString(const std::string &wsName,
   return format;
 }
 
+} // namespace Algorithms
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/RefinePowderInstrumentParameters.cpp b/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters.cpp
similarity index 82%
rename from Framework/CurveFitting/src/RefinePowderInstrumentParameters.cpp
rename to Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters.cpp
index 56a400e3b11d329ebde5463760d0e7e9b4c5e117..80d4fdec61c340ed49b564399931f1824e76dc26 100644
--- a/Framework/CurveFitting/src/RefinePowderInstrumentParameters.cpp
+++ b/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters.cpp
@@ -1,4 +1,4 @@
-#include "MantidCurveFitting/RefinePowderInstrumentParameters.h"
+#include "MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters.h"
 
 #include "MantidKernel/ListValidator.h"
 #include "MantidKernel/ArrayProperty.h"
@@ -14,11 +14,11 @@
 #include "MantidAPI/FunctionFactory.h"
 #include "MantidAPI/TextAxis.h"
 
-#include "MantidCurveFitting/Fit.h"
-#include "MantidCurveFitting/BackgroundFunction.h"
-#include "MantidCurveFitting/Polynomial.h"
-#include "MantidCurveFitting/BoundaryConstraint.h"
-#include "MantidCurveFitting/Gaussian.h"
+#include "MantidCurveFitting/Algorithms/Fit.h"
+#include "MantidCurveFitting/Constraints/BoundaryConstraint.h"
+#include "MantidCurveFitting/Functions/BackgroundFunction.h"
+#include "MantidCurveFitting/Functions/Polynomial.h"
+#include "MantidCurveFitting/Functions/Gaussian.h"
 
 #include "MantidGeometry/Crystal/UnitCell.h"
 
@@ -26,7 +26,6 @@
 #include <boost/algorithm/string/split.hpp>
 
 #include <fstream>
-#include <iomanip>
 
 #include <gsl/gsl_sf_erf.h>
 
@@ -34,18 +33,24 @@ using namespace Mantid;
 using namespace Mantid::API;
 using namespace Mantid::Kernel;
 using namespace Mantid::DataObjects;
+using namespace Mantid::CurveFitting::Algorithms;
+using namespace Mantid::CurveFitting::Functions;
+using namespace Mantid::CurveFitting::Constraints;
 
 using namespace std;
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Algorithms {
 
 DECLARE_ALGORITHM(RefinePowderInstrumentParameters)
 
 //----------------------------------------------------------------------------------------------
 /** Constructor
  */
-RefinePowderInstrumentParameters::RefinePowderInstrumentParameters() {}
+RefinePowderInstrumentParameters::RefinePowderInstrumentParameters()
+    : m_BestGSLChi2(0.0), m_MinSigma(0.0), m_MinNumFittedPeaks(0),
+      m_MaxNumberStoredParameters(0) {}
 
 //----------------------------------------------------------------------------------------------
 /** Destructor
@@ -142,7 +147,7 @@ void RefinePowderInstrumentParameters::exec() {
   DataObjects::TableWorkspace_sptr parameterWS =
       this->getProperty("InstrumentParameterWorkspace");
 
-  mMinSigma = getProperty("MinSigma");
+  m_MinSigma = getProperty("MinSigma");
 
   int tempint = getProperty("MinNumberFittedPeaks");
   if (tempint <= 1) {
@@ -150,13 +155,13 @@ void RefinePowderInstrumentParameters::exec() {
                   << " is too small. " << endl;
     throw std::invalid_argument("Input MinNumberFittedPeaks is too small.");
   }
-  mMinNumFittedPeaks = static_cast<size_t>(tempint);
+  m_MinNumFittedPeaks = static_cast<size_t>(tempint);
 
   tempint = getProperty("NumberBestFitRecorded");
   if (tempint <= 0)
     throw runtime_error(
         "Input NumberBestFitRecorded cannot be less and equal to 0. ");
-  mMaxNumberStoredParameters = static_cast<size_t>(tempint);
+  m_MaxNumberStoredParameters = static_cast<size_t>(tempint);
 
   string algoption = getProperty("RefinementAlgorithm");
   if (algoption.compare("DirectFit") == 0)
@@ -169,14 +174,14 @@ void RefinePowderInstrumentParameters::exec() {
 
   // 2. Parse input table workspace
   genPeaksFromTable(peakWS);
-  importParametersFromTable(parameterWS, mFuncParameters);
-  mOrigParameters = mFuncParameters;
+  importParametersFromTable(parameterWS, m_FuncParameters);
+  m_OrigParameters = m_FuncParameters;
 
   // 3. Generate a cener workspace as function of d-spacing.
   bool usemc = false;
   if (refinealgorithm == MonteCarlo)
     usemc = true;
-  genPeakCentersWorkspace(usemc, mMaxNumberStoredParameters);
+  genPeakCentersWorkspace(usemc, m_MaxNumberStoredParameters);
 
   // 4. Fit instrument geometry function
   stringstream errss;
@@ -205,7 +210,7 @@ void RefinePowderInstrumentParameters::exec() {
   }
 
   // 5. Set output workspace
-  this->setProperty("OutputWorkspace", dataWS);
+  this->setProperty("OutputWorkspace", m_dataWS);
 
   // 6. Output new instrument parameters
   DataObjects::TableWorkspace_sptr fitparamws =
@@ -224,18 +229,17 @@ void RefinePowderInstrumentParameters::fitInstrumentParameters() {
        << endl;
 
   // 1. Initialize the fitting function
-  CurveFitting::ThermalNeutronDtoTOFFunction rawfunc;
-  mFunction =
-      boost::make_shared<CurveFitting::ThermalNeutronDtoTOFFunction>(rawfunc);
-  mFunction->initialize();
+  ThermalNeutronDtoTOFFunction rawfunc;
+  m_Function = boost::make_shared<ThermalNeutronDtoTOFFunction>(rawfunc);
+  m_Function->initialize();
 
-  API::FunctionDomain1DVector domain(dataWS->readX(1));
+  API::FunctionDomain1DVector domain(m_dataWS->readX(1));
   API::FunctionValues values(domain);
-  const MantidVec &rawY = dataWS->readY(0);
-  const MantidVec &rawE = dataWS->readE(0);
+  const MantidVec &rawY = m_dataWS->readY(0);
+  const MantidVec &rawE = m_dataWS->readE(0);
 
   // 2. Set up parameters values
-  std::vector<std::string> funparamnames = mFunction->getParameterNames();
+  std::vector<std::string> funparamnames = m_Function->getParameterNames();
 
   std::vector<std::string> paramtofit = getProperty("ParametersToFit");
   std::sort(paramtofit.begin(), paramtofit.end());
@@ -245,22 +249,22 @@ void RefinePowderInstrumentParameters::fitInstrumentParameters() {
   std::map<std::string, double>::iterator paramiter;
   for (size_t i = 0; i < funparamnames.size(); ++i) {
     string parname = funparamnames[i];
-    paramiter = mFuncParameters.find(parname);
-    if (paramiter == mFuncParameters.end()) {
+    paramiter = m_FuncParameters.find(parname);
+    if (paramiter == m_FuncParameters.end()) {
       // Not found and thus skip
       continue;
     }
 
     double parvalue = paramiter->second;
-    mFunction->setParameter(parname, parvalue);
+    m_Function->setParameter(parname, parvalue);
     msgss << setw(10) << parname << " = " << parvalue << endl;
   }
   cout << msgss.str();
 
   // 2b. Calculate the statistic of the starting values
-  double gslchi2 = calculateFunctionStatistic(mFunction, dataWS, 0);
+  double gslchi2 = calculateFunctionStatistic(m_Function, m_dataWS, 0);
   double homchi2 =
-      calculateD2TOFFunction(mFunction, domain, values, rawY, rawE);
+      calculateD2TOFFunction(m_Function, domain, values, rawY, rawE);
   cout << "Fit Starting Value:  Chi^2 (GSL) = " << gslchi2
        << ",  Chi2^2 (Home) = " << homchi2 << endl;
 
@@ -272,9 +276,9 @@ void RefinePowderInstrumentParameters::fitInstrumentParameters() {
     vsiter = std::find(paramtofit.begin(), paramtofit.end(), parname);
 
     if (vsiter == paramtofit.end())
-      mFunction->fix(i);
+      m_Function->fix(i);
     else
-      mFunction->unfix(i);
+      m_Function->unfix(i);
   }
 
   // 4. Select minimizer.  Use Simplex for more than 1 parameters to fit.
@@ -286,13 +290,13 @@ void RefinePowderInstrumentParameters::fitInstrumentParameters() {
   g_log.information() << "Fit use minizer: " << minimizer << endl;
 
   // 5. Create and setup fit algorithm
-  g_log.information() << "Fit instrument geometry: " << mFunction->asString()
+  g_log.information() << "Fit instrument geometry: " << m_Function->asString()
                       << std::endl;
 
   stringstream outss;
-  for (size_t i = 0; i < dataWS->readX(0).size(); ++i)
-    outss << dataWS->readX(0)[i] << "\t\t" << dataWS->readY(0)[i] << "\t\t"
-          << dataWS->readE(0)[i] << endl;
+  for (size_t i = 0; i < m_dataWS->readX(0).size(); ++i)
+    outss << m_dataWS->readX(0)[i] << "\t\t" << m_dataWS->readY(0)[i] << "\t\t"
+          << m_dataWS->readE(0)[i] << endl;
   cout << "Input Peak Position Workspace To Fit: " << endl
        << outss.str() << endl;
 
@@ -300,8 +304,8 @@ void RefinePowderInstrumentParameters::fitInstrumentParameters() {
   fitalg->initialize();
 
   fitalg->setProperty("Function",
-                      boost::dynamic_pointer_cast<API::IFunction>(mFunction));
-  fitalg->setProperty("InputWorkspace", dataWS);
+                      boost::dynamic_pointer_cast<API::IFunction>(m_Function));
+  fitalg->setProperty("InputWorkspace", m_dataWS);
   fitalg->setProperty("WorkspaceIndex", 0);
   fitalg->setProperty("Minimizer", minimizer);
   fitalg->setProperty("CostFunction", "Least squares");
@@ -324,31 +328,31 @@ void RefinePowderInstrumentParameters::fitInstrumentParameters() {
   API::IFunction_sptr fitfunc = fitalg->getProperty("Function");
 
   // 4. Set the output data (model and diff)
-  mFunction->function(domain, values);
+  m_Function->function(domain, values);
 
   for (size_t i = 0; i < domain.size(); ++i) {
-    dataWS->dataY(1)[i] = values[i];
-    dataWS->dataY(2)[i] = dataWS->readY(0)[i] - values[i];
+    m_dataWS->dataY(1)[i] = values[i];
+    m_dataWS->dataY(2)[i] = m_dataWS->readY(0)[i] - values[i];
   }
 
   double selfchi2 =
-      calculateD2TOFFunction(mFunction, domain, values, rawY, rawE);
+      calculateD2TOFFunction(m_Function, domain, values, rawY, rawE);
   cout << "Homemade Chi^2 = " << selfchi2 << endl;
 
   // 5. Update fitted parameters
   for (size_t i = 0; i < funparamnames.size(); ++i) {
     std::string parname = funparamnames[i];
     double parvalue = fitfunc->getParameter(parname);
-    mFuncParameters[parname] = parvalue;
+    m_FuncParameters[parname] = parvalue;
   }
 
   // 6. Pretty screen output
   stringstream dbss;
   dbss << "************ Fit Parameter Result *************" << std::endl;
-  for (paramiter = mFuncParameters.begin(); paramiter != mFuncParameters.end();
-       ++paramiter) {
+  for (paramiter = m_FuncParameters.begin();
+       paramiter != m_FuncParameters.end(); ++paramiter) {
     std::string parname = paramiter->first;
-    double inpparvalue = mOrigParameters[parname];
+    double inpparvalue = m_OrigParameters[parname];
     double parvalue = paramiter->second;
     dbss << setw(20) << parname << " = " << setw(15) << setprecision(6)
          << parvalue << "\t\tFrom " << setw(15) << setprecision(6)
@@ -360,18 +364,18 @@ void RefinePowderInstrumentParameters::fitInstrumentParameters() {
   // 7. Play with Zscore:     template<typename TYPE>
   //    std::vector<double> getZscore(const std::vector<TYPE>& data, const bool
   //    sorted=false);
-  vector<double> z0 = Kernel::getZscore(dataWS->readY(0));
-  vector<double> z1 = Kernel::getZscore(dataWS->readY(1));
-  vector<double> z2 = Kernel::getZscore(dataWS->readY(2));
+  vector<double> z0 = Kernel::getZscore(m_dataWS->readY(0));
+  vector<double> z1 = Kernel::getZscore(m_dataWS->readY(1));
+  vector<double> z2 = Kernel::getZscore(m_dataWS->readY(2));
   stringstream zss;
   zss << setw(20) << "d_h" << setw(20) << "Z DataY" << setw(20) << "Z ModelY"
       << setw(20) << "Z DiffY" << setw(20) << "DiffY" << endl;
   for (size_t i = 0; i < z0.size(); ++i) {
-    double d_h = dataWS->readX(0)[i];
+    double d_h = m_dataWS->readX(0)[i];
     double zdatay = z0[i];
     double zmodely = z1[i];
     double zdiffy = z2[i];
-    double diffy = dataWS->readY(2)[i];
+    double diffy = m_dataWS->readY(2)[i];
     zss << setw(20) << d_h << setw(20) << zdatay << setw(20) << zmodely
         << setw(20) << zdiffy << setw(20) << diffy << endl;
   }
@@ -390,7 +394,7 @@ bool RefinePowderInstrumentParameters::fitFunction(IFunction_sptr func,
 
   fitalg->setProperty("Function",
                       boost::dynamic_pointer_cast<API::IFunction>(func));
-  fitalg->setProperty("InputWorkspace", dataWS);
+  fitalg->setProperty("InputWorkspace", m_dataWS);
   fitalg->setProperty("WorkspaceIndex", 0);
   fitalg->setProperty("Minimizer", "Simplex");
   fitalg->setProperty("CostFunction", "Least squares");
@@ -460,19 +464,20 @@ double RefinePowderInstrumentParameters::calculateFunctionStatistic(
 void RefinePowderInstrumentParameters::refineInstrumentParametersMC(
     TableWorkspace_sptr parameterWS, bool fit2) {
   // 1. Get function's parameter names
-  getD2TOFFuncParamNames(mPeakFunctionParameterNames);
+  getD2TOFFuncParamNames(m_PeakFunctionParameterNames);
 
   // 2. Parse parameter (table) workspace
   vector<double> stepsizes, lowerbounds, upperbounds;
-  importMonteCarloParametersFromTable(parameterWS, mPeakFunctionParameterNames,
+  importMonteCarloParametersFromTable(parameterWS, m_PeakFunctionParameterNames,
                                       stepsizes, lowerbounds, upperbounds);
 
   stringstream dbss;
-  for (size_t i = 0; i < mPeakFunctionParameterNames.size(); ++i) {
-    dbss << setw(20) << mPeakFunctionParameterNames[i] << ": Min = " << setw(15)
-         << setprecision(6) << lowerbounds[i] << ", Max = " << setw(15)
-         << setprecision(6) << upperbounds[i] << ", Step Size = " << setw(15)
-         << setprecision(6) << stepsizes[i] << endl;
+  for (size_t i = 0; i < m_PeakFunctionParameterNames.size(); ++i) {
+    dbss << setw(20) << m_PeakFunctionParameterNames[i]
+         << ": Min = " << setw(15) << setprecision(6) << lowerbounds[i]
+         << ", Max = " << setw(15) << setprecision(6) << upperbounds[i]
+         << ", Step Size = " << setw(15) << setprecision(6) << stepsizes[i]
+         << endl;
   }
   g_log.notice() << "Monte Carlo Parameters: " << endl
                  << dbss.str();
@@ -492,33 +497,33 @@ void RefinePowderInstrumentParameters::refineInstrumentParametersMC(
   double stepsizescalefactor = 1.1;
 
   // 5. Monte Carlo simulation
-  doParameterSpaceRandomWalk(mPeakFunctionParameterNames, lowerbounds,
+  doParameterSpaceRandomWalk(m_PeakFunctionParameterNames, lowerbounds,
                              upperbounds, stepsizes, maxsteps,
                              stepsizescalefactor, fit2);
 
   // 6. Record the result
-  const MantidVec &X = dataWS->readX(0);
-  const MantidVec &Y = dataWS->readY(0);
-  const MantidVec &E = dataWS->readE(0);
+  const MantidVec &X = m_dataWS->readX(0);
+  const MantidVec &Y = m_dataWS->readY(0);
+  const MantidVec &E = m_dataWS->readE(0);
   FunctionDomain1DVector domain(X);
   FunctionValues values(domain);
-  for (size_t i = 0; i < mBestFitParameters.size(); ++i) {
+  for (size_t i = 0; i < m_BestFitParameters.size(); ++i) {
     // a. Set the function with the
-    for (size_t j = 0; j < mPeakFunctionParameterNames.size(); ++j) {
-      mFunction->setParameter(mPeakFunctionParameterNames[j],
-                              mBestFitParameters[i].second[j]);
+    for (size_t j = 0; j < m_PeakFunctionParameterNames.size(); ++j) {
+      m_Function->setParameter(m_PeakFunctionParameterNames[j],
+                               m_BestFitParameters[i].second[j]);
     }
 
     // b. Calculate
-    calculateD2TOFFunction(mFunction, domain, values, Y, E);
+    calculateD2TOFFunction(m_Function, domain, values, Y, E);
 
     vector<double> vec_n;
-    calculateThermalNeutronSpecial(mFunction, X, vec_n);
+    calculateThermalNeutronSpecial(m_Function, X, vec_n);
 
     // c. Put the data to output workspace
-    MantidVec &newY = dataWS->dataY(3 * i + 1);
-    MantidVec &newD = dataWS->dataY(3 * i + 2);
-    MantidVec &newN = dataWS->dataY(3 * i + 3);
+    MantidVec &newY = m_dataWS->dataY(3 * i + 1);
+    MantidVec &newD = m_dataWS->dataY(3 * i + 2);
+    MantidVec &newN = m_dataWS->dataY(3 * i + 3);
     for (size_t j = 0; j < newY.size(); ++j) {
       newY[j] = values[j];
       newD[j] = Y[j] - values[j];
@@ -546,30 +551,30 @@ void RefinePowderInstrumentParameters::doParameterSpaceRandomWalk(
           << setw(20) << "Upper Boundary" << setw(20) << "Step Size" << endl;
   for (size_t i = 0; i < parnames.size(); ++i)
     inpinfo << setw(20) << parnames[i] << setw(20) <<
-  mFuncParameters[parnames[i]]
+  m_FuncParameters[parnames[i]]
             << setw(20) << lowerbounds[i]
             << setw(20) << upperbounds[i] << setw(20) <<  stepsizes[i] << endl;
   cout << inpinfo.str();
   ------------*/
 
-  // 1. Set up starting values, esp. to mFunction
+  // 1. Set up starting values, esp. to m_Function
   size_t numparameters = parnames.size();
   vector<double> paramvalues;
   for (size_t i = 0; i < numparameters; ++i) {
     string parname = parnames[i];
-    double parvalue = mFuncParameters[parname];
+    double parvalue = m_FuncParameters[parname];
     paramvalues.push_back(parvalue);
-    mFunction->setParameter(parname, parvalue);
+    m_Function->setParameter(parname, parvalue);
   }
 
   // Calcualte the function's initial statistic
-  mBestGSLChi2 = calculateFunctionStatistic(mFunction, dataWS, 0);
-  cout << "Function with starting values has Chi2 = " << mBestGSLChi2
+  m_BestGSLChi2 = calculateFunctionStatistic(m_Function, m_dataWS, 0);
+  cout << "Function with starting values has Chi2 = " << m_BestGSLChi2
        << " (GSL L.M) " << endl;
 
-  const MantidVec &X = dataWS->readX(0);
-  const MantidVec &rawY = dataWS->readY(0);
-  const MantidVec &rawE = dataWS->readE(0);
+  const MantidVec &X = m_dataWS->readX(0);
+  const MantidVec &rawY = m_dataWS->readY(0);
+  const MantidVec &rawE = m_dataWS->readE(0);
   FunctionDomain1DVector domain(X);
   FunctionValues values(domain);
 
@@ -621,7 +626,7 @@ void RefinePowderInstrumentParameters::doParameterSpaceRandomWalk(
 
   // 4. Do MC loops
   double curchi2 =
-      calculateD2TOFFunction(mFunction, domain, values, rawY, rawE);
+      calculateD2TOFFunction(m_Function, domain, values, rawY, rawE);
 
   g_log.notice() << "Monte Carlo Random Walk Starting Chi^2 = " << curchi2
                  << endl;
@@ -654,7 +659,7 @@ void RefinePowderInstrumentParameters::doParameterSpaceRandomWalk(
     }
 
     try {
-      mFunction->setParameter(parnames[paramindex], newvalue);
+      m_Function->setParameter(parnames[paramindex], newvalue);
     } catch (runtime_error &) {
       stringstream errss;
       errss << "New Value = " << newvalue
@@ -667,13 +672,13 @@ void RefinePowderInstrumentParameters::doParameterSpaceRandomWalk(
 
     // b. Calcualte the new
     double newchi2 =
-        calculateD2TOFFunction(mFunction, domain, values, rawY, rawE);
+        calculateD2TOFFunction(m_Function, domain, values, rawY, rawE);
 
     // Optionally fit
     if (fit2) {
       // i.   Copy the parameters
       for (size_t i = 0; i < numparameters; ++i) {
-        double parvalue = mFunction->getParameter(i);
+        double parvalue = m_Function->getParameter(i);
         func4fit->setParameter(i, parvalue);
       }
 
@@ -686,8 +691,8 @@ void RefinePowderInstrumentParameters::doParameterSpaceRandomWalk(
         double homchi2 =
             calculateD2TOFFunction(func4fit, domain, values, rawY, rawE);
 
-        if (gslchi2 < mBestGSLChi2)
-          mBestGSLChi2 = gslchi2;
+        if (gslchi2 < m_BestGSLChi2)
+          m_BestGSLChi2 = gslchi2;
 
         // iv.  Archive
         vector<double> newparvalues;
@@ -695,15 +700,15 @@ void RefinePowderInstrumentParameters::doParameterSpaceRandomWalk(
           double parvalue = func4fit->getParameter(i);
           newparvalues.push_back(parvalue);
         }
-        mBestFitParameters.push_back(make_pair(homchi2, newparvalues));
-        mBestFitChi2s.push_back(make_pair(homchi2, gslchi2));
+        m_BestFitParameters.push_back(make_pair(homchi2, newparvalues));
+        m_BestFitChi2s.push_back(make_pair(homchi2, gslchi2));
 
         // v.  Sort and keep in size
-        sort(mBestFitParameters.begin(), mBestFitParameters.end());
-        sort(mBestFitChi2s.begin(), mBestFitChi2s.end());
-        if (mBestFitParameters.size() > mMaxNumberStoredParameters) {
-          mBestFitParameters.pop_back();
-          mBestFitChi2s.pop_back();
+        sort(m_BestFitParameters.begin(), m_BestFitParameters.end());
+        sort(m_BestFitChi2s.begin(), m_BestFitChi2s.end());
+        if (m_BestFitParameters.size() > m_MaxNumberStoredParameters) {
+          m_BestFitParameters.pop_back();
+          m_BestFitChi2s.pop_back();
         }
 
         // cout << "\tHomemade Chi^2 = " << homchi2 << endl;
@@ -750,12 +755,12 @@ void RefinePowderInstrumentParameters::doParameterSpaceRandomWalk(
 
       // ii.  Add the new values to vector
       vector<double> parametervalues = paramvalues;
-      mBestMCParameters.push_back(make_pair(newchi2, parametervalues));
+      m_BestMCParameters.push_back(make_pair(newchi2, parametervalues));
 
       // iii. Sort and delete the last if necessary
-      sort(mBestMCParameters.begin(), mBestMCParameters.end());
-      if (mBestMCParameters.size() > mMaxNumberStoredParameters)
-        mBestMCParameters.pop_back();
+      sort(m_BestMCParameters.begin(), m_BestMCParameters.end());
+      if (m_BestMCParameters.size() > m_MaxNumberStoredParameters)
+        m_BestMCParameters.pop_back();
 
       // iv.  Update chi2 and ...
       curchi2 = newchi2;
@@ -771,24 +776,24 @@ void RefinePowderInstrumentParameters::doParameterSpaceRandomWalk(
 
   // 3. Debug output
   stringstream mcresult;
-  mcresult << "Monte Carlo Result for " << mBestMCParameters.size()
+  mcresult << "Monte Carlo Result for " << m_BestMCParameters.size()
            << " Best Results" << endl;
   mcresult << "Number of acceptance = " << numacceptance << ", out of "
            << maxsteps << " MC steps."
            << "Accept ratio = "
            << static_cast<double>(numacceptance) / static_cast<double>(maxsteps)
            << endl;
-  mcresult << "Best " << mBestMCParameters.size()
+  mcresult << "Best " << m_BestMCParameters.size()
            << " Monte Carlo (no fit) results: " << endl;
-  for (size_t i = 0; i < mBestMCParameters.size(); ++i) {
-    mcresult << setw(3) << i << ":  Chi^2 = " << mBestMCParameters[i].first
+  for (size_t i = 0; i < m_BestMCParameters.size(); ++i) {
+    mcresult << setw(3) << i << ":  Chi^2 = " << m_BestMCParameters[i].first
              << endl;
   }
-  mcresult << "Best " << mBestMCParameters.size()
-           << " fitting results.  Best Chi^2 =  " << mBestGSLChi2 << endl;
-  for (size_t i = 0; i < mBestFitParameters.size(); ++i) {
-    mcresult << setw(3) << i << ":  Chi^2 = " << mBestFitParameters[i].first
-             << ", GSL Chi^2 = " << mBestFitChi2s[i].second << endl;
+  mcresult << "Best " << m_BestMCParameters.size()
+           << " fitting results.  Best Chi^2 =  " << m_BestGSLChi2 << endl;
+  for (size_t i = 0; i < m_BestFitParameters.size(); ++i) {
+    mcresult << setw(3) << i << ":  Chi^2 = " << m_BestFitParameters[i].first
+             << ", GSL Chi^2 = " << m_BestFitChi2s[i].second << endl;
   }
   g_log.notice() << mcresult.str();
 
@@ -803,11 +808,11 @@ void RefinePowderInstrumentParameters::getD2TOFFuncParamNames(
   parnames.clear();
 
   // 2. Get the parameter names from function
-  CurveFitting::ThermalNeutronDtoTOFFunction d2toffunc;
+  ThermalNeutronDtoTOFFunction d2toffunc;
   d2toffunc.initialize();
   std::vector<std::string> funparamnames = d2toffunc.getParameterNames();
 
-  mFunction = boost::make_shared<ThermalNeutronDtoTOFFunction>(d2toffunc);
+  m_Function = boost::make_shared<ThermalNeutronDtoTOFFunction>(d2toffunc);
 
   // 3. Copy
   parnames = funparamnames;
@@ -822,14 +827,14 @@ double RefinePowderInstrumentParameters::calculateD2TOFFunction(
     const MantidVec &rawY, const MantidVec &rawE) {
   // 1. Check validity
   if (!func) {
-    throw std::runtime_error("mFunction has not been initialized!");
+    throw std::runtime_error("m_Function has not been initialized!");
   } else {
     /*
-    vector<string> parnames = mFunction->getParameterNames();
+    vector<string> parnames = m_Function->getParameterNames();
     for (size_t i = 0; i < parnames.size(); ++i)
     {
       cout << "DBx1125  " << parnames[i] << " = " <<
-    mFunction->getParameter(parnames[i]) << endl;
+    m_Function->getParameter(parnames[i]) << endl;
     }
     */
     ;
@@ -859,7 +864,7 @@ double RefinePowderInstrumentParameters::calculateD2TOFFunction(
 //------------------------------- Processing Inputs
 //----------------------------------------
 /** Genearte peaks from input workspace
-  * Peaks are stored in a map.  (HKL) is the key
+  * m_Peaks are stored in a map.  (HKL) is the key
   */
 void RefinePowderInstrumentParameters::genPeaksFromTable(
     DataObjects::TableWorkspace_sptr peakparamws) {
@@ -871,7 +876,7 @@ void RefinePowderInstrumentParameters::genPeaksFromTable(
         "Invalid input table workspace for peak parameters");
   }
 
-  mPeaks.clear();
+  m_Peaks.clear();
 
   // 2. Parse table workspace rows to generate peaks
   vector<string> colnames = peakparamws->getColumnNames();
@@ -879,7 +884,7 @@ void RefinePowderInstrumentParameters::genPeaksFromTable(
 
   for (size_t ir = 0; ir < numrows; ++ir) {
     // a) Generate peak
-    CurveFitting::BackToBackExponential newpeak;
+    BackToBackExponential newpeak;
     newpeak.initialize();
 
     // b) Parse parameters
@@ -930,20 +935,20 @@ void RefinePowderInstrumentParameters::genPeaksFromTable(
     newpeak.setParameter("I", height);
 
     // d) Make to share pointer and set to instance data structure (map)
-    CurveFitting::BackToBackExponential_sptr newpeakptr =
-        boost::make_shared<CurveFitting::BackToBackExponential>(newpeak);
+    BackToBackExponential_sptr newpeakptr =
+        boost::make_shared<BackToBackExponential>(newpeak);
 
     std::vector<int> hkl;
     hkl.push_back(h);
     hkl.push_back(k);
     hkl.push_back(l);
 
-    mPeaks.insert(std::make_pair(hkl, newpeakptr));
+    m_Peaks.insert(std::make_pair(hkl, newpeakptr));
 
-    mPeakErrors.insert(make_pair(hkl, chi2));
+    m_PeakErrors.insert(make_pair(hkl, chi2));
 
-    g_log.information() << "[GeneratePeaks] Peak " << ir << " HKL = [" << hkl[0]
-                        << ", " << hkl[1] << ", " << hkl[2]
+    g_log.information() << "[Generatem_Peaks] Peak " << ir << " HKL = ["
+                        << hkl[0] << ", " << hkl[1] << ", " << hkl[2]
                         << "], Input Center = " << setw(10) << setprecision(6)
                         << newpeak.centre() << endl;
 
@@ -1116,17 +1121,17 @@ hkl, double lattice)
 /** Calcualte value n for thermal neutron peak profile
   */
 void RefinePowderInstrumentParameters::calculateThermalNeutronSpecial(
-    IFunction_sptr mFunction, vector<double> vec_d, vector<double> &vec_n) {
-  if (mFunction->name().compare("ThermalNeutronDtoTOFFunction") != 0) {
-    g_log.warning() << "Function (" << mFunction->name()
+    IFunction_sptr m_Function, vector<double> vec_d, vector<double> &vec_n) {
+  if (m_Function->name().compare("ThermalNeutronDtoTOFFunction") != 0) {
+    g_log.warning() << "Function (" << m_Function->name()
                     << " is not ThermalNeutronDtoTOFFunction.  And it is not "
                        "required to calculate n." << endl;
     for (size_t i = 0; i < vec_d.size(); ++i)
       vec_n.push_back(0);
   }
 
-  double width = mFunction->getParameter("Width");
-  double tcross = mFunction->getParameter("Tcross");
+  double width = m_Function->getParameter("Width");
+  double tcross = m_Function->getParameter("Tcross");
 
   for (size_t i = 0; i < vec_d.size(); ++i) {
     double dh = vec_d[i];
@@ -1147,7 +1152,7 @@ void RefinePowderInstrumentParameters::calculateThermalNeutronSpecial(
 void RefinePowderInstrumentParameters::genPeakCentersWorkspace(
     bool montecarlo, size_t numbestfit) {
   // 1. Collect values in a vector for sorting
-  double lattice = mFuncParameters["LatticeConstant"];
+  double lattice = m_FuncParameters["LatticeConstant"];
   if (lattice < 1.0E-5) {
     std::stringstream errmsg;
     errmsg << "Input Lattice constant = " << lattice
@@ -1168,19 +1173,18 @@ void RefinePowderInstrumentParameters::genPeakCentersWorkspace(
     throw runtime_error(errss.str());
   }
 
-  std::map<std::vector<int>, CurveFitting::BackToBackExponential_sptr>::iterator
-      peakiter;
+  std::map<std::vector<int>, BackToBackExponential_sptr>::iterator peakiter;
   std::vector<std::pair<double, std::pair<double, double>>>
       peakcenters; // d_h [TOF_h, CHI2]
 
   Geometry::UnitCell unitcell(lattice, lattice, lattice, 90.0, 90.0, 90.0);
 
-  for (peakiter = mPeaks.begin(); peakiter != mPeaks.end(); ++peakiter) {
+  for (peakiter = m_Peaks.begin(); peakiter != m_Peaks.end(); ++peakiter) {
     vector<int> hkl = peakiter->first;
     BackToBackExponential_sptr peak = peakiter->second;
 
     double sigma = peak->getParameter("S");
-    if (sigma < mMinSigma) {
+    if (sigma < m_MinSigma) {
       g_log.information() << "Peak (" << hkl[0] << ", " << hkl[1] << ", "
                           << hkl[2]
                           << ") has unphysically small Sigma = " << sigma
@@ -1221,18 +1225,18 @@ void RefinePowderInstrumentParameters::genPeakCentersWorkspace(
     nspec = 1 + 3;
   }
 
-  dataWS = boost::dynamic_pointer_cast<DataObjects::Workspace2D>(
+  m_dataWS = boost::dynamic_pointer_cast<DataObjects::Workspace2D>(
       API::WorkspaceFactory::Instance().create("Workspace2D", nspec, size,
                                                size));
-  dataWS->getAxis(0)->setUnit("dSpacing");
+  m_dataWS->getAxis(0)->setUnit("dSpacing");
 
   // 4. Put data to output workspace
   for (size_t i = 0; i < peakcenters.size(); ++i) {
     for (size_t j = 0; j < nspec; ++j) {
-      dataWS->dataX(j)[i] = peakcenters[i].first;
+      m_dataWS->dataX(j)[i] = peakcenters[i].first;
     }
-    dataWS->dataY(0)[i] = peakcenters[i].second.first;
-    dataWS->dataE(0)[i] = peakcenters[i].second.second;
+    m_dataWS->dataY(0)[i] = peakcenters[i].second.first;
+    m_dataWS->dataE(0)[i] = peakcenters[i].second.second;
   }
 
   return;
@@ -1249,18 +1253,18 @@ RefinePowderInstrumentParameters::genMCResultTable() {
 
   tablews->addColumn("double", "Chi2");
   tablews->addColumn("double", "GSLChi2");
-  for (size_t i = 0; i < mPeakFunctionParameterNames.size(); ++i) {
-    tablews->addColumn("double", mPeakFunctionParameterNames[i]);
+  for (size_t i = 0; i < m_PeakFunctionParameterNames.size(); ++i) {
+    tablews->addColumn("double", m_PeakFunctionParameterNames[i]);
   }
 
   // 2. Put values in
-  for (size_t ib = 0; ib < mBestFitParameters.size(); ++ib) {
+  for (size_t ib = 0; ib < m_BestFitParameters.size(); ++ib) {
     TableRow newrow = tablews->appendRow();
-    double chi2 = mBestFitParameters[ib].first;
-    double gslchi2 = mBestFitChi2s[ib].second;
+    double chi2 = m_BestFitParameters[ib].first;
+    double gslchi2 = m_BestFitChi2s[ib].second;
     newrow << chi2 << gslchi2;
-    for (size_t ip = 0; ip < mPeakFunctionParameterNames.size(); ++ip) {
-      double tempdbl = mBestFitParameters[ib].second[ip];
+    for (size_t ip = 0; ip < m_PeakFunctionParameterNames.size(); ++ip) {
+      double tempdbl = m_BestFitParameters[ib].second[ip];
       newrow << tempdbl;
     }
   } // ENDFOR 1 Best Answer
@@ -1289,7 +1293,7 @@ RefinePowderInstrumentParameters::genOutputInstrumentParameterTable() {
 
   std::map<std::string, double>::iterator pariter;
 
-  for (pariter = mFuncParameters.begin(); pariter != mFuncParameters.end();
+  for (pariter = m_FuncParameters.begin(); pariter != m_FuncParameters.end();
        ++pariter) {
     API::TableRow newrow = newtablews->appendRow();
     std::string parname = pariter->first;
@@ -1300,5 +1304,6 @@ RefinePowderInstrumentParameters::genOutputInstrumentParameterTable() {
   return newtablews;
 }
 
+} // namespace Algorithms
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/RefinePowderInstrumentParameters3.cpp b/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters3.cpp
similarity index 98%
rename from Framework/CurveFitting/src/RefinePowderInstrumentParameters3.cpp
rename to Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters3.cpp
index b2f339bc14ef4a88622e1565a4df50765cee08ee..f87a83a0013f454452b40c588a6b9787401d477a 100644
--- a/Framework/CurveFitting/src/RefinePowderInstrumentParameters3.cpp
+++ b/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters3.cpp
@@ -1,4 +1,4 @@
-#include "MantidCurveFitting/RefinePowderInstrumentParameters3.h"
+#include "MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters3.h"
 
 #include "MantidAPI/Axis.h"
 #include "MantidAPI/TextAxis.h"
@@ -7,12 +7,14 @@
 
 using namespace Mantid::API;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Functions;
 using namespace Mantid::DataObjects;
 using namespace Mantid::Kernel;
 using namespace std;
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Algorithms {
 
 DECLARE_ALGORITHM(RefinePowderInstrumentParameters3)
 
@@ -868,8 +870,15 @@ double RefinePowderInstrumentParameters3::calculateFunctionError(
   // 2. Fit with zero iteration
   double chi2;
   string fitstatus;
-  doFitFunction(function, dataws, wsindex, "Levenberg-MarquardtMD", 0, chi2,
-                fitstatus);
+  const std::string minimizer = "Levenberg-MarquardtMD";
+  bool fitOK =
+      doFitFunction(function, dataws, wsindex, minimizer, 0, chi2, fitstatus);
+
+  if (!fitOK) {
+    g_log.warning() << "Fit by " << minimizer
+                    << " with 0 iterations failed, with reason: " << fitstatus
+                    << "\n";
+  }
 
   // 3. Restore the fit/fix setup
   for (size_t i = 0; i < parnames.size(); ++i) {
@@ -1266,8 +1275,9 @@ void RefinePowderInstrumentParameters3::setFunctionParameterFitSetups(
         double upperbound = param.maxvalue;
         if (lowerbound >= -DBL_MAX * 0.1 || upperbound <= DBL_MAX * 0.1) {
           // If there is a boundary
-          BoundaryConstraint *bc = new BoundaryConstraint(
-              function.get(), parname, lowerbound, upperbound, false);
+          Constraints::BoundaryConstraint *bc =
+              new Constraints::BoundaryConstraint(
+                  function.get(), parname, lowerbound, upperbound, false);
           function->addConstraint(bc);
         }
       } else {
@@ -1428,5 +1438,6 @@ void restoreFunctionParameterValue(
   return;
 }
 
+} // namespace Algorithms
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/SplineBackground.cpp b/Framework/CurveFitting/src/Algorithms/SplineBackground.cpp
similarity index 96%
rename from Framework/CurveFitting/src/SplineBackground.cpp
rename to Framework/CurveFitting/src/Algorithms/SplineBackground.cpp
index d3eddbab62067a8297f96e73f2911bfccfe6eab8..a19fa51061060d39206dd760f8a1d8db453d9fb0 100644
--- a/Framework/CurveFitting/src/SplineBackground.cpp
+++ b/Framework/CurveFitting/src/Algorithms/SplineBackground.cpp
@@ -1,7 +1,7 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/SplineBackground.h"
+#include "MantidCurveFitting/Algorithms/SplineBackground.h"
 #include <gsl/gsl_bspline.h>
 #include <gsl/gsl_multifit.h>
 #include <gsl/gsl_statistics.h>
@@ -9,6 +9,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Algorithms {
 
 DECLARE_ALGORITHM(SplineBackground)
 
@@ -65,8 +66,7 @@ void SplineBackground::exec() {
   bool isMasked = inWS->hasMaskedBins(spec);
   std::vector<int> masked(Y.size());
   if (isMasked) {
-    for (API::MatrixWorkspace::MaskList::const_iterator it =
-             inWS->maskedBins(spec).begin();
+    for (auto it = inWS->maskedBins(spec).begin();
          it != inWS->maskedBins(spec).end(); ++it)
       masked[it->first] = 1;
     n -= static_cast<int>(inWS->maskedBins(spec).size());
@@ -170,5 +170,6 @@ void SplineBackground::exec() {
   setProperty("OutputWorkspace", outWS);
 }
 
-} // namespace Algorithm
+} // namespace Algorithms
+} // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/SplineInterpolation.cpp b/Framework/CurveFitting/src/Algorithms/SplineInterpolation.cpp
similarity index 98%
rename from Framework/CurveFitting/src/SplineInterpolation.cpp
rename to Framework/CurveFitting/src/Algorithms/SplineInterpolation.cpp
index 63731d8bd084bc41f9eda55f90669c0b41b494d1..9d1a1bc531c9d0dc3c765ddf3a904e1bf1955a7c 100644
--- a/Framework/CurveFitting/src/SplineInterpolation.cpp
+++ b/Framework/CurveFitting/src/Algorithms/SplineInterpolation.cpp
@@ -2,16 +2,18 @@
 #include "MantidAPI/NumericAxis.h"
 #include "MantidAPI/Progress.h"
 #include "MantidKernel/BoundedValidator.h"
-#include "MantidCurveFitting/SplineInterpolation.h"
+#include "MantidCurveFitting/Algorithms/SplineInterpolation.h"
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Algorithms {
 
 // Register the algorithm into the AlgorithmFactory
 DECLARE_ALGORITHM(SplineInterpolation)
 
 using namespace API;
 using namespace Kernel;
+using Functions::CubicSpline;
 
 //----------------------------------------------------------------------------------------------
 /** Constructor
@@ -253,5 +255,6 @@ void SplineInterpolation::calculateSpline(
   m_cspline->function1D(yValues, xValues, nData);
 }
 
+} // namespace Algorithms
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/SplineSmoothing.cpp b/Framework/CurveFitting/src/Algorithms/SplineSmoothing.cpp
similarity index 99%
rename from Framework/CurveFitting/src/SplineSmoothing.cpp
rename to Framework/CurveFitting/src/Algorithms/SplineSmoothing.cpp
index 9cac9523f02913279baf3857de8585df1cf1611f..87fcfb16e36bfd4af6e18a84ed51b9c459f27e3c 100644
--- a/Framework/CurveFitting/src/SplineSmoothing.cpp
+++ b/Framework/CurveFitting/src/Algorithms/SplineSmoothing.cpp
@@ -4,19 +4,20 @@
 #include "MantidAPI/TextAxis.h"
 #include "MantidAPI/WorkspaceFactory.h"
 #include "MantidKernel/BoundedValidator.h"
-#include "MantidCurveFitting/SplineSmoothing.h"
+#include "MantidCurveFitting/Algorithms/SplineSmoothing.h"
 
 #include <algorithm>
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Algorithms {
 
 // Register the algorithm into the AlgorithmFactory
 DECLARE_ALGORITHM(SplineSmoothing)
 
 using namespace API;
 using namespace Kernel;
-
+using Functions::BSpline;
 //----------------------------------------------------------------------------------------------
 /** Constructor
  */
@@ -370,5 +371,6 @@ void SplineSmoothing::selectSmoothingPoints(
   }
 }
 
+} // namespace Algorithms
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/BoundaryConstraint.cpp b/Framework/CurveFitting/src/Constraints/BoundaryConstraint.cpp
similarity index 98%
rename from Framework/CurveFitting/src/BoundaryConstraint.cpp
rename to Framework/CurveFitting/src/Constraints/BoundaryConstraint.cpp
index 6ecbe020e781f48f2adbc63862c2ddb45fd067e5..86f3f52be2a7fe4549198c0a4926b5a0c3d1074a 100644
--- a/Framework/CurveFitting/src/BoundaryConstraint.cpp
+++ b/Framework/CurveFitting/src/Constraints/BoundaryConstraint.cpp
@@ -1,7 +1,7 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/BoundaryConstraint.h"
+#include "MantidCurveFitting/Constraints/BoundaryConstraint.h"
 #include "MantidAPI/Expression.h"
 #include "MantidAPI/ConstraintFactory.h"
 #include "MantidKernel/Logger.h"
@@ -10,6 +10,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Constraints {
 namespace {
 /// static logger
 Kernel::Logger g_log("BoundaryConstraint");
@@ -247,5 +248,6 @@ std::string BoundaryConstraint::asString() const {
   return ostr.str();
 }
 
+} // namespace Constraints
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/CostFuncFitting.cpp b/Framework/CurveFitting/src/CostFunctions/CostFuncFitting.cpp
similarity index 98%
rename from Framework/CurveFitting/src/CostFuncFitting.cpp
rename to Framework/CurveFitting/src/CostFunctions/CostFuncFitting.cpp
index 425bdcce324e7fcf858aa95d24c5aa0bd21f2b8f..021e2ed4db9b86a3b5f85a87cd5350288186c49d 100644
--- a/Framework/CurveFitting/src/CostFuncFitting.cpp
+++ b/Framework/CurveFitting/src/CostFunctions/CostFuncFitting.cpp
@@ -1,7 +1,7 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/CostFuncFitting.h"
+#include "MantidCurveFitting/CostFunctions/CostFuncFitting.h"
 #include "MantidCurveFitting/GSLJacobian.h"
 #include "MantidAPI/IConstraint.h"
 
@@ -10,6 +10,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace CostFunctions {
 
 /**
  * Constructor.
@@ -202,5 +203,6 @@ void CostFuncFitting::calTransformationMatrixNumerically(GSLMatrix &tm) {
   }
 }
 
+} // namespace CostFunctions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/CostFuncIgnorePosPeaks.cpp b/Framework/CurveFitting/src/CostFunctions/CostFuncIgnorePosPeaks.cpp
similarity index 95%
rename from Framework/CurveFitting/src/CostFuncIgnorePosPeaks.cpp
rename to Framework/CurveFitting/src/CostFunctions/CostFuncIgnorePosPeaks.cpp
index 6e6b404b1b2fd4fb680e0cf6c92e0babd2f2617f..8f5d5ecbb2e835d9b04494c915715a60ba097158 100644
--- a/Framework/CurveFitting/src/CostFuncIgnorePosPeaks.cpp
+++ b/Framework/CurveFitting/src/CostFunctions/CostFuncIgnorePosPeaks.cpp
@@ -1,13 +1,14 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/CostFuncIgnorePosPeaks.h"
+#include "MantidCurveFitting/CostFunctions/CostFuncIgnorePosPeaks.h"
 #include "MantidKernel/PhysicalConstants.h"
 #include <cmath>
 #include <gsl/gsl_sf_erf.h>
 
 namespace Mantid {
 namespace CurveFitting {
+namespace CostFunctions {
 
 DECLARE_COSTFUNCTION(CostFuncIgnorePosPeaks, Ignore positive peaks)
 
@@ -73,5 +74,6 @@ void CostFuncIgnorePosPeaks::deriv(const double *yData,
   }
 }
 
+} // namespace CostFunctions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/CostFuncLeastSquares.cpp b/Framework/CurveFitting/src/CostFunctions/CostFuncLeastSquares.cpp
similarity index 98%
rename from Framework/CurveFitting/src/CostFuncLeastSquares.cpp
rename to Framework/CurveFitting/src/CostFunctions/CostFuncLeastSquares.cpp
index e1fa52338bf531753909c036c1de96881be22f2f..025968c21b954c5bac4f0754a974669bcc9f462e 100644
--- a/Framework/CurveFitting/src/CostFuncLeastSquares.cpp
+++ b/Framework/CurveFitting/src/CostFunctions/CostFuncLeastSquares.cpp
@@ -1,7 +1,7 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/CostFuncLeastSquares.h"
+#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h"
 #include "MantidCurveFitting/Jacobian.h"
 #include "MantidCurveFitting/SeqDomain.h"
 #include "MantidAPI/IConstraint.h"
@@ -10,10 +10,9 @@
 #include "MantidKernel/Logger.h"
 #include "MantidKernel/MultiThreaded.h"
 
-#include <iomanip>
-
 namespace Mantid {
 namespace CurveFitting {
+namespace CostFunctions {
 namespace {
 /// static logger
 Kernel::Logger g_log("CostFuncLeastSquares");
@@ -438,5 +437,6 @@ void CostFuncLeastSquares::calActiveCovarianceMatrix(GSLMatrix &covar,
   }
 }
 
+} // namespace CostFunctions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/CostFuncRwp.cpp b/Framework/CurveFitting/src/CostFunctions/CostFuncRwp.cpp
similarity index 94%
rename from Framework/CurveFitting/src/CostFuncRwp.cpp
rename to Framework/CurveFitting/src/CostFunctions/CostFuncRwp.cpp
index c72d9d3d4a1487df71590914057100a46c4c9eab..17e783d9f7e438c9366c6d3fc3ffe700703e3872 100644
--- a/Framework/CurveFitting/src/CostFuncRwp.cpp
+++ b/Framework/CurveFitting/src/CostFunctions/CostFuncRwp.cpp
@@ -1,7 +1,7 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/CostFuncRwp.h"
+#include "MantidCurveFitting/CostFunctions/CostFuncRwp.h"
 #include "MantidCurveFitting/Jacobian.h"
 #include "MantidCurveFitting/SeqDomain.h"
 #include "MantidAPI/IConstraint.h"
@@ -9,10 +9,10 @@
 #include "MantidAPI/FunctionValues.h"
 
 #include <cmath>
-#include <iomanip>
 
 namespace Mantid {
 namespace CurveFitting {
+namespace CostFunctions {
 
 DECLARE_COSTFUNCTION(CostFuncRwp, Rwp)
 
@@ -64,5 +64,6 @@ double CostFuncRwp::calSqrtW(API::FunctionValues_sptr values) const {
   return sqrt(weight);
 }
 
+} // namespace CostFunctions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/CostFuncUnweightedLeastSquares.cpp b/Framework/CurveFitting/src/CostFunctions/CostFuncUnweightedLeastSquares.cpp
similarity index 95%
rename from Framework/CurveFitting/src/CostFuncUnweightedLeastSquares.cpp
rename to Framework/CurveFitting/src/CostFunctions/CostFuncUnweightedLeastSquares.cpp
index da4e2bd1170ff07e4dba224179e1d2a8e33d58b8..c7eadd62b70a84e434abd1ab4eacc719f584a558 100644
--- a/Framework/CurveFitting/src/CostFuncUnweightedLeastSquares.cpp
+++ b/Framework/CurveFitting/src/CostFunctions/CostFuncUnweightedLeastSquares.cpp
@@ -1,11 +1,11 @@
-#include "MantidCurveFitting/CostFuncUnweightedLeastSquares.h"
+#include "MantidCurveFitting/CostFunctions/CostFuncUnweightedLeastSquares.h"
 
 #include "MantidKernel/Logger.h"
-#include <iomanip>
 #include <cmath>
 
 namespace Mantid {
 namespace CurveFitting {
+namespace CostFunctions {
 
 namespace {
 /// static logger
@@ -80,5 +80,6 @@ double CostFuncUnweightedLeastSquares::getResidualVariance() const {
   return residualVariance;
 }
 
+} // namespace CostFunctions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/FitMW.cpp b/Framework/CurveFitting/src/FitMW.cpp
index d98e9dc7f3719d3111503175281cd3cd0d12242a..730110936f4ad63ae1821bdd9fe2d7c4e1cd6d15 100644
--- a/Framework/CurveFitting/src/FitMW.cpp
+++ b/Framework/CurveFitting/src/FitMW.cpp
@@ -2,7 +2,7 @@
 //----------------------------------------------------------------------
 #include "MantidCurveFitting/FitMW.h"
 #include "MantidCurveFitting/SeqDomain.h"
-#include "MantidCurveFitting/Convolution.h"
+#include "MantidCurveFitting/Functions/Convolution.h"
 #include "MantidCurveFitting/ParameterEstimator.h"
 
 #include "MantidAPI/CompositeFunction.h"
@@ -449,7 +449,7 @@ void FitMW::appendCompositeFunctionMembers(
   // if function is a Convolution then output of convolved model's mebers may be
   // required
   if (m_convolutionCompositeMembers &&
-      boost::dynamic_pointer_cast<CurveFitting::Convolution>(function)) {
+      boost::dynamic_pointer_cast<Functions::Convolution>(function)) {
     appendConvolvedCompositeFunctionMembers(functionList, function);
   } else {
     const auto compositeFn =
@@ -486,8 +486,8 @@ void FitMW::appendCompositeFunctionMembers(
 void FitMW::appendConvolvedCompositeFunctionMembers(
     std::list<API::IFunction_sptr> &functionList,
     const API::IFunction_sptr &function) const {
-  boost::shared_ptr<CurveFitting::Convolution> convolution =
-      boost::dynamic_pointer_cast<CurveFitting::Convolution>(function);
+  boost::shared_ptr<Functions::Convolution> convolution =
+      boost::dynamic_pointer_cast<Functions::Convolution>(function);
 
   const auto compositeFn = boost::dynamic_pointer_cast<API::CompositeFunction>(
       convolution->getFunction(1));
@@ -498,8 +498,8 @@ void FitMW::appendConvolvedCompositeFunctionMembers(
     const size_t nlocals = compositeFn->nFunctions();
     for (size_t i = 0; i < nlocals; ++i) {
       auto localFunction = compositeFn->getFunction(i);
-      boost::shared_ptr<CurveFitting::Convolution> localConvolution =
-          boost::make_shared<CurveFitting::Convolution>();
+      boost::shared_ptr<Functions::Convolution> localConvolution =
+          boost::make_shared<Functions::Convolution>();
       localConvolution->addFunction(resolution);
       localConvolution->addFunction(localFunction);
       functionList.insert(functionList.end(), localConvolution);
diff --git a/Framework/CurveFitting/src/BFGS_Minimizer.cpp b/Framework/CurveFitting/src/FuncMinimizers/BFGS_Minimizer.cpp
similarity index 85%
rename from Framework/CurveFitting/src/BFGS_Minimizer.cpp
rename to Framework/CurveFitting/src/FuncMinimizers/BFGS_Minimizer.cpp
index 8feb486fce889ac7784d01cbfe6a74a1032e0499..40b817c1028cc4f3d818e529859f37a7352fd00d 100644
--- a/Framework/CurveFitting/src/BFGS_Minimizer.cpp
+++ b/Framework/CurveFitting/src/FuncMinimizers/BFGS_Minimizer.cpp
@@ -1,7 +1,7 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/BFGS_Minimizer.h"
+#include "MantidCurveFitting/FuncMinimizers/BFGS_Minimizer.h"
 
 #include "MantidAPI/CostFunctionFactory.h"
 #include "MantidAPI/FuncMinimizerFactory.h"
@@ -10,6 +10,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace FuncMinimisers {
 namespace {
 /// static logger object
 Kernel::Logger g_log("BFGS_Minimizer");
@@ -23,5 +24,6 @@ const gsl_multimin_fdfminimizer_type *BFGS_Minimizer::getGSLMinimizerType() {
   return gsl_multimin_fdfminimizer_vector_bfgs2;
 }
 
+} // namespace FuncMinimisers
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/DampingMinimizer.cpp b/Framework/CurveFitting/src/FuncMinimizers/DampingMinimizer.cpp
similarity index 91%
rename from Framework/CurveFitting/src/DampingMinimizer.cpp
rename to Framework/CurveFitting/src/FuncMinimizers/DampingMinimizer.cpp
index 01e3169ebba8d9a0d3587a6d30143796d1de82f0..08114e04a546b699b4f359ba826924cf850a1917 100644
--- a/Framework/CurveFitting/src/DampingMinimizer.cpp
+++ b/Framework/CurveFitting/src/FuncMinimizers/DampingMinimizer.cpp
@@ -1,8 +1,8 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/DampingMinimizer.h"
-#include "MantidCurveFitting/CostFuncLeastSquares.h"
+#include "MantidCurveFitting/FuncMinimizers/DampingMinimizer.h"
+#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h"
 
 #include "MantidAPI/CostFunctionFactory.h"
 #include "MantidAPI/FuncMinimizerFactory.h"
@@ -17,6 +17,8 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace FuncMinimisers {
+
 namespace {
 /// static logger
 Kernel::Logger g_log("DampingMinimizer");
@@ -32,7 +34,9 @@ DampingMinimizer::DampingMinimizer(double relTol)
 
 /// Initialize minimizer, i.e. pass a function to minimize.
 void DampingMinimizer::initialize(API::ICostFunction_sptr function, size_t) {
-  m_leastSquares = boost::dynamic_pointer_cast<CostFuncLeastSquares>(function);
+  m_leastSquares =
+      boost::dynamic_pointer_cast<CostFunctions::CostFuncLeastSquares>(
+          function);
   if (!m_leastSquares) {
     throw std::invalid_argument("Damping minimizer works only with least "
                                 "squares. Different function was given.");
@@ -121,5 +125,6 @@ double DampingMinimizer::costFunctionVal() {
   return m_leastSquares->val();
 }
 
+} // namespace FuncMinimisers
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/DerivMinimizer.cpp b/Framework/CurveFitting/src/FuncMinimizers/DerivMinimizer.cpp
similarity index 88%
rename from Framework/CurveFitting/src/DerivMinimizer.cpp
rename to Framework/CurveFitting/src/FuncMinimizers/DerivMinimizer.cpp
index 57cbc5a122fcbce37b30629977b8cc9c6dcc0dc0..5f54e75d6d7bea7407b1156cb3d8d035f05e59e1 100644
--- a/Framework/CurveFitting/src/DerivMinimizer.cpp
+++ b/Framework/CurveFitting/src/FuncMinimizers/DerivMinimizer.cpp
@@ -1,11 +1,12 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/DerivMinimizer.h"
-#include "MantidCurveFitting/CostFuncFitting.h"
+#include "MantidCurveFitting/FuncMinimizers/DerivMinimizer.h"
+#include "MantidCurveFitting/CostFunctions/CostFuncFitting.h"
 
 namespace Mantid {
 namespace CurveFitting {
+namespace FuncMinimisers {
 
 /** Used by the GSL to calculate the cost function.
  * @param x :: Vector with parameters
@@ -17,8 +18,9 @@ double DerivMinimizer::fun(const gsl_vector *x, void *params) {
   for (size_t i = 0; i < n; ++i) {
     minimizer.m_costFunction->setParameter(i, gsl_vector_get(x, i));
   }
-  boost::shared_ptr<CostFuncFitting> fitting =
-      boost::dynamic_pointer_cast<CostFuncFitting>(minimizer.m_costFunction);
+  boost::shared_ptr<CostFunctions::CostFuncFitting> fitting =
+      boost::dynamic_pointer_cast<CostFunctions::CostFuncFitting>(
+          minimizer.m_costFunction);
   if (fitting) {
     fitting->getFittingFunction()->applyTies();
   }
@@ -36,8 +38,9 @@ void DerivMinimizer::dfun(const gsl_vector *x, void *params, gsl_vector *g) {
   for (size_t i = 0; i < n; ++i) {
     minimizer.m_costFunction->setParameter(i, gsl_vector_get(x, i));
   }
-  boost::shared_ptr<CostFuncFitting> fitting =
-      boost::dynamic_pointer_cast<CostFuncFitting>(minimizer.m_costFunction);
+  boost::shared_ptr<CostFunctions::CostFuncFitting> fitting =
+      boost::dynamic_pointer_cast<CostFunctions::CostFuncFitting>(
+          minimizer.m_costFunction);
   if (fitting) {
     fitting->getFittingFunction()->applyTies();
   }
@@ -61,8 +64,9 @@ void DerivMinimizer::fundfun(const gsl_vector *x, void *params, double *f,
   for (size_t i = 0; i < n; ++i) {
     minimizer.m_costFunction->setParameter(i, gsl_vector_get(x, i));
   }
-  boost::shared_ptr<CostFuncFitting> fitting =
-      boost::dynamic_pointer_cast<CostFuncFitting>(minimizer.m_costFunction);
+  boost::shared_ptr<CostFunctions::CostFuncFitting> fitting =
+      boost::dynamic_pointer_cast<CostFunctions::CostFuncFitting>(
+          minimizer.m_costFunction);
   if (fitting) {
     fitting->getFittingFunction()->applyTies();
   }
@@ -173,5 +177,6 @@ void DerivMinimizer::setStopGradient(const double value) {
 
 double DerivMinimizer::costFunctionVal() { return m_gslSolver->f; }
 
+} // namespace FuncMinimisers
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/FABADAMinimizer.cpp b/Framework/CurveFitting/src/FuncMinimizers/FABADAMinimizer.cpp
similarity index 97%
rename from Framework/CurveFitting/src/FABADAMinimizer.cpp
rename to Framework/CurveFitting/src/FuncMinimizers/FABADAMinimizer.cpp
index 8e8f7e3d70838d4d8dfaa06d2010a61b5954d7bc..fcdedf14c5017e8603999ccc7f97b1b8076febef 100644
--- a/Framework/CurveFitting/src/FABADAMinimizer.cpp
+++ b/Framework/CurveFitting/src/FuncMinimizers/FABADAMinimizer.cpp
@@ -1,6 +1,6 @@
-#include "MantidCurveFitting/FABADAMinimizer.h"
-#include "MantidCurveFitting/CostFuncLeastSquares.h"
-#include "MantidCurveFitting/BoundaryConstraint.h"
+#include "MantidCurveFitting/FuncMinimizers/FABADAMinimizer.h"
+#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h"
+#include "MantidCurveFitting//Constraints/BoundaryConstraint.h"
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -26,11 +26,11 @@
 #include <boost/version.hpp>
 #include <boost/math/special_functions/fpclassify.hpp>
 
-#include <iostream>
 #include <ctime>
 
 namespace Mantid {
 namespace CurveFitting {
+namespace FuncMinimisers {
 
 namespace {
 // static logger object
@@ -92,7 +92,9 @@ FABADAMinimizer::~FABADAMinimizer() {}
 void FABADAMinimizer::initialize(API::ICostFunction_sptr function,
                                  size_t maxIterations) {
 
-  m_leastSquares = boost::dynamic_pointer_cast<CostFuncLeastSquares>(function);
+  m_leastSquares =
+      boost::dynamic_pointer_cast<CostFunctions::CostFuncLeastSquares>(
+          function);
   if (!m_leastSquares) {
     throw std::invalid_argument(
         "FABADA works only with least squares. Different function was given.");
@@ -121,7 +123,8 @@ void FABADAMinimizer::initialize(API::ICostFunction_sptr function,
     m_bound.push_back(false);
     API::IConstraint *iconstr = fun->getConstraint(i);
     if (iconstr) {
-      BoundaryConstraint *bcon = dynamic_cast<BoundaryConstraint *>(iconstr);
+      Constraints::BoundaryConstraint *bcon =
+          dynamic_cast<Constraints::BoundaryConstraint *>(iconstr);
       if (bcon) {
         m_bound[i] = true;
         if (bcon->hasLower()) {
@@ -641,5 +644,6 @@ void FABADAMinimizer::finalize() {
   }
 }
 
+} // namespace FuncMinimisers
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/FRConjugateGradientMinimizer.cpp b/Framework/CurveFitting/src/FuncMinimizers/FRConjugateGradientMinimizer.cpp
similarity index 86%
rename from Framework/CurveFitting/src/FRConjugateGradientMinimizer.cpp
rename to Framework/CurveFitting/src/FuncMinimizers/FRConjugateGradientMinimizer.cpp
index a06a974c52ff6db48b0532bf76cab1c32bb2fd2e..d609f35a7cf2132a0a4c5b2aa81388d8cefb17d5 100644
--- a/Framework/CurveFitting/src/FRConjugateGradientMinimizer.cpp
+++ b/Framework/CurveFitting/src/FuncMinimizers/FRConjugateGradientMinimizer.cpp
@@ -1,7 +1,7 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/FRConjugateGradientMinimizer.h"
+#include "MantidCurveFitting/FuncMinimizers/FRConjugateGradientMinimizer.h"
 
 #include "MantidAPI/CostFunctionFactory.h"
 #include "MantidAPI/FuncMinimizerFactory.h"
@@ -10,6 +10,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace FuncMinimisers {
 namespace {
 /// static logger
 Kernel::Logger g_log("FRConjugateGradientMinimizer");
@@ -28,5 +29,6 @@ FRConjugateGradientMinimizer::getGSLMinimizerType() {
   return gsl_multimin_fdfminimizer_conjugate_fr;
 }
 
+} // namespace FuncMinimisers
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/LevenbergMarquardtMDMinimizer.cpp b/Framework/CurveFitting/src/FuncMinimizers/LevenbergMarquardtMDMinimizer.cpp
similarity index 96%
rename from Framework/CurveFitting/src/LevenbergMarquardtMDMinimizer.cpp
rename to Framework/CurveFitting/src/FuncMinimizers/LevenbergMarquardtMDMinimizer.cpp
index 11793321b58aa4f52d8d51db2238f6f28ab41022..74fe28e69cdf447d7ba99f833fca8083f359adb5 100644
--- a/Framework/CurveFitting/src/LevenbergMarquardtMDMinimizer.cpp
+++ b/Framework/CurveFitting/src/FuncMinimizers/LevenbergMarquardtMDMinimizer.cpp
@@ -1,8 +1,8 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/LevenbergMarquardtMDMinimizer.h"
-#include "MantidCurveFitting/CostFuncLeastSquares.h"
+#include "MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMDMinimizer.h"
+#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h"
 
 #include "MantidAPI/CostFunctionFactory.h"
 #include "MantidAPI/FuncMinimizerFactory.h"
@@ -12,11 +12,11 @@
 
 #include <boost/lexical_cast.hpp>
 #include <gsl/gsl_blas.h>
-#include <iostream>
 #include <cmath>
 
 namespace Mantid {
 namespace CurveFitting {
+namespace FuncMinimisers {
 namespace {
 /// static logger object
 Kernel::Logger g_log("LevenbergMarquardMD");
@@ -40,7 +40,9 @@ LevenbergMarquardtMDMinimizer::LevenbergMarquardtMDMinimizer()
 /// Initialize minimizer, i.e. pass a function to minimize.
 void LevenbergMarquardtMDMinimizer::initialize(API::ICostFunction_sptr function,
                                                size_t) {
-  m_leastSquares = boost::dynamic_pointer_cast<CostFuncLeastSquares>(function);
+  m_leastSquares =
+      boost::dynamic_pointer_cast<CostFunctions::CostFuncLeastSquares>(
+          function);
   if (!m_leastSquares) {
     throw std::invalid_argument("Levenberg-Marquardt minimizer works only with "
                                 "least squares. Different function was given.");
@@ -287,5 +289,6 @@ double LevenbergMarquardtMDMinimizer::costFunctionVal() {
   return m_leastSquares->val();
 }
 
+} // namespace FuncMinimisers
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/LevenbergMarquardtMinimizer.cpp b/Framework/CurveFitting/src/FuncMinimizers/LevenbergMarquardtMinimizer.cpp
similarity index 93%
rename from Framework/CurveFitting/src/LevenbergMarquardtMinimizer.cpp
rename to Framework/CurveFitting/src/FuncMinimizers/LevenbergMarquardtMinimizer.cpp
index 7e5614689298bb76705e4f6fed28472a1eab3ff5..df84cfc9f62124e1817e6b462e96fb64a59a7842 100644
--- a/Framework/CurveFitting/src/LevenbergMarquardtMinimizer.cpp
+++ b/Framework/CurveFitting/src/FuncMinimizers/LevenbergMarquardtMinimizer.cpp
@@ -1,8 +1,8 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/LevenbergMarquardtMinimizer.h"
-#include "MantidCurveFitting/CostFuncLeastSquares.h"
+#include "MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMinimizer.h"
+#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h"
 
 #include "MantidAPI/CostFunctionFactory.h"
 #include "MantidAPI/FuncMinimizerFactory.h"
@@ -13,10 +13,10 @@
 
 #include <boost/lexical_cast.hpp>
 #include <gsl/gsl_blas.h>
-#include <iostream>
 
 namespace Mantid {
 namespace CurveFitting {
+namespace FuncMinimisers {
 namespace {
 // Get a reference to the logger
 Kernel::Logger g_log("LevenbergMarquardtMinimizer");
@@ -41,7 +41,8 @@ void LevenbergMarquardtMinimizer::initialize(
     API::ICostFunction_sptr costFunction, size_t) {
   // set-up GSL container to be used with GSL simplex algorithm
   auto leastSquares =
-      boost::dynamic_pointer_cast<CostFuncLeastSquares>(costFunction);
+      boost::dynamic_pointer_cast<CostFunctions::CostFuncLeastSquares>(
+          costFunction);
   if (leastSquares) {
     m_data = new GSL_FitData(leastSquares);
   } else {
@@ -141,5 +142,6 @@ void LevenbergMarquardtMinimizer::calCovarianceMatrix(double epsrel,
   gsl_multifit_covar(m_gslSolver->J, epsrel, covar);
 }
 
+} // namespace FuncMinimisers
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/PRConjugateGradientMinimizer.cpp b/Framework/CurveFitting/src/FuncMinimizers/PRConjugateGradientMinimizer.cpp
similarity index 85%
rename from Framework/CurveFitting/src/PRConjugateGradientMinimizer.cpp
rename to Framework/CurveFitting/src/FuncMinimizers/PRConjugateGradientMinimizer.cpp
index ae9d3adaa6fb0e7841e23f563c88b6027a88685a..e208d427551e7e3ce76b176607ea017300396127 100644
--- a/Framework/CurveFitting/src/PRConjugateGradientMinimizer.cpp
+++ b/Framework/CurveFitting/src/FuncMinimizers/PRConjugateGradientMinimizer.cpp
@@ -1,7 +1,7 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/PRConjugateGradientMinimizer.h"
+#include "MantidCurveFitting/FuncMinimizers/PRConjugateGradientMinimizer.h"
 
 #include "MantidAPI/CostFunctionFactory.h"
 #include "MantidAPI/FuncMinimizerFactory.h"
@@ -10,6 +10,7 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace FuncMinimisers {
 
 // clang-format off
 ///@cond nodoc
@@ -24,5 +25,6 @@ PRConjugateGradientMinimizer::getGSLMinimizerType() {
   return gsl_multimin_fdfminimizer_conjugate_pr;
 }
 
+} // namespace FuncMinimisers
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/FuncMinimizers/SimplexMinimizer.cpp b/Framework/CurveFitting/src/FuncMinimizers/SimplexMinimizer.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..e9399ae13f134ee944285d188a5e406dc5698645
--- /dev/null
+++ b/Framework/CurveFitting/src/FuncMinimizers/SimplexMinimizer.cpp
@@ -0,0 +1,124 @@
+//----------------------------------------------------------------------
+// Includes
+//----------------------------------------------------------------------
+#include "MantidCurveFitting/FuncMinimizers/SimplexMinimizer.h"
+#include "MantidCurveFitting/CostFunctions/CostFuncFitting.h"
+
+#include "MantidAPI/FuncMinimizerFactory.h"
+
+#include "MantidKernel/Logger.h"
+
+namespace Mantid {
+namespace CurveFitting {
+namespace FuncMinimisers {
+namespace {
+/// static logger
+Kernel::Logger g_log("SimplexMinimizer");
+}
+
+DECLARE_FUNCMINIMIZER(SimplexMinimizer, Simplex)
+
+/** Calculating cost function
+*
+* @param x :: Input function arguments
+* @param params :: Pointer to a SimplexMinimizer
+* @return Value of the cost function
+*/
+double SimplexMinimizer::fun(const gsl_vector *x, void *params) {
+  SimplexMinimizer &minimizer = *static_cast<SimplexMinimizer *>(params);
+  // update function parameters
+  if (x->data) {
+    for (size_t i = 0; i < minimizer.m_costFunction->nParams(); ++i) {
+      minimizer.m_costFunction->setParameter(i, gsl_vector_get(x, i));
+    }
+  }
+  boost::shared_ptr<CostFunctions::CostFuncFitting> fitting =
+      boost::dynamic_pointer_cast<CostFunctions::CostFuncFitting>(
+          minimizer.m_costFunction);
+  if (fitting) {
+    fitting->getFittingFunction()->applyTies();
+  }
+  return minimizer.m_costFunction->val();
+}
+
+SimplexMinimizer::SimplexMinimizer(const double epsabs)
+    : m_epsabs(epsabs), m_costFunction(), m_size(1.0), m_simplexStepSize(NULL),
+      m_startGuess(NULL), m_gslSolver(NULL) {
+  gslContainer.f = NULL;
+  gslContainer.n = -1;
+  gslContainer.params = NULL;
+}
+
+void SimplexMinimizer::initialize(API::ICostFunction_sptr function, size_t) {
+  m_costFunction = function;
+
+  const gsl_multimin_fminimizer_type *T = gsl_multimin_fminimizer_nmsimplex;
+
+  size_t np = function->nParams();
+  // step size for simplex
+  m_simplexStepSize = gsl_vector_alloc(np);
+  gsl_vector_set_all(m_simplexStepSize, m_size);
+
+  // setup simplex container
+  gslContainer.n = np;
+  gslContainer.f = &fun;
+  gslContainer.params = this;
+
+  // fill in parameter values
+  m_startGuess = gsl_vector_alloc(np);
+  for (size_t i = 0; i < np; ++i) {
+    gsl_vector_set(m_startGuess, i, function->getParameter(i));
+  }
+
+  // setup minimizer
+  m_gslSolver = gsl_multimin_fminimizer_alloc(T, np);
+  gsl_multimin_fminimizer_set(m_gslSolver, &gslContainer, m_startGuess,
+                              m_simplexStepSize);
+}
+
+/**
+ * Do one iteration.
+ * @return :: true if iterations to be continued, false if they can stop
+ */
+bool SimplexMinimizer::iterate(size_t) {
+  int status = gsl_multimin_fminimizer_iterate(m_gslSolver);
+  if (status) {
+    m_errorString = gsl_strerror(status);
+    return false;
+  }
+  double size = gsl_multimin_fminimizer_size(m_gslSolver);
+  status = gsl_multimin_test_size(size, m_epsabs);
+  if (status != GSL_CONTINUE) {
+    m_errorString = gsl_strerror(status);
+    return false;
+  }
+  return true;
+}
+
+/// resets the size
+void SimplexMinimizer::resetSize(const double &size) {
+  m_size = size;
+  clearMemory();
+  initialize(m_costFunction);
+}
+
+SimplexMinimizer::~SimplexMinimizer() { clearMemory(); }
+
+/// clear memory
+void SimplexMinimizer::clearMemory() {
+  if (m_simplexStepSize) {
+    gsl_vector_free(m_simplexStepSize);
+  }
+  if (m_startGuess) {
+    gsl_vector_free(m_startGuess);
+  }
+  if (m_gslSolver) {
+    gsl_multimin_fminimizer_free(m_gslSolver);
+  }
+}
+
+double SimplexMinimizer::costFunctionVal() { return m_gslSolver->fval; }
+
+} // namespace FuncMinimisers
+} // namespace CurveFitting
+} // namespace Mantid
diff --git a/Framework/CurveFitting/src/SteepestDescentMinimizer.cpp b/Framework/CurveFitting/src/FuncMinimizers/SteepestDescentMinimizer.cpp
similarity index 85%
rename from Framework/CurveFitting/src/SteepestDescentMinimizer.cpp
rename to Framework/CurveFitting/src/FuncMinimizers/SteepestDescentMinimizer.cpp
index be4c4380ab191ba7a3db2150ca0a14c39a179e1b..810d63841a68ab2b02ff4f0630cbcc574bfb259d 100644
--- a/Framework/CurveFitting/src/SteepestDescentMinimizer.cpp
+++ b/Framework/CurveFitting/src/FuncMinimizers/SteepestDescentMinimizer.cpp
@@ -1,7 +1,7 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/SteepestDescentMinimizer.h"
+#include "MantidCurveFitting/FuncMinimizers/SteepestDescentMinimizer.h"
 
 #include "MantidAPI/CostFunctionFactory.h"
 #include "MantidAPI/FuncMinimizerFactory.h"
@@ -10,6 +10,8 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace FuncMinimisers {
+
 namespace {
 // Get a reference to the logger
 Kernel::Logger g_log("SteepestDescentMinimizer");
@@ -24,5 +26,6 @@ SteepestDescentMinimizer::getGSLMinimizerType() {
   return gsl_multimin_fdfminimizer_steepest_descent;
 }
 
+} // namespace FuncMinimisers
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/Abragam.cpp b/Framework/CurveFitting/src/Functions/Abragam.cpp
similarity index 93%
rename from Framework/CurveFitting/src/Abragam.cpp
rename to Framework/CurveFitting/src/Functions/Abragam.cpp
index cd24227e3143a73979c2fca010074c8d4ea831dc..40ff74e9b61da1d1896de518896c4d6c8f5cf25a 100644
--- a/Framework/CurveFitting/src/Abragam.cpp
+++ b/Framework/CurveFitting/src/Functions/Abragam.cpp
@@ -1,14 +1,18 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/Abragam.h"
+#include "MantidCurveFitting/Functions/Abragam.h"
 #include "MantidAPI//FunctionFactory.h"
 #include <cmath>
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 
 using namespace Kernel;
+
 using namespace API;
 
 DECLARE_FUNCTION(Abragam)
@@ -61,5 +65,6 @@ void Abragam::setActiveParameter(size_t i, double value) {
     setParameter(j, value, false);
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/BSpline.cpp b/Framework/CurveFitting/src/Functions/BSpline.cpp
similarity index 98%
rename from Framework/CurveFitting/src/BSpline.cpp
rename to Framework/CurveFitting/src/Functions/BSpline.cpp
index b174fdc184dedc64f68525912eddf8103fde4e81..670a7c8614abc0934bf5e909fe48b46bdcc26b4e 100644
--- a/Framework/CurveFitting/src/BSpline.cpp
+++ b/Framework/CurveFitting/src/Functions/BSpline.cpp
@@ -1,17 +1,21 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/BSpline.h"
+#include "MantidCurveFitting/Functions/BSpline.h"
 #include "MantidCurveFitting/GSLVector.h"
 #include "MantidCurveFitting/GSLMatrix.h"
 #include "MantidAPI/FunctionFactory.h"
 
 #include <boost/lexical_cast.hpp>
-#include <iostream>
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
+
 using namespace Kernel;
+
 using namespace API;
 
 DECLARE_FUNCTION(BSpline)
@@ -251,5 +255,6 @@ void BSpline::getGSLBreakPoints(std::vector<double> &bp) const {
   }
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/BackToBackExponential.cpp b/Framework/CurveFitting/src/Functions/BackToBackExponential.cpp
similarity index 96%
rename from Framework/CurveFitting/src/BackToBackExponential.cpp
rename to Framework/CurveFitting/src/Functions/BackToBackExponential.cpp
index 0c623c678de5444a75316e156d2abd584412dbf5..64a5d5aae6a6237bd4a293c78107fc7e4e7c5363 100644
--- a/Framework/CurveFitting/src/BackToBackExponential.cpp
+++ b/Framework/CurveFitting/src/Functions/BackToBackExponential.cpp
@@ -1,7 +1,7 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/BackToBackExponential.h"
+#include "MantidCurveFitting/Functions/BackToBackExponential.h"
 #include "MantidAPI/FunctionFactory.h"
 
 #include <gsl/gsl_sf_erf.h>
@@ -12,8 +12,12 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 
 using namespace Kernel;
+
 using namespace API;
 
 DECLARE_FUNCTION(BackToBackExponential)
@@ -144,5 +148,6 @@ double BackToBackExponential::expWidth() const {
   return M_LN2 * (a + b) / (a * b);
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/BackgroundFunction.cpp b/Framework/CurveFitting/src/Functions/BackgroundFunction.cpp
similarity index 78%
rename from Framework/CurveFitting/src/BackgroundFunction.cpp
rename to Framework/CurveFitting/src/Functions/BackgroundFunction.cpp
index a7d79bd6fe4109e9f58967b399e725ff16f25302..1b243cda6edc5f52619fe15152aab68edb443053 100644
--- a/Framework/CurveFitting/src/BackgroundFunction.cpp
+++ b/Framework/CurveFitting/src/Functions/BackgroundFunction.cpp
@@ -1,12 +1,16 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/BackgroundFunction.h"
+#include "MantidCurveFitting/Functions/BackgroundFunction.h"
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 
 using namespace Kernel;
+
 using namespace API;
 
 void BackgroundFunction::fit(const std::vector<double> &X,
@@ -15,5 +19,6 @@ void BackgroundFunction::fit(const std::vector<double> &X,
   (void)Y; // Avoid compiler warning
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/BivariateNormal.cpp b/Framework/CurveFitting/src/Functions/BivariateNormal.cpp
similarity index 98%
rename from Framework/CurveFitting/src/BivariateNormal.cpp
rename to Framework/CurveFitting/src/Functions/BivariateNormal.cpp
index f9cae2a8038f071c747db3f76be879e2778e15d7..59918f5e1e5e65171378450762c01892f3c9d5f4 100644
--- a/Framework/CurveFitting/src/BivariateNormal.cpp
+++ b/Framework/CurveFitting/src/Functions/BivariateNormal.cpp
@@ -1,5 +1,5 @@
-#include "MantidCurveFitting/BivariateNormal.h"
-#include "MantidCurveFitting/BoundaryConstraint.h"
+#include "MantidCurveFitting/Functions/BivariateNormal.h"
+#include "MantidCurveFitting/Constraints/BoundaryConstraint.h"
 #include "MantidAPI/MatrixWorkspace.h"
 #include "MantidKernel/PhysicalConstants.h"
 #include "MantidAPI/ParameterTie.h"
@@ -9,7 +9,6 @@
 #include <fstream>
 #include <algorithm>
 #include <math.h>
-#include <iostream>
 #include <sstream>
 #include <string>
 #include <cstdio>
@@ -18,6 +17,10 @@ using namespace Mantid::API;
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
+using namespace Constraints;
 
 namespace {
 /// static logger
@@ -680,5 +683,6 @@ double BivariateNormal::initCoeff(const MantidVec &D, const MantidVec &X,
   return penalty;
 }
 
+} // namespace Functions
 } // namespace curveFitting
 } // namespaceMantid
diff --git a/Framework/CurveFitting/src/Bk2BkExpConvPV.cpp b/Framework/CurveFitting/src/Functions/Bk2BkExpConvPV.cpp
similarity index 98%
rename from Framework/CurveFitting/src/Bk2BkExpConvPV.cpp
rename to Framework/CurveFitting/src/Functions/Bk2BkExpConvPV.cpp
index 7052c100cf82ebd824ef254c3b1495f466d269af..d3f4fcb35aae249b2971879a6f362d0066251462 100644
--- a/Framework/CurveFitting/src/Bk2BkExpConvPV.cpp
+++ b/Framework/CurveFitting/src/Functions/Bk2BkExpConvPV.cpp
@@ -1,18 +1,22 @@
 #include <cmath>
 
-#include "MantidCurveFitting/Bk2BkExpConvPV.h"
+#include "MantidCurveFitting/Functions/Bk2BkExpConvPV.h"
 #include "MantidKernel/System.h"
 #include "MantidAPI/FunctionFactory.h"
 
 #include <gsl/gsl_sf_erf.h>
 
 using namespace Mantid::Kernel;
+
 using namespace Mantid::API;
 
 using namespace std;
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 namespace {
 /// static logger
 Kernel::Logger g_log("Bk2BkExpConvPV");
@@ -250,4 +254,5 @@ void Bk2BkExpConvPV::calHandEta(double sigma2, double gamma, double &H,
 }
 
 } // namespace Mantid
+} // namespace Functions
 } // namespace CurveFitting
diff --git a/Framework/CurveFitting/src/ChebfunBase.cpp b/Framework/CurveFitting/src/Functions/ChebfunBase.cpp
similarity index 99%
rename from Framework/CurveFitting/src/ChebfunBase.cpp
rename to Framework/CurveFitting/src/Functions/ChebfunBase.cpp
index 3a1844b95636baf0adf96fa6b8e88bec092e97a4..4f25c57ba462bd4071272fba1c2ba8f17684dc99 100644
--- a/Framework/CurveFitting/src/ChebfunBase.cpp
+++ b/Framework/CurveFitting/src/Functions/ChebfunBase.cpp
@@ -1,4 +1,4 @@
-#include "MantidCurveFitting/ChebfunBase.h"
+#include "MantidCurveFitting/Functions/ChebfunBase.h"
 #include "MantidAPI/IFunction1D.h"
 #include "MantidAPI/FunctionDomain1D.h"
 #include "MantidAPI/FunctionValues.h"
@@ -19,6 +19,9 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 
 // Set the comparison tolerance.
 const double ChebfunBase::g_tolerance = 1e-15;
@@ -297,6 +300,7 @@ ChebfunBase::evalVector(const std::vector<double> &x,
  */
 void ChebfunBase::derivative(const std::vector<double> &a,
                              std::vector<double> &aout) const {
+
   using namespace std::placeholders;
   if (a.size() != m_x.size()) {
     throw std::invalid_argument(
@@ -331,6 +335,7 @@ void ChebfunBase::derivative(const std::vector<double> &a,
  */
 ChebfunBase_sptr ChebfunBase::integral(const std::vector<double> &a,
                                        std::vector<double> &aout) const {
+
   using namespace std::placeholders;
   if (a.size() != m_x.size()) {
     throw std::invalid_argument(
@@ -926,5 +931,6 @@ ChebfunBase::smooth(const std::vector<double> &xvalues,
   return y;
 }
 
+} // Functions
 } // CurveFitting
 } // Mantid
diff --git a/Framework/CurveFitting/src/Chebyshev.cpp b/Framework/CurveFitting/src/Functions/Chebyshev.cpp
similarity index 95%
rename from Framework/CurveFitting/src/Chebyshev.cpp
rename to Framework/CurveFitting/src/Functions/Chebyshev.cpp
index 7da4e1d0b8837453722a2f6952a7becc1c442e98..9395ced590de45f8a22db3d0d092e5b816334a0f 100644
--- a/Framework/CurveFitting/src/Chebyshev.cpp
+++ b/Framework/CurveFitting/src/Functions/Chebyshev.cpp
@@ -1,7 +1,7 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/Chebyshev.h"
+#include "MantidCurveFitting/Functions/Chebyshev.h"
 #include "MantidAPI/FunctionFactory.h"
 #include <boost/lexical_cast.hpp>
 
@@ -9,8 +9,12 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 
 using namespace Kernel;
+
 using namespace API;
 
 DECLARE_FUNCTION(Chebyshev)
@@ -99,5 +103,6 @@ void Chebyshev::setAttribute(const std::string &attName,
   }
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/ComptonPeakProfile.cpp b/Framework/CurveFitting/src/Functions/ComptonPeakProfile.cpp
similarity index 96%
rename from Framework/CurveFitting/src/ComptonPeakProfile.cpp
rename to Framework/CurveFitting/src/Functions/ComptonPeakProfile.cpp
index 89aaaab815f4d755a8cf390ded7d15b7c16083cd..c10c9bf5a8906fc1f6c2e66630ab2079cee8bb44 100644
--- a/Framework/CurveFitting/src/ComptonPeakProfile.cpp
+++ b/Framework/CurveFitting/src/Functions/ComptonPeakProfile.cpp
@@ -1,14 +1,17 @@
 //-----------------------------------------------------------------------------
 // Includes
 //-----------------------------------------------------------------------------
-#include "MantidCurveFitting/ComptonPeakProfile.h"
-#include "MantidCurveFitting/ConvertToYSpace.h"
+#include "MantidCurveFitting/Functions/ComptonPeakProfile.h"
+#include "MantidCurveFitting/Algorithms/ConvertToYSpace.h"
 #include "MantidAPI/FunctionFactory.h"
 
 #include <cmath>
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting::Algorithms;
 
 DECLARE_FUNCTION(ComptonPeakProfile)
 
@@ -82,6 +85,7 @@ void ComptonPeakProfile::function1D(double *out, const double *xValues,
  */
 void ComptonPeakProfile::setUpForFit() {
   // Voigt & Gaussian
+
   using namespace Mantid::API;
   m_gauss = boost::dynamic_pointer_cast<IPeakFunction>(
       FunctionFactory::Instance().createFunction("Gaussian"));
@@ -165,5 +169,6 @@ void ComptonPeakProfile::setAttribute(const std::string &name,
     m_voigtCutOff = value.asDouble();
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/ComptonProfile.cpp b/Framework/CurveFitting/src/Functions/ComptonProfile.cpp
similarity index 94%
rename from Framework/CurveFitting/src/ComptonProfile.cpp
rename to Framework/CurveFitting/src/Functions/ComptonProfile.cpp
index b7d2ede6cb7e7a10737f3f58823e84be996deceb..f93325fcd70707d6667bbe5d1e0bfab7c89e5a2c 100644
--- a/Framework/CurveFitting/src/ComptonProfile.cpp
+++ b/Framework/CurveFitting/src/Functions/ComptonProfile.cpp
@@ -1,13 +1,17 @@
 //-----------------------------------------------------------------------------
 // Includes
 //-----------------------------------------------------------------------------
-#include "MantidCurveFitting/ComptonProfile.h"
-#include "MantidCurveFitting/ConvertToYSpace.h"
+#include "MantidCurveFitting/Functions/ComptonProfile.h"
+#include "MantidCurveFitting/Algorithms/ConvertToYSpace.h"
 #include "MantidAPI/FunctionFactory.h"
 #include <gsl/gsl_poly.h>
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
+using namespace CurveFitting::Algorithms;
 
 namespace {
 ///@cond
@@ -24,6 +28,7 @@ ComptonProfile::ComptonProfile()
     : API::ParamFunction(), API::IFunction1D(), m_log("ComptonProfile"),
       m_wsIndex(0), m_mass(0.0), m_voigt(), m_resolutionFunction(), m_yspace(),
       m_modQ(), m_e0() {
+
   using namespace Mantid::API;
   m_resolutionFunction = boost::dynamic_pointer_cast<VesuvioResolution>(
       FunctionFactory::Instance().createFunction("VesuvioResolution"));
@@ -53,6 +58,7 @@ void ComptonProfile::function1D(double *out, const double *xValues,
  * Creates the internal caches
  */
 void ComptonProfile::setUpForFit() {
+
   using namespace Mantid::API;
   m_voigt = boost::dynamic_pointer_cast<IPeakFunction>(
       FunctionFactory::Instance().createFunction("Voigt"));
@@ -92,7 +98,7 @@ void ComptonProfile::setMatrixWorkspace(
   m_resolutionFunction->setAttributeValue("Mass", m_mass);
   m_resolutionFunction->setMatrixWorkspace(workspace, wsIndex, startX, endX);
 
-  DetectorParams detpar =
+  Algorithms::DetectorParams detpar =
       ConvertToYSpace::getDetectorParameters(workspace, m_wsIndex);
   this->cacheYSpaceValues(workspace->readX(m_wsIndex),
                           workspace->isHistogramData(), detpar);
@@ -100,7 +106,7 @@ void ComptonProfile::setMatrixWorkspace(
 
 void ComptonProfile::cacheYSpaceValues(const std::vector<double> &tseconds,
                                        const bool isHistogram,
-                                       const DetectorParams &detpar,
+                                       const Algorithms::DetectorParams &detpar,
                                        const ResolutionParams &respar) {
   m_resolutionFunction->cacheResolutionComponents(detpar, respar);
   this->cacheYSpaceValues(tseconds, isHistogram, detpar);
@@ -111,9 +117,9 @@ void ComptonProfile::cacheYSpaceValues(const std::vector<double> &tseconds,
  * @param isHistogram True if histogram tof values have been passed in
  * @param detpar Structure containing detector parameters
  */
-void ComptonProfile::cacheYSpaceValues(const std::vector<double> &tseconds,
-                                       const bool isHistogram,
-                                       const DetectorParams &detpar) {
+void ComptonProfile::cacheYSpaceValues(
+    const std::vector<double> &tseconds, const bool isHistogram,
+    const Algorithms::DetectorParams &detpar) {
   // ------ Fixed coefficients related to resolution & Y-space transforms
   // ------------------
   const double mevToK = PhysicalConstants::E_mev_toNeutronWavenumberSq;
@@ -235,5 +241,6 @@ void ComptonProfile::voigtApproxDiff(std::vector<double> &voigtDiff,
                    2.0 * std::pow(epsilon, 3))); // divided by (2eps^3)
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/ComptonScatteringCountRate.cpp b/Framework/CurveFitting/src/Functions/ComptonScatteringCountRate.cpp
similarity index 99%
rename from Framework/CurveFitting/src/ComptonScatteringCountRate.cpp
rename to Framework/CurveFitting/src/Functions/ComptonScatteringCountRate.cpp
index 67051c8d3166b3db68469c9919495d4f958e1e87..fa9ed893cb00c3a6785ce0b2285aafa9fe457461 100644
--- a/Framework/CurveFitting/src/ComptonScatteringCountRate.cpp
+++ b/Framework/CurveFitting/src/Functions/ComptonScatteringCountRate.cpp
@@ -1,4 +1,4 @@
-#include "MantidCurveFitting/ComptonScatteringCountRate.h"
+#include "MantidCurveFitting/Functions/ComptonScatteringCountRate.h"
 #include "MantidCurveFitting/AugmentedLagrangianOptimizer.h"
 #include "MantidAPI/FunctionFactory.h"
 #include "MantidAPI/MatrixWorkspace.h"
@@ -10,6 +10,9 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 using Kernel::Logger;
 
 namespace {
@@ -445,5 +448,6 @@ void ComptonScatteringCountRate::createEqualityCM(const size_t nmasses) {
   }
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/Convolution.cpp b/Framework/CurveFitting/src/Functions/Convolution.cpp
similarity index 98%
rename from Framework/CurveFitting/src/Convolution.cpp
rename to Framework/CurveFitting/src/Functions/Convolution.cpp
index db1f62ad49f2d0a9f2f960e59b4b507e5f3e0472..00ed29d4c139058504875f9b573db92e8002d028 100644
--- a/Framework/CurveFitting/src/Convolution.cpp
+++ b/Framework/CurveFitting/src/Functions/Convolution.cpp
@@ -1,8 +1,8 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/Convolution.h"
-#include "MantidCurveFitting/DeltaFunction.h"
+#include "MantidCurveFitting/Functions/Convolution.h"
+#include "MantidCurveFitting/Functions/DeltaFunction.h"
 #include "MantidAPI/IFunction1D.h"
 #include "MantidAPI/FunctionFactory.h"
 
@@ -20,8 +20,12 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 
 using namespace Kernel;
+
 using namespace API;
 
 DECLARE_FUNCTION(Convolution)
@@ -297,5 +301,6 @@ void Convolution::refreshResolution() const {
   m_resolution.clear();
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/CubicSpline.cpp b/Framework/CurveFitting/src/Functions/CubicSpline.cpp
similarity index 98%
rename from Framework/CurveFitting/src/CubicSpline.cpp
rename to Framework/CurveFitting/src/Functions/CubicSpline.cpp
index 6b0d2815989e52ae26cf5f7be2a1fe47f8df31e9..d13cb126fdd0971edc5a8a2b9f08aa8b925b32c5 100644
--- a/Framework/CurveFitting/src/CubicSpline.cpp
+++ b/Framework/CurveFitting/src/Functions/CubicSpline.cpp
@@ -1,24 +1,27 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/CubicSpline.h"
+#include "MantidCurveFitting/Functions/CubicSpline.h"
 #include "MantidAPI/FunctionFactory.h"
 #include "MantidKernel/Logger.h"
 
 #include <algorithm>
 #include <boost/lexical_cast.hpp>
-#include <iostream>
 #include <stdexcept>
 #include <vector>
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 namespace {
 /// static logger
 Kernel::Logger g_log("CubicSpline");
 }
 
 using namespace Kernel;
+
 using namespace API;
 
 DECLARE_FUNCTION(CubicSpline)
@@ -359,5 +362,6 @@ void CubicSpline::reallocGSLObjects(const int n) {
  *
  */
 CubicSpline::~CubicSpline() {}
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/DeltaFunction.cpp b/Framework/CurveFitting/src/Functions/DeltaFunction.cpp
similarity index 87%
rename from Framework/CurveFitting/src/DeltaFunction.cpp
rename to Framework/CurveFitting/src/Functions/DeltaFunction.cpp
index 883e0ed542810809d9c777fe98c4c5b15392dcf1..aa26ab1c786ff2f8747568353edd6f4078923b67 100644
--- a/Framework/CurveFitting/src/DeltaFunction.cpp
+++ b/Framework/CurveFitting/src/Functions/DeltaFunction.cpp
@@ -1,14 +1,18 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/DeltaFunction.h"
+#include "MantidCurveFitting/Functions/DeltaFunction.h"
 #include "MantidAPI/FunctionFactory.h"
 #include <algorithm>
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 
 using namespace Kernel;
+
 using namespace API;
 
 DECLARE_FUNCTION(DeltaFunction)
@@ -32,5 +36,6 @@ void DeltaFunction::functionDeriv1D(Jacobian *out, const double *xValues,
   std::runtime_error("Cannot compute derivative of a delta function");
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/DiffRotDiscreteCircle.cpp b/Framework/CurveFitting/src/Functions/DiffRotDiscreteCircle.cpp
similarity index 97%
rename from Framework/CurveFitting/src/DiffRotDiscreteCircle.cpp
rename to Framework/CurveFitting/src/Functions/DiffRotDiscreteCircle.cpp
index ceb07007e2621508b37ecb0b0dcc4e22bce68a79..f295573909e3ba7653a4aad0a806f57f97d95496 100644
--- a/Framework/CurveFitting/src/DiffRotDiscreteCircle.cpp
+++ b/Framework/CurveFitting/src/Functions/DiffRotDiscreteCircle.cpp
@@ -1,12 +1,12 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/DiffRotDiscreteCircle.h"
+#include "MantidCurveFitting/Functions/DiffRotDiscreteCircle.h"
 
 #include "MantidAPI/FunctionFactory.h"
 #include "MantidAPI/MatrixWorkspace.h"
 #include "MantidAPI/ParameterTie.h"
-#include "MantidCurveFitting/BoundaryConstraint.h"
+#include "MantidCurveFitting/Constraints/BoundaryConstraint.h"
 #include "MantidGeometry/IDetector.h"
 #include "MantidKernel/Exception.h"
 #include "MantidKernel/UnitConversion.h"
@@ -20,8 +20,13 @@ Mantid::Kernel::Logger g_log("DiffSphere");
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
+using namespace Constraints;
 
 using namespace API;
+
 using namespace Geometry;
 
 DECLARE_FUNCTION(ElasticDiffRotDiscreteCircle)
@@ -247,5 +252,6 @@ void DiffRotDiscreteCircle::init() {
   applyTies();
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/DiffSphere.cpp b/Framework/CurveFitting/src/Functions/DiffSphere.cpp
similarity index 98%
rename from Framework/CurveFitting/src/DiffSphere.cpp
rename to Framework/CurveFitting/src/Functions/DiffSphere.cpp
index bf7d4a803090902fc2df9b2c8675326f61196db4..19519493021e0af64a1816b461d1d68332fdbaa8 100644
--- a/Framework/CurveFitting/src/DiffSphere.cpp
+++ b/Framework/CurveFitting/src/Functions/DiffSphere.cpp
@@ -1,12 +1,12 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/DiffSphere.h"
+#include "MantidCurveFitting/Functions/DiffSphere.h"
 
 #include "MantidAPI/FunctionFactory.h"
 #include "MantidAPI/MatrixWorkspace.h"
 #include "MantidAPI/ParameterTie.h"
-#include "MantidCurveFitting/BoundaryConstraint.h"
+#include "MantidCurveFitting/Constraints/BoundaryConstraint.h"
 #include "MantidGeometry/IDetector.h"
 #include "MantidKernel/Exception.h"
 #include "MantidKernel/UnitConversion.h"
@@ -22,9 +22,15 @@ Mantid::Kernel::Logger g_log("DiffSphere");
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
+using namespace Constraints;
 
 using namespace API;
+
 using namespace Geometry;
+
 using namespace Kernel;
 
 DECLARE_FUNCTION(ElasticDiffSphere)
@@ -351,5 +357,6 @@ void DiffSphere::init() {
   applyTies();
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/DynamicKuboToyabe.cpp b/Framework/CurveFitting/src/Functions/DynamicKuboToyabe.cpp
similarity index 98%
rename from Framework/CurveFitting/src/DynamicKuboToyabe.cpp
rename to Framework/CurveFitting/src/Functions/DynamicKuboToyabe.cpp
index e62d0ba82c49eb9694c16d02874baf371cb0b1c5..e90d834562d8ce0768ab38f196a97d142b2686e8 100644
--- a/Framework/CurveFitting/src/DynamicKuboToyabe.cpp
+++ b/Framework/CurveFitting/src/Functions/DynamicKuboToyabe.cpp
@@ -1,7 +1,7 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/DynamicKuboToyabe.h"
+#include "MantidCurveFitting/Functions/DynamicKuboToyabe.h"
 #include "MantidAPI/Jacobian.h"
 #include "MantidAPI/FunctionFactory.h"
 #include "MantidAPI/MatrixWorkspace.h"
@@ -9,8 +9,12 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 
 using namespace Kernel;
+
 using namespace API;
 
 DECLARE_FUNCTION(DynamicKuboToyabe)
@@ -375,5 +379,6 @@ bool DynamicKuboToyabe::hasAttribute(const std::string &attName) const {
   return attName == "BinWidth";
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/EndErfc.cpp b/Framework/CurveFitting/src/Functions/EndErfc.cpp
similarity index 91%
rename from Framework/CurveFitting/src/EndErfc.cpp
rename to Framework/CurveFitting/src/Functions/EndErfc.cpp
index 7d5de37a67dd28340214068459843a2f09d31b99..ed8101f7d9a15b3a8c392225b17af219009fcc88 100644
--- a/Framework/CurveFitting/src/EndErfc.cpp
+++ b/Framework/CurveFitting/src/Functions/EndErfc.cpp
@@ -1,15 +1,19 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/EndErfc.h"
+#include "MantidCurveFitting/Functions/EndErfc.h"
 #include "MantidAPI/FunctionFactory.h"
 #include <cmath>
 #include <gsl/gsl_sf_erf.h>
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 
 using namespace Kernel;
+
 using namespace API;
 
 DECLARE_FUNCTION(EndErfc)
@@ -51,5 +55,6 @@ void EndErfc::setActiveParameter(size_t i, double value) {
     setParameter(j, value, false);
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/ExpDecay.cpp b/Framework/CurveFitting/src/Functions/ExpDecay.cpp
similarity index 90%
rename from Framework/CurveFitting/src/ExpDecay.cpp
rename to Framework/CurveFitting/src/Functions/ExpDecay.cpp
index c5d92311a04e1c729ccb877ec42cf047f9a2d070..3f26962c469291157c260c23e1c1c15ea63bf4c9 100644
--- a/Framework/CurveFitting/src/ExpDecay.cpp
+++ b/Framework/CurveFitting/src/Functions/ExpDecay.cpp
@@ -1,14 +1,18 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/ExpDecay.h"
+#include "MantidCurveFitting/Functions/ExpDecay.h"
 #include "MantidAPI/FunctionFactory.h"
 #include <cmath>
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 
 using namespace Kernel;
+
 using namespace API;
 
 DECLARE_FUNCTION(ExpDecay)
@@ -41,5 +45,6 @@ void ExpDecay::functionDeriv1D(Jacobian *out, const double *xValues,
   }
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/ExpDecayMuon.cpp b/Framework/CurveFitting/src/Functions/ExpDecayMuon.cpp
similarity index 90%
rename from Framework/CurveFitting/src/ExpDecayMuon.cpp
rename to Framework/CurveFitting/src/Functions/ExpDecayMuon.cpp
index 2f0867e8c10b8111da7e4de914c9bcc43a18d802..748b7ed6bae725f0eeb5eb5127f2fa88c28986da 100644
--- a/Framework/CurveFitting/src/ExpDecayMuon.cpp
+++ b/Framework/CurveFitting/src/Functions/ExpDecayMuon.cpp
@@ -1,14 +1,18 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/ExpDecayMuon.h"
+#include "MantidCurveFitting/Functions/ExpDecayMuon.h"
 #include "MantidAPI/FunctionFactory.h"
 #include <cmath>
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 
 using namespace Kernel;
+
 using namespace API;
 
 DECLARE_FUNCTION(ExpDecayMuon)
@@ -41,5 +45,6 @@ void ExpDecayMuon::functionDeriv1D(Jacobian *out, const double *xValues,
   }
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/ExpDecayOsc.cpp b/Framework/CurveFitting/src/Functions/ExpDecayOsc.cpp
similarity index 94%
rename from Framework/CurveFitting/src/ExpDecayOsc.cpp
rename to Framework/CurveFitting/src/Functions/ExpDecayOsc.cpp
index f3d677feee5204237636b8284c4446584b5164e0..53713374e6a8df68779401578a7d827b97810047 100644
--- a/Framework/CurveFitting/src/ExpDecayOsc.cpp
+++ b/Framework/CurveFitting/src/Functions/ExpDecayOsc.cpp
@@ -1,14 +1,18 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/ExpDecayOsc.h"
+#include "MantidCurveFitting/Functions/ExpDecayOsc.h"
 #include "MantidAPI/FunctionFactory.h"
 #include <cmath>
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 
 using namespace Kernel;
+
 using namespace API;
 
 DECLARE_FUNCTION(ExpDecayOsc)
@@ -68,5 +72,6 @@ void ExpDecayOsc::setActiveParameter(size_t i, double value) {
     setParameter(j, value, false);
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/FlatBackground.cpp b/Framework/CurveFitting/src/Functions/FlatBackground.cpp
similarity index 92%
rename from Framework/CurveFitting/src/FlatBackground.cpp
rename to Framework/CurveFitting/src/Functions/FlatBackground.cpp
index d1fc5c08ad6a7e1051cf4124ec6cf58256f21a3b..e73d11ecb56b9cefc4505bb0ebcafdd6689f3f31 100644
--- a/Framework/CurveFitting/src/FlatBackground.cpp
+++ b/Framework/CurveFitting/src/Functions/FlatBackground.cpp
@@ -1,12 +1,16 @@
-#include "MantidCurveFitting/FlatBackground.h"
+#include "MantidCurveFitting/Functions/FlatBackground.h"
 #include "MantidAPI/FunctionFactory.h"
 #include "MantidKernel/System.h"
 
 using namespace Mantid::Kernel;
+
 using namespace Mantid::API;
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 DECLARE_FUNCTION(FlatBackground)
 
 //----------------------------------------------------------------------------------------------
@@ -60,4 +64,5 @@ void FlatBackground::functionDeriv1D(API::Jacobian *out, const double *xValues,
 }
 
 } // namespace Mantid
+} // namespace Functions
 } // namespace CurveFitting
diff --git a/Framework/CurveFitting/src/FullprofPolynomial.cpp b/Framework/CurveFitting/src/Functions/FullprofPolynomial.cpp
similarity index 97%
rename from Framework/CurveFitting/src/FullprofPolynomial.cpp
rename to Framework/CurveFitting/src/Functions/FullprofPolynomial.cpp
index c11007ea6c0ff153321d028c68eee5b9edd990b4..0c694afb8b925a73e6614f2758d64f771725237f 100644
--- a/Framework/CurveFitting/src/FullprofPolynomial.cpp
+++ b/Framework/CurveFitting/src/Functions/FullprofPolynomial.cpp
@@ -1,9 +1,12 @@
-#include "MantidCurveFitting/FullprofPolynomial.h"
+#include "MantidCurveFitting/Functions/FullprofPolynomial.h"
 #include "MantidAPI/FunctionFactory.h"
 #include <boost/lexical_cast.hpp>
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 
 DECLARE_FUNCTION(FullprofPolynomial)
 
@@ -161,5 +164,6 @@ bool FullprofPolynomial::hasAttribute(const std::string &attName) const {
   return has;
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/GausDecay.cpp b/Framework/CurveFitting/src/Functions/GausDecay.cpp
similarity index 91%
rename from Framework/CurveFitting/src/GausDecay.cpp
rename to Framework/CurveFitting/src/Functions/GausDecay.cpp
index 1497dbd6af7153865b61fb19ed45d4b0fc69f204..62e7fa7b723c6c9d88c9175bdd8a271d0a88c962 100644
--- a/Framework/CurveFitting/src/GausDecay.cpp
+++ b/Framework/CurveFitting/src/Functions/GausDecay.cpp
@@ -1,14 +1,18 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/GausDecay.h"
+#include "MantidCurveFitting/Functions/GausDecay.h"
 #include "MantidAPI/FunctionFactory.h"
 #include <cmath>
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 
 using namespace Kernel;
+
 using namespace API;
 
 DECLARE_FUNCTION(GausDecay)
@@ -51,5 +55,6 @@ void GausDecay::setActiveParameter(size_t i, double value) {
     setParameter(j, value, false);
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/GausOsc.cpp b/Framework/CurveFitting/src/Functions/GausOsc.cpp
similarity index 94%
rename from Framework/CurveFitting/src/GausOsc.cpp
rename to Framework/CurveFitting/src/Functions/GausOsc.cpp
index fbf341f190a4665c037e4d8cdc935aed2ffbdac1..54b17aec67d9e64e675c0d28e4054c6f908aebb9 100644
--- a/Framework/CurveFitting/src/GausOsc.cpp
+++ b/Framework/CurveFitting/src/Functions/GausOsc.cpp
@@ -1,14 +1,18 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/GausOsc.h"
+#include "MantidCurveFitting/Functions/GausOsc.h"
 #include "MantidAPI/FunctionFactory.h"
 #include <cmath>
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 
 using namespace Kernel;
+
 using namespace API;
 
 DECLARE_FUNCTION(GausOsc)
@@ -69,5 +73,6 @@ void GausOsc::setActiveParameter(size_t i, double value) {
     setParameter(j, value, false);
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/Gaussian.cpp b/Framework/CurveFitting/src/Functions/Gaussian.cpp
similarity index 94%
rename from Framework/CurveFitting/src/Gaussian.cpp
rename to Framework/CurveFitting/src/Functions/Gaussian.cpp
index 886d31e3f3ef9c0abe4a87030d2e5f2621668f2e..eeacee84e14d13cca2f551c7fb8dd0a864134e12 100644
--- a/Framework/CurveFitting/src/Gaussian.cpp
+++ b/Framework/CurveFitting/src/Functions/Gaussian.cpp
@@ -1,7 +1,7 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/Gaussian.h"
+#include "MantidCurveFitting/Functions/Gaussian.h"
 #include "MantidAPI/FunctionFactory.h"
 
 #include <cmath>
@@ -9,8 +9,12 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 
 using namespace Kernel;
+
 using namespace API;
 
 DECLARE_FUNCTION(Gaussian)
@@ -69,5 +73,6 @@ double Gaussian::activeParameter(size_t i) const {
     return getParameter(i);
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/GaussianComptonProfile.cpp b/Framework/CurveFitting/src/Functions/GaussianComptonProfile.cpp
similarity index 96%
rename from Framework/CurveFitting/src/GaussianComptonProfile.cpp
rename to Framework/CurveFitting/src/Functions/GaussianComptonProfile.cpp
index 3cc941c99647c2c51097a6c5f2f81326a2611cc0..23af0e475ee0caf438272c175d588066b1cb2111 100644
--- a/Framework/CurveFitting/src/GaussianComptonProfile.cpp
+++ b/Framework/CurveFitting/src/Functions/GaussianComptonProfile.cpp
@@ -1,13 +1,16 @@
 //------------------------------------------------------------------------------------------------
 // Includes
 //------------------------------------------------------------------------------------------------
-#include "MantidCurveFitting/GaussianComptonProfile.h"
+#include "MantidCurveFitting/Functions/GaussianComptonProfile.h"
 #include "MantidAPI/FunctionFactory.h"
 
 #include <cmath>
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 DECLARE_FUNCTION(GaussianComptonProfile)
 
 const char *WIDTH_PARAM = "Width";
@@ -112,5 +115,6 @@ void GaussianComptonProfile::massProfile(double *result, const size_t nData,
   }
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/GramCharlierComptonProfile.cpp b/Framework/CurveFitting/src/Functions/GramCharlierComptonProfile.cpp
similarity index 98%
rename from Framework/CurveFitting/src/GramCharlierComptonProfile.cpp
rename to Framework/CurveFitting/src/Functions/GramCharlierComptonProfile.cpp
index 7003021e27ecf3f23f1e331fb07d307eb1c9db38..dcefc759c3041571c04728526393f096af35dbae 100644
--- a/Framework/CurveFitting/src/GramCharlierComptonProfile.cpp
+++ b/Framework/CurveFitting/src/Functions/GramCharlierComptonProfile.cpp
@@ -1,7 +1,7 @@
 //------------------------------------------------------------------------------------------------
 // Includes
 //------------------------------------------------------------------------------------------------
-#include "MantidCurveFitting/GramCharlierComptonProfile.h"
+#include "MantidCurveFitting/Functions/GramCharlierComptonProfile.h"
 #include "MantidAPI/FunctionFactory.h"
 #include "MantidKernel/Math/Distributions/HermitePolynomials.h"
 
@@ -14,6 +14,9 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 // Register into factory
 DECLARE_FUNCTION(GramCharlierComptonProfile)
 
@@ -247,6 +250,7 @@ size_t GramCharlierComptonProfile::fillConstraintMatrix(
 void GramCharlierComptonProfile::massProfile(double *result,
                                              const size_t nData) const {
   UNUSED_ARG(nData);
+
   using namespace Mantid::Kernel;
 
   // Hermite expansion (only even terms) + FSE term
@@ -275,6 +279,7 @@ void GramCharlierComptonProfile::massProfile(double *result,
  */
 void GramCharlierComptonProfile::addMassProfile(
     double *result, const unsigned int npoly) const {
+
   using namespace Mantid::Kernel;
 
   const double amp(1.0), wg(getParameter(WIDTH_PARAM));
@@ -300,6 +305,7 @@ void GramCharlierComptonProfile::addMassProfile(
  */
 void GramCharlierComptonProfile::addFSETerm(std::vector<double> &lhs) const {
   assert(static_cast<size_t>(NFINE_Y) == lhs.size());
+
   using namespace Mantid::Kernel;
 
   const double amp(1.0), wg(getParameter(WIDTH_PARAM));
@@ -362,7 +368,7 @@ void GramCharlierComptonProfile::setMatrixWorkspace(
  */
 void GramCharlierComptonProfile::cacheYSpaceValues(
     const std::vector<double> &tseconds, const bool isHistogram,
-    const DetectorParams &detpar) {
+    const Algorithms::DetectorParams &detpar) {
   ComptonProfile::cacheYSpaceValues(tseconds, isHistogram,
                                     detpar); // base-class calculations
 
@@ -438,5 +444,6 @@ void GramCharlierComptonProfile::cacheYSpaceValues(
                                   // vector
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/IkedaCarpenterPV.cpp b/Framework/CurveFitting/src/Functions/IkedaCarpenterPV.cpp
similarity index 97%
rename from Framework/CurveFitting/src/IkedaCarpenterPV.cpp
rename to Framework/CurveFitting/src/Functions/IkedaCarpenterPV.cpp
index 527a9c39698081e58d8acc3d322ee20b35585697..519f78976bd762d60dcdab2afc56eedbceba0123 100644
--- a/Framework/CurveFitting/src/IkedaCarpenterPV.cpp
+++ b/Framework/CurveFitting/src/Functions/IkedaCarpenterPV.cpp
@@ -1,8 +1,8 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/IkedaCarpenterPV.h"
-#include "MantidCurveFitting/BoundaryConstraint.h"
+#include "MantidCurveFitting/Functions/IkedaCarpenterPV.h"
+#include "MantidCurveFitting/Constraints/BoundaryConstraint.h"
 #include "MantidCurveFitting/SpecialFunctionSupport.h"
 #include "MantidAPI/MatrixWorkspace.h"
 #include "MantidAPI/FunctionFactory.h"
@@ -21,6 +21,9 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 
 namespace {
 /// static logger
@@ -28,8 +31,11 @@ Kernel::Logger g_log("IkedaCarpenterPV");
 }
 
 using namespace Kernel;
-using namespace SpecialFunctionSupport;
+
+using namespace CurveFitting::SpecialFunctionSupport;
+
 using namespace Geometry;
+using namespace Constraints;
 
 DECLARE_FUNCTION(IkedaCarpenterPV)
 
@@ -366,5 +372,6 @@ void IkedaCarpenterPV::functionDeriv(const API::FunctionDomain &domain,
   calNumericalDeriv(domain, jacobian);
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/LinearBackground.cpp b/Framework/CurveFitting/src/Functions/LinearBackground.cpp
similarity index 94%
rename from Framework/CurveFitting/src/LinearBackground.cpp
rename to Framework/CurveFitting/src/Functions/LinearBackground.cpp
index 5961d95a20ed370a835d6464e891ba1d56d27db1..de365f0d88caddcebecc73905b980b9156f64983 100644
--- a/Framework/CurveFitting/src/LinearBackground.cpp
+++ b/Framework/CurveFitting/src/Functions/LinearBackground.cpp
@@ -1,13 +1,17 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/LinearBackground.h"
+#include "MantidCurveFitting/Functions/LinearBackground.h"
 #include "MantidAPI/FunctionFactory.h"
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 
 using namespace Kernel;
+
 using namespace API;
 
 DECLARE_FUNCTION(LinearBackground)
@@ -79,5 +83,6 @@ void LinearBackground::fit(const std::vector<double> &X,
   setParameter("A1", a1);
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/LogNormal.cpp b/Framework/CurveFitting/src/Functions/LogNormal.cpp
similarity index 95%
rename from Framework/CurveFitting/src/LogNormal.cpp
rename to Framework/CurveFitting/src/Functions/LogNormal.cpp
index e7cba5f58ea4f41da6946e3452617b53bfd48fbf..85e24ebfcf8ecd2a6705f68c61793754a6851b91 100644
--- a/Framework/CurveFitting/src/LogNormal.cpp
+++ b/Framework/CurveFitting/src/Functions/LogNormal.cpp
@@ -1,14 +1,18 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/LogNormal.h"
+#include "MantidCurveFitting/Functions/LogNormal.h"
 #include "MantidAPI/FunctionFactory.h"
 #include <cmath>
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 
 using namespace Kernel;
+
 using namespace API;
 
 DECLARE_FUNCTION(LogNormal)
@@ -78,5 +82,6 @@ void LogNormal::functionDeriv1D(API::Jacobian *out, const double *xValues,
   }
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/Lorentzian.cpp b/Framework/CurveFitting/src/Functions/Lorentzian.cpp
similarity index 94%
rename from Framework/CurveFitting/src/Lorentzian.cpp
rename to Framework/CurveFitting/src/Functions/Lorentzian.cpp
index 8d58c9a3915b9d7bd87d8d9da9be2a6f5ae70be0..0b5d4b534624e37d6e81d22b099809d16d1ac346 100644
--- a/Framework/CurveFitting/src/Lorentzian.cpp
+++ b/Framework/CurveFitting/src/Functions/Lorentzian.cpp
@@ -1,14 +1,18 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/Lorentzian.h"
+#include "MantidCurveFitting/Functions/Lorentzian.h"
 #include "MantidAPI/FunctionFactory.h"
 #include <cmath>
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 
 using namespace Kernel;
+
 using namespace API;
 
 DECLARE_FUNCTION(Lorentzian)
@@ -75,5 +79,6 @@ void Lorentzian::functionDerivLocal(Jacobian *out, const double *xValues,
   }
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/Lorentzian1D.cpp b/Framework/CurveFitting/src/Functions/Lorentzian1D.cpp
similarity index 95%
rename from Framework/CurveFitting/src/Lorentzian1D.cpp
rename to Framework/CurveFitting/src/Functions/Lorentzian1D.cpp
index 763d9a92ed152d2f081d9dfb6ae8bdfe627b537f..1c19669665cef0be1ff816dc5d58c0074c2a8465 100644
--- a/Framework/CurveFitting/src/Lorentzian1D.cpp
+++ b/Framework/CurveFitting/src/Functions/Lorentzian1D.cpp
@@ -1,13 +1,16 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/Lorentzian1D.h"
+#include "MantidCurveFitting/Functions/Lorentzian1D.h"
 #include <gsl/gsl_sf_erf.h>
 #include <gsl/gsl_multifit_nlin.h>
 #include "MantidKernel/BoundedValidator.h"
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 using API::Jacobian;
 
 // Register the class into the algorithm factory
@@ -69,5 +72,6 @@ void Lorentzian1D::functionDeriv(const double *in, Jacobian *out,
   }
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/MuonFInteraction.cpp b/Framework/CurveFitting/src/Functions/MuonFInteraction.cpp
similarity index 90%
rename from Framework/CurveFitting/src/MuonFInteraction.cpp
rename to Framework/CurveFitting/src/Functions/MuonFInteraction.cpp
index a11f82c92ae02a68df3adeb7030eeeed61e72b4b..4fcb0672c65bf56ee6691a3b0880d4d2f23fcba0 100644
--- a/Framework/CurveFitting/src/MuonFInteraction.cpp
+++ b/Framework/CurveFitting/src/Functions/MuonFInteraction.cpp
@@ -1,14 +1,18 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/MuonFInteraction.h"
+#include "MantidCurveFitting/Functions/MuonFInteraction.h"
 #include "MantidAPI/FunctionFactory.h"
 #include <cmath>
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 
 using namespace Kernel;
+
 using namespace API;
 
 DECLARE_FUNCTION(MuonFInteraction)
@@ -40,5 +44,6 @@ void MuonFInteraction::function1D(double *out, const double *xValues,
   }
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/NeutronBk2BkExpConvPVoigt.cpp b/Framework/CurveFitting/src/Functions/NeutronBk2BkExpConvPVoigt.cpp
similarity index 99%
rename from Framework/CurveFitting/src/NeutronBk2BkExpConvPVoigt.cpp
rename to Framework/CurveFitting/src/Functions/NeutronBk2BkExpConvPVoigt.cpp
index 9f4d315690da912d41a074727fa5cb012015d8a3..c451d8d528adedf27626917dd0b574be8fffcbda 100644
--- a/Framework/CurveFitting/src/NeutronBk2BkExpConvPVoigt.cpp
+++ b/Framework/CurveFitting/src/Functions/NeutronBk2BkExpConvPVoigt.cpp
@@ -1,4 +1,4 @@
-#include "MantidCurveFitting/NeutronBk2BkExpConvPVoigt.h"
+#include "MantidCurveFitting/Functions/NeutronBk2BkExpConvPVoigt.h"
 #include "MantidAPI/FunctionFactory.h"
 #include "MantidAPI/ParamFunction.h"
 #include "MantidKernel/EmptyValues.h"
@@ -17,6 +17,9 @@ using namespace std;
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 namespace {
 /// static logger
 Kernel::Logger g_log("NeutronBk2BkExpConvPV");
@@ -504,5 +507,6 @@ double NeutronBk2BkExpConvPVoigt::calOmega(const double x, const double eta,
   return omega;
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/PawleyFunction.cpp b/Framework/CurveFitting/src/Functions/PawleyFunction.cpp
similarity index 98%
rename from Framework/CurveFitting/src/PawleyFunction.cpp
rename to Framework/CurveFitting/src/Functions/PawleyFunction.cpp
index ab4c06fb473da7c04457368a46baeed882992d86..2f4231d00f45460479cb798489372750eca5f56c 100644
--- a/Framework/CurveFitting/src/PawleyFunction.cpp
+++ b/Framework/CurveFitting/src/Functions/PawleyFunction.cpp
@@ -1,9 +1,9 @@
-#include "MantidCurveFitting/PawleyFunction.h"
+#include "MantidCurveFitting/Functions/PawleyFunction.h"
 
 #include "MantidAPI/FunctionFactory.h"
 #include "MantidAPI/MatrixWorkspace.h"
 
-#include "MantidCurveFitting/BoundaryConstraint.h"
+#include "MantidCurveFitting/Constraints/BoundaryConstraint.h"
 
 #include "MantidKernel/UnitConversion.h"
 #include "MantidKernel/UnitFactory.h"
@@ -13,11 +13,17 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
+using namespace Constraints;
 
 DECLARE_FUNCTION(PawleyParameterFunction)
 
 using namespace API;
+
 using namespace Geometry;
+
 using namespace Kernel;
 
 /// Constructor
@@ -572,5 +578,6 @@ void PawleyFunction::beforeDecoratedFunctionSet(const API::IFunction_sptr &fn) {
   }
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/PeakParameterFunction.cpp b/Framework/CurveFitting/src/Functions/PeakParameterFunction.cpp
similarity index 93%
rename from Framework/CurveFitting/src/PeakParameterFunction.cpp
rename to Framework/CurveFitting/src/Functions/PeakParameterFunction.cpp
index 068e7d5440dcf0f2e3dae8b5ff1cc009a4d61274..5991f2ad484d034df9434b38cb1a7a29329fc232 100644
--- a/Framework/CurveFitting/src/PeakParameterFunction.cpp
+++ b/Framework/CurveFitting/src/Functions/PeakParameterFunction.cpp
@@ -1,9 +1,12 @@
-#include "MantidCurveFitting/PeakParameterFunction.h"
+#include "MantidCurveFitting/Functions/PeakParameterFunction.h"
 #include "MantidAPI/IPeakFunction.h"
 #include "MantidAPI/FunctionFactory.h"
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 
 using namespace API;
 
@@ -59,5 +62,6 @@ void PeakParameterFunction::beforeDecoratedFunctionSet(
   m_peakFunction = peakFunction;
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/Polynomial.cpp b/Framework/CurveFitting/src/Functions/Polynomial.cpp
similarity index 97%
rename from Framework/CurveFitting/src/Polynomial.cpp
rename to Framework/CurveFitting/src/Functions/Polynomial.cpp
index d6b20c93df577952f06af3527ebccffd30c9a685..800902e4ffabba0586b272a7f9cf0ef3145609f5 100644
--- a/Framework/CurveFitting/src/Polynomial.cpp
+++ b/Framework/CurveFitting/src/Functions/Polynomial.cpp
@@ -1,14 +1,18 @@
-#include "MantidCurveFitting/Polynomial.h"
+#include "MantidCurveFitting/Functions/Polynomial.h"
 #include "MantidAPI/FunctionFactory.h"
 #include <boost/lexical_cast.hpp>
 
 using namespace Mantid::Kernel;
+
 using namespace Mantid::API;
 
 using namespace std;
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 
 DECLARE_FUNCTION(Polynomial)
 
@@ -154,5 +158,6 @@ bool Polynomial::hasAttribute(const std::string &attName) const {
   return attName == "n";
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/ProcessBackground.cpp b/Framework/CurveFitting/src/Functions/ProcessBackground.cpp
similarity index 98%
rename from Framework/CurveFitting/src/ProcessBackground.cpp
rename to Framework/CurveFitting/src/Functions/ProcessBackground.cpp
index d6bd7e43f1a3cf57dab73270076e1b83b6994019..3df0c026c17f7f09df892405a48b89137f95b329 100644
--- a/Framework/CurveFitting/src/ProcessBackground.cpp
+++ b/Framework/CurveFitting/src/Functions/ProcessBackground.cpp
@@ -1,4 +1,4 @@
-#include "MantidCurveFitting/ProcessBackground.h"
+#include "MantidCurveFitting/Functions/ProcessBackground.h"
 #include "MantidAPI/WorkspaceProperty.h"
 #include "MantidKernel/Property.h"
 #include "MantidKernel/ListValidator.h"
@@ -6,8 +6,8 @@
 #include "MantidKernel/VisibleWhenProperty.h"
 #include "MantidAPI/WorkspaceFactory.h"
 #include "MantidAPI/MatrixWorkspace.h"
-#include "MantidCurveFitting/Polynomial.h"
-#include "MantidCurveFitting/Chebyshev.h"
+#include "MantidCurveFitting/Functions/Polynomial.h"
+#include "MantidCurveFitting/Functions/Chebyshev.h"
 #include "MantidDataObjects/TableWorkspace.h"
 #include "MantidGeometry/Crystal/IPeak.h"
 #include "MantidAPI/TableRow.h"
@@ -17,15 +17,22 @@
 #include <boost/algorithm/string/split.hpp>
 
 using namespace Mantid;
+
 using namespace Mantid::API;
+
 using namespace Mantid::Kernel;
+
 using namespace Mantid::DataObjects;
+
 using namespace Mantid::CurveFitting;
 
 using namespace std;
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 
 DECLARE_ALGORITHM(ProcessBackground)
 
@@ -677,17 +684,16 @@ ProcessBackground::autoBackgroundSelection(Workspace2D_sptr bkgdWS) {
   */
 BackgroundFunction_sptr
 ProcessBackground::createBackgroundFunction(const string backgroundtype) {
-  CurveFitting::BackgroundFunction_sptr bkgdfunction;
+  Functions::BackgroundFunction_sptr bkgdfunction;
 
   if (backgroundtype.compare("Polynomial") == 0) {
-    bkgdfunction =
-        boost::dynamic_pointer_cast<CurveFitting::BackgroundFunction>(
-            boost::make_shared<CurveFitting::Polynomial>());
+    bkgdfunction = boost::dynamic_pointer_cast<Functions::BackgroundFunction>(
+        boost::make_shared<Functions::Polynomial>());
     bkgdfunction->initialize();
   } else if (backgroundtype.compare("Chebyshev") == 0) {
-    Chebyshev_sptr cheby = boost::make_shared<CurveFitting::Chebyshev>();
+    Chebyshev_sptr cheby = boost::make_shared<Functions::Chebyshev>();
     bkgdfunction =
-        boost::dynamic_pointer_cast<CurveFitting::BackgroundFunction>(cheby);
+        boost::dynamic_pointer_cast<Functions::BackgroundFunction>(cheby);
     bkgdfunction->initialize();
 
     g_log.debug() << "[D] Chebyshev is set to range " << m_lowerBound << ", "
@@ -1099,5 +1105,6 @@ size_t RemovePeaks::excludePeaks(vector<double> v_inX, vector<bool> &v_useX,
   return count;
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/ProductFunction.cpp b/Framework/CurveFitting/src/Functions/ProductFunction.cpp
similarity index 89%
rename from Framework/CurveFitting/src/ProductFunction.cpp
rename to Framework/CurveFitting/src/Functions/ProductFunction.cpp
index 91152ccf885dd482e7f781cf3cbcec49e4986bcc..777e29e20fc2a09b9f1d455a5bb99d526e919aea 100644
--- a/Framework/CurveFitting/src/ProductFunction.cpp
+++ b/Framework/CurveFitting/src/Functions/ProductFunction.cpp
@@ -1,11 +1,14 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/ProductFunction.h"
+#include "MantidCurveFitting/Functions/ProductFunction.h"
 #include "MantidAPI/FunctionFactory.h"
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 
 DECLARE_FUNCTION(ProductFunction)
 
@@ -34,5 +37,6 @@ void ProductFunction::functionDeriv(const API::FunctionDomain &domain,
   calNumericalDeriv(domain, jacobian);
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/ProductLinearExp.cpp b/Framework/CurveFitting/src/Functions/ProductLinearExp.cpp
similarity index 87%
rename from Framework/CurveFitting/src/ProductLinearExp.cpp
rename to Framework/CurveFitting/src/Functions/ProductLinearExp.cpp
index 58079f6a9cdb9d39ad19d0ba3fd67d8c58684e75..c4d3758b8240479f579389db207affbd0c0f8e6b 100644
--- a/Framework/CurveFitting/src/ProductLinearExp.cpp
+++ b/Framework/CurveFitting/src/Functions/ProductLinearExp.cpp
@@ -1,13 +1,17 @@
-#include "MantidCurveFitting/ProductLinearExp.h"
-#include "MantidCurveFitting/ExpDecay.h"
-#include "MantidCurveFitting/LinearBackground.h"
-#include "MantidCurveFitting/ProductFunction.h"
+#include "MantidCurveFitting/Functions/ProductLinearExp.h"
+#include "MantidCurveFitting/Functions/ExpDecay.h"
+#include "MantidCurveFitting/Functions/LinearBackground.h"
+#include "MantidCurveFitting/Functions/ProductFunction.h"
 #include "MantidAPI/FunctionFactory.h"
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 
 using namespace Kernel;
+
 using namespace API;
 
 DECLARE_FUNCTION(ProductLinearExp)
@@ -72,5 +76,6 @@ void ProductLinearExp::function1D(double *out, const double *xValues,
   }
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/ProductQuadraticExp.cpp b/Framework/CurveFitting/src/Functions/ProductQuadraticExp.cpp
similarity index 88%
rename from Framework/CurveFitting/src/ProductQuadraticExp.cpp
rename to Framework/CurveFitting/src/Functions/ProductQuadraticExp.cpp
index 0d6dc24cd0997d06bbf9c44605ec95e1da170f69..5bd2458173bcdc84d300630334c6142f09eb4f04 100644
--- a/Framework/CurveFitting/src/ProductQuadraticExp.cpp
+++ b/Framework/CurveFitting/src/Functions/ProductQuadraticExp.cpp
@@ -1,11 +1,14 @@
-#include "MantidCurveFitting/ProductQuadraticExp.h"
-#include "MantidCurveFitting/ExpDecay.h"
-#include "MantidCurveFitting/Quadratic.h"
-#include "MantidCurveFitting/ProductFunction.h"
+#include "MantidCurveFitting/Functions/ProductQuadraticExp.h"
+#include "MantidCurveFitting/Functions/ExpDecay.h"
+#include "MantidCurveFitting/Functions/Quadratic.h"
+#include "MantidCurveFitting/Functions/ProductFunction.h"
 #include "MantidAPI/FunctionFactory.h"
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 
 DECLARE_FUNCTION(ProductQuadraticExp)
 
@@ -73,5 +76,6 @@ void ProductQuadraticExp::function1D(double *out, const double *xValues,
   }
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/PseudoVoigt.cpp b/Framework/CurveFitting/src/Functions/PseudoVoigt.cpp
similarity index 92%
rename from Framework/CurveFitting/src/PseudoVoigt.cpp
rename to Framework/CurveFitting/src/Functions/PseudoVoigt.cpp
index a492df6add6514a4888fc8eb88b80719fd5c99dd..a0ce2def8134e7420663297cd75c8fb529bc7b94 100644
--- a/Framework/CurveFitting/src/PseudoVoigt.cpp
+++ b/Framework/CurveFitting/src/Functions/PseudoVoigt.cpp
@@ -1,11 +1,15 @@
-#include "MantidCurveFitting/PseudoVoigt.h"
+#include "MantidCurveFitting/Functions/PseudoVoigt.h"
 #include "MantidAPI/FunctionFactory.h"
-#include "MantidCurveFitting/BoundaryConstraint.h"
+#include "MantidCurveFitting/Constraints/BoundaryConstraint.h"
 
 #include <cmath>
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
+using namespace Constraints;
 
 using namespace API;
 
@@ -83,5 +87,6 @@ void PseudoVoigt::init() {
   addConstraint(mixingConstraint);
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/Quadratic.cpp b/Framework/CurveFitting/src/Functions/Quadratic.cpp
similarity index 92%
rename from Framework/CurveFitting/src/Quadratic.cpp
rename to Framework/CurveFitting/src/Functions/Quadratic.cpp
index 0b364ce4a2319cdc0d2b4ef5feb11aad2f1e9963..cb6a2b6f6613a13494efed79a674bedcd94fe056 100644
--- a/Framework/CurveFitting/src/Quadratic.cpp
+++ b/Framework/CurveFitting/src/Functions/Quadratic.cpp
@@ -1,13 +1,17 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/Quadratic.h"
+#include "MantidCurveFitting/Functions/Quadratic.h"
 #include "MantidAPI/FunctionFactory.h"
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 
 using namespace Kernel;
+
 using namespace API;
 
 DECLARE_FUNCTION(Quadratic)
@@ -53,5 +57,6 @@ void Quadratic::functionDeriv1D(API::Jacobian *out, const double *xValues,
   }
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/ReflectivityMulf.cpp b/Framework/CurveFitting/src/Functions/ReflectivityMulf.cpp
similarity index 98%
rename from Framework/CurveFitting/src/ReflectivityMulf.cpp
rename to Framework/CurveFitting/src/Functions/ReflectivityMulf.cpp
index 17ab832f7de39c76e1e7bc4e17654844dbce9667..4d84564dd5a0ab38d2ccec35b20b363cbc60dcda 100644
--- a/Framework/CurveFitting/src/ReflectivityMulf.cpp
+++ b/Framework/CurveFitting/src/Functions/ReflectivityMulf.cpp
@@ -1,15 +1,19 @@
-#include "MantidCurveFitting/ReflectivityMulf.h"
+#include "MantidCurveFitting/Functions/ReflectivityMulf.h"
 #include "MantidAPI/FunctionFactory.h"
 #include <boost/lexical_cast.hpp>
 #include <cmath>
 
 using namespace Mantid::Kernel;
+
 using namespace Mantid::API;
 
 using namespace std;
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 
 DECLARE_FUNCTION(ReflectivityMulf)
 
@@ -292,5 +296,6 @@ void ReflectivityMulf::setAttribute(const std::string &attName,
   }
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/Resolution.cpp b/Framework/CurveFitting/src/Functions/Resolution.cpp
similarity index 90%
rename from Framework/CurveFitting/src/Resolution.cpp
rename to Framework/CurveFitting/src/Functions/Resolution.cpp
index 75319dbcb07e8d3e5c43e859a30e364208b6798e..fad3353dbfd1de98e2d4d5f84bfd156a5ab1a35f 100644
--- a/Framework/CurveFitting/src/Resolution.cpp
+++ b/Framework/CurveFitting/src/Functions/Resolution.cpp
@@ -1,13 +1,17 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/Resolution.h"
+#include "MantidCurveFitting/Functions/Resolution.h"
 #include "MantidAPI/FunctionFactory.h"
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 
 using namespace Kernel;
+
 using namespace API;
 
 DECLARE_FUNCTION(Resolution)
@@ -43,5 +47,6 @@ bool Resolution::hasAttribute(const std::string &attName) const {
   return m_fun.hasAttribute(attName);
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/SimpleChebfun.cpp b/Framework/CurveFitting/src/Functions/SimpleChebfun.cpp
similarity index 97%
rename from Framework/CurveFitting/src/SimpleChebfun.cpp
rename to Framework/CurveFitting/src/Functions/SimpleChebfun.cpp
index 9416aaaae314a59def2b0c4b00c2ae95d413ad59..1cc4ce08e3f2f9ed010d08128465edda590161cc 100644
--- a/Framework/CurveFitting/src/SimpleChebfun.cpp
+++ b/Framework/CurveFitting/src/Functions/SimpleChebfun.cpp
@@ -1,10 +1,13 @@
-#include "MantidCurveFitting/SimpleChebfun.h"
+#include "MantidCurveFitting/Functions/SimpleChebfun.h"
 #include "MantidAPI/IFunction.h"
 
 #include <boost/make_shared.hpp>
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 
 //----------------------------------------------------------------------------------------------
 /// Constructs a SimpleChebfun that approximates a function with a polynomial of
@@ -163,5 +166,6 @@ SimpleChebfun &SimpleChebfun::operator+=(ChebfunFunctionType fun) {
   return *this;
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/StaticKuboToyabe.cpp b/Framework/CurveFitting/src/Functions/StaticKuboToyabe.cpp
similarity index 87%
rename from Framework/CurveFitting/src/StaticKuboToyabe.cpp
rename to Framework/CurveFitting/src/Functions/StaticKuboToyabe.cpp
index 6d96804846ab9f92aa37aa5a8261ced40e400b91..9875e375005a0643d38d89ebbdf44a2fc5a286dc 100644
--- a/Framework/CurveFitting/src/StaticKuboToyabe.cpp
+++ b/Framework/CurveFitting/src/Functions/StaticKuboToyabe.cpp
@@ -1,14 +1,18 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/StaticKuboToyabe.h"
+#include "MantidCurveFitting/Functions/StaticKuboToyabe.h"
 #include "MantidAPI/FunctionFactory.h"
 #include <cmath>
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 
 using namespace Kernel;
+
 using namespace API;
 
 DECLARE_FUNCTION(StaticKuboToyabe)
@@ -30,5 +34,6 @@ void StaticKuboToyabe::function1D(double *out, const double *xValues,
   }
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/StaticKuboToyabeTimesExpDecay.cpp b/Framework/CurveFitting/src/Functions/StaticKuboToyabeTimesExpDecay.cpp
similarity index 87%
rename from Framework/CurveFitting/src/StaticKuboToyabeTimesExpDecay.cpp
rename to Framework/CurveFitting/src/Functions/StaticKuboToyabeTimesExpDecay.cpp
index 8ee826d6dbc1de68b6903e508f3db0124516c15b..33e328757063e52ecbc75829779ec16f6e1dd310 100644
--- a/Framework/CurveFitting/src/StaticKuboToyabeTimesExpDecay.cpp
+++ b/Framework/CurveFitting/src/Functions/StaticKuboToyabeTimesExpDecay.cpp
@@ -1,11 +1,15 @@
-#include "MantidCurveFitting/StaticKuboToyabeTimesExpDecay.h"
+#include "MantidCurveFitting/Functions/StaticKuboToyabeTimesExpDecay.h"
 #include "MantidAPI/FunctionFactory.h"
 #include <cmath>
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 
 using namespace Kernel;
+
 using namespace API;
 
 DECLARE_FUNCTION(StaticKuboToyabeTimesExpDecay)
@@ -34,5 +38,6 @@ void StaticKuboToyabeTimesExpDecay::function1D(double *out,
   }
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/StaticKuboToyabeTimesGausDecay.cpp b/Framework/CurveFitting/src/Functions/StaticKuboToyabeTimesGausDecay.cpp
similarity index 88%
rename from Framework/CurveFitting/src/StaticKuboToyabeTimesGausDecay.cpp
rename to Framework/CurveFitting/src/Functions/StaticKuboToyabeTimesGausDecay.cpp
index 50a84ee40c92b50a38917037d2c481a1a111b102..3fd2c5394f95286b21697564df093db0039f9d92 100644
--- a/Framework/CurveFitting/src/StaticKuboToyabeTimesGausDecay.cpp
+++ b/Framework/CurveFitting/src/Functions/StaticKuboToyabeTimesGausDecay.cpp
@@ -1,10 +1,15 @@
-#include "MantidCurveFitting/StaticKuboToyabeTimesGausDecay.h"
+#include "MantidCurveFitting/Functions/StaticKuboToyabeTimesGausDecay.h"
 #include "MantidAPI/FunctionFactory.h"
 #include <cmath>
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
+
 using namespace Kernel;
+
 using namespace API;
 
 DECLARE_FUNCTION(StaticKuboToyabeTimesGausDecay)
@@ -36,5 +41,6 @@ void StaticKuboToyabeTimesGausDecay::function1D(double *out,
         A * (exp(-(x2 * D2) / 2) * (1 - x2 * D2) * C1 + C2) * exp(-S2 * x2);
   }
 }
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/StretchExp.cpp b/Framework/CurveFitting/src/Functions/StretchExp.cpp
similarity index 94%
rename from Framework/CurveFitting/src/StretchExp.cpp
rename to Framework/CurveFitting/src/Functions/StretchExp.cpp
index 51064e2b85c9a6d5b9071afb15bdcb9a8fce9822..41a8cf8b7ff734787fbe4260de9cf4400ed4d1e5 100644
--- a/Framework/CurveFitting/src/StretchExp.cpp
+++ b/Framework/CurveFitting/src/Functions/StretchExp.cpp
@@ -1,14 +1,18 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/StretchExp.h"
+#include "MantidCurveFitting/Functions/StretchExp.h"
 #include "MantidAPI/FunctionFactory.h"
 #include <cmath>
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 
 using namespace Kernel;
+
 using namespace API;
 
 DECLARE_FUNCTION(StretchExp)
@@ -71,5 +75,6 @@ void StretchExp::functionDeriv1D(API::Jacobian *out, const double *xValues,
   }
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/StretchExpMuon.cpp b/Framework/CurveFitting/src/Functions/StretchExpMuon.cpp
similarity index 88%
rename from Framework/CurveFitting/src/StretchExpMuon.cpp
rename to Framework/CurveFitting/src/Functions/StretchExpMuon.cpp
index 3c14c8fead5e209b6a6de41a690dfa819079e125..c88d045de580b32c08f6eb0341d26784da9fdf76 100644
--- a/Framework/CurveFitting/src/StretchExpMuon.cpp
+++ b/Framework/CurveFitting/src/Functions/StretchExpMuon.cpp
@@ -1,14 +1,18 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/StretchExpMuon.h"
+#include "MantidCurveFitting/Functions/StretchExpMuon.h"
 #include "MantidAPI/FunctionFactory.h"
 #include <cmath>
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 
 using namespace Kernel;
+
 using namespace API;
 
 DECLARE_FUNCTION(StretchExpMuon)
@@ -31,5 +35,6 @@ void StretchExpMuon::function1D(double *out, const double *xValues,
   }
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/TabulatedFunction.cpp b/Framework/CurveFitting/src/Functions/TabulatedFunction.cpp
similarity index 98%
rename from Framework/CurveFitting/src/TabulatedFunction.cpp
rename to Framework/CurveFitting/src/Functions/TabulatedFunction.cpp
index 10f9e8168a8779989e05a736b8c56b3b8108c6e1..d0efc13940ae2ce8c316fbd2d6445b2839293b20 100644
--- a/Framework/CurveFitting/src/TabulatedFunction.cpp
+++ b/Framework/CurveFitting/src/Functions/TabulatedFunction.cpp
@@ -1,7 +1,7 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/TabulatedFunction.h"
+#include "MantidCurveFitting/Functions/TabulatedFunction.h"
 #include "MantidKernel/FileValidator.h"
 #include "MantidAPI/Algorithm.h"
 #include "MantidAPI/FunctionFactory.h"
@@ -14,7 +14,12 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
+
 using namespace Kernel;
+
 using namespace API;
 
 namespace {
@@ -276,5 +281,6 @@ void TabulatedFunction::setupData() const {
   m_setupFinished = true;
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/ThermalNeutronBk2BkExpAlpha.cpp b/Framework/CurveFitting/src/Functions/ThermalNeutronBk2BkExpAlpha.cpp
similarity index 94%
rename from Framework/CurveFitting/src/ThermalNeutronBk2BkExpAlpha.cpp
rename to Framework/CurveFitting/src/Functions/ThermalNeutronBk2BkExpAlpha.cpp
index 9eff40af37195f5aa5a285dbcbedf0709fbc9d90..464c73e7fb34fa7da4c8d0724e10434e2a6cb249 100644
--- a/Framework/CurveFitting/src/ThermalNeutronBk2BkExpAlpha.cpp
+++ b/Framework/CurveFitting/src/Functions/ThermalNeutronBk2BkExpAlpha.cpp
@@ -1,4 +1,4 @@
-#include "MantidCurveFitting/ThermalNeutronBk2BkExpAlpha.h"
+#include "MantidCurveFitting/Functions/ThermalNeutronBk2BkExpAlpha.h"
 #include "MantidKernel/System.h"
 #include "MantidAPI/FunctionFactory.h"
 
@@ -6,12 +6,18 @@
 #include <cmath>
 
 using namespace std;
+
 using namespace Mantid;
+
 using namespace Mantid::API;
+
 using namespace Mantid::CurveFitting;
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 
 DECLARE_FUNCTION(ThermalNeutronBk2BkExpAlpha)
 
@@ -80,5 +86,6 @@ double ThermalNeutronBk2BkExpAlpha::corefunction(double dh, double width,
   return alpha;
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/ThermalNeutronBk2BkExpBeta.cpp b/Framework/CurveFitting/src/Functions/ThermalNeutronBk2BkExpBeta.cpp
similarity index 94%
rename from Framework/CurveFitting/src/ThermalNeutronBk2BkExpBeta.cpp
rename to Framework/CurveFitting/src/Functions/ThermalNeutronBk2BkExpBeta.cpp
index ae1170803594d1666b7d81497f488802e5e5c85f..92901743be4ceca7e440dbd811db471ffd153962 100644
--- a/Framework/CurveFitting/src/ThermalNeutronBk2BkExpBeta.cpp
+++ b/Framework/CurveFitting/src/Functions/ThermalNeutronBk2BkExpBeta.cpp
@@ -1,4 +1,4 @@
-#include "MantidCurveFitting/ThermalNeutronBk2BkExpBeta.h"
+#include "MantidCurveFitting/Functions/ThermalNeutronBk2BkExpBeta.h"
 #include "MantidKernel/System.h"
 #include "MantidAPI/FunctionFactory.h"
 
@@ -6,12 +6,18 @@
 #include <cmath>
 
 using namespace std;
+
 using namespace Mantid;
+
 using namespace Mantid::CurveFitting;
+
 using namespace Mantid::API;
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 
 DECLARE_FUNCTION(ThermalNeutronBk2BkExpBeta)
 
@@ -79,5 +85,6 @@ double ThermalNeutronBk2BkExpBeta::corefunction(double dh, double width,
   return beta;
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/ThermalNeutronBk2BkExpConvPVoigt.cpp b/Framework/CurveFitting/src/Functions/ThermalNeutronBk2BkExpConvPVoigt.cpp
similarity index 99%
rename from Framework/CurveFitting/src/ThermalNeutronBk2BkExpConvPVoigt.cpp
rename to Framework/CurveFitting/src/Functions/ThermalNeutronBk2BkExpConvPVoigt.cpp
index 521becfcc478059efe73a2c0aca2a8c645108d6c..8ee59b58177ad3525a2615c6ef4ec8fcd8b8703a 100644
--- a/Framework/CurveFitting/src/ThermalNeutronBk2BkExpConvPVoigt.cpp
+++ b/Framework/CurveFitting/src/Functions/ThermalNeutronBk2BkExpConvPVoigt.cpp
@@ -1,4 +1,4 @@
-#include "MantidCurveFitting/ThermalNeutronBk2BkExpConvPVoigt.h"
+#include "MantidCurveFitting/Functions/ThermalNeutronBk2BkExpConvPVoigt.h"
 #include "MantidAPI/FunctionFactory.h"
 #include "MantidAPI/ParamFunction.h"
 #include "MantidKernel/EmptyValues.h"
@@ -14,11 +14,16 @@ const double PEAKRANGE = 5.0;
 const double NEG_DBL_MAX = -1. * DBL_MAX;
 
 using namespace std;
+
 using namespace Mantid;
+
 using namespace Mantid::API;
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 namespace {
 /// static reference to the logger
 Kernel::Logger g_log("ThermalNeutronBk2BkExpConvPV");
@@ -774,5 +779,6 @@ void ThermalNeutronBk2BkExpConvPVoigt::setPeakRadius(const int& r)
 }
   */
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/ThermalNeutronBk2BkExpSigma.cpp b/Framework/CurveFitting/src/Functions/ThermalNeutronBk2BkExpSigma.cpp
similarity index 94%
rename from Framework/CurveFitting/src/ThermalNeutronBk2BkExpSigma.cpp
rename to Framework/CurveFitting/src/Functions/ThermalNeutronBk2BkExpSigma.cpp
index ed8f0af7b195223ea9093587e5bdbf6a29fbca31..51c0370b5cffa8752f75d08b2e7ac51f259e3f71 100644
--- a/Framework/CurveFitting/src/ThermalNeutronBk2BkExpSigma.cpp
+++ b/Framework/CurveFitting/src/Functions/ThermalNeutronBk2BkExpSigma.cpp
@@ -1,4 +1,4 @@
-#include "MantidCurveFitting/ThermalNeutronBk2BkExpSigma.h"
+#include "MantidCurveFitting/Functions/ThermalNeutronBk2BkExpSigma.h"
 #include "MantidKernel/System.h"
 #include "MantidAPI/FunctionFactory.h"
 
@@ -6,12 +6,18 @@
 #include <cmath>
 
 using namespace std;
+
 using namespace Mantid;
+
 using namespace Mantid::API;
+
 using namespace Mantid::CurveFitting;
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 
 DECLARE_FUNCTION(ThermalNeutronBk2BkExpSigma)
 
@@ -77,5 +83,6 @@ double ThermalNeutronBk2BkExpSigma::corefunction(double dh, double sig0sq,
   return sigma;
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/ThermalNeutronDtoTOFFunction.cpp b/Framework/CurveFitting/src/Functions/ThermalNeutronDtoTOFFunction.cpp
similarity index 96%
rename from Framework/CurveFitting/src/ThermalNeutronDtoTOFFunction.cpp
rename to Framework/CurveFitting/src/Functions/ThermalNeutronDtoTOFFunction.cpp
index 8566384197fe62b9422f94a5b9fd39defa2090fc..4d3bb672a2df48ce85ad78f6c9e1cdaa5100d454 100644
--- a/Framework/CurveFitting/src/ThermalNeutronDtoTOFFunction.cpp
+++ b/Framework/CurveFitting/src/Functions/ThermalNeutronDtoTOFFunction.cpp
@@ -1,4 +1,4 @@
-#include "MantidCurveFitting/ThermalNeutronDtoTOFFunction.h"
+#include "MantidCurveFitting/Functions/ThermalNeutronDtoTOFFunction.h"
 #include "MantidKernel/System.h"
 #include "MantidAPI/FunctionFactory.h"
 #include "MantidAPI/FunctionDomain1D.h"
@@ -6,10 +6,14 @@
 #include <cmath>
 
 using namespace Mantid::API;
+
 using namespace std;
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 
 //----------------------------------------------------------------------------------------------
 DECLARE_FUNCTION(ThermalNeutronDtoTOFFunction)
@@ -140,5 +144,6 @@ void ThermalNeutronDtoTOFFunction::functionDerivLocal(API::Jacobian *,
       "ThermalNeutronDtoTOFFunction.");
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/UserFunction.cpp b/Framework/CurveFitting/src/Functions/UserFunction.cpp
similarity index 95%
rename from Framework/CurveFitting/src/UserFunction.cpp
rename to Framework/CurveFitting/src/Functions/UserFunction.cpp
index b367c452958f8775f7e667120a214977ed01357e..45ec9fc62f46b77425f2af1f312576146f0c507d 100644
--- a/Framework/CurveFitting/src/UserFunction.cpp
+++ b/Framework/CurveFitting/src/Functions/UserFunction.cpp
@@ -1,18 +1,22 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/UserFunction.h"
+#include "MantidCurveFitting/Functions/UserFunction.h"
 #include "MantidAPI/FunctionFactory.h"
 #include <boost/tokenizer.hpp>
 #include "MantidGeometry/muParser_Silent.h"
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 
 // Register the class into the function factory
 DECLARE_FUNCTION(UserFunction)
 
 using namespace Kernel;
+
 using namespace API;
 
 /// Constructor
@@ -113,5 +117,6 @@ void UserFunction::functionDeriv(const API::FunctionDomain &domain,
   calNumericalDeriv(domain, jacobian);
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/UserFunction1D.cpp b/Framework/CurveFitting/src/Functions/UserFunction1D.cpp
similarity index 97%
rename from Framework/CurveFitting/src/UserFunction1D.cpp
rename to Framework/CurveFitting/src/Functions/UserFunction1D.cpp
index 5164c2322bb93304a9703a2856c7d883296f1697..0c0ee89a9d0c1c6e2befac956b6146109db7825b 100644
--- a/Framework/CurveFitting/src/UserFunction1D.cpp
+++ b/Framework/CurveFitting/src/Functions/UserFunction1D.cpp
@@ -1,18 +1,22 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include "MantidCurveFitting/UserFunction1D.h"
+#include "MantidCurveFitting/Functions/UserFunction1D.h"
 #include "MantidKernel/UnitFactory.h"
 #include "MantidKernel/MandatoryValidator.h"
 #include <boost/tokenizer.hpp>
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 
 // Register the class into the algorithm factory
 DECLARE_ALGORITHM(UserFunction1D)
 
 using namespace Kernel;
+
 using namespace API;
 
 /** Static callback function used by MuParser to initialize variables implicitly
@@ -155,5 +159,6 @@ void UserFunction1D::functionDeriv(const double *in, Jacobian *out,
   }
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/VesuvioResolution.cpp b/Framework/CurveFitting/src/Functions/VesuvioResolution.cpp
similarity index 96%
rename from Framework/CurveFitting/src/VesuvioResolution.cpp
rename to Framework/CurveFitting/src/Functions/VesuvioResolution.cpp
index d850ed0f223861674134ac23aa1fa84bb5a6bd82..44c6b1e458ef1142f49b68f0f61080fca750fe4e 100644
--- a/Framework/CurveFitting/src/VesuvioResolution.cpp
+++ b/Framework/CurveFitting/src/Functions/VesuvioResolution.cpp
@@ -1,13 +1,18 @@
 //-----------------------------------------------------------------------------
 // Includes
 //-----------------------------------------------------------------------------
-#include "MantidCurveFitting/VesuvioResolution.h"
-#include "MantidCurveFitting/ConvertToYSpace.h"
+#include "MantidCurveFitting/Functions/VesuvioResolution.h"
+#include "MantidCurveFitting/Algorithms/ConvertToYSpace.h"
 #include "MantidAPI/FunctionFactory.h"
 #include <gsl/gsl_poly.h>
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace Mantid;
+using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Algorithms;
 namespace {
 ///@cond
 const char *MASS_NAME = "Mass";
@@ -78,6 +83,7 @@ std::string VesuvioResolution::name() const { return "VesuvioResolution"; }
  */
 void VesuvioResolution::setUpForFit() {
   // Voigt
+
   using namespace Mantid::API;
   m_voigt = boost::dynamic_pointer_cast<IPeakFunction>(
       FunctionFactory::Instance().createFunction("Voigt"));
@@ -108,7 +114,7 @@ void VesuvioResolution::setMatrixWorkspace(
  * @param respar Structure containing resolution parameters
  */
 void VesuvioResolution::cacheResolutionComponents(
-    const DetectorParams &detpar, const ResolutionParams &respar) {
+    const Algorithms::DetectorParams &detpar, const ResolutionParams &respar) {
   // geometry
   double theta = detpar.theta; // cache for frequent access
   double hwhmLorentzE = respar.dEnLorentz;
@@ -253,5 +259,6 @@ void VesuvioResolution::voigtApprox(std::vector<double> &voigt,
                  std::bind2nd(std::multiplies<double>(), norm));
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/Voigt.cpp b/Framework/CurveFitting/src/Functions/Voigt.cpp
similarity index 97%
rename from Framework/CurveFitting/src/Voigt.cpp
rename to Framework/CurveFitting/src/Functions/Voigt.cpp
index 9e006da4d314d97a44efe6c8f7f5bcc3b4b0a90a..73ce3f49f9979c516ecceedd0af016ee7b69eaf5 100644
--- a/Framework/CurveFitting/src/Voigt.cpp
+++ b/Framework/CurveFitting/src/Functions/Voigt.cpp
@@ -1,7 +1,7 @@
 //----------------------------------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------------------------------
-#include "MantidCurveFitting/Voigt.h"
+#include "MantidCurveFitting/Functions/Voigt.h"
 
 #include "MantidAPI/FunctionFactory.h"
 
@@ -9,6 +9,9 @@
 
 namespace Mantid {
 namespace CurveFitting {
+namespace Functions {
+
+using namespace CurveFitting;
 DECLARE_FUNCTION(Voigt)
 
 namespace {
@@ -165,5 +168,6 @@ void Voigt::setFwhm(const double value) {
   this->setParameter(GAUSSIAN_FWHM, 0.5 * value);
 }
 
+} // namespace Functions
 } // namespace CurveFitting
 } // namespace Mantid
diff --git a/Framework/CurveFitting/src/GSLFunctions.cpp b/Framework/CurveFitting/src/GSLFunctions.cpp
index d5c4445dcc00a0821742647014922c1ea3c7c16d..2ebd26b9ec65f05f028b43dc61b5a802e7a51600 100644
--- a/Framework/CurveFitting/src/GSLFunctions.cpp
+++ b/Framework/CurveFitting/src/GSLFunctions.cpp
@@ -126,7 +126,7 @@ int gsl_df(const gsl_vector *x, void *params, gsl_matrix *J) {
 
   // functionDeriv() return derivatives of calculated data values. Need to
   // convert this values into
-  // derivatives of calculated-observed devided by error values used by GSL
+  // derivatives of calculated-observed divided by error values used by GSL
   auto values = boost::dynamic_pointer_cast<API::FunctionValues>(
       p->costFunction->getValues());
   if (!values) {
@@ -159,7 +159,8 @@ int gsl_fdf(const gsl_vector *x, void *params, gsl_vector *f, gsl_matrix *J) {
  * Constructor. Creates declared -> active index map
  * @param cf :: ICostFunction
  */
-GSL_FitData::GSL_FitData(boost::shared_ptr<CostFuncLeastSquares> cf)
+GSL_FitData::GSL_FitData(
+    boost::shared_ptr<CostFunctions::CostFuncLeastSquares> cf)
     : function(cf->getFittingFunction()), costFunction(cf) {
   gsl_set_error_handler_off();
   // number of active parameters
diff --git a/Framework/CurveFitting/src/GSLVector.cpp b/Framework/CurveFitting/src/GSLVector.cpp
index 6c7c341cf7d4f0f9f158ba91e7ebffe771a3cce0..cdbc2a12db0e7f571b5a8703754af69f1805cfd1 100644
--- a/Framework/CurveFitting/src/GSLVector.cpp
+++ b/Framework/CurveFitting/src/GSLVector.cpp
@@ -157,10 +157,12 @@ double GSLVector::dot(const GSLVector &v) const {
 
 /// The << operator.
 std::ostream &operator<<(std::ostream &ostr, const GSLVector &v) {
+  std::ios::fmtflags fflags(ostr.flags());
   ostr << std::scientific << std::setprecision(6);
   for (size_t j = 0; j < v.size(); ++j) {
     ostr << std::setw(13) << v[j] << ' ';
   }
+  ostr.flags(fflags);
   return ostr;
 }
 
diff --git a/Framework/CurveFitting/src/IFittingAlgorithm.cpp b/Framework/CurveFitting/src/IFittingAlgorithm.cpp
index de562d920cb7ca6961c07095663dd03ce53bc28c..4984b1edc74ed77ea305da877eece95d140f407f 100644
--- a/Framework/CurveFitting/src/IFittingAlgorithm.cpp
+++ b/Framework/CurveFitting/src/IFittingAlgorithm.cpp
@@ -216,9 +216,10 @@ void IFittingAlgorithm::addWorkspace(const std::string &workspacePropertyName,
     boost::shared_ptr<MultiDomainCreator> multiCreator =
         boost::dynamic_pointer_cast<MultiDomainCreator>(m_domainCreator);
     if (!multiCreator) {
+      auto &reference = *m_domainCreator.get();
       throw std::runtime_error(
           std::string("MultiDomainCreator expected, found ") +
-          typeid(*m_domainCreator.get()).name());
+          typeid(reference).name());
     }
     if (!multiCreator->hasCreator(index)) {
       creator->declareDatasetProperties(suffix, addProperties);
@@ -283,4 +284,4 @@ void IFittingAlgorithm::exec() {
 }
 
 } // namespace CurveFitting
-} // namespace Mantid
\ No newline at end of file
+} // namespace Mantid
diff --git a/Framework/CurveFitting/src/LatticeDomainCreator.cpp b/Framework/CurveFitting/src/LatticeDomainCreator.cpp
index 69901d090985206b121217ff3a25cc940bff389d..db2ebe4bde9fca3df9b46c7a12805e94876df8e1 100644
--- a/Framework/CurveFitting/src/LatticeDomainCreator.cpp
+++ b/Framework/CurveFitting/src/LatticeDomainCreator.cpp
@@ -9,7 +9,7 @@
 #include "MantidAPI/WorkspaceFactory.h"
 
 #include "MantidDataObjects/Peak.h"
-#include "MantidCurveFitting/PawleyFit.h"
+#include "MantidCurveFitting/Algorithms/PawleyFit.h"
 
 namespace Mantid {
 namespace CurveFitting {
@@ -17,6 +17,7 @@ namespace CurveFitting {
 using namespace API;
 using namespace Kernel;
 using namespace DataObjects;
+using namespace CurveFitting::Algorithms;
 
 /// Constructor
 LatticeDomainCreator::LatticeDomainCreator(
diff --git a/Framework/CurveFitting/src/LatticeFunction.cpp b/Framework/CurveFitting/src/LatticeFunction.cpp
index 895327b1d97f18dcb4252531b56b780828c0a84b..0fd29c73d2762d3ef7ee2772847997eee024d4b3 100644
--- a/Framework/CurveFitting/src/LatticeFunction.cpp
+++ b/Framework/CurveFitting/src/LatticeFunction.cpp
@@ -62,8 +62,8 @@ void LatticeFunction::init() {
 
 /// Checks that the decorated function is a PawleyParameterFunction.
 void LatticeFunction::beforeDecoratedFunctionSet(const IFunction_sptr &fn) {
-  PawleyParameterFunction_sptr paramFn =
-      boost::dynamic_pointer_cast<PawleyParameterFunction>(fn);
+  Functions::PawleyParameterFunction_sptr paramFn =
+      boost::dynamic_pointer_cast<Functions::PawleyParameterFunction>(fn);
 
   if (!paramFn) {
     throw std::invalid_argument(
diff --git a/Framework/CurveFitting/src/MultiBG.cpp b/Framework/CurveFitting/src/MultiBG.cpp
deleted file mode 100644
index 284b6ce33908b4cf7b664d8e0af7f513123eac64..0000000000000000000000000000000000000000
--- a/Framework/CurveFitting/src/MultiBG.cpp
+++ /dev/null
@@ -1,307 +0,0 @@
-//----------------------------------------------------------------------
-// Includes
-//----------------------------------------------------------------------
-#include "MantidCurveFitting/MultiBG.h"
-#include "MantidAPI/IFunctionMW.h"
-#include "MantidAPI/Expression.h"
-#include "MantidAPI/AnalysisDataService.h"
-#include "MantidAPI/WorkspaceGroup.h"
-#include "MantidAPI/FunctionFactory.h"
-
-#include <boost/lambda/lambda.hpp>
-#include <boost/lexical_cast.hpp>
-
-#include <sstream>
-#include <iostream>
-#include <algorithm>
-#include <iterator>
-#include <float.h>
-
-using namespace boost::lambda;
-
-namespace Mantid {
-namespace CurveFitting {
-
-DECLARE_FUNCTION(MultiBG)
-
-/** A Jacobian for individual functions
- */
-class PartialJacobian : public API::Jacobian {
-  API::Jacobian *m_J; ///< pointer to the overall Jacobian
-  size_t m_iY0; ///< data array offset in the overall Jacobian for a particular
-  /// function
-  size_t m_iP0; ///< parameter offset in the overall Jacobian for a particular
-  /// function
-  size_t m_iaP0; ///< offset in the active Jacobian for a particular function
-public:
-  /** Constructor
-   * @param J :: A pointer to the overall Jacobian
-   * @param iY0 :: Data array offset index (declared) for a particular function
-   * @param iP0 :: The parameter index (declared) offset for a particular
-   * function
-   * @param iap0 :: The active parameter index (declared) offset for a
-   * particular function
-   */
-  PartialJacobian(API::Jacobian *J, size_t iY0, size_t iP0, size_t iap0)
-      : m_J(J), m_iY0(iY0), m_iP0(iP0), m_iaP0(iap0) {}
-  /**
-   * Overridden Jacobian::set(...).
-   * @param iY :: The index of the data point
-   * @param iP :: The parameter index of an individual function.
-   * @param value :: The derivative value
-   */
-  void set(size_t iY, size_t iP, double value) {
-    m_J->set(m_iY0 + iY, m_iP0 + iP, value);
-  }
-  /**
-   * Overridden Jacobian::get(...).
-   * @param iY :: The index of the data point
-   * @param iP :: The parameter index of an individual function.
-   */
-  double get(size_t iY, size_t iP) { return m_J->get(m_iY0 + iY, m_iP0 + iP); }
-  /**  Add number to all iY (data) Jacobian elements for a given iP (parameter)
-   *   @param value :: Value to add
-   *   @param iActiveP :: The index of an active parameter.
-   */
-  virtual void addNumberToColumn(const double &value, const size_t &iActiveP) {
-    m_J->addNumberToColumn(value, m_iaP0 + iActiveP);
-  }
-};
-
-/// Destructor
-MultiBG::~MultiBG() {}
-
-/**
- * Function you want to fit to.
- */
-void MultiBG::function(double *out) const {
-  std::vector<double> tmpOut(dataSize());
-  std::fill_n(out, dataSize(), 0);
-  for (size_t i = 0; i < nFunctions(); i++) {
-    IFitFunction *fun = dynamic_cast<IFitFunction *>(getFunction(i));
-    if (!fun) {
-      throw std::runtime_error(
-          "IFitFunction expected but function of another type found");
-    }
-    size_t nWS = m_funIndex[i].size();
-    for (size_t k = 0; k < nWS; ++k) {
-      size_t j = m_funIndex[i][k];
-      fun->setWorkspace(m_spectra[k].first,
-                        "WorkspaceIndex=" + boost::lexical_cast<std::string>(
-                                                m_spectra[j].second),
-                        false);
-      // std::cerr << i << ' ' << k << " Function " << fun->name() << " ws " <<
-      // fun->getWorkspace()->getName() << " wi "
-      //  << dynamic_cast<Mantid::API::IFunctionMW*>(fun)->getWorkspaceIndex()
-      //  << std::endl;
-      double *out1 = out + m_offset[j];
-      double *tmp1 = &tmpOut[0] + m_offset[j];
-      size_t nData = 0;
-      if (j < m_offset.size() - 1)
-        nData = m_offset[j + 1] - m_offset[j];
-      else
-        nData = dataSize() - m_offset[j];
-      if (i == 0) {
-        fun->function(out1);
-      } else {
-        fun->function(tmp1);
-        std::transform(out1, out1 + nData, tmp1, out1, std::plus<double>());
-      }
-    }
-  }
-  // std::cerr << "Function:\n";
-  // for(size_t i = 0; i<nParams();++i)
-  //{
-  //  std::cerr << getParameter(i) << ' ' ;
-  //}
-  // std::cerr << std::endl;
-  // std::for_each(out,out+m_dataSize,std::cerr << _1 << '\n');
-  // std::cerr << std::endl;
-}
-
-void MultiBG::functionDeriv(API::Jacobian *out) {
-  // it is possible that out is NULL
-  if (!out)
-    return;
-  for (size_t i = 0; i < nFunctions(); i++) {
-    IFitFunction *fun = dynamic_cast<IFitFunction *>(getFunction(i));
-    if (!fun) {
-      throw std::runtime_error(
-          "IFitFunction expected but function of another type found");
-    }
-    size_t nWS = m_funIndex[i].size();
-    for (size_t k = 0; k < nWS; ++k) {
-      size_t j = m_funIndex[i][k];
-      fun->setWorkspace(m_spectra[k].first,
-                        "WorkspaceIndex=" + boost::lexical_cast<std::string>(
-                                                m_spectra[j].second),
-                        false);
-      PartialJacobian J(out, m_offset[j], paramOffset(i), activeOffset(i));
-      fun->functionDeriv(&J);
-    }
-  }
-}
-
-void MultiBG::setWorkspace(boost::shared_ptr<const API::Workspace> ws, bool) {
-  boost::shared_ptr<const API::MatrixWorkspace> mws =
-      boost::dynamic_pointer_cast<const API::MatrixWorkspace>(ws);
-  if (ws && !mws) {
-    throw std::invalid_argument(
-        "Workspace in MultiBG has a wrong type (not a MatrixWorkspace)");
-  }
-  m_workspace = mws;
-}
-/**
- * Sets workspaces to member functions. Constructs the data set for fitting.
- * @param slicing :: A map between member functions and workspaces or empty
- * string. Format:
- *   "f0,Workspace0,i0;f1,Workspace1,i1;f2,Workspace2,i2;..."
- */
-void MultiBG::setSlicing(const std::string &slicing) {
-  boost::shared_ptr<const API::MatrixWorkspace> mws = m_workspace;
-
-  m_funIndex.resize(nFunctions());
-
-  if (!slicing.empty()) {
-    Mantid::API::Expression expr;
-    expr.parse(slicing);
-    // expr can be treated as a list even if it has only 1 term
-    expr.toList(";");
-    for (size_t i = 0; i < expr.size(); ++i) {
-      const Mantid::API::Expression &e = expr[i];
-      if (e.name() != "," || e.size() != 3) {
-        // slicing has a wrong format - ignore it
-        break;
-      }
-      try {
-        std::string wsName = e[1].name();
-        Mantid::API::MatrixWorkspace_sptr ws =
-            boost::dynamic_pointer_cast<Mantid::API::MatrixWorkspace>(
-                Mantid::API::AnalysisDataService::Instance().retrieve(wsName));
-
-        size_t iFun = boost::lexical_cast<size_t>(e[0].name().substr(1));
-        size_t wi = boost::lexical_cast<size_t>(e[2].name());
-        if (iFun >= nFunctions()) {
-          throw std::invalid_argument("MultiBG::setWorkspace: function " +
-                                      e[0].name() + " not found");
-        }
-        std::pair<boost::shared_ptr<const API::MatrixWorkspace>, size_t>
-            spectrum = std::make_pair(ws, wi);
-        m_funIndex[iFun].push_back(m_spectra.size());
-        m_spectra.push_back(spectrum);
-        IFitFunction *fun = dynamic_cast<IFitFunction *>(getFunction(iFun));
-        if (!fun) {
-          throw std::runtime_error(
-              "IFitFunction expected but function of another type found");
-        }
-        fun->setWorkspace(ws, "WorkspaceIndex=" + e[2].name(), false);
-      } catch (...) {
-        break;
-      }
-    }
-  }
-
-  // examine the member functions and fill in the m_funIndex array
-  for (size_t iFun = 0; iFun < nFunctions(); iFun++) {
-    API::IFunctionMW *fun = dynamic_cast<API::IFunctionMW *>(getFunction(iFun));
-    if (!fun) {
-      throw std::runtime_error("MultiBG works with IFunctionMW only");
-    }
-    if (fun->getWorkspace()) {
-      boost::shared_ptr<const API::MatrixWorkspace> iws =
-          fun->getMatrixWorkspace();
-      std::pair<boost::shared_ptr<const API::MatrixWorkspace>, size_t>
-          spectrum = std::make_pair(iws, fun->getWorkspaceIndex());
-      std::vector<std::pair<boost::shared_ptr<const API::MatrixWorkspace>,
-                            size_t>>::iterator it =
-          std::find(m_spectra.begin(), m_spectra.end(), spectrum);
-      size_t i;
-      if (it == m_spectra.end()) {
-        i = m_spectra.size();
-        m_spectra.push_back(spectrum);
-      } else {
-        i = size_t(std::distance(it, m_spectra.begin()));
-      }
-      m_funIndex[iFun].push_back(i);
-      // fun->setWorkspace(boost::static_pointer_cast<const
-      // API::Workspace>(iws),slicing,false);
-    }
-  }
-
-  // setWorkspace can be called by GUI when the function had not been properly
-  // initialized
-  if (m_spectra.empty()) {
-    return;
-  }
-
-  // make functions without set workspace fit to all workspaces
-  for (size_t iFun = 0; iFun < nFunctions(); iFun++) {
-    std::vector<size_t> &index = m_funIndex[iFun];
-    if (index.empty()) {
-      index.resize(m_spectra.size());
-      int i = 0;
-      std::for_each(index.begin(), index.end(), _1 = var(i)++);
-      IFitFunction *fun = dynamic_cast<IFitFunction *>(getFunction(iFun));
-      if (!fun) {
-        throw std::runtime_error(
-            "IFitFunction expected but function of another type found");
-      }
-      fun->setWorkspace(m_spectra[0].first,
-                        "WorkspaceIndex=" + boost::lexical_cast<std::string>(
-                                                m_spectra[0].second),
-                        false);
-    }
-  }
-
-  // set dimensions and calculate ws's contribution to m_dataSize
-  // IFunctionMW::setWorkspace(ws,slicing,false);
-  // add other workspaces
-  m_offset.resize(m_spectra.size(), 0);
-  size_t nData = 0;
-  for (size_t i = 0; i < m_spectra.size(); ++i) {
-    mws = m_spectra[i].first;
-    size_t n = mws->blocksize();
-    m_offset[i] = nData;
-    nData += static_cast<int>(n);
-  }
-
-  m_data.resize(nData);
-  m_weights.resize(nData);
-
-  //... fill in the data and the weights ...
-
-  for (size_t i = 0; i < m_spectra.size(); ++i) {
-    mws = m_spectra[i].first;
-    size_t wi = m_spectra[i].second;
-    const Mantid::MantidVec &Y = mws->readY(wi);
-    const Mantid::MantidVec &E = mws->readE(wi);
-    size_t j0 = m_offset[i];
-    for (size_t j = 0; j < Y.size(); ++j) {
-      m_data[j0 + j] = Y[j];
-      double err = E[j];
-      m_weights[j0 + j] = err != 0.0 ? 1. / err : 1.0;
-    }
-  }
-
-  // std::cerr << "Workspace:\n";
-  // std::for_each(&m_data[0],&m_data[0]+m_dataSize,std::cerr << _1 << '\n');
-}
-
-/**
- * Creates a workspace containing values calculated with this function. It takes
- * a workspace and ws index
- * of a spectrum which this function may have been fitted to. The output
- * contains the original spectrum
- * (wi = 0), the calculated values (ws = 1), and the difference between them (ws
- * = 2).
- * @param sd :: optional standard deviations of the parameters for calculating
- * the error bars
- * @return created workspase
- */
-boost::shared_ptr<API::WorkspaceGroup>
-MultiBG::createCalculatedWorkspaceGroup(const std::vector<double> &sd) {
-  UNUSED_ARG(sd)
-  return boost::shared_ptr<API::WorkspaceGroup>();
-}
-} // namespace API
-} // namespace Mantid
diff --git a/Framework/CurveFitting/src/ParDomain.cpp b/Framework/CurveFitting/src/ParDomain.cpp
index 7cd4fdfe9e2f07b684cc16b4edcb6b9df9145177..01a76765f051c38b7e694348961519a5dc7639d4 100644
--- a/Framework/CurveFitting/src/ParDomain.cpp
+++ b/Framework/CurveFitting/src/ParDomain.cpp
@@ -28,7 +28,8 @@ void ParDomain::getDomainAndValues(size_t i, API::FunctionDomain_sptr &domain,
  * Calculate the value of a least squares cost function
  * @param leastSquares :: The least squares cost func to calculate the value for
  */
-void ParDomain::leastSquaresVal(const CostFuncLeastSquares &leastSquares) {
+void ParDomain::leastSquaresVal(
+    const CostFunctions::CostFuncLeastSquares &leastSquares) {
   const int n = static_cast<int>(getNDomains());
   PARALLEL_FOR_NO_WSP_CHECK()
   for (int i = 0; i < n; ++i) {
@@ -54,7 +55,7 @@ void ParDomain::leastSquaresVal(const CostFuncLeastSquares &leastSquares) {
  * @param evalHessian :: Flag to evaluate the Hessian (second derivatives)
  */
 void ParDomain::leastSquaresValDerivHessian(
-    const CostFuncLeastSquares &leastSquares, bool evalDeriv,
+    const CostFunctions::CostFuncLeastSquares &leastSquares, bool evalDeriv,
     bool evalHessian) {
   const int n = static_cast<int>(getNDomains());
   PARALLEL_SET_DYNAMIC(0);
diff --git a/Framework/CurveFitting/src/ParameterEstimator.cpp b/Framework/CurveFitting/src/ParameterEstimator.cpp
index b06ef9bf59e96e5ecb51b54e67e221a14b95be9a..93c46fd68fbb9ae0690fbf296458a5f3bb20b7c4 100644
--- a/Framework/CurveFitting/src/ParameterEstimator.cpp
+++ b/Framework/CurveFitting/src/ParameterEstimator.cpp
@@ -1,5 +1,5 @@
 #include "MantidCurveFitting/ParameterEstimator.h"
-#include "MantidCurveFitting/SimpleChebfun.h"
+#include "MantidCurveFitting/Functions/SimpleChebfun.h"
 
 #include "MantidAPI/CompositeFunction.h"
 #include "MantidAPI/FunctionDomain1D.h"
@@ -13,6 +13,8 @@ namespace Mantid {
 namespace CurveFitting {
 namespace ParameterEstimator {
 
+using namespace Functions;
+
 /// The logger.
 Kernel::Logger g_log("ParameterEstimator");
 
diff --git a/Framework/CurveFitting/src/SeqDomain.cpp b/Framework/CurveFitting/src/SeqDomain.cpp
index a36e808948d556a6e366f88551bcdf8fffe2d645..8a704c1745664d0961b48088642ba0fdffc410e6 100644
--- a/Framework/CurveFitting/src/SeqDomain.cpp
+++ b/Framework/CurveFitting/src/SeqDomain.cpp
@@ -68,7 +68,8 @@ SeqDomain *SeqDomain::create(API::IDomainCreator::DomainType type) {
  * Calculate the value of a least squares cost function
  * @param leastSquares :: The least squares cost func to calculate the value for
  */
-void SeqDomain::leastSquaresVal(const CostFuncLeastSquares &leastSquares) {
+void SeqDomain::leastSquaresVal(
+    const CostFunctions::CostFuncLeastSquares &leastSquares) {
   API::FunctionDomain_sptr domain;
   API::FunctionValues_sptr values;
   const size_t n = getNDomains();
@@ -87,7 +88,7 @@ void SeqDomain::leastSquaresVal(const CostFuncLeastSquares &leastSquares) {
  * Calculate the value of a least squares cost function
  * @param rwp :: The RWP cost func to calculate the value for
  */
-void SeqDomain::rwpVal(const CostFuncRwp &rwp) {
+void SeqDomain::rwpVal(const CostFunctions::CostFuncRwp &rwp) {
   API::FunctionDomain_sptr domain;
   API::FunctionValues_sptr values;
   const size_t n = getNDomains();
@@ -109,7 +110,7 @@ void SeqDomain::rwpVal(const CostFuncRwp &rwp) {
  * @param evalHessian :: Flag to evaluate the Hessian (second derivatives)
  */
 void SeqDomain::leastSquaresValDerivHessian(
-    const CostFuncLeastSquares &leastSquares, bool evalDeriv,
+    const CostFunctions::CostFuncLeastSquares &leastSquares, bool evalDeriv,
     bool evalHessian) {
   API::FunctionDomain_sptr domain;
   API::FunctionValues_sptr values;
@@ -131,8 +132,8 @@ void SeqDomain::leastSquaresValDerivHessian(
  * @param evalDeriv :: Flag to evaluate the first derivatives
  * @param evalHessian :: Flag to evaluate the Hessian (second derivatives)
  */
-void SeqDomain::rwpValDerivHessian(const CostFuncRwp &rwp, bool evalDeriv,
-                                   bool evalHessian) {
+void SeqDomain::rwpValDerivHessian(const CostFunctions::CostFuncRwp &rwp,
+                                   bool evalDeriv, bool evalHessian) {
   API::FunctionDomain_sptr domain;
   API::FunctionValues_sptr values;
   const size_t n = getNDomains();
diff --git a/Framework/CurveFitting/test/CalculateChiSquaredTest.h b/Framework/CurveFitting/test/Algorithms/CalculateChiSquaredTest.h
similarity index 99%
rename from Framework/CurveFitting/test/CalculateChiSquaredTest.h
rename to Framework/CurveFitting/test/Algorithms/CalculateChiSquaredTest.h
index 39fb96307a24056335df98216d80fd5641bf899b..fb29bda4b80738fd99f9a2d89838ab547850f606 100644
--- a/Framework/CurveFitting/test/CalculateChiSquaredTest.h
+++ b/Framework/CurveFitting/test/Algorithms/CalculateChiSquaredTest.h
@@ -3,7 +3,7 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/CalculateChiSquared.h"
+#include "MantidCurveFitting/Algorithms/CalculateChiSquared.h"
 #include "MantidAPI/FunctionDomain1D.h"
 #include "MantidAPI/FunctionFactory.h"
 #include "MantidAPI/FunctionValues.h"
@@ -16,7 +16,7 @@
 #include <boost/math/special_functions/fpclassify.hpp>
 #include <limits>
 
-using Mantid::CurveFitting::CalculateChiSquared;
+using Mantid::CurveFitting::Algorithms::CalculateChiSquared;
 using namespace Mantid;
 using namespace Mantid::API;
 
diff --git a/Framework/CurveFitting/test/CalculateGammaBackgroundTest.h b/Framework/CurveFitting/test/Algorithms/CalculateGammaBackgroundTest.h
similarity index 98%
rename from Framework/CurveFitting/test/CalculateGammaBackgroundTest.h
rename to Framework/CurveFitting/test/Algorithms/CalculateGammaBackgroundTest.h
index d5d7dbf487ae5e8493ce8aba1bb577456be3b310..502479b5f363c09a4312cdab88c88b92e233be80 100644
--- a/Framework/CurveFitting/test/CalculateGammaBackgroundTest.h
+++ b/Framework/CurveFitting/test/Algorithms/CalculateGammaBackgroundTest.h
@@ -3,10 +3,10 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/CalculateGammaBackground.h"
-#include "ComptonProfileTestHelpers.h"
+#include "MantidCurveFitting/Algorithms/CalculateGammaBackground.h"
+#include "../Functions/ComptonProfileTestHelpers.h"
 
-using Mantid::CurveFitting::CalculateGammaBackground;
+using Mantid::CurveFitting::Algorithms::CalculateGammaBackground;
 
 class CalculateGammaBackgroundTest : public CxxTest::TestSuite {
 public:
diff --git a/Framework/CurveFitting/test/CalculateMSVesuvioTest.h b/Framework/CurveFitting/test/Algorithms/CalculateMSVesuvioTest.h
similarity index 98%
rename from Framework/CurveFitting/test/CalculateMSVesuvioTest.h
rename to Framework/CurveFitting/test/Algorithms/CalculateMSVesuvioTest.h
index 33f7f30b77a0252c38d2c692e8a529ea52de9d9f..f6eefbb0e35fd18579c0e7b04b0cc30398b88512 100644
--- a/Framework/CurveFitting/test/CalculateMSVesuvioTest.h
+++ b/Framework/CurveFitting/test/Algorithms/CalculateMSVesuvioTest.h
@@ -5,7 +5,7 @@
 
 #include "boost/version.hpp"
 
-#include "MantidCurveFitting/CalculateMSVesuvio.h"
+#include "MantidCurveFitting/Algorithms/CalculateMSVesuvio.h"
 #include "MantidGeometry/Instrument/Goniometer.h"
 #include "MantidGeometry/Instrument/Detector.h"
 #include "MantidGeometry/Objects/ShapeFactory.h"
@@ -13,9 +13,9 @@
 #include "MantidTestHelpers/ComponentCreationHelper.h"
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
 
-#include "ComptonProfileTestHelpers.h"
+#include "../Functions/ComptonProfileTestHelpers.h"
 
-using Mantid::CurveFitting::CalculateMSVesuvio;
+using Mantid::CurveFitting::Algorithms::CalculateMSVesuvio;
 
 class CalculateMSVesuvioTest : public CxxTest::TestSuite {
 public:
diff --git a/Framework/CurveFitting/test/ConvertToYSpaceTest.h b/Framework/CurveFitting/test/Algorithms/ConvertToYSpaceTest.h
similarity index 96%
rename from Framework/CurveFitting/test/ConvertToYSpaceTest.h
rename to Framework/CurveFitting/test/Algorithms/ConvertToYSpaceTest.h
index a3fed78b8baaa7c85c3ea0b918de70b4c4cc7fa3..839a9202dcdaa6ca483a5d439f97522d1dba0471 100644
--- a/Framework/CurveFitting/test/ConvertToYSpaceTest.h
+++ b/Framework/CurveFitting/test/Algorithms/ConvertToYSpaceTest.h
@@ -3,10 +3,10 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/ConvertToYSpace.h"
-#include "ComptonProfileTestHelpers.h"
+#include "MantidCurveFitting/Algorithms/ConvertToYSpace.h"
+#include "../Functions/ComptonProfileTestHelpers.h"
 
-using Mantid::CurveFitting::ConvertToYSpace;
+using Mantid::CurveFitting::Algorithms::ConvertToYSpace;
 
 class ConvertToYSpaceTest : public CxxTest::TestSuite {
 public:
diff --git a/Framework/CurveFitting/test/ConvolveWorkspacesTest.h b/Framework/CurveFitting/test/Algorithms/ConvolveWorkspacesTest.h
similarity index 92%
rename from Framework/CurveFitting/test/ConvolveWorkspacesTest.h
rename to Framework/CurveFitting/test/Algorithms/ConvolveWorkspacesTest.h
index 0e748fa7ad2ea2d13e197185366269ced7bc6c73..fe9dc90f597485b84dc5257466b1ec3f8a180aed 100644
--- a/Framework/CurveFitting/test/ConvolveWorkspacesTest.h
+++ b/Framework/CurveFitting/test/Algorithms/ConvolveWorkspacesTest.h
@@ -5,8 +5,8 @@
 
 #include "MantidAPI/FrameworkManager.h"
 #include "MantidAPI/AnalysisDataService.h"
-#include "MantidCurveFitting/ConvolveWorkspaces.h"
-#include "MantidCurveFitting/Fit.h"
+#include "MantidCurveFitting/Algorithms/ConvolveWorkspaces.h"
+#include "MantidCurveFitting/Algorithms/Fit.h"
 #include "MantidDataObjects/TableWorkspace.h"
 #include "MantidAPI/IPeakFunction.h"
 #include "MantidAPI/TableRow.h"
@@ -15,12 +15,13 @@
 #include "MantidAPI/FunctionFactory.h"
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
 #include "MantidTestHelpers/FakeObjects.h"
-#include "MantidCurveFitting/Gaussian.h"
+#include "MantidCurveFitting/Functions/Gaussian.h"
 
 using namespace Mantid;
 using namespace Mantid::API;
 using namespace Mantid::DataObjects;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Algorithms;
 
 class ConvolveWorkspacesTest : public CxxTest::TestSuite {
 public:
diff --git a/Framework/CurveFitting/test/EstimatePeakErrorsTest.h b/Framework/CurveFitting/test/Algorithms/EstimatePeakErrorsTest.h
similarity index 98%
rename from Framework/CurveFitting/test/EstimatePeakErrorsTest.h
rename to Framework/CurveFitting/test/Algorithms/EstimatePeakErrorsTest.h
index 3ea8b1328cfa5098cdffdc2af7219645d00b2a4f..04baa92e562d387740477077d681853d54945792 100644
--- a/Framework/CurveFitting/test/EstimatePeakErrorsTest.h
+++ b/Framework/CurveFitting/test/Algorithms/EstimatePeakErrorsTest.h
@@ -3,7 +3,7 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/EstimatePeakErrors.h"
+#include "MantidCurveFitting/Algorithms/EstimatePeakErrors.h"
 
 #include "MantidAPI/AlgorithmManager.h"
 #include "MantidAPI/AnalysisDataService.h"
@@ -19,6 +19,7 @@
 using namespace Mantid;
 using namespace Mantid::API;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Algorithms;
 using namespace WorkspaceCreationHelper;
 
 class EstimatePeakErrorsTest : public CxxTest::TestSuite {
diff --git a/Framework/CurveFitting/test/EvaluateFunctionTest.h b/Framework/CurveFitting/test/Algorithms/EvaluateFunctionTest.h
similarity index 98%
rename from Framework/CurveFitting/test/EvaluateFunctionTest.h
rename to Framework/CurveFitting/test/Algorithms/EvaluateFunctionTest.h
index 22e8a5aac0777d3003c7215b26ff7a1eb1f1f18f..cf8b80f4d991cbd76fe4a197c039c5eea0e15e6f 100644
--- a/Framework/CurveFitting/test/EvaluateFunctionTest.h
+++ b/Framework/CurveFitting/test/Algorithms/EvaluateFunctionTest.h
@@ -3,7 +3,7 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/EvaluateFunction.h"
+#include "MantidCurveFitting/Algorithms/EvaluateFunction.h"
 #include "MantidAPI/AlgorithmManager.h"
 #include "MantidAPI/AnalysisDataService.h"
 #include "MantidAPI/FunctionFactory.h"
@@ -15,7 +15,7 @@
 #include "MantidAPI/MatrixWorkspace.h"
 #include "MantidKernel/EmptyValues.h"
 
-using Mantid::CurveFitting::EvaluateFunction;
+using Mantid::CurveFitting::Algorithms::EvaluateFunction;
 using namespace Mantid;
 using namespace Mantid::API;
 
diff --git a/Framework/CurveFitting/test/FitPowderDiffPeaksTest.h b/Framework/CurveFitting/test/Algorithms/FitPowderDiffPeaksTest.h
similarity index 99%
rename from Framework/CurveFitting/test/FitPowderDiffPeaksTest.h
rename to Framework/CurveFitting/test/Algorithms/FitPowderDiffPeaksTest.h
index ffc3aa2b5be75b21602fda724cfd7ee954fd182e..2eea28afa5bc7c29710dadd82f362ece62d132fb 100644
--- a/Framework/CurveFitting/test/FitPowderDiffPeaksTest.h
+++ b/Framework/CurveFitting/test/Algorithms/FitPowderDiffPeaksTest.h
@@ -3,7 +3,7 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/FitPowderDiffPeaks.h"
+#include "MantidCurveFitting/Algorithms/FitPowderDiffPeaks.h"
 #include "MantidDataHandling/LoadAscii.h"
 #include "MantidAPI/MatrixWorkspace.h"
 #include "MantidDataObjects/Workspace2D.h"
@@ -11,7 +11,7 @@
 #include "MantidAPI/TableRow.h"
 #include <fstream>
 
-using Mantid::CurveFitting::FitPowderDiffPeaks;
+using Mantid::CurveFitting::Algorithms::FitPowderDiffPeaks;
 
 using namespace std;
 using namespace Mantid;
@@ -32,7 +32,7 @@ public:
   /** Test init
     */
   void test_Init() {
-    CurveFitting::FitPowderDiffPeaks alg;
+    Algorithms::FitPowderDiffPeaks alg;
     TS_ASSERT_THROWS_NOTHING(alg.initialize());
     TS_ASSERT(alg.isInitialized());
 
diff --git a/Framework/CurveFitting/test/FitTest.h b/Framework/CurveFitting/test/Algorithms/FitTest.h
similarity index 98%
rename from Framework/CurveFitting/test/FitTest.h
rename to Framework/CurveFitting/test/Algorithms/FitTest.h
index d4ce164b49008fd56dfc082016524bab1e9a7743..94b27088b284b5188b077158fe2d7ab871c110f7 100644
--- a/Framework/CurveFitting/test/FitTest.h
+++ b/Framework/CurveFitting/test/Algorithms/FitTest.h
@@ -7,11 +7,12 @@
 #include "MantidAPI/FrameworkManager.h"
 #include "MantidAPI/IFuncMinimizer.h"
 #include "MantidAPI/FuncMinimizerFactory.h"
-#include "MantidCurveFitting/Fit.h"
+#include "MantidCurveFitting/Algorithms/Fit.h"
 #include "FitTestHelpers.h"
 
 using namespace Mantid;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Algorithms;
 using namespace Mantid::API;
 
 namespace {
diff --git a/Framework/CurveFitting/test/FitTestHelpers.h b/Framework/CurveFitting/test/Algorithms/FitTestHelpers.h
similarity index 100%
rename from Framework/CurveFitting/test/FitTestHelpers.h
rename to Framework/CurveFitting/test/Algorithms/FitTestHelpers.h
diff --git a/Framework/CurveFitting/test/LeBailFitTest.h b/Framework/CurveFitting/test/Algorithms/LeBailFitTest.h
similarity index 99%
rename from Framework/CurveFitting/test/LeBailFitTest.h
rename to Framework/CurveFitting/test/Algorithms/LeBailFitTest.h
index 367da9173d58de7fbc930245072ebf27239bca6a..363ef9c91010ca6812518c889f784cbca4f3f335 100644
--- a/Framework/CurveFitting/test/LeBailFitTest.h
+++ b/Framework/CurveFitting/test/Algorithms/LeBailFitTest.h
@@ -5,11 +5,9 @@
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
 
-#include "MantidCurveFitting/LeBailFit.h"
+#include "MantidCurveFitting/Algorithms/LeBailFit.h"
 #include "MantidDataHandling/LoadAscii.h"
 
-#include <iostream>
-#include <iomanip>
 #include <fstream>
 
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
@@ -30,7 +28,7 @@ using namespace WorkspaceCreationHelper;
 
 using namespace std;
 
-using Mantid::CurveFitting::LeBailFit;
+using Mantid::CurveFitting::Algorithms::LeBailFit;
 
 class LeBailFitTest : public CxxTest::TestSuite {
 public:
diff --git a/Framework/CurveFitting/test/LeBailFunctionTest.h b/Framework/CurveFitting/test/Algorithms/LeBailFunctionTest.h
similarity index 99%
rename from Framework/CurveFitting/test/LeBailFunctionTest.h
rename to Framework/CurveFitting/test/Algorithms/LeBailFunctionTest.h
index af5ecb5b30b30784720c1e4c0ce9945d0f35f34e..3c0fbdc897d010019117c62fe14533fb34c997a9 100644
--- a/Framework/CurveFitting/test/LeBailFunctionTest.h
+++ b/Framework/CurveFitting/test/Algorithms/LeBailFunctionTest.h
@@ -5,14 +5,13 @@
 #include "MantidAPI/WorkspaceFactory.h"
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 #include <fstream>
 
-#include "MantidCurveFitting/LeBailFunction.h"
+#include "MantidCurveFitting/Algorithms/LeBailFunction.h"
 
 using namespace Mantid;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Algorithms;
 using namespace Mantid::API;
 
 using namespace std;
diff --git a/Framework/CurveFitting/test/NormaliseByPeakAreaTest.h b/Framework/CurveFitting/test/Algorithms/NormaliseByPeakAreaTest.h
similarity index 98%
rename from Framework/CurveFitting/test/NormaliseByPeakAreaTest.h
rename to Framework/CurveFitting/test/Algorithms/NormaliseByPeakAreaTest.h
index 42e26ed2efc5fbadba4d4a247a2dcb7b48351e0d..30d27a5a9b32834fae81aba7fc65f4d3fd6e56a3 100644
--- a/Framework/CurveFitting/test/NormaliseByPeakAreaTest.h
+++ b/Framework/CurveFitting/test/Algorithms/NormaliseByPeakAreaTest.h
@@ -3,10 +3,10 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/NormaliseByPeakArea.h"
-#include "ComptonProfileTestHelpers.h"
+#include "MantidCurveFitting/Algorithms/NormaliseByPeakArea.h"
+#include "../Functions/ComptonProfileTestHelpers.h"
 
-using Mantid::CurveFitting::NormaliseByPeakArea;
+using Mantid::CurveFitting::Algorithms::NormaliseByPeakArea;
 
 class NormaliseByPeakAreaTest : public CxxTest::TestSuite {
 public:
diff --git a/Framework/CurveFitting/test/PawleyFitTest.h b/Framework/CurveFitting/test/Algorithms/PawleyFitTest.h
similarity index 98%
rename from Framework/CurveFitting/test/PawleyFitTest.h
rename to Framework/CurveFitting/test/Algorithms/PawleyFitTest.h
index 3c99605f3d889689ca20cd3a8f375a4c09f0a93f..1766df896cd2ddba7d2486f7210f2496a25dd0fd 100644
--- a/Framework/CurveFitting/test/PawleyFitTest.h
+++ b/Framework/CurveFitting/test/Algorithms/PawleyFitTest.h
@@ -3,7 +3,7 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/PawleyFit.h"
+#include "MantidCurveFitting/Algorithms/PawleyFit.h"
 #include "MantidAPI/AlgorithmManager.h"
 #include "MantidAPI/FunctionFactory.h"
 #include "MantidAPI/TableRow.h"
@@ -11,8 +11,8 @@
 #include "MantidKernel/V3D.h"
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
 
-using Mantid::CurveFitting::PawleyFit;
-using Mantid::CurveFitting::V3DFromHKLColumnExtractor;
+using Mantid::CurveFitting::Algorithms::PawleyFit;
+using Mantid::CurveFitting::Algorithms::V3DFromHKLColumnExtractor;
 using namespace Mantid::API;
 using namespace Mantid::Kernel;
 
diff --git a/Framework/CurveFitting/test/PlotPeakByLogValueTest.h b/Framework/CurveFitting/test/Algorithms/PlotPeakByLogValueTest.h
similarity index 99%
rename from Framework/CurveFitting/test/PlotPeakByLogValueTest.h
rename to Framework/CurveFitting/test/Algorithms/PlotPeakByLogValueTest.h
index 03947a4ae12f68f9ef830eeab19346b35e5fa4f7..9fb02f3eff1711f19136fd8add1b58a3658e50b4 100644
--- a/Framework/CurveFitting/test/PlotPeakByLogValueTest.h
+++ b/Framework/CurveFitting/test/Algorithms/PlotPeakByLogValueTest.h
@@ -3,7 +3,7 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/PlotPeakByLogValue.h"
+#include "MantidCurveFitting/Algorithms/PlotPeakByLogValue.h"
 #include "MantidDataObjects/Workspace2D.h"
 #include "MantidDataObjects/TableWorkspace.h"
 #include "MantidAPI/TableRow.h"
@@ -26,6 +26,7 @@ using namespace Mantid;
 using namespace Mantid::API;
 using namespace Mantid::DataObjects;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Algorithms;
 
 typedef Mantid::DataObjects::Workspace2D_sptr WS_type;
 typedef Mantid::DataObjects::TableWorkspace_sptr TWS_type;
diff --git a/Framework/CurveFitting/test/RefinePowderInstrumentParameters3Test.h b/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParameters3Test.h
similarity index 99%
rename from Framework/CurveFitting/test/RefinePowderInstrumentParameters3Test.h
rename to Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParameters3Test.h
index a77678e9ebccb2dae4462d4d8d0611b4fc1c4f26..dedf1a1c02d6251cc27152f26dde9d4820c39563 100644
--- a/Framework/CurveFitting/test/RefinePowderInstrumentParameters3Test.h
+++ b/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParameters3Test.h
@@ -3,7 +3,7 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/RefinePowderInstrumentParameters3.h"
+#include "MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters3.h"
 
 #include "MantidAPI/WorkspaceFactory.h"
 #include "MantidDataObjects/Workspace2D.h"
@@ -12,7 +12,7 @@
 
 #include <fstream>
 
-using Mantid::CurveFitting::RefinePowderInstrumentParameters3;
+using Mantid::CurveFitting::Algorithms::RefinePowderInstrumentParameters3;
 
 using namespace Mantid;
 using namespace Mantid::DataObjects;
diff --git a/Framework/CurveFitting/test/RefinePowderInstrumentParametersTest.h b/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParametersTest.h
similarity index 98%
rename from Framework/CurveFitting/test/RefinePowderInstrumentParametersTest.h
rename to Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParametersTest.h
index 421e4728d18724aff5a18509d3079997d7af5c81..fccdacb20db30175b3a3fa7c457b9ca9d9cbff43 100644
--- a/Framework/CurveFitting/test/RefinePowderInstrumentParametersTest.h
+++ b/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParametersTest.h
@@ -3,14 +3,14 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/RefinePowderInstrumentParameters.h"
+#include "MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters.h"
 #include "MantidAPI/MatrixWorkspace.h"
 #include "MantidDataObjects/Workspace2D.h"
 #include "MantidDataObjects/TableWorkspace.h"
 #include "MantidAPI/TableRow.h"
 #include <fstream>
 
-using Mantid::CurveFitting::RefinePowderInstrumentParameters;
+using Mantid::CurveFitting::Algorithms::RefinePowderInstrumentParameters;
 using namespace Mantid;
 using namespace Mantid::Kernel;
 using namespace Mantid::API;
@@ -153,7 +153,7 @@ public:
                                                  geomparamws);
 
     // 2. Set up algorithm parameters
-    CurveFitting::RefinePowderInstrumentParameters alg;
+    RefinePowderInstrumentParameters alg;
     TS_ASSERT_THROWS_NOTHING(alg.initialize());
     TS_ASSERT(alg.isInitialized());
 
@@ -236,7 +236,7 @@ public:
                                                  geomparamws);
 
     // 2. Set up algorithm parameters
-    CurveFitting::RefinePowderInstrumentParameters alg;
+    RefinePowderInstrumentParameters alg;
     TS_ASSERT_THROWS_NOTHING(alg.initialize());
     TS_ASSERT(alg.isInitialized());
 
diff --git a/Framework/CurveFitting/test/SeqDomainSpectrumCreatorTest.h b/Framework/CurveFitting/test/Algorithms/SeqDomainSpectrumCreatorTest.h
similarity index 99%
rename from Framework/CurveFitting/test/SeqDomainSpectrumCreatorTest.h
rename to Framework/CurveFitting/test/Algorithms/SeqDomainSpectrumCreatorTest.h
index 4cf5c605467e89f40040a1d00da1b3cea7d9b196..077ca4fd6b7d0e7eaf1743731055c1fa0de27f03 100644
--- a/Framework/CurveFitting/test/SeqDomainSpectrumCreatorTest.h
+++ b/Framework/CurveFitting/test/Algorithms/SeqDomainSpectrumCreatorTest.h
@@ -10,7 +10,7 @@
 #include "MantidAPI/IFunction1DSpectrum.h"
 #include "MantidAPI/ParamFunction.h"
 
-#include "MantidCurveFitting/Fit.h"
+#include "MantidCurveFitting/Algorithms/Fit.h"
 #include "MantidAPI/TableRow.h"
 #include "MantidAPI/FunctionFactory.h"
 
@@ -20,6 +20,7 @@
 using namespace Mantid::Kernel;
 using namespace Mantid::API;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Algorithms;
 
 class SeqDomainSpectrumCreatorTest : public CxxTest::TestSuite {
 public:
diff --git a/Framework/CurveFitting/test/SplineBackgroundTest.h b/Framework/CurveFitting/test/Algorithms/SplineBackgroundTest.h
similarity index 96%
rename from Framework/CurveFitting/test/SplineBackgroundTest.h
rename to Framework/CurveFitting/test/Algorithms/SplineBackgroundTest.h
index 935ed917426390465f5b952deb4f385aba20c967..4608bff0880d02351a3143f238691427d8a7896f 100644
--- a/Framework/CurveFitting/test/SplineBackgroundTest.h
+++ b/Framework/CurveFitting/test/Algorithms/SplineBackgroundTest.h
@@ -2,7 +2,7 @@
 #define SPLINEBACKGROUNDTEST_H_
 
 #include <cxxtest/TestSuite.h>
-#include "MantidCurveFitting/SplineBackground.h"
+#include "MantidCurveFitting/Algorithms/SplineBackground.h"
 #include "MantidAPI/AnalysisDataService.h"
 #include "MantidAPI/FrameworkManager.h"
 #include "MantidAPI/MatrixWorkspace.h"
diff --git a/Framework/CurveFitting/test/SplineInterpolationTest.h b/Framework/CurveFitting/test/Algorithms/SplineInterpolationTest.h
similarity index 97%
rename from Framework/CurveFitting/test/SplineInterpolationTest.h
rename to Framework/CurveFitting/test/Algorithms/SplineInterpolationTest.h
index 43b5adc90e74c081932edbe431ce6a50dcd11081..e55dc97c987ca523d7b8ac445a20e1c9ea1e0f2e 100644
--- a/Framework/CurveFitting/test/SplineInterpolationTest.h
+++ b/Framework/CurveFitting/test/Algorithms/SplineInterpolationTest.h
@@ -3,12 +3,12 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/SplineInterpolation.h"
+#include "MantidCurveFitting/Algorithms/SplineInterpolation.h"
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
 #include "MantidAPI/NumericAxis.h"
 #include "MantidAPI/TextAxis.h"
 
-using Mantid::CurveFitting::SplineInterpolation;
+using Mantid::CurveFitting::Algorithms::SplineInterpolation;
 using namespace Mantid::API;
 
 class SplineInterpolationTest : public CxxTest::TestSuite {
diff --git a/Framework/CurveFitting/test/SplineSmoothingTest.h b/Framework/CurveFitting/test/Algorithms/SplineSmoothingTest.h
similarity index 96%
rename from Framework/CurveFitting/test/SplineSmoothingTest.h
rename to Framework/CurveFitting/test/Algorithms/SplineSmoothingTest.h
index cc28ba8c4361c88f6d91c53231d3120d033fdc9b..bc88af1750e9c0de3be3a6940fd5c9667859b100 100644
--- a/Framework/CurveFitting/test/SplineSmoothingTest.h
+++ b/Framework/CurveFitting/test/Algorithms/SplineSmoothingTest.h
@@ -4,9 +4,9 @@
 #include <cxxtest/TestSuite.h>
 
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
-#include "MantidCurveFitting/SplineSmoothing.h"
+#include "MantidCurveFitting/Algorithms/SplineSmoothing.h"
 
-using Mantid::CurveFitting::SplineSmoothing;
+using Mantid::CurveFitting::Algorithms::SplineSmoothing;
 
 class SplineSmoothingTest : public CxxTest::TestSuite {
 public:
diff --git a/Framework/CurveFitting/test/CompositeFunctionTest.h b/Framework/CurveFitting/test/CompositeFunctionTest.h
index 9ee2946430933592a048a59e1f179eee728fcb8a..62a5cc3a1e5a15205b4504fafbb040b3f1543b75 100644
--- a/Framework/CurveFitting/test/CompositeFunctionTest.h
+++ b/Framework/CurveFitting/test/CompositeFunctionTest.h
@@ -5,7 +5,7 @@
 
 #include "MantidAPI/IPeakFunction.h"
 #include "MantidAPI/CompositeFunction.h"
-#include "MantidCurveFitting/Fit.h"
+#include "MantidCurveFitting/Algorithms/Fit.h"
 #include "MantidDataObjects/Workspace2D.h"
 #include "MantidDataObjects/TableWorkspace.h"
 #include "MantidAPI/TableRow.h"
@@ -13,12 +13,12 @@
 #include "MantidKernel/ConfigService.h"
 #include "MantidAPI/FrameworkManager.h"
 
-#include "MantidCurveFitting/SimplexMinimizer.h"
-#include "MantidCurveFitting/BFGS_Minimizer.h"
-#include "MantidCurveFitting/LevenbergMarquardtMDMinimizer.h"
-#include "MantidCurveFitting/UserFunction.h"
-#include "MantidCurveFitting/ExpDecay.h"
-#include "MantidCurveFitting/CostFuncLeastSquares.h"
+#include "MantidCurveFitting/FuncMinimizers/SimplexMinimizer.h"
+#include "MantidCurveFitting/FuncMinimizers/BFGS_Minimizer.h"
+#include "MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMDMinimizer.h"
+#include "MantidCurveFitting/Functions/UserFunction.h"
+#include "MantidCurveFitting/Functions/ExpDecay.h"
+#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h"
 #include "MantidCurveFitting/GSLJacobian.h"
 #include "MantidAPI/FunctionDomain1D.h"
 #include "MantidAPI/FunctionValues.h"
@@ -28,6 +28,10 @@
 using namespace Mantid::API;
 using namespace Mantid::DataObjects;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Algorithms;
+using namespace Mantid::CurveFitting::Functions;
+using namespace Mantid::CurveFitting::FuncMinimisers;
+using namespace Mantid::CurveFitting::CostFunctions;
 
 typedef Mantid::DataObjects::Workspace2D_sptr WS_type;
 typedef Mantid::DataObjects::TableWorkspace_sptr TWS_type;
diff --git a/Framework/CurveFitting/test/BoundaryConstraintTest.h b/Framework/CurveFitting/test/Constraints/BoundaryConstraintTest.h
similarity index 95%
rename from Framework/CurveFitting/test/BoundaryConstraintTest.h
rename to Framework/CurveFitting/test/Constraints/BoundaryConstraintTest.h
index e23d1847af1eadd572844b8ece762178eb6588c5..6e340def5735e36eb437735f2ef22b333dbe501e 100644
--- a/Framework/CurveFitting/test/BoundaryConstraintTest.h
+++ b/Framework/CurveFitting/test/Constraints/BoundaryConstraintTest.h
@@ -3,9 +3,9 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/BoundaryConstraint.h"
-#include "MantidCurveFitting/Gaussian.h"
-#include "MantidCurveFitting/Lorentzian.h"
+#include "MantidCurveFitting/Constraints/BoundaryConstraint.h"
+#include "MantidCurveFitting/Functions/Gaussian.h"
+#include "MantidCurveFitting/Functions/Lorentzian.h"
 #include "MantidKernel/UnitFactory.h"
 #include "MantidAPI/AnalysisDataService.h"
 #include "MantidAPI/WorkspaceFactory.h"
@@ -15,6 +15,8 @@
 
 using namespace Mantid::API;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Functions;
+using namespace Mantid::CurveFitting::Constraints;
 
 class BoundaryConstraintTest : public CxxTest::TestSuite {
 public:
@@ -39,7 +41,7 @@ public:
     TS_ASSERT(bc.hasUpper());
 
     BoundaryConstraint bc2;
-    ;
+
     bc2.reset(&gaus, 2);
     bc2.setBounds(10, 20);
 
diff --git a/Framework/CurveFitting/test/CostFuncUnweightedLeastSquaresTest.h b/Framework/CurveFitting/test/CostFunctions/CostFuncUnweightedLeastSquaresTest.h
similarity index 95%
rename from Framework/CurveFitting/test/CostFuncUnweightedLeastSquaresTest.h
rename to Framework/CurveFitting/test/CostFunctions/CostFuncUnweightedLeastSquaresTest.h
index 7604eac76910549eb1946377693e565aed930d03..6b79954f49eac2fdc6c250fb04dec93e158ad58b 100644
--- a/Framework/CurveFitting/test/CostFuncUnweightedLeastSquaresTest.h
+++ b/Framework/CurveFitting/test/CostFunctions/CostFuncUnweightedLeastSquaresTest.h
@@ -5,11 +5,11 @@
 #include "MantidAPI/FunctionDomain1D.h"
 #include "MantidAPI/FunctionFactory.h"
 
-#include "MantidCurveFitting/CostFuncUnweightedLeastSquares.h"
+#include "MantidCurveFitting/CostFunctions/CostFuncUnweightedLeastSquares.h"
 
 #include <boost/make_shared.hpp>
 
-using Mantid::CurveFitting::CostFuncUnweightedLeastSquares;
+using Mantid::CurveFitting::CostFunctions::CostFuncUnweightedLeastSquares;
 using namespace Mantid::API;
 
 class CostFuncUnweightedLeastSquaresTest : public CxxTest::TestSuite {
diff --git a/Framework/CurveFitting/test/LeastSquaresTest.h b/Framework/CurveFitting/test/CostFunctions/LeastSquaresTest.h
similarity index 94%
rename from Framework/CurveFitting/test/LeastSquaresTest.h
rename to Framework/CurveFitting/test/CostFunctions/LeastSquaresTest.h
index 3f49a8cb1103c33ff00f0a512d4b4bd3f1a26417..425d34058f918ca2c14b4cd84a90a9fe86ded20b 100644
--- a/Framework/CurveFitting/test/LeastSquaresTest.h
+++ b/Framework/CurveFitting/test/CostFunctions/LeastSquaresTest.h
@@ -3,24 +3,27 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/CostFuncLeastSquares.h"
-#include "MantidCurveFitting/CostFuncRwp.h"
-#include "MantidCurveFitting/SimplexMinimizer.h"
-#include "MantidCurveFitting/BFGS_Minimizer.h"
-#include "MantidCurveFitting/LevenbergMarquardtMDMinimizer.h"
-#include "MantidCurveFitting/UserFunction.h"
-#include "MantidCurveFitting/ExpDecay.h"
+#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h"
+#include "MantidCurveFitting/CostFunctions/CostFuncRwp.h"
+#include "MantidCurveFitting/FuncMinimizers/SimplexMinimizer.h"
+#include "MantidCurveFitting/FuncMinimizers/BFGS_Minimizer.h"
+#include "MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMDMinimizer.h"
 #include "MantidAPI/FunctionDomain1D.h"
 #include "MantidAPI/FunctionValues.h"
 #include "MantidAPI/CompositeFunction.h"
-#include "MantidCurveFitting/LinearBackground.h"
-#include "MantidCurveFitting/Gaussian.h"
+#include "MantidCurveFitting/Functions/LinearBackground.h"
+#include "MantidCurveFitting/Functions/Gaussian.h"
+#include "MantidCurveFitting/Functions/UserFunction.h"
+#include "MantidCurveFitting/Functions/ExpDecay.h"
 
 #include <gsl/gsl_blas.h>
 #include <sstream>
 
 using namespace Mantid;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::FuncMinimisers;
+using namespace Mantid::CurveFitting::CostFunctions;
+using namespace Mantid::CurveFitting::Functions;
 using namespace Mantid::API;
 
 class LeastSquaresTest : public CxxTest::TestSuite {
diff --git a/Framework/CurveFitting/test/FitMWTest.h b/Framework/CurveFitting/test/FitMWTest.h
index 78782f80d0678cdc1fd95ae41b4ca82ae54c3d68..00f938a976097564634c962ab59e1d74bf45e6a0 100644
--- a/Framework/CurveFitting/test/FitMWTest.h
+++ b/Framework/CurveFitting/test/FitMWTest.h
@@ -5,13 +5,13 @@
 #include "MantidTestHelpers/FakeObjects.h"
 
 #include "MantidCurveFitting/FitMW.h"
-#include "MantidCurveFitting/Fit.h"
-#include "MantidCurveFitting/UserFunction.h"
-#include "MantidCurveFitting/ExpDecay.h"
+#include "MantidCurveFitting/Algorithms/Fit.h"
 #include "MantidCurveFitting/SeqDomain.h"
-#include "MantidCurveFitting/Convolution.h"
-#include "MantidCurveFitting/Gaussian.h"
-#include "MantidCurveFitting/Polynomial.h"
+#include "MantidCurveFitting/Functions/UserFunction.h"
+#include "MantidCurveFitting/Functions/ExpDecay.h"
+#include "MantidCurveFitting/Functions/Convolution.h"
+#include "MantidCurveFitting/Functions/Gaussian.h"
+#include "MantidCurveFitting/Functions/Polynomial.h"
 
 #include "MantidAPI/CompositeFunction.h"
 #include "MantidAPI/FrameworkManager.h"
@@ -29,6 +29,8 @@
 
 using namespace Mantid;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Algorithms;
+using namespace Mantid::CurveFitting::Functions;
 using namespace Mantid::API;
 
 class FitMWTest : public CxxTest::TestSuite {
@@ -51,7 +53,7 @@ public:
     fun->setParameter("Height", 1.);
     fun->setParameter("Lifetime", 1.0);
 
-    Fit fit;
+    Algorithms::Fit fit;
     fit.initialize();
 
     fit.setProperty("Function", fun);
@@ -159,7 +161,7 @@ public:
     fun->setParameter("Height", 1.);
     fun->setParameter("Lifetime", 1.);
 
-    Fit fit;
+    Algorithms::Fit fit;
     fit.initialize();
 
     fit.setProperty("Function", fun);
diff --git a/Framework/CurveFitting/test/BFGSTest.h b/Framework/CurveFitting/test/FuncMinimizers/BFGSTest.h
similarity index 94%
rename from Framework/CurveFitting/test/BFGSTest.h
rename to Framework/CurveFitting/test/FuncMinimizers/BFGSTest.h
index f0c03cb3e3792a1e600f9eaacdb761c0d10fcacf..0343e6677710560c70b4180980c6f01dfda4cbb2 100644
--- a/Framework/CurveFitting/test/BFGSTest.h
+++ b/Framework/CurveFitting/test/FuncMinimizers/BFGSTest.h
@@ -3,13 +3,14 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/BFGS_Minimizer.h"
+#include "MantidCurveFitting/FuncMinimizers/BFGS_Minimizer.h"
 #include "MantidAPI/ICostFunction.h"
 
 #include <sstream>
 
 using namespace Mantid;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::FuncMinimisers;
 using namespace Mantid::API;
 
 class BFGSTestCostFunction : public ICostFunction {
diff --git a/Framework/CurveFitting/test/DampingMinimizerTest.h b/Framework/CurveFitting/test/FuncMinimizers/DampingMinimizerTest.h
similarity index 95%
rename from Framework/CurveFitting/test/DampingMinimizerTest.h
rename to Framework/CurveFitting/test/FuncMinimizers/DampingMinimizerTest.h
index 61ce4aa560fc51076541d6c0ea00f39367759c01..1e8d08c13f590156ab50f463a09e6ea4e3714271 100644
--- a/Framework/CurveFitting/test/DampingMinimizerTest.h
+++ b/Framework/CurveFitting/test/FuncMinimizers/DampingMinimizerTest.h
@@ -3,17 +3,21 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/CostFuncLeastSquares.h"
-#include "MantidCurveFitting/DampingMinimizer.h"
-#include "MantidCurveFitting/UserFunction.h"
+#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h"
+#include "MantidCurveFitting/FuncMinimizers/DampingMinimizer.h"
+#include "MantidCurveFitting/Functions/UserFunction.h"
 #include "MantidAPI/FunctionDomain1D.h"
 #include "MantidAPI/FunctionValues.h"
-#include "MantidCurveFitting/BoundaryConstraint.h"
+#include "MantidCurveFitting/Constraints/BoundaryConstraint.h"
 
 #include <sstream>
 
 using namespace Mantid;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::FuncMinimisers;
+using namespace Mantid::CurveFitting::CostFunctions;
+using namespace Mantid::CurveFitting::Constraints;
+using namespace Mantid::CurveFitting::Functions;
 using namespace Mantid::API;
 
 class DampingMinimizerTest : public CxxTest::TestSuite {
diff --git a/Framework/CurveFitting/test/FABADAMinimizerTest.h b/Framework/CurveFitting/test/FuncMinimizers/FABADAMinimizerTest.h
similarity index 94%
rename from Framework/CurveFitting/test/FABADAMinimizerTest.h
rename to Framework/CurveFitting/test/FuncMinimizers/FABADAMinimizerTest.h
index 29b304014ebc1c720151f74adc0cfdae6d961be1..73f6508f42790dfc83079c5dcf4796ff14c0bf6b 100644
--- a/Framework/CurveFitting/test/FABADAMinimizerTest.h
+++ b/Framework/CurveFitting/test/FuncMinimizers/FABADAMinimizerTest.h
@@ -3,20 +3,22 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/FABADAMinimizer.h"
+#include "MantidCurveFitting/FuncMinimizers/FABADAMinimizer.h"
 
-#include "MantidCurveFitting/Fit.h"
+#include "MantidCurveFitting/Algorithms/Fit.h"
 #include "MantidAPI/AlgorithmManager.h"
 
-#include "MantidCurveFitting/ExpDecay.h"
+#include "MantidCurveFitting/Functions/ExpDecay.h"
 #include "MantidKernel/PropertyManager.h"
 #include "MantidTestHelpers/FakeObjects.h"
 #include "MantidKernel/Exception.h"
 
-using Mantid::CurveFitting::FABADAMinimizer;
+using Mantid::CurveFitting::FuncMinimisers::FABADAMinimizer;
 using namespace Mantid::API;
 using namespace Mantid;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Algorithms;
+using namespace Mantid::CurveFitting::Functions;
 
 class FABADAMinimizerTest : public CxxTest::TestSuite {
 public:
@@ -34,7 +36,7 @@ public:
     fun->setParameter("Height", 8.);
     fun->setParameter("Lifetime", 1.0);
 
-    Fit fit;
+    Algorithms::Fit fit;
     fit.initialize();
 
     fit.setRethrows(true);
@@ -143,7 +145,7 @@ public:
     fun->setParameter("Height", 1.);
     fun->setParameter("Lifetime", 1.0);
 
-    Fit fit;
+    Algorithms::Fit fit;
     fit.initialize();
 
     fit.setRethrows(true);
diff --git a/Framework/CurveFitting/test/FRConjugateGradientTest.h b/Framework/CurveFitting/test/FuncMinimizers/FRConjugateGradientTest.h
similarity index 94%
rename from Framework/CurveFitting/test/FRConjugateGradientTest.h
rename to Framework/CurveFitting/test/FuncMinimizers/FRConjugateGradientTest.h
index 34028a02dd1213cb225a4deb8173f35f9de845e1..12629afb2dbd101ef72e3d9cbea61a74c1c13698 100644
--- a/Framework/CurveFitting/test/FRConjugateGradientTest.h
+++ b/Framework/CurveFitting/test/FuncMinimizers/FRConjugateGradientTest.h
@@ -3,13 +3,14 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/FRConjugateGradientMinimizer.h"
+#include "MantidCurveFitting/FuncMinimizers/FRConjugateGradientMinimizer.h"
 #include "MantidAPI/ICostFunction.h"
 
 #include <sstream>
 
 using namespace Mantid;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::FuncMinimisers;
 using namespace Mantid::API;
 
 class FRConjugateGradientTestCostFunction : public ICostFunction {
diff --git a/Framework/CurveFitting/test/LevenbergMarquardtMDTest.h b/Framework/CurveFitting/test/FuncMinimizers/LevenbergMarquardtMDTest.h
similarity index 95%
rename from Framework/CurveFitting/test/LevenbergMarquardtMDTest.h
rename to Framework/CurveFitting/test/FuncMinimizers/LevenbergMarquardtMDTest.h
index 93ae0e5dd0a8c4fbe019e61fd35211a07ad5aadd..edaeec639e087ddf475094d1d23c41b66cccb0ea 100644
--- a/Framework/CurveFitting/test/LevenbergMarquardtMDTest.h
+++ b/Framework/CurveFitting/test/FuncMinimizers/LevenbergMarquardtMDTest.h
@@ -3,17 +3,21 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/CostFuncLeastSquares.h"
-#include "MantidCurveFitting/LevenbergMarquardtMDMinimizer.h"
-#include "MantidCurveFitting/UserFunction.h"
+#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h"
+#include "MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMDMinimizer.h"
+#include "MantidCurveFitting/Functions/UserFunction.h"
 #include "MantidAPI/FunctionDomain1D.h"
 #include "MantidAPI/FunctionValues.h"
-#include "MantidCurveFitting/BoundaryConstraint.h"
+#include "MantidCurveFitting/Constraints/BoundaryConstraint.h"
 
 #include <sstream>
 
 using namespace Mantid;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::FuncMinimisers;
+using namespace Mantid::CurveFitting::CostFunctions;
+using namespace Mantid::CurveFitting::Constraints;
+using namespace Mantid::CurveFitting::Functions;
 using namespace Mantid::API;
 
 class LevenbergMarquardtMDTest : public CxxTest::TestSuite {
diff --git a/Framework/CurveFitting/test/LevenbergMarquardtTest.h b/Framework/CurveFitting/test/FuncMinimizers/LevenbergMarquardtTest.h
similarity index 95%
rename from Framework/CurveFitting/test/LevenbergMarquardtTest.h
rename to Framework/CurveFitting/test/FuncMinimizers/LevenbergMarquardtTest.h
index 30a690d98b9fd530976cf180cb1616a2461c7a0b..359712feb5f798bacd3398eb7e15d1193dac7f58 100644
--- a/Framework/CurveFitting/test/LevenbergMarquardtTest.h
+++ b/Framework/CurveFitting/test/FuncMinimizers/LevenbergMarquardtTest.h
@@ -3,17 +3,21 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/CostFuncLeastSquares.h"
-#include "MantidCurveFitting/LevenbergMarquardtMinimizer.h"
-#include "MantidCurveFitting/UserFunction.h"
+#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h"
+#include "MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMinimizer.h"
+#include "MantidCurveFitting/Functions/UserFunction.h"
 #include "MantidAPI/FunctionDomain1D.h"
 #include "MantidAPI/FunctionValues.h"
-#include "MantidCurveFitting/BoundaryConstraint.h"
+#include "MantidCurveFitting/Constraints/BoundaryConstraint.h"
 
 #include <sstream>
 
 using namespace Mantid;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::FuncMinimisers;
+using namespace Mantid::CurveFitting::CostFunctions;
+using namespace Mantid::CurveFitting::Constraints;
+using namespace Mantid::CurveFitting::Functions;
 using namespace Mantid::API;
 
 class LevenbergMarquardtTest : public CxxTest::TestSuite {
diff --git a/Framework/CurveFitting/test/PRConjugateGradientTest.h b/Framework/CurveFitting/test/FuncMinimizers/PRConjugateGradientTest.h
similarity index 94%
rename from Framework/CurveFitting/test/PRConjugateGradientTest.h
rename to Framework/CurveFitting/test/FuncMinimizers/PRConjugateGradientTest.h
index b5a8a910e1492319ec72a65f5f6d2d8a0e7d2cdd..6f250d93aa4a3ff039555979831aac6ca411556b 100644
--- a/Framework/CurveFitting/test/PRConjugateGradientTest.h
+++ b/Framework/CurveFitting/test/FuncMinimizers/PRConjugateGradientTest.h
@@ -3,13 +3,14 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/PRConjugateGradientMinimizer.h"
+#include "MantidCurveFitting/FuncMinimizers/PRConjugateGradientMinimizer.h"
 #include "MantidAPI/ICostFunction.h"
 
 #include <sstream>
 
 using namespace Mantid;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::FuncMinimisers;
 using namespace Mantid::API;
 
 class PRConjugateGradientTestCostFunction : public ICostFunction {
diff --git a/Framework/CurveFitting/test/SimplexTest.h b/Framework/CurveFitting/test/FuncMinimizers/SimplexTest.h
similarity index 93%
rename from Framework/CurveFitting/test/SimplexTest.h
rename to Framework/CurveFitting/test/FuncMinimizers/SimplexTest.h
index 95811e161315ccb4ef59c832762cc5b792392a31..6edf55ccb183f24d904837fcf25fcd9021132fc0 100644
--- a/Framework/CurveFitting/test/SimplexTest.h
+++ b/Framework/CurveFitting/test/FuncMinimizers/SimplexTest.h
@@ -3,13 +3,14 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/SimplexMinimizer.h"
+#include "MantidCurveFitting/FuncMinimizers/SimplexMinimizer.h"
 #include "MantidAPI/ICostFunction.h"
 
 #include <sstream>
 
 using namespace Mantid;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::FuncMinimisers;
 using namespace Mantid::API;
 
 class SimplexTestCostFunction : public ICostFunction {
diff --git a/Framework/CurveFitting/test/FunctionParameterDecoratorFitTest.h b/Framework/CurveFitting/test/FunctionParameterDecoratorFitTest.h
index c7f60ebf936da427adc02bfe5a1b4a01c6b27288..699b840af67808e1503a8155ce93469c96282a33 100644
--- a/Framework/CurveFitting/test/FunctionParameterDecoratorFitTest.h
+++ b/Framework/CurveFitting/test/FunctionParameterDecoratorFitTest.h
@@ -9,13 +9,14 @@
 #include "MantidAPI/FunctionParameterDecorator.h"
 #include "MantidDataObjects/Workspace2D.h"
 
-#include "MantidCurveFitting/Fit.h"
+#include "MantidCurveFitting/Algorithms/Fit.h"
 
 #include <boost/make_shared.hpp>
 
 using namespace Mantid::API;
 using namespace Mantid::DataObjects;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Algorithms;
 
 class FunctionParameterDecoratorFitTest;
 
diff --git a/Framework/CurveFitting/test/AbragamTest.h b/Framework/CurveFitting/test/Functions/AbragamTest.h
similarity index 91%
rename from Framework/CurveFitting/test/AbragamTest.h
rename to Framework/CurveFitting/test/Functions/AbragamTest.h
index 342eb7360e7b6942a94cd021848e1f6d4e67c333..387926477b7d2f73b443265d2ce80dfafbcd571c 100644
--- a/Framework/CurveFitting/test/AbragamTest.h
+++ b/Framework/CurveFitting/test/Functions/AbragamTest.h
@@ -3,11 +3,11 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/Abragam.h"
+#include "MantidCurveFitting/Functions/Abragam.h"
 #include "MantidAPI/CompositeFunction.h"
-#include "MantidCurveFitting/LinearBackground.h"
-#include "MantidCurveFitting/BoundaryConstraint.h"
-#include "MantidCurveFitting/Fit.h"
+#include "MantidCurveFitting/Functions/LinearBackground.h"
+#include "MantidCurveFitting/Constraints/BoundaryConstraint.h"
+#include "MantidCurveFitting/Algorithms/Fit.h"
 #include "MantidKernel/UnitFactory.h"
 #include "MantidAPI/AnalysisDataService.h"
 #include "MantidAPI/WorkspaceFactory.h"
@@ -19,6 +19,8 @@
 using namespace Mantid::Kernel;
 using namespace Mantid::API;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Algorithms;
+using namespace Mantid::CurveFitting::Functions;
 using namespace Mantid::DataObjects;
 
 class AbragamTest : public CxxTest::TestSuite {
@@ -54,7 +56,7 @@ public:
   }
 
   void testAgainstMockData() {
-    Fit alg2;
+    Algorithms::Fit alg2;
     TS_ASSERT_THROWS_NOTHING(alg2.initialize());
     TS_ASSERT(alg2.isInitialized());
 
diff --git a/Framework/CurveFitting/test/BSplineTest.h b/Framework/CurveFitting/test/Functions/BSplineTest.h
similarity index 96%
rename from Framework/CurveFitting/test/BSplineTest.h
rename to Framework/CurveFitting/test/Functions/BSplineTest.h
index 0b5e362ab4cca0afec2ef9c0a487f5ff97dbcdd2..a504230e745db1cdc97040a74e634ad084a9351a 100644
--- a/Framework/CurveFitting/test/BSplineTest.h
+++ b/Framework/CurveFitting/test/Functions/BSplineTest.h
@@ -1,21 +1,22 @@
 #ifndef BSPLINETEST_H_
 #define BSPLINETEST_H_
 
-#include "MantidCurveFitting/BSpline.h"
-#include "MantidCurveFitting/UserFunction.h"
-#include "MantidCurveFitting/LevenbergMarquardtMDMinimizer.h"
-#include "MantidCurveFitting/CostFuncLeastSquares.h"
+#include "MantidCurveFitting/Functions/BSpline.h"
+#include "MantidCurveFitting/Functions/UserFunction.h"
+#include "MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMDMinimizer.h"
+#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h"
 #include "MantidAPI/FunctionDomain1D.h"
 #include "MantidAPI/FunctionValues.h"
 #include "MantidAPI/FunctionFactory.h"
 
 #include <cxxtest/TestSuite.h>
 #include <boost/lexical_cast.hpp>
-#include <iostream>
 
 using namespace Mantid;
 using namespace Mantid::API;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Functions;
+using namespace Mantid::CurveFitting::CostFunctions;
 
 class BSplineTest : public CxxTest::TestSuite {
 public:
@@ -345,7 +346,7 @@ private:
     boost::shared_ptr<CostFuncLeastSquares> costFun(new CostFuncLeastSquares);
     costFun->setFittingFunction(bsp, domain, values);
 
-    LevenbergMarquardtMDMinimizer s;
+    FuncMinimisers::LevenbergMarquardtMDMinimizer s;
     s.initialize(costFun);
     TS_ASSERT(s.minimize());
     return costFun->val();
diff --git a/Framework/CurveFitting/test/BackToBackExponentialTest.h b/Framework/CurveFitting/test/Functions/BackToBackExponentialTest.h
similarity index 97%
rename from Framework/CurveFitting/test/BackToBackExponentialTest.h
rename to Framework/CurveFitting/test/Functions/BackToBackExponentialTest.h
index bd30cef1e0906c2d5374fcd99603e57df1b73c4e..764131715ec7f1abb6e84a8ea97b90920846d6a7 100644
--- a/Framework/CurveFitting/test/BackToBackExponentialTest.h
+++ b/Framework/CurveFitting/test/Functions/BackToBackExponentialTest.h
@@ -3,13 +3,13 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/BackToBackExponential.h"
+#include "MantidCurveFitting/Functions/BackToBackExponential.h"
 #include "MantidAPI/FunctionDomain1D.h"
 #include "MantidAPI/FunctionValues.h"
 
 #include <cmath>
 
-using Mantid::CurveFitting::BackToBackExponential;
+using Mantid::CurveFitting::Functions::BackToBackExponential;
 
 namespace {
 /**
diff --git a/Framework/CurveFitting/test/BivariateNormalTest.h b/Framework/CurveFitting/test/Functions/BivariateNormalTest.h
similarity index 98%
rename from Framework/CurveFitting/test/BivariateNormalTest.h
rename to Framework/CurveFitting/test/Functions/BivariateNormalTest.h
index d3f8c5bd6c010c21a801f7cd55f12defb17f37d9..c169d9787aa554cdd55bc0a05c1333a376ec90a9 100644
--- a/Framework/CurveFitting/test/BivariateNormalTest.h
+++ b/Framework/CurveFitting/test/Functions/BivariateNormalTest.h
@@ -9,7 +9,7 @@
 #define BIVARIATENORMALTEST_H_
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/BivariateNormal.h"
+#include "MantidCurveFitting/Functions/BivariateNormal.h"
 #include "MantidKernel/Matrix.h"
 #include "MantidAPI/Jacobian.h"
 #include "MantidAPI/WorkspaceFactory.h"
@@ -21,7 +21,6 @@
 #include "MantidCurveFitting/GSLFunctions.h"
 #include "MantidKernel/UnitFactory.h"
 */
-#include <iostream>
 #include <cmath>
 #include <stdio.h>
 #include <stdlib.h>
@@ -32,6 +31,7 @@ using namespace Mantid::API;
 using namespace Mantid::Geometry;
 using namespace Mantid::DataObjects;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Functions;
 /**
  * Used for testing only
  */
diff --git a/Framework/CurveFitting/test/Bk2BkExpConvPVTest.h b/Framework/CurveFitting/test/Functions/Bk2BkExpConvPVTest.h
similarity index 96%
rename from Framework/CurveFitting/test/Bk2BkExpConvPVTest.h
rename to Framework/CurveFitting/test/Functions/Bk2BkExpConvPVTest.h
index 9897818fbc4b5e631475ca687260b7cca4cb135d..95fe716309da8ae2f705171fdcb9efde9d0f810e 100644
--- a/Framework/CurveFitting/test/Bk2BkExpConvPVTest.h
+++ b/Framework/CurveFitting/test/Functions/Bk2BkExpConvPVTest.h
@@ -4,17 +4,17 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 #include <fstream>
 
-#include "MantidCurveFitting/Bk2BkExpConvPV.h"
-#include "MantidCurveFitting/Fit.h"
+#include "MantidCurveFitting/Functions/Bk2BkExpConvPV.h"
+#include "MantidCurveFitting/Algorithms/Fit.h"
 #include "MantidAPI/WorkspaceFactory.h"
 #include "MantidDataObjects/Workspace2D.h"
 
 using namespace Mantid;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Algorithms;
+using namespace Mantid::CurveFitting::Functions;
 using namespace Mantid::API;
 
 class Bk2BkExpConvPVTest : public CxxTest::TestSuite {
@@ -158,7 +158,7 @@ public:
               << std::endl;
 
     // 3. Set fit
-    Fit fitalg;
+    Algorithms::Fit fitalg;
     fitalg.initialize();
     TS_ASSERT(fitalg.isInitialized());
 
diff --git a/Framework/CurveFitting/test/ChebfunBaseTest.h b/Framework/CurveFitting/test/Functions/ChebfunBaseTest.h
similarity index 98%
rename from Framework/CurveFitting/test/ChebfunBaseTest.h
rename to Framework/CurveFitting/test/Functions/ChebfunBaseTest.h
index 0d2a8fb5fefc059bcf34a1f666c8419caaaba3ed..175fa53033dff71443d3260d7d825f4f89c94d51 100644
--- a/Framework/CurveFitting/test/ChebfunBaseTest.h
+++ b/Framework/CurveFitting/test/Functions/ChebfunBaseTest.h
@@ -3,12 +3,13 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/ChebfunBase.h"
+#include "MantidCurveFitting/Functions/ChebfunBase.h"
 #include <cmath>
 
 using namespace Mantid;
 using namespace Mantid::API;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Functions;
 
 double Sin(double x) { return sin(x); }
 double MinusSin(double x) { return -sin(x); }
diff --git a/Framework/CurveFitting/test/ChebyshevTest.h b/Framework/CurveFitting/test/Functions/ChebyshevTest.h
similarity index 94%
rename from Framework/CurveFitting/test/ChebyshevTest.h
rename to Framework/CurveFitting/test/Functions/ChebyshevTest.h
index 7cad35f6467b458528ae24878517dd66a89ad8c8..2602cc30011f506b35969d80ec4fbc5d25a0265a 100644
--- a/Framework/CurveFitting/test/ChebyshevTest.h
+++ b/Framework/CurveFitting/test/Functions/ChebyshevTest.h
@@ -3,8 +3,8 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/Chebyshev.h"
-#include "MantidCurveFitting/Fit.h"
+#include "MantidCurveFitting/Functions/Chebyshev.h"
+#include "MantidCurveFitting/Algorithms/Fit.h"
 #include "MantidDataObjects/Workspace2D.h"
 #include "MantidAPI/FunctionFactory.h"
 #include "MantidAPI/AnalysisDataService.h"
@@ -14,6 +14,8 @@
 using namespace Mantid;
 using namespace Mantid::API;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Algorithms;
+using namespace Mantid::CurveFitting::Functions;
 
 class ChebyshevTest : public CxxTest::TestSuite {
 public:
@@ -59,7 +61,7 @@ public:
     Chebyshev cheb;
     cheb.setAttributeValue("n", 3);
 
-    Fit fit;
+    Algorithms::Fit fit;
     fit.initialize();
 
     fit.setPropertyValue("Function", cheb.asString());
@@ -116,7 +118,7 @@ public:
     cheb.setAttributeValue("StartX", -10.0);
     cheb.setAttributeValue("EndX", 10.0);
 
-    Fit fit;
+    Algorithms::Fit fit;
     fit.initialize();
 
     fit.setPropertyValue("Function", cheb.asString());
diff --git a/Framework/CurveFitting/test/ComptonPeakProfileTest.h b/Framework/CurveFitting/test/Functions/ComptonPeakProfileTest.h
similarity index 95%
rename from Framework/CurveFitting/test/ComptonPeakProfileTest.h
rename to Framework/CurveFitting/test/Functions/ComptonPeakProfileTest.h
index b66b087aa802c527caca4a6d8e1fd330d5e621b6..1d5a8488d99c3a143fd1ed5df9d99c4d97e3a7e6 100644
--- a/Framework/CurveFitting/test/ComptonPeakProfileTest.h
+++ b/Framework/CurveFitting/test/Functions/ComptonPeakProfileTest.h
@@ -3,10 +3,10 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/ComptonPeakProfile.h"
+#include "MantidCurveFitting/Functions/ComptonPeakProfile.h"
 #include "ComptonProfileTestHelpers.h"
 
-using Mantid::CurveFitting::ComptonPeakProfile;
+using Mantid::CurveFitting::Functions::ComptonPeakProfile;
 
 class ComptonPeakProfileTest : public CxxTest::TestSuite {
 
diff --git a/Framework/CurveFitting/test/ComptonProfileTest.h b/Framework/CurveFitting/test/Functions/ComptonProfileTest.h
similarity index 95%
rename from Framework/CurveFitting/test/ComptonProfileTest.h
rename to Framework/CurveFitting/test/Functions/ComptonProfileTest.h
index f1a33b8d848929d5101ef39af333cc2e05d9e482..2d21d6981cac2ea1c2bdd06f2e744938371e4cf7 100644
--- a/Framework/CurveFitting/test/ComptonProfileTest.h
+++ b/Framework/CurveFitting/test/Functions/ComptonProfileTest.h
@@ -3,10 +3,10 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/ComptonProfile.h"
+#include "MantidCurveFitting/Functions/ComptonProfile.h"
 #include <boost/make_shared.hpp>
 
-using Mantid::CurveFitting::ComptonProfile;
+using Mantid::CurveFitting::Functions::ComptonProfile;
 
 class ComptonProfileTest : public CxxTest::TestSuite {
 
diff --git a/Framework/CurveFitting/test/ComptonProfileTestHelpers.h b/Framework/CurveFitting/test/Functions/ComptonProfileTestHelpers.h
similarity index 100%
rename from Framework/CurveFitting/test/ComptonProfileTestHelpers.h
rename to Framework/CurveFitting/test/Functions/ComptonProfileTestHelpers.h
diff --git a/Framework/CurveFitting/test/ComptonScatteringCountRateTest.h b/Framework/CurveFitting/test/Functions/ComptonScatteringCountRateTest.h
similarity index 97%
rename from Framework/CurveFitting/test/ComptonScatteringCountRateTest.h
rename to Framework/CurveFitting/test/Functions/ComptonScatteringCountRateTest.h
index 714776b1bef083fc29139c04106ce15933024a16..a9fe90bd3babc3a60a9d8cf51350bd93db538fe3 100644
--- a/Framework/CurveFitting/test/ComptonScatteringCountRateTest.h
+++ b/Framework/CurveFitting/test/Functions/ComptonScatteringCountRateTest.h
@@ -2,9 +2,12 @@
 #define MANTID_CURVEFITTING_COMPTONSCATTERINGCOUNTRATETEST_H_
 
 #include <cxxtest/TestSuite.h>
-#include "MantidCurveFitting/ComptonScatteringCountRate.h"
+#include "MantidCurveFitting/Functions/ComptonScatteringCountRate.h"
 #include "ComptonProfileTestHelpers.h"
 
+using Mantid::CurveFitting::Functions::ComptonScatteringCountRate;
+using Mantid::CurveFitting::Functions::ComptonProfile;
+
 class ComptonScatteringCountRateTest : public CxxTest::TestSuite {
 public:
   // This pair of boilerplate methods prevent the suite being created statically
@@ -209,7 +212,7 @@ public:
 private:
   /// A simple working object to use for the testing
   /// Provides a canned answer of 1 for the massProfile
-  class ComptonProfileStub : public Mantid::CurveFitting::ComptonProfile {
+  class ComptonProfileStub : public ComptonProfile {
   public:
     ComptonProfileStub() : ComptonProfile() {
       declareParameter("Width", 1.0);
@@ -289,7 +292,7 @@ private:
     return func;
   }
 
-  boost::shared_ptr<Mantid::CurveFitting::ComptonScatteringCountRate>
+  boost::shared_ptr<ComptonScatteringCountRate>
   createFunctionNoBackground(const bool useTwoIntensityFuncAsFirst = false) {
     boost::shared_ptr<ComptonProfileStub> func1;
     if (useTwoIntensityFuncAsFirst) {
@@ -310,7 +313,6 @@ private:
     func2->setParameter("Width", 10.0);
     func2->setParameter("Intensity", 3.0);
 
-    using Mantid::CurveFitting::ComptonScatteringCountRate;
     auto profile = boost::make_shared<ComptonScatteringCountRate>();
     profile->initialize();
     profile->addFunction(func1);
@@ -321,7 +323,6 @@ private:
   }
 
   Mantid::API::IFunction_sptr createFunction() {
-    using Mantid::CurveFitting::ComptonScatteringCountRate;
 
     auto profile = boost::make_shared<ComptonScatteringCountRate>();
     profile->initialize();
diff --git a/Framework/CurveFitting/test/ConvolutionTest.h b/Framework/CurveFitting/test/Functions/ConvolutionTest.h
similarity index 98%
rename from Framework/CurveFitting/test/ConvolutionTest.h
rename to Framework/CurveFitting/test/Functions/ConvolutionTest.h
index 222e87689568f9c6e3885b24b2b446fcb3c727d6..21c97b9b390e28361bbb123333158d45c82abf6d 100644
--- a/Framework/CurveFitting/test/ConvolutionTest.h
+++ b/Framework/CurveFitting/test/Functions/ConvolutionTest.h
@@ -5,8 +5,8 @@
 
 #include "MantidAPI/FrameworkManager.h"
 #include "MantidAPI/AnalysisDataService.h"
-#include "MantidCurveFitting/Convolution.h"
-#include "MantidCurveFitting/Fit.h"
+#include "MantidCurveFitting/Functions/Convolution.h"
+#include "MantidCurveFitting/Algorithms/Fit.h"
 #include "MantidDataObjects/Workspace2D.h"
 #include "MantidDataObjects/TableWorkspace.h"
 #include "MantidAPI/IPeakFunction.h"
@@ -21,6 +21,8 @@ using namespace Mantid;
 using namespace Mantid::API;
 using namespace Mantid::DataObjects;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Algorithms;
+using namespace Mantid::CurveFitting::Functions;
 
 typedef Mantid::DataObjects::Workspace2D_sptr WS_type;
 typedef Mantid::DataObjects::TableWorkspace_sptr TWS_type;
@@ -406,7 +408,7 @@ public:
     conv->setParameter("f1.h", 1);
     conv->setParameter("f1.w", 1);
 
-    Fit fit;
+    Algorithms::Fit fit;
     fit.initialize();
 
     fit.setPropertyValue("Function", conv->asString());
@@ -424,7 +426,7 @@ public:
         0.1, fabs(out->getParameter("f1.w") - conv->getParameter("f1.w")));
 
     conv->setAttributeValue("FixResolution", false);
-    Fit fit1;
+    Algorithms::Fit fit1;
     fit1.initialize();
     fit1.setProperty("Function", boost::dynamic_pointer_cast<IFunction>(conv));
     fit1.setProperty("InputWorkspace", data);
diff --git a/Framework/CurveFitting/test/CubicSplineTest.h b/Framework/CurveFitting/test/Functions/CubicSplineTest.h
similarity index 97%
rename from Framework/CurveFitting/test/CubicSplineTest.h
rename to Framework/CurveFitting/test/Functions/CubicSplineTest.h
index 4412cd13f5e308158cf79a9eeb48732ddae05bc0..f90d200345fe5ffece9b81c38ba57583f84135e9 100644
--- a/Framework/CurveFitting/test/CubicSplineTest.h
+++ b/Framework/CurveFitting/test/Functions/CubicSplineTest.h
@@ -4,10 +4,9 @@
 #include <boost/scoped_array.hpp>
 #include <cmath>
 #include <cxxtest/TestSuite.h>
-#include <iostream>
 
-#include "MantidCurveFitting/CubicSpline.h"
-#include "MantidCurveFitting/Fit.h"
+#include "MantidCurveFitting/Functions/CubicSpline.h"
+#include "MantidCurveFitting/Algorithms/Fit.h"
 #include "MantidDataObjects/Workspace2D.h"
 #include "MantidAPI/FunctionFactory.h"
 #include "MantidAPI/AnalysisDataService.h"
@@ -17,6 +16,8 @@
 using namespace Mantid;
 using namespace Mantid::API;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Algorithms;
+using namespace Mantid::CurveFitting::Functions;
 
 class CubicSplineTest : public CxxTest::TestSuite {
 public:
diff --git a/Framework/CurveFitting/test/DeltaFunctionTest.h b/Framework/CurveFitting/test/Functions/DeltaFunctionTest.h
similarity index 93%
rename from Framework/CurveFitting/test/DeltaFunctionTest.h
rename to Framework/CurveFitting/test/Functions/DeltaFunctionTest.h
index d6ff22def118eb83ee4bd09828903e1cc5e7ebf6..b7fabe94be69f939f9593a29ee64bf745353847f 100644
--- a/Framework/CurveFitting/test/DeltaFunctionTest.h
+++ b/Framework/CurveFitting/test/Functions/DeltaFunctionTest.h
@@ -2,10 +2,10 @@
 #define DELTAFUNCTIONTEST_H
 
 #include <cxxtest/TestSuite.h>
-#include "MantidCurveFitting/Fit.h"
+#include "MantidCurveFitting/Algorithms/Fit.h"
 
-#include "MantidCurveFitting/DeltaFunction.h"
-#include "MantidCurveFitting/Convolution.h"
+#include "MantidCurveFitting/Functions/DeltaFunction.h"
+#include "MantidCurveFitting/Functions/Convolution.h"
 
 #include "MantidAPI/FunctionDomain1D.h"
 #include "MantidAPI/FunctionValues.h"
@@ -13,6 +13,8 @@
 using namespace Mantid::Kernel;
 using namespace Mantid::API;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Algorithms;
+using namespace Mantid::CurveFitting::Functions;
 
 // same class as ConvolutionTest_Gauss in ConvolutionTest.h
 class DeltaFunctionTest_Gauss : public IPeakFunction {
diff --git a/Framework/CurveFitting/test/DiffRotDiscreteCircleTest.h b/Framework/CurveFitting/test/Functions/DiffRotDiscreteCircleTest.h
similarity index 94%
rename from Framework/CurveFitting/test/DiffRotDiscreteCircleTest.h
rename to Framework/CurveFitting/test/Functions/DiffRotDiscreteCircleTest.h
index b6ffb6e4c0ff751c700ef445c3a6cb72a15f52d6..4b8df7d7a42592fafb9a381ecd27f535e01e3fdb 100644
--- a/Framework/CurveFitting/test/DiffRotDiscreteCircleTest.h
+++ b/Framework/CurveFitting/test/Functions/DiffRotDiscreteCircleTest.h
@@ -3,10 +3,10 @@
 
 #include "MantidAPI/FunctionFactory.h"
 #include "MantidAPI/AlgorithmFactory.h"
-#include "MantidCurveFitting/Convolution.h"
-#include "MantidCurveFitting/DiffRotDiscreteCircle.h"
-#include "MantidCurveFitting/Gaussian.h"
-#include "MantidCurveFitting/Fit.h"
+#include "MantidCurveFitting/Functions/Convolution.h"
+#include "MantidCurveFitting/Functions/DiffRotDiscreteCircle.h"
+#include "MantidCurveFitting/Functions/Gaussian.h"
+#include "MantidCurveFitting/Algorithms/Fit.h"
 #include "MantidGeometry/Instrument/ReferenceFrame.h"
 #include "MantidTestHelpers/ComponentCreationHelper.h"
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
@@ -18,6 +18,10 @@
 #include <boost/random/uniform_real.hpp>
 #include <boost/shared_ptr.hpp>
 
+using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Algorithms;
+using namespace Mantid::CurveFitting::Functions;
+
 class DiffRotDiscreteCircleTest : public CxxTest::TestSuite {
 
 public:
@@ -34,8 +38,7 @@ public:
     const double w0 = random_value(-1.0, 1.0);
     const double h = random_value(1.0, 1000.0);
     const double fwhm = random_value(1.0, 100.0);
-    boost::shared_ptr<Mantid::CurveFitting::Gaussian> resolution(
-        new Mantid::CurveFitting::Gaussian());
+    boost::shared_ptr<Gaussian> resolution(new Gaussian());
     resolution->initialize(); // declare parameters
     resolution->setCentre(w0);
     resolution->setHeight(h);
@@ -47,16 +50,15 @@ public:
     const double r = random_value(0.3, 9.8);
     const double Q = 0.9;
     const int N = 6;
-    boost::shared_ptr<Mantid::CurveFitting::ElasticDiffRotDiscreteCircle>
-        structure_factor(
-            new Mantid::CurveFitting::ElasticDiffRotDiscreteCircle());
+    boost::shared_ptr<ElasticDiffRotDiscreteCircle> structure_factor(
+        new ElasticDiffRotDiscreteCircle());
     structure_factor->setParameter("Height", I);
     structure_factor->setParameter("Radius", r);
     structure_factor->setAttributeValue("Q", Q);
     structure_factor->setAttributeValue("N", N);
 
     // initialize the convolution function
-    Mantid::CurveFitting::Convolution conv;
+    Convolution conv;
     conv.addFunction(resolution);
     conv.addFunction(structure_factor);
 
@@ -124,7 +126,7 @@ public:
                                  "9,Intensity=2.9,Radius=2.3,Decay=0.468";
 
     // Do a fit with no iterations
-    Mantid::CurveFitting::Fit fitalg;
+    Algorithms::Fit fitalg;
     TS_ASSERT_THROWS_NOTHING(fitalg.initialize());
     TS_ASSERT(fitalg.isInitialized());
     fitalg.setProperty("Function", funtion_string);
@@ -172,7 +174,7 @@ public:
     const double tao = 0.45;
     const double Q = 0.7;
     const int N = 4;
-    Mantid::CurveFitting::DiffRotDiscreteCircle func;
+    DiffRotDiscreteCircle func;
     func.init();
     func.setParameter("f1.Intensity", I);
     func.setParameter("f1.Radius", R);
@@ -181,8 +183,7 @@ public:
     func.setAttributeValue("N", N);
 
     // check values where correctly initialized
-    auto ids = boost::dynamic_pointer_cast<
-        Mantid::CurveFitting::InelasticDiffRotDiscreteCircle>(
+    auto ids = boost::dynamic_pointer_cast<InelasticDiffRotDiscreteCircle>(
         func.getFunction(1));
     TS_ASSERT_EQUALS(ids->getParameter("Intensity"), I);
     TS_ASSERT_EQUALS(ids->getParameter("Radius"), R);
@@ -192,8 +193,7 @@ public:
 
     // check the ties were applied correctly
     func.applyTies(); // elastic parameters are tied to inelastic parameters
-    auto eds = boost::dynamic_pointer_cast<
-        Mantid::CurveFitting::ElasticDiffRotDiscreteCircle>(
+    auto eds = boost::dynamic_pointer_cast<ElasticDiffRotDiscreteCircle>(
         func.getFunction(0));
     TS_ASSERT_EQUALS(eds->getParameter("Height"), I);
     TS_ASSERT_EQUALS(eds->getParameter("Radius"), R);
@@ -207,15 +207,14 @@ public:
     const double tao = 0.45;
 
     // This should set parameters of the inelastic part
-    Mantid::CurveFitting::DiffRotDiscreteCircle func;
+    DiffRotDiscreteCircle func;
     func.init();
     func.setParameter("Intensity", I);
     func.setParameter("Radius", R);
     func.setParameter("Decay", tao);
 
     // check the parameter of the inelastic part
-    auto ifunc = boost::dynamic_pointer_cast<
-        Mantid::CurveFitting::InelasticDiffRotDiscreteCircle>(
+    auto ifunc = boost::dynamic_pointer_cast<InelasticDiffRotDiscreteCircle>(
         func.getFunction(1));
     TS_ASSERT_EQUALS(ifunc->getParameter("Intensity"), I);
     TS_ASSERT_EQUALS(ifunc->getParameter("Radius"), R);
@@ -223,8 +222,7 @@ public:
 
     // check the parameters of the elastic part
     func.applyTies(); // elastic parameters are tied to inelastic parameters
-    auto efunc = boost::dynamic_pointer_cast<
-        Mantid::CurveFitting::ElasticDiffRotDiscreteCircle>(
+    auto efunc = boost::dynamic_pointer_cast<ElasticDiffRotDiscreteCircle>(
         func.getFunction(0));
     TS_ASSERT_EQUALS(efunc->getParameter("Height"), I);
     TS_ASSERT_EQUALS(efunc->getParameter("Radius"), R);
@@ -244,7 +242,7 @@ public:
         "Radius=1.567,Decay=7.567))";
 
     // Initialize the fit function in the Fit algorithm
-    Mantid::CurveFitting::Fit fitalg;
+    Algorithms::Fit fitalg;
     TS_ASSERT_THROWS_NOTHING(fitalg.initialize());
     TS_ASSERT(fitalg.isInitialized());
     fitalg.setProperty("Function", funtion_string);
@@ -277,8 +275,7 @@ public:
     Mantid::API::IFunction_sptr fitalg_function =
         fitalg.getProperty("Function");
     auto fitalg_conv =
-        boost::dynamic_pointer_cast<Mantid::CurveFitting::Convolution>(
-            fitalg_function);
+        boost::dynamic_pointer_cast<Convolution>(fitalg_function);
     Mantid::API::IFunction_sptr fitalg_resolution = fitalg_conv->getFunction(0);
     TS_ASSERT_DELTA(fitalg_resolution->getParameter("PeakCentre"), 0.0,
                     0.00001); // allow for a small percent variation
@@ -342,7 +339,7 @@ private:
         << ",Shift=" << S << ")";
 
     // Initialize the fit function in the Fit algorithm
-    Mantid::CurveFitting::Fit fitalg;
+    Algorithms::Fit fitalg;
     TS_ASSERT_THROWS_NOTHING(fitalg.initialize());
     TS_ASSERT(fitalg.isInitialized());
     fitalg.setProperty("Function", function_stream.str());
@@ -384,8 +381,7 @@ private:
     Mantid::API::IFunction_sptr fitalg_function =
         fitalg.getProperty("Function");
     auto fitalg_conv =
-        boost::dynamic_pointer_cast<Mantid::CurveFitting::Convolution>(
-            fitalg_function);
+        boost::dynamic_pointer_cast<Convolution>(fitalg_function);
     Mantid::API::IFunction_sptr fitalg_resolution = fitalg_conv->getFunction(0);
     TS_ASSERT_DELTA(fitalg_resolution->getParameter("PeakCentre"), 0.0,
                     0.00001); // allow for a small percent variation
@@ -525,7 +521,7 @@ private:
 
   // create a data workspace using a Fit algorithm
   Mantid::DataObjects::Workspace2D_sptr
-  generateWorkspaceFromFitAlgorithm(Mantid::CurveFitting::Fit &fitalg) {
+  generateWorkspaceFromFitAlgorithm(Algorithms::Fit &fitalg) {
     using namespace Mantid::Kernel;
     using namespace Mantid::Geometry;
 
diff --git a/Framework/CurveFitting/test/DiffSphereTest.h b/Framework/CurveFitting/test/Functions/DiffSphereTest.h
similarity index 94%
rename from Framework/CurveFitting/test/DiffSphereTest.h
rename to Framework/CurveFitting/test/Functions/DiffSphereTest.h
index 45ef43ca1072ea36e61282e52501506d296c26c3..06807332917f92d65dcc128bff337207ef34e7fa 100644
--- a/Framework/CurveFitting/test/DiffSphereTest.h
+++ b/Framework/CurveFitting/test/Functions/DiffSphereTest.h
@@ -1,7 +1,6 @@
 #ifndef DIFFSPHERETEST_H_
 #define DIFFSPHERETEST_H_
 
-#include <iostream>
 #include <fstream>
 #include <limits>
 #include <numeric>
@@ -11,17 +10,21 @@
 // Include local copy of Valgrind header to avoid creating a dependency
 #include "valgrind.h"
 
-#include "MantidCurveFitting/DiffSphere.h"
-#include "MantidCurveFitting/Gaussian.h"
-#include "MantidCurveFitting/Convolution.h"
+#include "MantidCurveFitting/Functions/DiffSphere.h"
+#include "MantidCurveFitting/Functions/Gaussian.h"
+#include "MantidCurveFitting/Functions/Convolution.h"
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
-#include "MantidCurveFitting/Fit.h"
+#include "MantidCurveFitting/Algorithms/Fit.h"
 #include "MantidAPI/FunctionFactory.h"
 #include "MantidAPI/AlgorithmFactory.h"
 
 #include "MantidGeometry/Instrument/ReferenceFrame.h"
 #include "MantidTestHelpers/ComponentCreationHelper.h"
 
+using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Algorithms;
+using namespace Mantid::CurveFitting::Functions;
+
 class DiffSphereTest : public CxxTest::TestSuite {
 public:
   bool skipTests() {
@@ -43,7 +46,7 @@ public:
         "Sigma=0.002);name=ElasticDiffSphere,Q=0.5,Height=47.014,Radius=3.567)";
 
     // Initialize the fit function in the Fit algorithm
-    Mantid::CurveFitting::Fit fitalg;
+    Algorithms::Fit fitalg;
     TS_ASSERT_THROWS_NOTHING(fitalg.initialize());
     TS_ASSERT(fitalg.isInitialized());
     fitalg.setProperty("Function", funtion_string);
@@ -83,8 +86,7 @@ public:
     Mantid::API::IFunction_sptr fitalg_function =
         fitalg.getProperty("Function");
     auto fitalg_conv =
-        boost::dynamic_pointer_cast<Mantid::CurveFitting::Convolution>(
-            fitalg_function);
+        boost::dynamic_pointer_cast<Convolution>(fitalg_function);
     Mantid::API::IFunction_sptr fitalg_resolution = fitalg_conv->getFunction(0);
     TS_ASSERT_DELTA(fitalg_resolution->getParameter("PeakCentre"), 0.0,
                     0.00001); // allow for a small percent variation
@@ -133,16 +135,15 @@ public:
                              // of the 99 coefficients to break down
 
     // initialize the elastic part
-    boost::shared_ptr<Mantid::CurveFitting::ElasticDiffSphere> elastic_part(
-        new Mantid::CurveFitting::ElasticDiffSphere());
+    boost::shared_ptr<ElasticDiffSphere> elastic_part(new ElasticDiffSphere());
     elastic_part->setParameter("Height", I);
     elastic_part->setParameter("Radius", R);
     elastic_part->setAttributeValue("Q", Q);
     elastic_part->init();
 
     // initialize the inelastic part
-    boost::shared_ptr<Mantid::CurveFitting::InelasticDiffSphere> inelastic_part(
-        new Mantid::CurveFitting::InelasticDiffSphere());
+    boost::shared_ptr<InelasticDiffSphere> inelastic_part(
+        new InelasticDiffSphere());
     inelastic_part->setParameter("Intensity", I);
     inelastic_part->setParameter("Radius", R);
     inelastic_part->setParameter("Diffusion", D);
@@ -186,7 +187,7 @@ public:
     const double Q(0.5);
 
     // Initialize the fit function in the Fit algorithm
-    Mantid::CurveFitting::Fit fitalg;
+    Algorithms::Fit fitalg;
     TS_ASSERT_THROWS_NOTHING(fitalg.initialize());
     TS_ASSERT(fitalg.isInitialized());
     std::ostringstream funtion_stream;
@@ -206,18 +207,15 @@ public:
     Mantid::API::IFunction_sptr fitalg_function =
         fitalg.getProperty("Function"); // main function
     fitalg_function->initialize();
-    auto fitalg_conv =
-        boost::dynamic_pointer_cast<Mantid::CurveFitting::Convolution>(
-            fitalg_function);                      // cast to Convolution
+    auto fitalg_conv = boost::dynamic_pointer_cast<Convolution>(
+        fitalg_function);                          // cast to Convolution
     fitalg_function = fitalg_conv->getFunction(1); // DiffSphere
     auto fitalg_structure_factor =
-        boost::dynamic_pointer_cast<Mantid::CurveFitting::DiffSphere>(
-            fitalg_function);
+        boost::dynamic_pointer_cast<DiffSphere>(fitalg_function);
 
     fitalg_function = fitalg_structure_factor->getFunction(0);
     auto fitalg_elastic =
-        boost::dynamic_pointer_cast<Mantid::CurveFitting::ElasticDiffSphere>(
-            fitalg_function);
+        boost::dynamic_pointer_cast<ElasticDiffSphere>(fitalg_function);
     TS_ASSERT_DELTA(fitalg_elastic->getParameter("Height"), I_0,
                     std::numeric_limits<double>::epsilon());
     TS_ASSERT_DELTA(fitalg_elastic->getParameter("Radius"), R_0,
@@ -230,8 +228,7 @@ public:
 
     fitalg_function = fitalg_structure_factor->getFunction(1);
     auto fitalg_inelastic =
-        boost::dynamic_pointer_cast<Mantid::CurveFitting::InelasticDiffSphere>(
-            fitalg_function);
+        boost::dynamic_pointer_cast<InelasticDiffSphere>(fitalg_function);
     TS_ASSERT_DELTA(fitalg_inelastic->getParameter("Intensity"), I_0,
                     std::numeric_limits<double>::epsilon());
     TS_ASSERT_DELTA(fitalg_inelastic->getParameter("Radius"), R_0,
@@ -332,7 +329,7 @@ private:
       simQ = 0.20092;
 
     // Initialize the fit function in the Fit algorithm
-    Mantid::CurveFitting::Fit fitalg;
+    Algorithms::Fit fitalg;
     TS_ASSERT_THROWS_NOTHING(fitalg.initialize());
     TS_ASSERT(fitalg.isInitialized());
     std::ostringstream funtion_stream;
@@ -399,8 +396,7 @@ private:
     Mantid::API::IFunction_sptr fitalg_function =
         fitalg.getProperty("Function");
     auto fitalg_conv =
-        boost::dynamic_pointer_cast<Mantid::CurveFitting::Convolution>(
-            fitalg_function);
+        boost::dynamic_pointer_cast<Convolution>(fitalg_function);
     Mantid::API::IFunction_sptr fitalg_resolution = fitalg_conv->getFunction(0);
 
     TS_ASSERT_DELTA(fitalg_resolution->getParameter("PeakCentre"), S,
@@ -458,7 +454,7 @@ private:
 
   // create a data workspace using a Fit algorithm
   Mantid::DataObjects::Workspace2D_sptr
-  generateWorkspaceFromFitAlgorithm(Mantid::CurveFitting::Fit &fitalg) {
+  generateWorkspaceFromFitAlgorithm(Algorithms::Fit &fitalg) {
     using namespace Mantid::Kernel;
     using namespace Mantid::Geometry;
 
diff --git a/Framework/CurveFitting/test/DynamicKuboToyabeTest.h b/Framework/CurveFitting/test/Functions/DynamicKuboToyabeTest.h
similarity index 95%
rename from Framework/CurveFitting/test/DynamicKuboToyabeTest.h
rename to Framework/CurveFitting/test/Functions/DynamicKuboToyabeTest.h
index cb987b5fc70802662484bb4c949f927c2b696a77..dd533ab427dc806cd9709c3986360e37ded82496 100644
--- a/Framework/CurveFitting/test/DynamicKuboToyabeTest.h
+++ b/Framework/CurveFitting/test/Functions/DynamicKuboToyabeTest.h
@@ -3,14 +3,15 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/DynamicKuboToyabe.h"
-#include "MantidCurveFitting/StaticKuboToyabe.h"
+#include "MantidCurveFitting/Functions/DynamicKuboToyabe.h"
+#include "MantidCurveFitting/Functions/StaticKuboToyabe.h"
 #include "MantidAPI/FunctionDomain1D.h"
 #include "MantidAPI/FunctionValues.h"
 
 using namespace Mantid::Kernel;
 using namespace Mantid::API;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Functions;
 
 class DynamicKuboToyabeTest : public CxxTest::TestSuite {
 public:
diff --git a/Framework/CurveFitting/test/EndErfcTest.h b/Framework/CurveFitting/test/Functions/EndErfcTest.h
similarity index 92%
rename from Framework/CurveFitting/test/EndErfcTest.h
rename to Framework/CurveFitting/test/Functions/EndErfcTest.h
index 8e2ba2f3485752e855f833486be3d5dc079979b5..dc03dd49687bc3504fa6fede22461e39bd487145 100644
--- a/Framework/CurveFitting/test/EndErfcTest.h
+++ b/Framework/CurveFitting/test/Functions/EndErfcTest.h
@@ -3,11 +3,8 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/EndErfc.h"
-#include "MantidAPI/CompositeFunction.h"
-#include "MantidCurveFitting/LinearBackground.h"
-#include "MantidCurveFitting/BoundaryConstraint.h"
-#include "MantidCurveFitting/Fit.h"
+#include "MantidCurveFitting/Functions/EndErfc.h"
+#include "MantidCurveFitting/Algorithms/Fit.h"
 #include "MantidAPI/AnalysisDataService.h"
 #include "MantidAPI/WorkspaceFactory.h"
 #include "MantidDataObjects/Workspace2D.h"
@@ -16,6 +13,8 @@
 using namespace Mantid::Kernel;
 using namespace Mantid::API;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Functions;
+using namespace Mantid::CurveFitting::Algorithms;
 using namespace Mantid::DataObjects;
 
 class EndErfcTest : public CxxTest::TestSuite {
@@ -41,7 +40,7 @@ public:
   }
 
   void testAgainstMockData() {
-    Fit alg2;
+    Algorithms::Fit alg2;
     TS_ASSERT_THROWS_NOTHING(alg2.initialize());
     TS_ASSERT(alg2.isInitialized());
 
diff --git a/Framework/CurveFitting/test/ExpDecayMuonTest.h b/Framework/CurveFitting/test/Functions/ExpDecayMuonTest.h
similarity index 89%
rename from Framework/CurveFitting/test/ExpDecayMuonTest.h
rename to Framework/CurveFitting/test/Functions/ExpDecayMuonTest.h
index bf17e5d9a7728820700c5cccac72a17cf1b66225..02a079776da1b8fc1632ca1ddc4e09cd632bcaff 100644
--- a/Framework/CurveFitting/test/ExpDecayMuonTest.h
+++ b/Framework/CurveFitting/test/Functions/ExpDecayMuonTest.h
@@ -3,11 +3,11 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/ExpDecayMuon.h"
+#include "MantidCurveFitting/Functions/ExpDecayMuon.h"
 #include "MantidAPI/CompositeFunction.h"
-#include "MantidCurveFitting/LinearBackground.h"
-#include "MantidCurveFitting/BoundaryConstraint.h"
-#include "MantidCurveFitting/Fit.h"
+#include "MantidCurveFitting/Functions/LinearBackground.h"
+#include "MantidCurveFitting/Constraints/BoundaryConstraint.h"
+#include "MantidCurveFitting/Algorithms/Fit.h"
 #include "MantidAPI/AnalysisDataService.h"
 #include "MantidAPI/WorkspaceFactory.h"
 #include "MantidDataObjects/Workspace2D.h"
@@ -16,6 +16,8 @@
 using namespace Mantid::Kernel;
 using namespace Mantid::API;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Algorithms;
+using namespace Mantid::CurveFitting::Functions;
 using namespace Mantid::DataObjects;
 
 class ExpDecayMuonTest : public CxxTest::TestSuite {
@@ -48,7 +50,7 @@ public:
   }
 
   void testAgainstMockData() {
-    Fit alg2;
+    Algorithms::Fit alg2;
     TS_ASSERT_THROWS_NOTHING(alg2.initialize());
     TS_ASSERT(alg2.isInitialized());
 
diff --git a/Framework/CurveFitting/test/ExpDecayOscTest.h b/Framework/CurveFitting/test/Functions/ExpDecayOscTest.h
similarity index 90%
rename from Framework/CurveFitting/test/ExpDecayOscTest.h
rename to Framework/CurveFitting/test/Functions/ExpDecayOscTest.h
index 865c28d2c1c9811aae3c25d04b01e35ed13e8975..9c91b5e7dccd6734f9deb754062e9da48fcc81a9 100644
--- a/Framework/CurveFitting/test/ExpDecayOscTest.h
+++ b/Framework/CurveFitting/test/Functions/ExpDecayOscTest.h
@@ -4,9 +4,9 @@
 #include <cxxtest/TestSuite.h>
 #include <cmath>
 
-#include "MantidCurveFitting/ExpDecayOsc.h"
-#include "MantidCurveFitting/Fit.h"
-#include "MantidCurveFitting/BoundaryConstraint.h"
+#include "MantidCurveFitting/Functions/ExpDecayOsc.h"
+#include "MantidCurveFitting/Algorithms/Fit.h"
+#include "MantidCurveFitting/Constraints/BoundaryConstraint.h"
 #include "MantidAPI/AnalysisDataService.h"
 #include "MantidAPI/WorkspaceFactory.h"
 #include "MantidDataObjects/Workspace2D.h"
@@ -14,6 +14,9 @@
 using namespace Mantid::Kernel;
 using namespace Mantid::API;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Algorithms;
+using namespace Mantid::CurveFitting::Functions;
+using namespace Mantid::CurveFitting::Constraints;
 using namespace Mantid::DataObjects;
 
 class ExpDecayOscTest : public CxxTest::TestSuite {
@@ -48,7 +51,7 @@ public:
   }
 
   void testAgainstMockData() {
-    Fit alg2;
+    Algorithms::Fit alg2;
     TS_ASSERT_THROWS_NOTHING(alg2.initialize());
     TS_ASSERT(alg2.isInitialized());
 
diff --git a/Framework/CurveFitting/test/ExpDecayTest.h b/Framework/CurveFitting/test/Functions/ExpDecayTest.h
similarity index 90%
rename from Framework/CurveFitting/test/ExpDecayTest.h
rename to Framework/CurveFitting/test/Functions/ExpDecayTest.h
index fbfa2c5a556b69117e0bf3163c16e4b3285a5738..149edd05e1a5ba33f31244e8764be4b53a4c5692 100644
--- a/Framework/CurveFitting/test/ExpDecayTest.h
+++ b/Framework/CurveFitting/test/Functions/ExpDecayTest.h
@@ -3,11 +3,11 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/ExpDecay.h"
+#include "MantidCurveFitting/Functions/ExpDecay.h"
 #include "MantidAPI/CompositeFunction.h"
-#include "MantidCurveFitting/LinearBackground.h"
-#include "MantidCurveFitting/BoundaryConstraint.h"
-#include "MantidCurveFitting/Fit.h"
+#include "MantidCurveFitting/Functions/LinearBackground.h"
+#include "MantidCurveFitting/Constraints/BoundaryConstraint.h"
+#include "MantidCurveFitting/Algorithms/Fit.h"
 #include "MantidKernel/UnitFactory.h"
 #include "MantidAPI/AnalysisDataService.h"
 #include "MantidAPI/WorkspaceFactory.h"
@@ -19,6 +19,8 @@
 using namespace Mantid::Kernel;
 using namespace Mantid::API;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Algorithms;
+using namespace Mantid::CurveFitting::Functions;
 using namespace Mantid::DataObjects;
 
 class ExpDecayTest : public CxxTest::TestSuite {
@@ -51,7 +53,7 @@ public:
   }
 
   void testAgainstMockData() {
-    Fit alg2;
+    Algorithms::Fit alg2;
     TS_ASSERT_THROWS_NOTHING(alg2.initialize());
     TS_ASSERT(alg2.isInitialized());
 
diff --git a/Framework/CurveFitting/test/FlatBackgroundTest.h b/Framework/CurveFitting/test/Functions/FlatBackgroundTest.h
similarity index 92%
rename from Framework/CurveFitting/test/FlatBackgroundTest.h
rename to Framework/CurveFitting/test/Functions/FlatBackgroundTest.h
index a93d1a379247bb7222bb0af32ee6889c581f9ad7..821dfed7a8478416ac589cca32e44d24e2e87dba 100644
--- a/Framework/CurveFitting/test/FlatBackgroundTest.h
+++ b/Framework/CurveFitting/test/Functions/FlatBackgroundTest.h
@@ -4,13 +4,12 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
-#include "MantidCurveFitting/FlatBackground.h"
+#include "MantidCurveFitting/Functions/FlatBackground.h"
 
 using namespace Mantid;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Functions;
 using namespace Mantid::API;
 
 class FlatBackgroundTest : public CxxTest::TestSuite {
diff --git a/Framework/CurveFitting/test/FullprofPolynomialTest.h b/Framework/CurveFitting/test/Functions/FullprofPolynomialTest.h
similarity index 92%
rename from Framework/CurveFitting/test/FullprofPolynomialTest.h
rename to Framework/CurveFitting/test/Functions/FullprofPolynomialTest.h
index 2ecf9c6d841e358fb2ebab5aaf284bcc245302e2..42b9226a157d35194382d641ca202f57561deb76 100644
--- a/Framework/CurveFitting/test/FullprofPolynomialTest.h
+++ b/Framework/CurveFitting/test/Functions/FullprofPolynomialTest.h
@@ -3,17 +3,19 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/FullprofPolynomial.h"
+#include "MantidCurveFitting/Functions/FullprofPolynomial.h"
 #include "MantidAPI/IFunction.h"
 #include "MantidAPI/WorkspaceFactory.h"
-#include "MantidCurveFitting/Fit.h"
+#include "MantidCurveFitting/Algorithms/Fit.h"
 #include "MantidDataObjects/Workspace2D.h"
 
-using Mantid::CurveFitting::FullprofPolynomial;
+using Mantid::CurveFitting::Functions::FullprofPolynomial;
 
 using namespace Mantid;
 using namespace Mantid::API;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Algorithms;
+using namespace Mantid::CurveFitting::Functions;
 using namespace Mantid::DataObjects;
 using namespace Mantid::Kernel;
 
@@ -87,7 +89,7 @@ public:
     tofbkgd->setParameter("A3", 0.0);
 
     // Set up fit
-    CurveFitting::Fit fitalg;
+    CurveFitting::Algorithms::Fit fitalg;
     TS_ASSERT_THROWS_NOTHING(fitalg.initialize());
     TS_ASSERT(fitalg.isInitialized());
 
diff --git a/Framework/CurveFitting/test/GausDecayTest.h b/Framework/CurveFitting/test/Functions/GausDecayTest.h
similarity index 90%
rename from Framework/CurveFitting/test/GausDecayTest.h
rename to Framework/CurveFitting/test/Functions/GausDecayTest.h
index d3a087a5a047ce48be4856fa3eb57ce798df056f..3771d22c694d4c4438d2c3681fb7435e5dc634ac 100644
--- a/Framework/CurveFitting/test/GausDecayTest.h
+++ b/Framework/CurveFitting/test/Functions/GausDecayTest.h
@@ -3,11 +3,11 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/GausDecay.h"
+#include "MantidCurveFitting/Functions/GausDecay.h"
 #include "MantidAPI/CompositeFunction.h"
-#include "MantidCurveFitting/LinearBackground.h"
-#include "MantidCurveFitting/BoundaryConstraint.h"
-#include "MantidCurveFitting/Fit.h"
+#include "MantidCurveFitting/Functions/LinearBackground.h"
+#include "MantidCurveFitting/Constraints/BoundaryConstraint.h"
+#include "MantidCurveFitting/Algorithms/Fit.h"
 #include "MantidKernel/UnitFactory.h"
 #include "MantidAPI/AnalysisDataService.h"
 #include "MantidAPI/WorkspaceFactory.h"
@@ -21,6 +21,8 @@
 using namespace Mantid::Kernel;
 using namespace Mantid::API;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Functions;
+using namespace Mantid::CurveFitting::Algorithms;
 using namespace Mantid::DataObjects;
 using namespace Mantid::DataHandling;
 
@@ -52,7 +54,7 @@ public:
   }
 
   void testAgainstMockData() {
-    Fit alg2;
+    Algorithms::Fit alg2;
     TS_ASSERT_THROWS_NOTHING(alg2.initialize());
     TS_ASSERT(alg2.isInitialized());
 
diff --git a/Framework/CurveFitting/test/GausOscTest.h b/Framework/CurveFitting/test/Functions/GausOscTest.h
similarity index 91%
rename from Framework/CurveFitting/test/GausOscTest.h
rename to Framework/CurveFitting/test/Functions/GausOscTest.h
index 434cf9ba475c4eb988b4c6239aeedc90c829b9b3..0e31dc9c702bb0f9a5499f3a7ffcceaf22dd8d86 100644
--- a/Framework/CurveFitting/test/GausOscTest.h
+++ b/Framework/CurveFitting/test/Functions/GausOscTest.h
@@ -4,11 +4,11 @@
 #include <cxxtest/TestSuite.h>
 #include <cmath>
 
-#include "MantidCurveFitting/GausOsc.h"
+#include "MantidCurveFitting/Functions/GausOsc.h"
 #include "MantidAPI/CompositeFunction.h"
-#include "MantidCurveFitting/LinearBackground.h"
-#include "MantidCurveFitting/BoundaryConstraint.h"
-#include "MantidCurveFitting/Fit.h"
+#include "MantidCurveFitting/Functions/LinearBackground.h"
+#include "MantidCurveFitting/Constraints/BoundaryConstraint.h"
+#include "MantidCurveFitting/Algorithms/Fit.h"
 #include "MantidKernel/UnitFactory.h"
 #include "MantidAPI/AnalysisDataService.h"
 #include "MantidAPI/WorkspaceFactory.h"
@@ -22,6 +22,8 @@
 using namespace Mantid::Kernel;
 using namespace Mantid::API;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Functions;
+using namespace Mantid::CurveFitting::Algorithms;
 using namespace Mantid::DataObjects;
 using namespace Mantid::DataHandling;
 
@@ -57,7 +59,7 @@ public:
   void testAgainstMockData() // Parts of test disabled because it does not give
                              // result like that obtained in mantidplot.
   {
-    Fit alg2;
+    Algorithms::Fit alg2;
     TS_ASSERT_THROWS_NOTHING(alg2.initialize());
     TS_ASSERT(alg2.isInitialized());
 
diff --git a/Framework/CurveFitting/test/GaussianComptonProfileTest.h b/Framework/CurveFitting/test/Functions/GaussianComptonProfileTest.h
similarity index 94%
rename from Framework/CurveFitting/test/GaussianComptonProfileTest.h
rename to Framework/CurveFitting/test/Functions/GaussianComptonProfileTest.h
index 546dd4a9de2cb7c9d032fbff41062962064a02c6..dfec3f0af151f71660962a523f453ec815eb1a96 100644
--- a/Framework/CurveFitting/test/GaussianComptonProfileTest.h
+++ b/Framework/CurveFitting/test/Functions/GaussianComptonProfileTest.h
@@ -2,12 +2,13 @@
 #define MANTID_CURVEFITTING_GAUSSIANCOMPTONPROFILETEST_H_
 
 #include <cxxtest/TestSuite.h>
-#include "MantidCurveFitting/GaussianComptonProfile.h"
+#include "MantidCurveFitting/Functions/GaussianComptonProfile.h"
 
 #include "MantidAPI/FunctionDomain1D.h"
 #include "ComptonProfileTestHelpers.h"
 
-using Mantid::CurveFitting::GaussianComptonProfile;
+using Mantid::CurveFitting::Functions::GaussianComptonProfile;
+using Mantid::CurveFitting::Functions::ComptonProfile;
 
 class GaussianComptonProfileTest : public CxxTest::TestSuite {
 public:
@@ -40,8 +41,7 @@ public:
   }
 
   void test_Function_Has_One_Intensity_Coefficient() {
-    boost::shared_ptr<Mantid::CurveFitting::ComptonProfile> profile =
-        createFunction();
+    boost::shared_ptr<ComptonProfile> profile = createFunction();
 
     auto intensityIndices = profile->intensityParameterIndices();
     TS_ASSERT_EQUALS(1, intensityIndices.size());
diff --git a/Framework/CurveFitting/test/GaussianTest.h b/Framework/CurveFitting/test/Functions/GaussianTest.h
similarity index 95%
rename from Framework/CurveFitting/test/GaussianTest.h
rename to Framework/CurveFitting/test/Functions/GaussianTest.h
index 91492c50f5ab2aa2bd0da295408e010fec8d0561..079292914546c5b19922438bcc98aab4ab79b476 100644
--- a/Framework/CurveFitting/test/GaussianTest.h
+++ b/Framework/CurveFitting/test/Functions/GaussianTest.h
@@ -3,11 +3,10 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/Gaussian.h"
-#include "MantidCurveFitting/Fit.h"
+#include "MantidCurveFitting/Functions/Gaussian.h"
+#include "MantidCurveFitting/Algorithms/Fit.h"
 #include "MantidAPI/CompositeFunction.h"
-#include "MantidCurveFitting/LinearBackground.h"
-#include "MantidCurveFitting/BoundaryConstraint.h"
+#include "MantidCurveFitting/Constraints/BoundaryConstraint.h"
 #include "MantidKernel/UnitFactory.h"
 #include "MantidAPI/AnalysisDataService.h"
 #include "MantidAPI/InstrumentDataService.h"
@@ -23,14 +22,19 @@
 #include "MantidAPI/FunctionFactory.h"
 #include "MantidAPI/FunctionDomain1D.h"
 #include "MantidAPI/FunctionValues.h"
-#include "MantidCurveFitting/LevenbergMarquardtMDMinimizer.h"
-#include "MantidCurveFitting/UserFunction.h"
-#include "MantidCurveFitting/CostFuncLeastSquares.h"
+#include "MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMDMinimizer.h"
+#include "MantidCurveFitting/Functions/UserFunction.h"
+#include "MantidCurveFitting/Functions/LinearBackground.h"
+#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h"
 
 using namespace Mantid;
 using namespace Mantid::Kernel;
 using namespace Mantid::API;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Functions;
+using namespace Mantid::CurveFitting::CostFunctions;
+using namespace Mantid::CurveFitting::Constraints;
+using namespace Mantid::CurveFitting::Algorithms;
 using namespace Mantid::DataObjects;
 using namespace Mantid::DataHandling;
 
@@ -201,7 +205,7 @@ public:
     costFun->setFittingFunction(fnWithBk, domain, values);
     // TS_ASSERT_EQUALS(costFun->nParams(),3);
 
-    LevenbergMarquardtMDMinimizer s;
+    FuncMinimisers::LevenbergMarquardtMDMinimizer s;
     s.initialize(costFun);
     TS_ASSERT(s.minimize());
 
@@ -236,7 +240,7 @@ public:
     TS_ASSERT_THROWS_NOTHING(AnalysisDataService::Instance().add(wsName, ws2D));
 
     // Initialise algorithm
-    Fit alg;
+    Algorithms::Fit alg;
     TS_ASSERT_THROWS_NOTHING(alg.initialize());
     TS_ASSERT(alg.isInitialized());
 
@@ -305,7 +309,7 @@ public:
     Mantid::MantidVec &e = ws2D->dataE(0); // error values of counts
     getMockData(y, e);
 
-    Fit alg2;
+    Algorithms::Fit alg2;
     TS_ASSERT_THROWS_NOTHING(alg2.initialize());
     TS_ASSERT(alg2.isInitialized());
 
@@ -358,7 +362,7 @@ public:
     // put this workspace in the data service
     TS_ASSERT_THROWS_NOTHING(AnalysisDataService::Instance().add(wsName, ws2D));
 
-    Fit alg2;
+    Algorithms::Fit alg2;
     TS_ASSERT_THROWS_NOTHING(alg2.initialize());
     TS_ASSERT(alg2.isInitialized());
 
@@ -424,7 +428,7 @@ public:
         ConfigService::Instance().getString("curvefitting.peakRadius");
     ConfigService::Instance().setString("curvefitting.peakRadius", "5");
 
-    Fit alg;
+    Algorithms::Fit alg;
     TS_ASSERT_THROWS_NOTHING(alg.initialize());
     TS_ASSERT(alg.isInitialized());
 
diff --git a/Framework/CurveFitting/test/GramCharlierComptonProfileTest.h b/Framework/CurveFitting/test/Functions/GramCharlierComptonProfileTest.h
similarity index 94%
rename from Framework/CurveFitting/test/GramCharlierComptonProfileTest.h
rename to Framework/CurveFitting/test/Functions/GramCharlierComptonProfileTest.h
index 8220bfd74ed2e60ec30d4ada2ee6b3282141622a..905278a19172c6d03ee6b237f972058c2da5d16a 100644
--- a/Framework/CurveFitting/test/GramCharlierComptonProfileTest.h
+++ b/Framework/CurveFitting/test/Functions/GramCharlierComptonProfileTest.h
@@ -2,11 +2,12 @@
 #define MANTID_CURVEFITTING_GRAMCHARLIERCOMPTONPROFILETEST_H_
 
 #include <cxxtest/TestSuite.h>
-#include "MantidCurveFitting/GramCharlierComptonProfile.h"
+#include "MantidCurveFitting/Functions/GramCharlierComptonProfile.h"
 
 #include "ComptonProfileTestHelpers.h"
 
-using Mantid::CurveFitting::GramCharlierComptonProfile;
+using Mantid::CurveFitting::Functions::ComptonProfile;
+using Mantid::CurveFitting::Functions::GramCharlierComptonProfile;
 
 class GramCharlierComptonProfileTest : public CxxTest::TestSuite {
 public:
@@ -58,8 +59,7 @@ public:
 
   void
   test_Function_Returns_Same_Number_Intensity_Coefficents_As_Active_Hermite_Coefficients_If_KFSE_Is_Fixed() {
-    boost::shared_ptr<Mantid::CurveFitting::ComptonProfile> profile =
-        createFunction();
+    boost::shared_ptr<ComptonProfile> profile = createFunction();
     profile->setAttributeValue("HermiteCoeffs", "1 0 1"); // turn on C_0 & C_4
     profile->fix(profile->parameterIndex("FSECoeff"));
 
@@ -69,8 +69,7 @@ public:
 
   void
   test_Function_Returns_Same_Number_Intensity_Coefficents_As_Active_Hermite_Coefficients_Plus_One_If_KFSE_Is_Free() {
-    boost::shared_ptr<Mantid::CurveFitting::ComptonProfile> profile =
-        createFunction();
+    boost::shared_ptr<ComptonProfile> profile = createFunction();
     profile->setAttributeValue("HermiteCoeffs", "1 0 1"); // turn on C_0 & C_4
 
     auto intensityIndices = profile->intensityParameterIndices();
diff --git a/Framework/CurveFitting/test/IkedaCarpenterPVTest.h b/Framework/CurveFitting/test/Functions/IkedaCarpenterPVTest.h
similarity index 96%
rename from Framework/CurveFitting/test/IkedaCarpenterPVTest.h
rename to Framework/CurveFitting/test/Functions/IkedaCarpenterPVTest.h
index 53cc7b2f7d9a362e1915efffd4cfeb308c8be2b9..df2182987c94074e520b9ee41fedffc68bff08f7 100644
--- a/Framework/CurveFitting/test/IkedaCarpenterPVTest.h
+++ b/Framework/CurveFitting/test/Functions/IkedaCarpenterPVTest.h
@@ -3,8 +3,8 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/IkedaCarpenterPV.h"
-#include "MantidCurveFitting/Fit.h"
+#include "MantidCurveFitting/Functions/IkedaCarpenterPV.h"
+#include "MantidCurveFitting/Algorithms/Fit.h"
 #include "MantidKernel/ConfigService.h"
 
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
@@ -102,6 +102,7 @@ public:
   void testAgainstMockData() {
     using namespace Mantid::API;
     using namespace Mantid::CurveFitting;
+    using namespace Mantid::CurveFitting::Functions;
 
 /**
  * Changing compiler on OS X has yet again caused this (and only this) test to
@@ -172,6 +173,7 @@ public:
   void test_Against_Data_In_DeltaE() {
     using namespace Mantid::API;
     using namespace Mantid::CurveFitting;
+    using namespace Mantid::CurveFitting::Functions;
 
 #if !(defined __APPLE__)
 
@@ -253,6 +255,7 @@ private:
   Mantid::API::IAlgorithm_sptr runFit(const std::string &wsName) {
     using namespace Mantid::API;
     using namespace Mantid::CurveFitting;
+    using namespace Mantid::CurveFitting::Functions;
 
     // set up fitting function and pass to Fit
     IkedaCarpenterPV icpv;
@@ -265,7 +268,7 @@ private:
     icpv.tie("Kappa", "46.025921");
     icpv.setParameter("X0", 45.0);
 
-    auto alg = boost::shared_ptr<IAlgorithm>(new Fit);
+    auto alg = boost::shared_ptr<IAlgorithm>(new Algorithms::Fit);
     alg->initialize();
     alg->setPropertyValue("Function", icpv.asString());
     // Set general Fit parameters
diff --git a/Framework/CurveFitting/test/LinearBackgroundTest.h b/Framework/CurveFitting/test/Functions/LinearBackgroundTest.h
similarity index 92%
rename from Framework/CurveFitting/test/LinearBackgroundTest.h
rename to Framework/CurveFitting/test/Functions/LinearBackgroundTest.h
index f281f018e0533813b77359d129e0e5b63497cba0..03f2d8341c2adbb05608afa567f854141bc8298d 100644
--- a/Framework/CurveFitting/test/LinearBackgroundTest.h
+++ b/Framework/CurveFitting/test/Functions/LinearBackgroundTest.h
@@ -3,9 +3,9 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/LinearBackground.h"
+#include "MantidCurveFitting/Functions/LinearBackground.h"
 
-#include "MantidCurveFitting/Fit.h"
+#include "MantidCurveFitting/Algorithms/Fit.h"
 #include "MantidKernel/UnitFactory.h"
 #include "MantidAPI/AnalysisDataService.h"
 #include "MantidAPI/WorkspaceFactory.h"
@@ -17,8 +17,8 @@
 
 using namespace Mantid::Kernel;
 using namespace Mantid::API;
-using Mantid::CurveFitting::LinearBackground;
-using Mantid::CurveFitting::Fit;
+using Mantid::CurveFitting::Functions::LinearBackground;
+using Mantid::CurveFitting::Algorithms::Fit;
 using namespace Mantid::DataObjects;
 using namespace Mantid::DataHandling;
 
diff --git a/Framework/CurveFitting/test/LogNormalTest.h b/Framework/CurveFitting/test/Functions/LogNormalTest.h
similarity index 92%
rename from Framework/CurveFitting/test/LogNormalTest.h
rename to Framework/CurveFitting/test/Functions/LogNormalTest.h
index b6ca2231c59266dcc8b9538d6c5b43c1a7c7ca69..d4391f687f2020a2aab3d304feae0ad7e181ec74 100644
--- a/Framework/CurveFitting/test/LogNormalTest.h
+++ b/Framework/CurveFitting/test/Functions/LogNormalTest.h
@@ -3,11 +3,11 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/LogNormal.h"
+#include "MantidCurveFitting/Functions/LogNormal.h"
 #include "MantidAPI/CompositeFunction.h"
-#include "MantidCurveFitting/LinearBackground.h"
-#include "MantidCurveFitting/BoundaryConstraint.h"
-#include "MantidCurveFitting/Fit.h"
+#include "MantidCurveFitting/Functions/LinearBackground.h"
+#include "MantidCurveFitting/Constraints/BoundaryConstraint.h"
+#include "MantidCurveFitting/Algorithms/Fit.h"
 #include "MantidKernel/UnitFactory.h"
 #include "MantidAPI/AnalysisDataService.h"
 #include "MantidAPI/WorkspaceFactory.h"
@@ -19,6 +19,8 @@
 using namespace Mantid::Kernel;
 using namespace Mantid::API;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Functions;
+using namespace Mantid::CurveFitting::Algorithms;
 using namespace Mantid::DataObjects;
 
 class LogNormalTest : public CxxTest::TestSuite {
@@ -54,7 +56,7 @@ public:
   }
 
   void testAgainstMockData() {
-    Fit alg2;
+    Algorithms::Fit alg2;
     TS_ASSERT_THROWS_NOTHING(alg2.initialize());
     TS_ASSERT(alg2.isInitialized());
 
diff --git a/Framework/CurveFitting/test/Lorentzian1DTest.h b/Framework/CurveFitting/test/Functions/Lorentzian1DTest.h
similarity index 96%
rename from Framework/CurveFitting/test/Lorentzian1DTest.h
rename to Framework/CurveFitting/test/Functions/Lorentzian1DTest.h
index 10d4d940f1751a5491e9528d421f16d347c75714..d56d87abe45f2cf3e6dd7bb6b2719c5e6b4f8a67 100644
--- a/Framework/CurveFitting/test/Lorentzian1DTest.h
+++ b/Framework/CurveFitting/test/Functions/Lorentzian1DTest.h
@@ -3,7 +3,7 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/Lorentzian1D.h"
+#include "MantidCurveFitting/Functions/Lorentzian1D.h"
 #include "MantidKernel/UnitFactory.h"
 #include "MantidAPI/AnalysisDataService.h"
 #include "MantidAPI/WorkspaceFactory.h"
@@ -12,7 +12,7 @@
 
 using namespace Mantid::Kernel;
 using namespace Mantid::API;
-using Mantid::CurveFitting::Lorentzian1D;
+using Mantid::CurveFitting::Functions::Lorentzian1D;
 using namespace Mantid::DataObjects;
 
 class Lorentzian1DTest : public CxxTest::TestSuite {
diff --git a/Framework/CurveFitting/test/LorentzianTest.h b/Framework/CurveFitting/test/Functions/LorentzianTest.h
similarity index 87%
rename from Framework/CurveFitting/test/LorentzianTest.h
rename to Framework/CurveFitting/test/Functions/LorentzianTest.h
index f4fa3ef83c727c495bf6ba4650de053a2a6859c3..50f9bc895d555bd215ed6dd191b9d617e2718612 100644
--- a/Framework/CurveFitting/test/LorentzianTest.h
+++ b/Framework/CurveFitting/test/Functions/LorentzianTest.h
@@ -3,12 +3,13 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/Lorentzian.h"
+#include "MantidCurveFitting/Functions/Lorentzian.h"
 #include "MantidCurveFitting/Jacobian.h"
 #include "MantidAPI/FunctionDomain1D.h"
 #include "MantidAPI/FunctionValues.h"
 
 #include <boost/make_shared.hpp>
+using Mantid::CurveFitting::Functions::Lorentzian;
 
 class LorentzianTest : public CxxTest::TestSuite {
 public:
@@ -41,7 +42,7 @@ public:
   }
 
   void test_categories() {
-    Mantid::CurveFitting::Lorentzian forCat;
+    Lorentzian forCat;
     const std::vector<std::string> categories = forCat.categories();
     TS_ASSERT(categories.size() == 1);
     TS_ASSERT(categories[0] == "Peak");
@@ -49,7 +50,7 @@ public:
 
   void test_FWHM() {
     double hwhm = 0.5;
-    Mantid::CurveFitting::Lorentzian lor;
+    Lorentzian lor;
     lor.initialize();
     lor.setParameter("Amplitude", 1.0);
     lor.setParameter("PeakCentre", 0.0);
@@ -63,7 +64,7 @@ public:
   }
 
   void test_height() {
-    Mantid::CurveFitting::Lorentzian lor;
+    Lorentzian lor;
     lor.initialize();
     lor.setHeight(2.0);
     lor.setCentre(3.0);
@@ -78,7 +79,7 @@ public:
   }
 
   void test_height_zero_width() {
-    Mantid::CurveFitting::Lorentzian lor;
+    Lorentzian lor;
     lor.initialize();
     lor.setHeight(2.0);
     lor.setCentre(3.0);
@@ -96,7 +97,7 @@ public:
   }
 
   void testIntensity() {
-    Mantid::CurveFitting::Lorentzian lor;
+    Lorentzian lor;
     lor.initialize();
     lor.setHeight(2.0);
     lor.setCentre(3.0);
@@ -110,15 +111,15 @@ public:
   }
 
 private:
-  class TestableLorentzian : public Mantid::CurveFitting::Lorentzian {
+  class TestableLorentzian : public Lorentzian {
   public:
     void functionLocal(double *out, const double *xValues,
                        const size_t nData) const {
-      Mantid::CurveFitting::Lorentzian::functionLocal(out, xValues, nData);
+      Lorentzian::functionLocal(out, xValues, nData);
     }
     void functionDerivLocal(Mantid::API::Jacobian *out, const double *xValues,
                             const size_t nData) {
-      Mantid::CurveFitting::Lorentzian::functionDerivLocal(out, xValues, nData);
+      Lorentzian::functionDerivLocal(out, xValues, nData);
     }
   };
 
diff --git a/Framework/CurveFitting/test/MuonFInteractionTest.h b/Framework/CurveFitting/test/Functions/MuonFInteractionTest.h
similarity index 93%
rename from Framework/CurveFitting/test/MuonFInteractionTest.h
rename to Framework/CurveFitting/test/Functions/MuonFInteractionTest.h
index b9b5b3b7d968869e05b05e394344826c27ed76c4..a03d49a13135f5697a6f46e2ca9d2a8a2c067e89 100644
--- a/Framework/CurveFitting/test/MuonFInteractionTest.h
+++ b/Framework/CurveFitting/test/Functions/MuonFInteractionTest.h
@@ -3,11 +3,8 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/MuonFInteraction.h"
-#include "MantidAPI/CompositeFunction.h"
-#include "MantidCurveFitting/LinearBackground.h"
-#include "MantidCurveFitting/BoundaryConstraint.h"
-#include "MantidCurveFitting/Fit.h"
+#include "MantidCurveFitting/Functions/MuonFInteraction.h"
+#include "MantidCurveFitting/Algorithms/Fit.h"
 #include "MantidKernel/UnitFactory.h"
 #include "MantidAPI/AnalysisDataService.h"
 #include "MantidAPI/WorkspaceFactory.h"
@@ -19,6 +16,8 @@
 using namespace Mantid::Kernel;
 using namespace Mantid::API;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Functions;
+using namespace Mantid::CurveFitting::Algorithms;
 using namespace Mantid::DataObjects;
 
 class MuonFInteractionTest : public CxxTest::TestSuite {
@@ -54,7 +53,7 @@ public:
   }
 
   void testAgainstMockData() {
-    Fit alg2;
+    Algorithms::Fit alg2;
     TS_ASSERT_THROWS_NOTHING(alg2.initialize());
     TS_ASSERT(alg2.isInitialized());
 
diff --git a/Framework/CurveFitting/test/NeutronBk2BkExpConvPVoigtTest.h b/Framework/CurveFitting/test/Functions/NeutronBk2BkExpConvPVoigtTest.h
similarity index 99%
rename from Framework/CurveFitting/test/NeutronBk2BkExpConvPVoigtTest.h
rename to Framework/CurveFitting/test/Functions/NeutronBk2BkExpConvPVoigtTest.h
index 946ebe697dc0713f9887fa454ad16d3ad3f90294..ad44379ead2f7307b6fff1d56f2bda5df4561ac5 100644
--- a/Framework/CurveFitting/test/NeutronBk2BkExpConvPVoigtTest.h
+++ b/Framework/CurveFitting/test/Functions/NeutronBk2BkExpConvPVoigtTest.h
@@ -3,10 +3,10 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/NeutronBk2BkExpConvPVoigt.h"
+#include "MantidCurveFitting/Functions/NeutronBk2BkExpConvPVoigt.h"
 
 using namespace std;
-using Mantid::CurveFitting::NeutronBk2BkExpConvPVoigt;
+using Mantid::CurveFitting::Functions::NeutronBk2BkExpConvPVoigt;
 
 class NeutronBk2BkExpConvPVoigtTest : public CxxTest::TestSuite {
 public:
diff --git a/Framework/CurveFitting/test/PawleyFunctionTest.h b/Framework/CurveFitting/test/Functions/PawleyFunctionTest.h
similarity index 99%
rename from Framework/CurveFitting/test/PawleyFunctionTest.h
rename to Framework/CurveFitting/test/Functions/PawleyFunctionTest.h
index 141f4d008e4764a8fdbb892a25f23da0b1f51422..f746d52c86d2c82aa215978eafe8cb2ea0257b04 100644
--- a/Framework/CurveFitting/test/PawleyFunctionTest.h
+++ b/Framework/CurveFitting/test/Functions/PawleyFunctionTest.h
@@ -3,7 +3,7 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/PawleyFunction.h"
+#include "MantidCurveFitting/Functions/PawleyFunction.h"
 #include "MantidGeometry/Crystal/PointGroup.h"
 #include "MantidAPI/AlgorithmManager.h"
 #include "MantidAPI/FunctionFactory.h"
@@ -11,6 +11,7 @@
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
 
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Functions;
 using namespace Mantid::API;
 using namespace Mantid::Geometry;
 using namespace Mantid::Kernel;
diff --git a/Framework/CurveFitting/test/PeakParameterFunctionTest.h b/Framework/CurveFitting/test/Functions/PeakParameterFunctionTest.h
similarity index 97%
rename from Framework/CurveFitting/test/PeakParameterFunctionTest.h
rename to Framework/CurveFitting/test/Functions/PeakParameterFunctionTest.h
index 4f5bb3317308e6f871d5c0f994b693b99be1c5d3..80cf00d80492ae098d07649a3cf5b8c882d8aca7 100644
--- a/Framework/CurveFitting/test/PeakParameterFunctionTest.h
+++ b/Framework/CurveFitting/test/Functions/PeakParameterFunctionTest.h
@@ -3,7 +3,7 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/PeakParameterFunction.h"
+#include "MantidCurveFitting/Functions/PeakParameterFunction.h"
 #include "MantidAPI/FrameworkManager.h"
 #include "MantidAPI/FunctionDomain1D.h"
 #include "MantidAPI/FunctionFactory.h"
@@ -13,6 +13,7 @@
 #include "MantidCurveFitting/Jacobian.h"
 
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Functions;
 using namespace Mantid::API;
 
 class PeakParameterFunctionTest : public CxxTest::TestSuite {
diff --git a/Framework/CurveFitting/test/PolynomialTest.h b/Framework/CurveFitting/test/Functions/PolynomialTest.h
similarity index 92%
rename from Framework/CurveFitting/test/PolynomialTest.h
rename to Framework/CurveFitting/test/Functions/PolynomialTest.h
index c33a5e183567d675eb3ad72a41be6b0052334813..13d0461f676997d8bc7ccc44f69831644154cb02 100644
--- a/Framework/CurveFitting/test/PolynomialTest.h
+++ b/Framework/CurveFitting/test/Functions/PolynomialTest.h
@@ -3,15 +3,16 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/Polynomial.h"
+#include "MantidCurveFitting/Functions/Polynomial.h"
 #include "MantidDataObjects/Workspace2D.h"
 #include "MantidAPI/WorkspaceFactory.h"
-#include "MantidCurveFitting/Fit.h"
+#include "MantidCurveFitting/Algorithms/Fit.h"
 
-using Mantid::CurveFitting::Polynomial;
+using Mantid::CurveFitting::Functions::Polynomial;
 using namespace Mantid;
 using namespace API;
 using namespace Kernel;
+using namespace Mantid::CurveFitting::Algorithms;
 
 class PolynomialTest : public CxxTest::TestSuite {
 public:
@@ -45,7 +46,7 @@ public:
     // put this workspace in the data service
     TS_ASSERT_THROWS_NOTHING(AnalysisDataService::Instance().add(wsName, ws2D));
 
-    CurveFitting::Fit alg2;
+    CurveFitting::Algorithms::Fit alg2;
     TS_ASSERT_THROWS_NOTHING(alg2.initialize());
     TS_ASSERT(alg2.isInitialized());
 
diff --git a/Framework/CurveFitting/test/ProcessBackgroundTest.h b/Framework/CurveFitting/test/Functions/ProcessBackgroundTest.h
similarity index 99%
rename from Framework/CurveFitting/test/ProcessBackgroundTest.h
rename to Framework/CurveFitting/test/Functions/ProcessBackgroundTest.h
index 393ef4b2ceb904fc8a169e8317b46abcf277693b..9ad20b34455b34d2f8d1d236501ce8af4c42ae4d 100644
--- a/Framework/CurveFitting/test/ProcessBackgroundTest.h
+++ b/Framework/CurveFitting/test/Functions/ProcessBackgroundTest.h
@@ -3,7 +3,7 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/ProcessBackground.h"
+#include "MantidCurveFitting/Functions/ProcessBackground.h"
 #include "MantidDataObjects/Workspace2D.h"
 #include "MantidDataObjects/TableWorkspace.h"
 #include "MantidAPI/WorkspaceFactory.h"
@@ -11,7 +11,7 @@
 
 #include <fstream>
 
-using Mantid::CurveFitting::ProcessBackground;
+using Mantid::CurveFitting::Functions::ProcessBackground;
 using namespace Mantid;
 using namespace Mantid::API;
 using namespace Kernel;
diff --git a/Framework/CurveFitting/test/ProductFunctionTest.h b/Framework/CurveFitting/test/Functions/ProductFunctionTest.h
similarity index 94%
rename from Framework/CurveFitting/test/ProductFunctionTest.h
rename to Framework/CurveFitting/test/Functions/ProductFunctionTest.h
index 48cb11dc1fea7b8bde2140d39d630e177960b956..a34711c1d98af800f1f0c991ade79c0a39b44026 100644
--- a/Framework/CurveFitting/test/ProductFunctionTest.h
+++ b/Framework/CurveFitting/test/Functions/ProductFunctionTest.h
@@ -3,10 +3,10 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/ProductFunction.h"
-#include "MantidCurveFitting/Fit.h"
-#include "MantidCurveFitting/Gaussian.h"
+#include "MantidCurveFitting/Functions/ProductFunction.h"
+#include "MantidCurveFitting/Functions/Gaussian.h"
 #include "MantidCurveFitting/Jacobian.h"
+#include "MantidCurveFitting/Algorithms/Fit.h"
 
 #include "MantidDataObjects/Workspace2D.h"
 
@@ -19,6 +19,9 @@
 #include "MantidAPI/FunctionValues.h"
 
 typedef Mantid::DataObjects::Workspace2D_sptr WS_type;
+using Mantid::CurveFitting::Functions::ProductFunction;
+using Mantid::CurveFitting::Functions::Gaussian;
+using Mantid::CurveFitting::Algorithms::Fit;
 
 class ProductFunctionMWTest_Gauss : public Mantid::API::IPeakFunction {
 public:
@@ -99,7 +102,7 @@ DECLARE_FUNCTION(ProductFunctionMWTest_Linear)
 class ProductFunctionTest : public CxxTest::TestSuite {
 public:
   void testFunction() {
-    Mantid::CurveFitting::ProductFunction prodF;
+    ProductFunction prodF;
 
     Mantid::API::IFunction_sptr gauss1(new ProductFunctionMWTest_Gauss);
     gauss1->setParameter(0, 1.1);
@@ -154,8 +157,7 @@ public:
             prodF.asString());
     TS_ASSERT(fun);
 
-    Mantid::CurveFitting::ProductFunction *prodF1 =
-        dynamic_cast<Mantid::CurveFitting::ProductFunction *>(fun.get());
+    ProductFunction *prodF1 = dynamic_cast<ProductFunction *>(fun.get());
     TS_ASSERT(prodF1);
 
     TS_ASSERT_EQUALS(prodF1->nFunctions(), 4);
@@ -182,12 +184,12 @@ public:
   }
 
   void testProductFunction() {
-    Mantid::CurveFitting::ProductFunction prodF;
+    ProductFunction prodF;
 
     double c1 = 1.0;
     double h1 = 3.0;
     double s1 = 0.5;
-    Mantid::API::IFunction_sptr f0(new Mantid::CurveFitting::Gaussian);
+    Mantid::API::IFunction_sptr f0(new Gaussian);
     f0->initialize();
     f0->setParameter("PeakCentre", c1);
     f0->setParameter("Height", h1);
@@ -208,7 +210,7 @@ public:
     double c2 = 2;
     double h2 = 10.0;
     double s2 = 0.5;
-    Mantid::API::IFunction_sptr f1(new Mantid::CurveFitting::Gaussian);
+    Mantid::API::IFunction_sptr f1(new Gaussian);
     f1->initialize();
     f1->setParameter("PeakCentre", c2);
     f1->setParameter("Height", h2);
@@ -249,7 +251,7 @@ public:
 
     Mantid::API::AnalysisDataService::Instance().add(wsName, ws);
 
-    Mantid::CurveFitting::Fit fit;
+    Mantid::CurveFitting::Algorithms::Fit fit;
     fit.initialize();
 
     f0->tie("PeakCentre", "1.0");
@@ -284,14 +286,14 @@ public:
   }
 
   void testForCategories() {
-    Mantid::CurveFitting::ProductFunction forCat;
+    ProductFunction forCat;
     const std::vector<std::string> categories = forCat.categories();
     TS_ASSERT(categories.size() == 1);
     TS_ASSERT(categories[0] == "General");
   }
 
   void testDerivatives() {
-    Mantid::CurveFitting::ProductFunction prodF;
+    ProductFunction prodF;
 
     Mantid::API::IFunction_sptr linear1(new ProductFunctionMWTest_Linear);
     linear1->setParameter(0, 1.0);
diff --git a/Framework/CurveFitting/test/ProductLinearExpTest.h b/Framework/CurveFitting/test/Functions/ProductLinearExpTest.h
similarity index 96%
rename from Framework/CurveFitting/test/ProductLinearExpTest.h
rename to Framework/CurveFitting/test/Functions/ProductLinearExpTest.h
index 99cb313f5f6ebbfd17f9a148b1d9250e945652fc..a198b826c7ae86af588c6f966874bde85024b175 100644
--- a/Framework/CurveFitting/test/ProductLinearExpTest.h
+++ b/Framework/CurveFitting/test/Functions/ProductLinearExpTest.h
@@ -3,10 +3,10 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/ProductLinearExp.h"
-#include "MantidCurveFitting/ExpDecay.h"
-#include "MantidCurveFitting/LinearBackground.h"
-#include "MantidCurveFitting/ProductFunction.h"
+#include "MantidCurveFitting/Functions/ProductLinearExp.h"
+#include "MantidCurveFitting/Functions/ExpDecay.h"
+#include "MantidCurveFitting/Functions/LinearBackground.h"
+#include "MantidCurveFitting/Functions/ProductFunction.h"
 #include "MantidCurveFitting/Jacobian.h"
 #include "MantidAPI/FunctionDomain1D.h"
 #include "MantidAPI/FunctionValues.h"
@@ -16,6 +16,7 @@
 #include <boost/make_shared.hpp>
 
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Functions;
 using namespace Mantid::API;
 
 class ProductLinearExpTest : public CxxTest::TestSuite {
diff --git a/Framework/CurveFitting/test/ProductQuadraticExpTest.h b/Framework/CurveFitting/test/Functions/ProductQuadraticExpTest.h
similarity index 96%
rename from Framework/CurveFitting/test/ProductQuadraticExpTest.h
rename to Framework/CurveFitting/test/Functions/ProductQuadraticExpTest.h
index 51604e1a486f1b734ac181257475df8c162fdb91..c6c4385de3e644ddc19eb57c44e70fa1ed07c65a 100644
--- a/Framework/CurveFitting/test/ProductQuadraticExpTest.h
+++ b/Framework/CurveFitting/test/Functions/ProductQuadraticExpTest.h
@@ -3,10 +3,10 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/ProductQuadraticExp.h"
-#include "MantidCurveFitting/ExpDecay.h"
-#include "MantidCurveFitting/Quadratic.h"
-#include "MantidCurveFitting/ProductFunction.h"
+#include "MantidCurveFitting/Functions/ProductQuadraticExp.h"
+#include "MantidCurveFitting/Functions/ExpDecay.h"
+#include "MantidCurveFitting/Functions/Quadratic.h"
+#include "MantidCurveFitting/Functions/ProductFunction.h"
 #include "MantidCurveFitting/Jacobian.h"
 #include "MantidAPI/FunctionDomain1D.h"
 #include "MantidAPI/FunctionValues.h"
@@ -16,6 +16,7 @@
 #include <boost/make_shared.hpp>
 
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Functions;
 using namespace Mantid::API;
 
 class ProductQuadraticExpTest : public CxxTest::TestSuite {
diff --git a/Framework/CurveFitting/test/PseudoVoigtTest.h b/Framework/CurveFitting/test/Functions/PseudoVoigtTest.h
similarity index 98%
rename from Framework/CurveFitting/test/PseudoVoigtTest.h
rename to Framework/CurveFitting/test/Functions/PseudoVoigtTest.h
index 53a4d256f16cf76d0714a5b84ee8f5d9f0c548ef..fd94bc3955f8d97674c3d4a57dc417ba80c34dab 100644
--- a/Framework/CurveFitting/test/PseudoVoigtTest.h
+++ b/Framework/CurveFitting/test/Functions/PseudoVoigtTest.h
@@ -3,13 +3,13 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/PseudoVoigt.h"
+#include "MantidCurveFitting/Functions/PseudoVoigt.h"
 #include "MantidAPI/FunctionDomain1D.h"
 #include "MantidCurveFitting/Jacobian.h"
 #include <boost/make_shared.hpp>
 
-#include "MantidCurveFitting/Gaussian.h"
-#include "MantidCurveFitting/Lorentzian.h"
+#include "MantidCurveFitting/Functions/Gaussian.h"
+#include "MantidCurveFitting/Functions/Lorentzian.h"
 #include "MantidAPI/AlgorithmManager.h"
 
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
@@ -17,6 +17,7 @@
 #include "MantidKernel/MersenneTwister.h"
 
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Functions;
 using namespace Mantid::API;
 using namespace Mantid::DataObjects;
 
diff --git a/Framework/CurveFitting/test/QuadraticTest.h b/Framework/CurveFitting/test/Functions/QuadraticTest.h
similarity index 92%
rename from Framework/CurveFitting/test/QuadraticTest.h
rename to Framework/CurveFitting/test/Functions/QuadraticTest.h
index 110a2f079bbd45b51546c5fddc2e384197dc4ce8..293b34a479a774bb824a08c6e21c509b25d17a39 100644
--- a/Framework/CurveFitting/test/QuadraticTest.h
+++ b/Framework/CurveFitting/test/Functions/QuadraticTest.h
@@ -3,9 +3,9 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/Quadratic.h"
+#include "MantidCurveFitting/Functions/Quadratic.h"
 
-#include "MantidCurveFitting/Fit.h"
+#include "MantidCurveFitting/Algorithms/Fit.h"
 #include "MantidKernel/UnitFactory.h"
 #include "MantidAPI/AnalysisDataService.h"
 #include "MantidAPI/WorkspaceFactory.h"
@@ -17,8 +17,8 @@
 
 using namespace Mantid::Kernel;
 using namespace Mantid::API;
-using Mantid::CurveFitting::Quadratic;
-using Mantid::CurveFitting::Fit;
+using Mantid::CurveFitting::Functions::Quadratic;
+using Mantid::CurveFitting::Algorithms::Fit;
 using namespace Mantid::DataObjects;
 using namespace Mantid::DataHandling;
 
diff --git a/Framework/CurveFitting/test/ReflectivityMulfTest.h b/Framework/CurveFitting/test/Functions/ReflectivityMulfTest.h
similarity index 96%
rename from Framework/CurveFitting/test/ReflectivityMulfTest.h
rename to Framework/CurveFitting/test/Functions/ReflectivityMulfTest.h
index 7c045ddccc3a764e0a3126bfa990e485fb6cee90..b32cfb9c05f1a3aa4c7e65b45a632af23e3b5853 100644
--- a/Framework/CurveFitting/test/ReflectivityMulfTest.h
+++ b/Framework/CurveFitting/test/Functions/ReflectivityMulfTest.h
@@ -3,13 +3,14 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/ReflectivityMulf.h"
+#include "MantidCurveFitting/Functions/ReflectivityMulf.h"
 #include "MantidAPI/FunctionDomain1D.h"
 #include "MantidAPI/FunctionValues.h"
 
 using namespace Mantid;
 using namespace Mantid::API;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Functions;
 
 class ReflectivityMulfTest : public CxxTest::TestSuite {
 public:
diff --git a/Framework/CurveFitting/test/ResolutionTest.h b/Framework/CurveFitting/test/Functions/ResolutionTest.h
similarity index 96%
rename from Framework/CurveFitting/test/ResolutionTest.h
rename to Framework/CurveFitting/test/Functions/ResolutionTest.h
index 5dfdd646bdea04ae81665ad2bee4fabb533325a4..7ac7e7a642c912f6a0cd301f390f0908b776dedb 100644
--- a/Framework/CurveFitting/test/ResolutionTest.h
+++ b/Framework/CurveFitting/test/Functions/ResolutionTest.h
@@ -3,9 +3,9 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/Resolution.h"
-#include "MantidCurveFitting/Fit.h"
-#include "MantidCurveFitting/Convolution.h"
+#include "MantidCurveFitting/Functions/Resolution.h"
+#include "MantidCurveFitting/Algorithms/Fit.h"
+#include "MantidCurveFitting/Functions/Convolution.h"
 #include "MantidAPI/IPeakFunction.h"
 #include "MantidAPI/FunctionFactory.h"
 #include <Poco/File.h>
@@ -13,6 +13,7 @@
 #include <fstream>
 
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Functions;
 using namespace Mantid::API;
 
 class ResolutionTest_Gauss : public IPeakFunction {
@@ -169,7 +170,7 @@ public:
     conv.addFunction(res);
     conv.addFunction(gauss);
 
-    Fit fit;
+    Algorithms::Fit fit;
     fit.initialize();
     fit.setPropertyValue("Function", conv.asString());
     fit.setPropertyValue("InputWorkspace", "ResolutionTest_WS");
diff --git a/Framework/CurveFitting/test/SimpleChebfunTest.h b/Framework/CurveFitting/test/Functions/SimpleChebfunTest.h
similarity index 98%
rename from Framework/CurveFitting/test/SimpleChebfunTest.h
rename to Framework/CurveFitting/test/Functions/SimpleChebfunTest.h
index 7d13981bb5581d93df5691dcdcf992a64f561550..c512c001280461964ebd0b5a38694aae74a7d6e9 100644
--- a/Framework/CurveFitting/test/SimpleChebfunTest.h
+++ b/Framework/CurveFitting/test/Functions/SimpleChebfunTest.h
@@ -3,12 +3,13 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/SimpleChebfun.h"
+#include "MantidCurveFitting/Functions/SimpleChebfun.h"
 #include <cmath>
 
 using namespace Mantid;
 using namespace Mantid::API;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Functions;
 
 namespace {
 double Sin(double x) { return sin(x); }
diff --git a/Framework/CurveFitting/test/StaticKuboToyabeTest.h b/Framework/CurveFitting/test/Functions/StaticKuboToyabeTest.h
similarity index 91%
rename from Framework/CurveFitting/test/StaticKuboToyabeTest.h
rename to Framework/CurveFitting/test/Functions/StaticKuboToyabeTest.h
index 6d188da076a69e7035b6f2e9c8dd7ad74e085c03..75aabd12039f6c9253ca7a6683e7352c39939be0 100644
--- a/Framework/CurveFitting/test/StaticKuboToyabeTest.h
+++ b/Framework/CurveFitting/test/Functions/StaticKuboToyabeTest.h
@@ -3,11 +3,11 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/StaticKuboToyabe.h"
+#include "MantidCurveFitting/Functions/StaticKuboToyabe.h"
 #include "MantidAPI/CompositeFunction.h"
-#include "MantidCurveFitting/LinearBackground.h"
-#include "MantidCurveFitting/BoundaryConstraint.h"
-#include "MantidCurveFitting/Fit.h"
+#include "MantidCurveFitting/Functions/LinearBackground.h"
+#include "MantidCurveFitting/Constraints/BoundaryConstraint.h"
+#include "MantidCurveFitting/Algorithms/Fit.h"
 #include "MantidKernel/UnitFactory.h"
 #include "MantidAPI/AnalysisDataService.h"
 #include "MantidAPI/WorkspaceFactory.h"
@@ -19,6 +19,7 @@
 using namespace Mantid::Kernel;
 using namespace Mantid::API;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Functions;
 using namespace Mantid::DataObjects;
 
 class StaticKuboToyabeTest : public CxxTest::TestSuite {
@@ -50,7 +51,7 @@ public:
   }
 
   void testAgainstMockData() {
-    Fit alg2;
+    Algorithms::Fit alg2;
     TS_ASSERT_THROWS_NOTHING(alg2.initialize());
     TS_ASSERT(alg2.isInitialized());
 
diff --git a/Framework/CurveFitting/test/StaticKuboToyabeTimesExpDecayTest.h b/Framework/CurveFitting/test/Functions/StaticKuboToyabeTimesExpDecayTest.h
similarity index 91%
rename from Framework/CurveFitting/test/StaticKuboToyabeTimesExpDecayTest.h
rename to Framework/CurveFitting/test/Functions/StaticKuboToyabeTimesExpDecayTest.h
index 1546f743eefec9d8b70eae292361d17d15c34f32..41872069e5d1ce649428af575ca217ba8050f801 100644
--- a/Framework/CurveFitting/test/StaticKuboToyabeTimesExpDecayTest.h
+++ b/Framework/CurveFitting/test/Functions/StaticKuboToyabeTimesExpDecayTest.h
@@ -3,16 +3,18 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/StaticKuboToyabeTimesExpDecay.h"
+#include "MantidCurveFitting/Functions/StaticKuboToyabeTimesExpDecay.h"
 #include "MantidAPI/FunctionFactory.h"
-#include "MantidCurveFitting/Fit.h"
+#include "MantidCurveFitting/Algorithms/Fit.h"
 #include "MantidDataObjects/Workspace2D.h"
 
-using Mantid::CurveFitting::StaticKuboToyabeTimesExpDecay;
+using Mantid::CurveFitting::Functions::StaticKuboToyabeTimesExpDecay;
 
 using namespace Mantid::Kernel;
 using namespace Mantid::API;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Functions;
+using namespace Mantid::CurveFitting::Algorithms;
 using namespace Mantid::DataObjects;
 
 class StaticKuboToyabeTimesExpDecayTest : public CxxTest::TestSuite {
@@ -69,7 +71,7 @@ public:
   }
 
   void test_AgainstMockData() {
-    Fit alg2;
+    Algorithms::Fit alg2;
     TS_ASSERT_THROWS_NOTHING(alg2.initialize());
     TS_ASSERT(alg2.isInitialized());
 
diff --git a/Framework/CurveFitting/test/StaticKuboToyabeTimesGausDecayTest.h b/Framework/CurveFitting/test/Functions/StaticKuboToyabeTimesGausDecayTest.h
similarity index 91%
rename from Framework/CurveFitting/test/StaticKuboToyabeTimesGausDecayTest.h
rename to Framework/CurveFitting/test/Functions/StaticKuboToyabeTimesGausDecayTest.h
index e49a1065582563e8098f0e810c661b1418d0b023..f257182091434c6f21ab1bac0b9c17afa3e90b29 100644
--- a/Framework/CurveFitting/test/StaticKuboToyabeTimesGausDecayTest.h
+++ b/Framework/CurveFitting/test/Functions/StaticKuboToyabeTimesGausDecayTest.h
@@ -3,15 +3,17 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/StaticKuboToyabeTimesGausDecay.h"
+#include "MantidCurveFitting/Functions/StaticKuboToyabeTimesGausDecay.h"
 #include "MantidAPI/FunctionFactory.h"
-#include "MantidCurveFitting/Fit.h"
+#include "MantidCurveFitting/Algorithms/Fit.h"
 #include "MantidDataObjects/Workspace2D.h"
 
-using Mantid::CurveFitting::StaticKuboToyabeTimesGausDecay;
+using Mantid::CurveFitting::Functions::StaticKuboToyabeTimesGausDecay;
 using namespace Mantid::Kernel;
 using namespace Mantid::API;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Functions;
+using namespace Mantid::CurveFitting::Algorithms;
 using namespace Mantid::DataObjects;
 
 class StaticKuboToyabeTimesGausDecayTest : public CxxTest::TestSuite {
@@ -68,7 +70,7 @@ public:
   }
 
   void test_AgainstMockData() {
-    Fit alg2;
+    Algorithms::Fit alg2;
     TS_ASSERT_THROWS_NOTHING(alg2.initialize());
     TS_ASSERT(alg2.isInitialized());
 
diff --git a/Framework/CurveFitting/test/StretchExpMuonTest.h b/Framework/CurveFitting/test/Functions/StretchExpMuonTest.h
similarity index 91%
rename from Framework/CurveFitting/test/StretchExpMuonTest.h
rename to Framework/CurveFitting/test/Functions/StretchExpMuonTest.h
index dcf022beceeabfaa68bd7539a38575e69929b90b..8bbbfb9041cd005233bdd865d79009bcdcb0f444 100644
--- a/Framework/CurveFitting/test/StretchExpMuonTest.h
+++ b/Framework/CurveFitting/test/Functions/StretchExpMuonTest.h
@@ -3,11 +3,11 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/StretchExpMuon.h"
+#include "MantidCurveFitting/Functions/StretchExpMuon.h"
 #include "MantidAPI/CompositeFunction.h"
-#include "MantidCurveFitting/LinearBackground.h"
-#include "MantidCurveFitting/BoundaryConstraint.h"
-#include "MantidCurveFitting/Fit.h"
+#include "MantidCurveFitting/Functions/LinearBackground.h"
+#include "MantidCurveFitting/Constraints/BoundaryConstraint.h"
+#include "MantidCurveFitting/Algorithms/Fit.h"
 #include "MantidKernel/UnitFactory.h"
 #include "MantidAPI/AnalysisDataService.h"
 #include "MantidAPI/WorkspaceFactory.h"
@@ -19,6 +19,8 @@
 using namespace Mantid::Kernel;
 using namespace Mantid::API;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Functions;
+using namespace Mantid::CurveFitting::Algorithms;
 using namespace Mantid::DataObjects;
 
 class StretchExpMuonTest : public CxxTest::TestSuite {
@@ -54,7 +56,7 @@ public:
   }
 
   void testAgainstMockData() {
-    Fit alg2;
+    Algorithms::Fit alg2;
     TS_ASSERT_THROWS_NOTHING(alg2.initialize());
     TS_ASSERT(alg2.isInitialized());
 
diff --git a/Framework/CurveFitting/test/StretchExpTest.h b/Framework/CurveFitting/test/Functions/StretchExpTest.h
similarity index 93%
rename from Framework/CurveFitting/test/StretchExpTest.h
rename to Framework/CurveFitting/test/Functions/StretchExpTest.h
index 8ad7fbd15465389bc445b84126dcbe845ee15314..a17208356f7b9261d4ab4551706426a3fe683297 100644
--- a/Framework/CurveFitting/test/StretchExpTest.h
+++ b/Framework/CurveFitting/test/Functions/StretchExpTest.h
@@ -3,11 +3,11 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/StretchExp.h"
+#include "MantidCurveFitting/Functions/StretchExp.h"
 #include "MantidAPI/CompositeFunction.h"
-#include "MantidCurveFitting/LinearBackground.h"
-#include "MantidCurveFitting/BoundaryConstraint.h"
-#include "MantidCurveFitting/Fit.h"
+#include "MantidCurveFitting/Functions/LinearBackground.h"
+#include "MantidCurveFitting/Constraints/BoundaryConstraint.h"
+#include "MantidCurveFitting/Algorithms/Fit.h"
 #include "MantidKernel/UnitFactory.h"
 #include "MantidAPI/AnalysisDataService.h"
 #include "MantidAPI/WorkspaceFactory.h"
@@ -21,6 +21,8 @@
 using namespace Mantid::Kernel;
 using namespace Mantid::API;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Functions;
+using namespace Mantid::CurveFitting::Algorithms;
 using namespace Mantid::DataObjects;
 
 class StretchExpTest_Jacobian : public Mantid::API::Jacobian {
@@ -65,7 +67,7 @@ public:
   }
 
   void testAgainstMockData() {
-    Fit alg2;
+    Algorithms::Fit alg2;
     TS_ASSERT_THROWS_NOTHING(alg2.initialize());
     TS_ASSERT(alg2.isInitialized());
 
diff --git a/Framework/CurveFitting/test/TabulatedFunctionTest.h b/Framework/CurveFitting/test/Functions/TabulatedFunctionTest.h
similarity index 98%
rename from Framework/CurveFitting/test/TabulatedFunctionTest.h
rename to Framework/CurveFitting/test/Functions/TabulatedFunctionTest.h
index f243adc77658f580826be8c15e34342bf1fbb2ad..1937f365c1cab0b8a9f5d3f4a557868d3c3ed357 100644
--- a/Framework/CurveFitting/test/TabulatedFunctionTest.h
+++ b/Framework/CurveFitting/test/Functions/TabulatedFunctionTest.h
@@ -3,8 +3,8 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/TabulatedFunction.h"
-#include "MantidCurveFitting/UserFunction.h"
+#include "MantidCurveFitting/Functions/TabulatedFunction.h"
+#include "MantidCurveFitting/Functions/UserFunction.h"
 #include "MantidCurveFitting/Jacobian.h"
 #include "MantidAPI/FunctionDomain.h"
 #include "MantidAPI/AlgorithmFactory.h"
@@ -19,6 +19,7 @@
 #include <fstream>
 
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Functions;
 using namespace Mantid::API;
 
 namespace {
diff --git a/Framework/CurveFitting/test/ThermalNeutronBk2BkExpAlphaTest.h b/Framework/CurveFitting/test/Functions/ThermalNeutronBk2BkExpAlphaTest.h
similarity index 90%
rename from Framework/CurveFitting/test/ThermalNeutronBk2BkExpAlphaTest.h
rename to Framework/CurveFitting/test/Functions/ThermalNeutronBk2BkExpAlphaTest.h
index 93179e749256588a67025dc326afb4959f9e1955..5a61091389e989eee6469986bb54e6cccf5bc672 100644
--- a/Framework/CurveFitting/test/ThermalNeutronBk2BkExpAlphaTest.h
+++ b/Framework/CurveFitting/test/Functions/ThermalNeutronBk2BkExpAlphaTest.h
@@ -3,10 +3,10 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/ThermalNeutronBk2BkExpAlpha.h"
+#include "MantidCurveFitting/Functions/ThermalNeutronBk2BkExpAlpha.h"
 
 using namespace Mantid;
-using Mantid::CurveFitting::ThermalNeutronBk2BkExpAlpha;
+using Mantid::CurveFitting::Functions::ThermalNeutronBk2BkExpAlpha;
 
 class ThermalNeutronBk2BkExpAlphaTest : public CxxTest::TestSuite {
 public:
@@ -36,7 +36,7 @@ public:
     vec_tof.push_back(124187);
 
     // 2. Initialize the method
-    Mantid::CurveFitting::ThermalNeutronBk2BkExpAlpha function;
+    ThermalNeutronBk2BkExpAlpha function;
     function.initialize();
 
     function.setParameter("Alph0", 4.026);
diff --git a/Framework/CurveFitting/test/ThermalNeutronBk2BkExpBetaTest.h b/Framework/CurveFitting/test/Functions/ThermalNeutronBk2BkExpBetaTest.h
similarity index 90%
rename from Framework/CurveFitting/test/ThermalNeutronBk2BkExpBetaTest.h
rename to Framework/CurveFitting/test/Functions/ThermalNeutronBk2BkExpBetaTest.h
index 226e9229d10ac60170f0eb72ae3c26767133d927..978370be21897feafe65708f61d40d7e7a0b7a24 100644
--- a/Framework/CurveFitting/test/ThermalNeutronBk2BkExpBetaTest.h
+++ b/Framework/CurveFitting/test/Functions/ThermalNeutronBk2BkExpBetaTest.h
@@ -3,10 +3,10 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/ThermalNeutronBk2BkExpBeta.h"
+#include "MantidCurveFitting/Functions/ThermalNeutronBk2BkExpBeta.h"
 
 using namespace Mantid;
-using Mantid::CurveFitting::ThermalNeutronBk2BkExpBeta;
+using Mantid::CurveFitting::Functions::ThermalNeutronBk2BkExpBeta;
 
 class ThermalNeutronBk2BkExpBetaTest : public CxxTest::TestSuite {
 public:
@@ -36,7 +36,7 @@ public:
     vec_tof.push_back(124187);
 
     // 2. Initialize the method
-    Mantid::CurveFitting::ThermalNeutronBk2BkExpBeta function;
+    ThermalNeutronBk2BkExpBeta function;
     function.initialize();
 
     function.setParameter("Beta0", 3.489);
diff --git a/Framework/CurveFitting/test/ThermalNeutronBk2BkExpConvPVoigtTest.h b/Framework/CurveFitting/test/Functions/ThermalNeutronBk2BkExpConvPVoigtTest.h
similarity index 99%
rename from Framework/CurveFitting/test/ThermalNeutronBk2BkExpConvPVoigtTest.h
rename to Framework/CurveFitting/test/Functions/ThermalNeutronBk2BkExpConvPVoigtTest.h
index 4c4aaccc8a542460d3dc7441f8515ef72ef252a4..ee593a2d2fbb7f09ae2663dc081eba4d765c95b4 100644
--- a/Framework/CurveFitting/test/ThermalNeutronBk2BkExpConvPVoigtTest.h
+++ b/Framework/CurveFitting/test/Functions/ThermalNeutronBk2BkExpConvPVoigtTest.h
@@ -2,16 +2,15 @@
 #define MANTID_CURVEFITTING_THERMALNEUTRONBK2BKEXPCONVPVTEST_H_
 
 #include <cxxtest/TestSuite.h>
-#include <iostream>
 #include <fstream>
 #include <cmath>
 
-#include "MantidCurveFitting/ThermalNeutronBk2BkExpConvPVoigt.h"
+#include "MantidCurveFitting/Functions/ThermalNeutronBk2BkExpConvPVoigt.h"
 
 using namespace Mantid;
 using namespace Kernel;
 using namespace std;
-using Mantid::CurveFitting::ThermalNeutronBk2BkExpConvPVoigt;
+using Mantid::CurveFitting::Functions::ThermalNeutronBk2BkExpConvPVoigt;
 
 class ThermalNeutronBk2BkExpConvPVoigtTest : public CxxTest::TestSuite {
 public:
@@ -138,7 +137,7 @@ public:
     generateData(vecX, vecY, vecE);
 
     // 1. Create peak
-    CurveFitting::ThermalNeutronBk2BkExpConvPVoigt peak;
+    ThermalNeutronBk2BkExpConvPVoigt peak;
     peak.initialize();
 
     peak.setMillerIndex(1, 1, 1);
diff --git a/Framework/CurveFitting/test/ThermalNeutronBk2BkExpSigmaTest.h b/Framework/CurveFitting/test/Functions/ThermalNeutronBk2BkExpSigmaTest.h
similarity index 89%
rename from Framework/CurveFitting/test/ThermalNeutronBk2BkExpSigmaTest.h
rename to Framework/CurveFitting/test/Functions/ThermalNeutronBk2BkExpSigmaTest.h
index 3e861dafcbdd461b342e18e1a692e2c113528995..cdc782f28503b2189db8142fda18c6ed8420b43e 100644
--- a/Framework/CurveFitting/test/ThermalNeutronBk2BkExpSigmaTest.h
+++ b/Framework/CurveFitting/test/Functions/ThermalNeutronBk2BkExpSigmaTest.h
@@ -3,9 +3,9 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/ThermalNeutronBk2BkExpSigma.h"
+#include "MantidCurveFitting/Functions/ThermalNeutronBk2BkExpSigma.h"
 
-using Mantid::CurveFitting::ThermalNeutronBk2BkExpSigma;
+using Mantid::CurveFitting::Functions::ThermalNeutronBk2BkExpSigma;
 using namespace Mantid;
 
 class ThermalNeutronBk2BkExpSigmaTest : public CxxTest::TestSuite {
@@ -36,7 +36,7 @@ public:
     vec_tof.push_back(124187);
 
     // 2. Initialize the method
-    Mantid::CurveFitting::ThermalNeutronBk2BkExpSigma function;
+    ThermalNeutronBk2BkExpSigma function;
     function.initialize();
 
     function.setParameter("Sig2", sqrt(11.380));
diff --git a/Framework/CurveFitting/test/ThermalNeutronDtoTOFFunctionTest.h b/Framework/CurveFitting/test/Functions/ThermalNeutronDtoTOFFunctionTest.h
similarity index 95%
rename from Framework/CurveFitting/test/ThermalNeutronDtoTOFFunctionTest.h
rename to Framework/CurveFitting/test/Functions/ThermalNeutronDtoTOFFunctionTest.h
index 991cb0884f577e89b5bd47513ec117d8c12ad4a1..ef8adbfa43e6989e178c00b1fc2908887de122dc 100644
--- a/Framework/CurveFitting/test/ThermalNeutronDtoTOFFunctionTest.h
+++ b/Framework/CurveFitting/test/Functions/ThermalNeutronDtoTOFFunctionTest.h
@@ -3,15 +3,14 @@
 
 #include <cxxtest/TestSuite.h>
 #include <cmath>
-#include <iostream>
 #include <math.h>
 #include <fstream>
 
-#include "MantidCurveFitting/ThermalNeutronDtoTOFFunction.h"
+#include "MantidCurveFitting/Functions/ThermalNeutronDtoTOFFunction.h"
 #include "MantidAPI/FunctionDomain1D.h"
 #include "MantidAPI/FunctionValues.h"
 
-using Mantid::CurveFitting::ThermalNeutronDtoTOFFunction;
+using Mantid::CurveFitting::Functions::ThermalNeutronDtoTOFFunction;
 using namespace Mantid;
 using namespace Mantid::API;
 
@@ -45,7 +44,7 @@ public:
     vec_tof.push_back(124187);
 
     // 2. Initialize the method
-    Mantid::CurveFitting::ThermalNeutronDtoTOFFunction function;
+    ThermalNeutronDtoTOFFunction function;
     function.initialize();
 
     function.setParameter("Dtt1", 22777.1);
diff --git a/Framework/CurveFitting/test/UserFunction1DTest.h b/Framework/CurveFitting/test/Functions/UserFunction1DTest.h
similarity index 96%
rename from Framework/CurveFitting/test/UserFunction1DTest.h
rename to Framework/CurveFitting/test/Functions/UserFunction1DTest.h
index 43abd49d3c90739abf922eac37866fa98c5f0ecb..8ea1cd7792cca9458adabe1b2842ce987f6e0ac9 100644
--- a/Framework/CurveFitting/test/UserFunction1DTest.h
+++ b/Framework/CurveFitting/test/Functions/UserFunction1DTest.h
@@ -3,7 +3,7 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/UserFunction1D.h"
+#include "MantidCurveFitting/Functions/UserFunction1D.h"
 #include "MantidAPI/AnalysisDataService.h"
 #include "MantidAPI/FrameworkManager.h"
 #include "MantidDataObjects/Workspace2D.h"
@@ -11,6 +11,7 @@
 #include "MantidAPI/ITableWorkspace.h"
 
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Functions;
 using namespace Mantid::API;
 
 class UserFunction1DTest : public CxxTest::TestSuite {
diff --git a/Framework/CurveFitting/test/UserFunctionTest.h b/Framework/CurveFitting/test/Functions/UserFunctionTest.h
similarity index 95%
rename from Framework/CurveFitting/test/UserFunctionTest.h
rename to Framework/CurveFitting/test/Functions/UserFunctionTest.h
index 7355f7120938957f2b0057217199df9962db4214..b527257a1754fe4503333ffb399c9b3db34eafe7 100644
--- a/Framework/CurveFitting/test/UserFunctionTest.h
+++ b/Framework/CurveFitting/test/Functions/UserFunctionTest.h
@@ -3,11 +3,12 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/UserFunction.h"
+#include "MantidCurveFitting/Functions/UserFunction.h"
 #include "MantidAPI/Jacobian.h"
 #include "MantidAPI/FunctionDomain1D.h"
 
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Functions;
 using namespace Mantid::API;
 
 class UserFunctionTest : public CxxTest::TestSuite {
diff --git a/Framework/CurveFitting/test/VesuvioResolutionTest.h b/Framework/CurveFitting/test/Functions/VesuvioResolutionTest.h
similarity index 96%
rename from Framework/CurveFitting/test/VesuvioResolutionTest.h
rename to Framework/CurveFitting/test/Functions/VesuvioResolutionTest.h
index 2e0fe33a435ea860f9d78d19a367bdbe1ecc6ade..8488b55e50588cf4734bf3b03463c4c3dd374660 100644
--- a/Framework/CurveFitting/test/VesuvioResolutionTest.h
+++ b/Framework/CurveFitting/test/Functions/VesuvioResolutionTest.h
@@ -2,11 +2,11 @@
 #define MANTID_CURVEFITTING_VESUVIORESOLUTIONTEST_H_
 
 #include <cxxtest/TestSuite.h>
-#include "MantidCurveFitting/VesuvioResolution.h"
+#include "MantidCurveFitting/Functions/VesuvioResolution.h"
 
 #include "ComptonProfileTestHelpers.h"
 
-using Mantid::CurveFitting::VesuvioResolution;
+using Mantid::CurveFitting::Functions::VesuvioResolution;
 
 class VesuvioResolutionTest : public CxxTest::TestSuite {
 public:
diff --git a/Framework/CurveFitting/test/VoigtTest.h b/Framework/CurveFitting/test/Functions/VoigtTest.h
similarity index 98%
rename from Framework/CurveFitting/test/VoigtTest.h
rename to Framework/CurveFitting/test/Functions/VoigtTest.h
index 769a77f2d4b6c5e9f70cb825bbf23d2553d9add5..74c76e0aa518baa8c9d7ed76c45d70b2b04ea523 100644
--- a/Framework/CurveFitting/test/VoigtTest.h
+++ b/Framework/CurveFitting/test/Functions/VoigtTest.h
@@ -3,7 +3,7 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include "MantidCurveFitting/Voigt.h"
+#include "MantidCurveFitting/Functions/Voigt.h"
 
 #include "MantidAPI/FunctionDomain1D.h"
 #include "MantidAPI/FunctionValues.h"
@@ -12,7 +12,7 @@
 #include <boost/scoped_ptr.hpp>
 #include <boost/make_shared.hpp>
 
-using Mantid::CurveFitting::Voigt;
+using Mantid::CurveFitting::Functions::Voigt;
 using Mantid::API::IFunction;
 
 class VoigtTest : public CxxTest::TestSuite {
diff --git a/Framework/CurveFitting/test/valgrind.h b/Framework/CurveFitting/test/Functions/valgrind.h
similarity index 100%
rename from Framework/CurveFitting/test/valgrind.h
rename to Framework/CurveFitting/test/Functions/valgrind.h
diff --git a/Framework/CurveFitting/test/MultiDomainCreatorTest.h b/Framework/CurveFitting/test/MultiDomainCreatorTest.h
index 83eafed823d50e2c85f4faf697a3271c4d50aa29..1694bf0d114b7a05bd639b8defe1c3786fc4461d 100644
--- a/Framework/CurveFitting/test/MultiDomainCreatorTest.h
+++ b/Framework/CurveFitting/test/MultiDomainCreatorTest.h
@@ -12,7 +12,7 @@
 #include "MantidAPI/ParamFunction.h"
 #include "MantidCurveFitting/MultiDomainCreator.h"
 #include "MantidCurveFitting/FitMW.h"
-#include "MantidCurveFitting/UserFunction.h"
+#include "MantidCurveFitting/Functions/UserFunction.h"
 #include "MantidKernel/PropertyManager.h"
 
 #include "MantidTestHelpers/FakeObjects.h"
@@ -20,11 +20,11 @@
 #include <cxxtest/TestSuite.h>
 #include <boost/make_shared.hpp>
 #include <algorithm>
-#include <iostream>
 
 using namespace Mantid;
 using namespace Mantid::API;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Functions;
 
 class MultiDomainCreatorTest_Fun : public IFunction1D, public ParamFunction {
 public:
diff --git a/Framework/CurveFitting/test/MultiDomainFunctionTest.h b/Framework/CurveFitting/test/MultiDomainFunctionTest.h
index f99acf8e0d5ff8e99d07a562e4e5a0510e7fae9b..b379b210af6f1737273136468e9e6e052958e2f0 100644
--- a/Framework/CurveFitting/test/MultiDomainFunctionTest.h
+++ b/Framework/CurveFitting/test/MultiDomainFunctionTest.h
@@ -9,20 +9,21 @@
 #include "MantidAPI/ParamFunction.h"
 #include "MantidAPI/AlgorithmManager.h"
 #include "MantidAPI/FrameworkManager.h"
-#include "MantidCurveFitting/CostFuncLeastSquares.h"
-#include "MantidCurveFitting/LevenbergMarquardtMDMinimizer.h"
-#include "MantidCurveFitting/Fit.h"
+#include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h"
+#include "MantidCurveFitting/FuncMinimizers/LevenbergMarquardtMDMinimizer.h"
+#include "MantidCurveFitting/Algorithms/Fit.h"
 
 #include "MantidTestHelpers/FakeObjects.h"
 
 #include <cxxtest/TestSuite.h>
 #include <boost/make_shared.hpp>
 #include <algorithm>
-#include <iostream>
 
 using namespace Mantid;
 using namespace Mantid::API;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::CostFunctions;
+using namespace Mantid::CurveFitting::Algorithms;
 
 class MultiDomainFunctionTest_Function : public virtual IFunction1D,
                                          public virtual ParamFunction {
@@ -162,7 +163,7 @@ public:
     costFun->setFittingFunction(multi, domain, values);
     TS_ASSERT_EQUALS(costFun->nParams(), 6);
 
-    LevenbergMarquardtMDMinimizer s;
+    FuncMinimisers::LevenbergMarquardtMDMinimizer s;
     s.initialize(costFun);
     TS_ASSERT(s.minimize());
 
@@ -186,7 +187,7 @@ public:
     multi->getFunction(2)->setParameter("A", 0);
     multi->getFunction(2)->setParameter("B", 0);
 
-    Fit fit;
+    Algorithms::Fit fit;
     fit.initialize();
     fit.setProperty("Function", boost::dynamic_pointer_cast<IFunction>(multi));
     fit.setProperty("InputWorkspace", ws1);
diff --git a/Framework/CurveFitting/test/SpecialFunctionSupportTest.h b/Framework/CurveFitting/test/SpecialFunctionSupportTest.h
index 4117c204942f384dd9403e591a2232cd5aeee87f..60cef0c51dcc6e96a18cd04a3ae6d78e49cb90e0 100644
--- a/Framework/CurveFitting/test/SpecialFunctionSupportTest.h
+++ b/Framework/CurveFitting/test/SpecialFunctionSupportTest.h
@@ -5,7 +5,7 @@
 #include <complex>
 #include "MantidCurveFitting/SpecialFunctionSupport.h"
 
-#include "MantidCurveFitting/Lorentzian1D.h"
+#include "MantidCurveFitting/Functions/Lorentzian1D.h"
 #include "MantidKernel/UnitFactory.h"
 #include "MantidAPI/AnalysisDataService.h"
 #include "MantidAPI/WorkspaceFactory.h"
diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadAscii.h b/Framework/DataHandling/inc/MantidDataHandling/LoadAscii.h
index 44e695b5bcd1d3a08be0c73641950774822fbbb9..cf495c009be312933a224018d34b0deb1079edab 100644
--- a/Framework/DataHandling/inc/MantidDataHandling/LoadAscii.h
+++ b/Framework/DataHandling/inc/MantidDataHandling/LoadAscii.h
@@ -5,6 +5,7 @@
 // Includes
 //----------------------------------------------------------------------
 #include "MantidAPI/IFileLoader.h"
+#include "MantidAPI/DeprecatedAlgorithm.h"
 
 namespace Mantid {
 namespace DataHandling {
@@ -45,7 +46,8 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 File change history is stored at: <https://github.com/mantidproject/mantid>.
 Code Documentation is available at: <http://doxygen.mantidproject.org>
 */
-class DLLExport LoadAscii : public API::IFileLoader<Kernel::FileDescriptor> {
+class DLLExport LoadAscii : public API::IFileLoader<Kernel::FileDescriptor>,
+                            public API::DeprecatedAlgorithm {
 public:
   /// Default constructor
   LoadAscii();
diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadEventPreNexus.h b/Framework/DataHandling/inc/MantidDataHandling/LoadEventPreNexus.h
index c3f14b233810c5a14e3082ea5bc88725df2ef0ed..328be8a18896d921be8e0a25bd1c6ff8f0185c86 100644
--- a/Framework/DataHandling/inc/MantidDataHandling/LoadEventPreNexus.h
+++ b/Framework/DataHandling/inc/MantidDataHandling/LoadEventPreNexus.h
@@ -5,6 +5,7 @@
 #include <string>
 #include <vector>
 #include "MantidAPI/IFileLoader.h"
+#include "MantidAPI/DeprecatedAlgorithm.h"
 #include "MantidKernel/BinaryFile.h"
 #include "MantidDataObjects/EventWorkspace.h"
 #include "MantidDataObjects/Events.h"
@@ -88,7 +89,8 @@ struct Pulse {
 #pragma pack(pop)
 
 class DLLExport LoadEventPreNexus
-    : public API::IFileLoader<Kernel::FileDescriptor> {
+    : public API::IFileLoader<Kernel::FileDescriptor>,
+      public API::DeprecatedAlgorithm {
 public:
   /// Constructor
   LoadEventPreNexus();
diff --git a/Framework/DataHandling/src/CheckMantidVersion.cpp b/Framework/DataHandling/src/CheckMantidVersion.cpp
index 30a620c6079eaca94651b3e22d92d059b72a93cf..01776379510adfeda238fd768ab2a72cf9949863 100644
--- a/Framework/DataHandling/src/CheckMantidVersion.cpp
+++ b/Framework/DataHandling/src/CheckMantidVersion.cpp
@@ -107,11 +107,35 @@ void CheckMantidVersion::exec() {
   if (!json.empty()) {
     Json::Reader r;
     Json::Value root;
-    r.parse(json, root);
+    bool parseOK = r.parse(json, root);
+    if (!parseOK) {
+      // just warning. The parser is able to get relevant info even if there are
+      // formatting issues like missing quotes or brackets.
+      g_log.warning() << "Error found when parsing version information "
+                         "retrieved from GitHub as a JSON string. "
+                         "Error trying to parse this JSON string: " << json
+                      << std::endl
+                      << ". Parsing error details: "
+                      << r.getFormattedErrorMessages() << std::endl;
+    }
 
-    std::string gitHubVersionTag = root["tag_name"].asString();
-    mostRecentVersion = cleanVersionTag(gitHubVersionTag);
+    std::string gitHubVersionTag;
+    try {
+      gitHubVersionTag = root["tag_name"].asString();
+    } catch (std::runtime_error &re) {
+      g_log.error()
+          << "Error while trying to get the field 'tag_name' from "
+             "the version information retrieved from GitHub. This "
+             "algorithm cannot continue and will stop now. Error details: "
+          << re.what() << std::endl;
+
+      mostRecentVersion = "Could not get information from GitHub";
+      setProperty("MostRecentVersion", mostRecentVersion);
+      setProperty("IsNewVersionAvailable", isNewVersionAvailable);
+      return;
+    }
 
+    mostRecentVersion = cleanVersionTag(gitHubVersionTag);
     isNewVersionAvailable =
         isVersionMoreRecent(currentVersion, mostRecentVersion);
     if (isNewVersionAvailable) {
diff --git a/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp b/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp
index 3684648d6bb8b1eaee1361bd746a1860eb5ce325..78f98e8ac21bdebfd1cfc1142000ad17c84845b8 100644
--- a/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp
+++ b/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp
@@ -3,7 +3,6 @@
 #include <sstream>
 #include <stdexcept>
 #include <functional>
-#include <iostream>
 #include <set>
 #include <vector>
 #include <Poco/File.h>
diff --git a/Framework/DataHandling/src/FindDetectorsPar.cpp b/Framework/DataHandling/src/FindDetectorsPar.cpp
index a47d89cc73190dcc42beab2306c15fa242ec62ae..ebf13530cb10af84b215944a36f5ec26b906d378 100644
--- a/Framework/DataHandling/src/FindDetectorsPar.cpp
+++ b/Framework/DataHandling/src/FindDetectorsPar.cpp
@@ -13,7 +13,6 @@
 
 #include <Poco/File.h>
 #include <limits>
-#include <iostream>
 
 namespace Mantid {
 namespace DataHandling {
diff --git a/Framework/DataHandling/src/GroupDetectors2.cpp b/Framework/DataHandling/src/GroupDetectors2.cpp
index 060f54bee77e172c5cfa3da87e6294c5f0aea2c2..ff3e821142095f905fda8b80a02507ba33457a8b 100644
--- a/Framework/DataHandling/src/GroupDetectors2.cpp
+++ b/Framework/DataHandling/src/GroupDetectors2.cpp
@@ -353,7 +353,7 @@ void GroupDetectors2::getGroups(API::MatrixWorkspace_const_sptr workspace,
     }
     // check we don't have an index that is too high for the workspace
     size_t maxIn = static_cast<size_t>(workspace->getNumberHistograms() - 1);
-    std::vector<size_t>::const_iterator it = m_GroupSpecInds[0].begin();
+    auto it = m_GroupSpecInds[0].begin();
     for (; it != m_GroupSpecInds[0].end(); ++it) {
       if (*it > maxIn) {
         g_log.error() << "Spectra index " << *it
@@ -375,7 +375,7 @@ void GroupDetectors2::getGroups(API::MatrixWorkspace_const_sptr workspace,
 
   // up date unUsedSpec, this is used to find duplicates and when the user has
   // set KeepUngroupedSpectra
-  std::vector<size_t>::const_iterator index = m_GroupSpecInds[0].begin();
+  auto index = m_GroupSpecInds[0].begin();
   for (; index != m_GroupSpecInds[0].end();
        ++index) { // the vector<int> m_GroupSpecInds[0] must not index contain
                   // numbers that don't exist in the workspaace
@@ -804,6 +804,10 @@ void GroupDetectors2::readFile(spec2index_map &specs2index, std::istream &File,
       numberOfSpectra = readInt(thisLine);
     } while (numberOfSpectra == EMPTY_LINE);
 
+    if (numberOfSpectra <= 0) {
+      throw std::invalid_argument("The number of spectra is zero or negative");
+    }
+
     // the value of this map is the list of spectra numbers that will be
     // combined into a group
     m_GroupSpecInds[spectrumNo].reserve(numberOfSpectra);
diff --git a/Framework/DataHandling/src/ISISDataArchive.cpp b/Framework/DataHandling/src/ISISDataArchive.cpp
index cf814ef149f66db057e227949477c6cddbcad672..033e7187378799512317c1a90cf582ac62de2f57 100644
--- a/Framework/DataHandling/src/ISISDataArchive.cpp
+++ b/Framework/DataHandling/src/ISISDataArchive.cpp
@@ -12,7 +12,6 @@
 #include <Poco/Exception.h>
 
 #include <sstream>
-#include <iostream>
 
 namespace Mantid {
 namespace DataHandling {
diff --git a/Framework/DataHandling/src/LoadAscii.cpp b/Framework/DataHandling/src/LoadAscii.cpp
index 747bd5422b98555db8ceb6e6bff37a5245f66abe..74dda663af566b72c71ca5209a90493ddff03af7 100644
--- a/Framework/DataHandling/src/LoadAscii.cpp
+++ b/Framework/DataHandling/src/LoadAscii.cpp
@@ -24,7 +24,9 @@ using namespace Kernel;
 using namespace API;
 
 /// Empty constructor
-LoadAscii::LoadAscii() : m_columnSep(), m_separatorIndex() {}
+LoadAscii::LoadAscii() : m_columnSep(), m_separatorIndex() {
+  this->useAlgorithm("LoadAscii", 2);
+}
 
 /**
  * Return the confidence with with this algorithm can load the file
diff --git a/Framework/DataHandling/src/LoadEventPreNexus.cpp b/Framework/DataHandling/src/LoadEventPreNexus.cpp
index 2024d53cfc9d8ec6fb544ab442cc61e4e262c815..e6687146f3fab3f327e3d18c3213dddf8b786999 100644
--- a/Framework/DataHandling/src/LoadEventPreNexus.cpp
+++ b/Framework/DataHandling/src/LoadEventPreNexus.cpp
@@ -26,7 +26,6 @@
 #include <sstream>
 #include <stdexcept>
 #include <functional>
-#include <iostream>
 #include <set>
 #include <vector>
 #include <Poco/File.h>
@@ -85,7 +84,9 @@ LoadEventPreNexus::LoadEventPreNexus()
       num_good_events(0), num_error_events(0), num_ignored_events(0),
       first_event(0), max_events(0), using_mapping_file(false),
       loadOnlySomeSpectra(false), spectraLoadMap(), longest_tof(0),
-      shortest_tof(0), parallelProcessing(false) {}
+      shortest_tof(0), parallelProcessing(false) {
+  this->useAlgorithm("LoadEventPreNexus", 2);
+}
 
 LoadEventPreNexus::~LoadEventPreNexus() { delete this->eventfile; }
 
diff --git a/Framework/DataHandling/src/LoadEventPreNexus2.cpp b/Framework/DataHandling/src/LoadEventPreNexus2.cpp
index e50dd9c66b0d7d2a6543b327d8ac164224da4dbc..0b44191476242498ef428a714124c880ef33881c 100644
--- a/Framework/DataHandling/src/LoadEventPreNexus2.cpp
+++ b/Framework/DataHandling/src/LoadEventPreNexus2.cpp
@@ -3,7 +3,6 @@
 #include <sstream>
 #include <stdexcept>
 #include <functional>
-#include <iostream>
 #include <set>
 #include <vector>
 #include <Poco/File.h>
diff --git a/Framework/DataHandling/src/LoadGSS.cpp b/Framework/DataHandling/src/LoadGSS.cpp
index 6f27008e5c7716c5d20e0c65e42499d6eb9cb516..eb228a845fad9e75f85288cf57e9aac4b2626faf 100644
--- a/Framework/DataHandling/src/LoadGSS.cpp
+++ b/Framework/DataHandling/src/LoadGSS.cpp
@@ -14,10 +14,8 @@
 
 #include <boost/math/special_functions/fpclassify.hpp>
 #include <Poco/File.h>
-#include <iostream>
 #include <fstream>
 #include <sstream>
-#include <iomanip>
 
 using namespace Mantid::DataHandling;
 using namespace Mantid::API;
diff --git a/Framework/DataHandling/src/LoadILL.cpp b/Framework/DataHandling/src/LoadILL.cpp
index 0f84c252a6f86a32fa9d6b811cc2a0ead98442ae..402c72e967211aaf27eb2c52f5d8053d50008cbf 100644
--- a/Framework/DataHandling/src/LoadILL.cpp
+++ b/Framework/DataHandling/src/LoadILL.cpp
@@ -14,7 +14,6 @@
 
 #include <limits>
 #include <algorithm>
-#include <iostream>
 #include <vector>
 #include <cmath>
 
diff --git a/Framework/DataHandling/src/LoadILLIndirect.cpp b/Framework/DataHandling/src/LoadILLIndirect.cpp
index 30c647209dfe11825a329fc814826eee2d9cabad..269c04e8bb0d431f50218baa900ddf5c6a1b34f9 100644
--- a/Framework/DataHandling/src/LoadILLIndirect.cpp
+++ b/Framework/DataHandling/src/LoadILLIndirect.cpp
@@ -7,8 +7,6 @@
 #include <boost/algorithm/string.hpp>
 
 #include <nexus/napi.h>
-#include <iostream>
-#include <iomanip> // std::setw
 
 namespace Mantid {
 namespace DataHandling {
diff --git a/Framework/DataHandling/src/LoadILLReflectometry.cpp b/Framework/DataHandling/src/LoadILLReflectometry.cpp
index 2230840c96f62720f70a4ad9adf2b59c79a773ce..18a7f5888d66210f3d3a443a45e13b9af4673e42 100644
--- a/Framework/DataHandling/src/LoadILLReflectometry.cpp
+++ b/Framework/DataHandling/src/LoadILLReflectometry.cpp
@@ -13,7 +13,6 @@
 #include <algorithm>
 
 #include <nexus/napi.h>
-#include <iostream>
 
 namespace Mantid {
 namespace DataHandling {
diff --git a/Framework/DataHandling/src/LoadInstrument.cpp b/Framework/DataHandling/src/LoadInstrument.cpp
index 595dd5d8b1c2906242d08febb2bf4590341193ea..6337801bb66a5e8918a61ebe4f0d90f6ef65c258 100644
--- a/Framework/DataHandling/src/LoadInstrument.cpp
+++ b/Framework/DataHandling/src/LoadInstrument.cpp
@@ -20,7 +20,6 @@
 #include <Poco/Exception.h>
 #include <sstream>
 #include <fstream>
-#include <iostream>
 #include "MantidGeometry/Instrument/InstrumentDefinitionParser.h"
 
 using Poco::XML::DOMParser;
diff --git a/Framework/DataHandling/src/LoadIsawDetCal.cpp b/Framework/DataHandling/src/LoadIsawDetCal.cpp
index 99294d57ece947559d6331666732392507341ad8..5a7ddf61096bc0e18243b50d626eb116159d9055 100644
--- a/Framework/DataHandling/src/LoadIsawDetCal.cpp
+++ b/Framework/DataHandling/src/LoadIsawDetCal.cpp
@@ -21,7 +21,6 @@
 #include <fstream>
 #include <numeric>
 #include <cmath>
-#include <iomanip>
 #include "MantidAPI/WorkspaceValidators.h"
 
 namespace Mantid {
diff --git a/Framework/DataHandling/src/LoadLLB.cpp b/Framework/DataHandling/src/LoadLLB.cpp
index 353f8ccc8b4a1e89701592f71f6d6220277b99be..bc37e7062bcefcc6c1ebd042366bd6936c0577ed 100644
--- a/Framework/DataHandling/src/LoadLLB.cpp
+++ b/Framework/DataHandling/src/LoadLLB.cpp
@@ -7,7 +7,6 @@
 
 #include <limits>
 #include <algorithm>
-#include <iostream>
 #include <vector>
 #include <cmath>
 
diff --git a/Framework/DataHandling/src/LoadLogsForSNSPulsedMagnet.cpp b/Framework/DataHandling/src/LoadLogsForSNSPulsedMagnet.cpp
index 7327e048fb6445863854111b7e63a2c31c916939..f6ec882919c2a00f79be240fba05634083782134 100644
--- a/Framework/DataHandling/src/LoadLogsForSNSPulsedMagnet.cpp
+++ b/Framework/DataHandling/src/LoadLogsForSNSPulsedMagnet.cpp
@@ -4,7 +4,6 @@
 #include "MantidAPI/FileProperty.h"
 #include "MantidKernel/ConfigService.h"
 
-#include <iostream>
 #include <fstream>
 #include <sys/stat.h>
 #include <sstream>
diff --git a/Framework/DataHandling/src/LoadMLZ.cpp b/Framework/DataHandling/src/LoadMLZ.cpp
index 7d2b4b9c94d561a71d319cf29b3a54fe74b5dda5..7f516fd0b87c3293659a9716d160ed8fe7c53742 100644
--- a/Framework/DataHandling/src/LoadMLZ.cpp
+++ b/Framework/DataHandling/src/LoadMLZ.cpp
@@ -12,7 +12,6 @@
 
 #include <limits>
 #include <algorithm>
-#include <iostream>
 #include <vector>
 #include <cmath>
 //-----------------------------------------------------------------------
diff --git a/Framework/DataHandling/src/LoadPreNexusMonitors.cpp b/Framework/DataHandling/src/LoadPreNexusMonitors.cpp
index af5cce8e457c5ff57dc471f3558ac0ee03913784..2ab2dd8416b18d698b3197865c85cf8f8036ce1a 100644
--- a/Framework/DataHandling/src/LoadPreNexusMonitors.cpp
+++ b/Framework/DataHandling/src/LoadPreNexusMonitors.cpp
@@ -1,7 +1,6 @@
 #include <cmath>
 #include <cstdlib>
 #include <fstream>
-#include <iostream>
 #include <iterator>
 
 #include "MantidDataHandling/LoadPreNexusMonitors.h"
diff --git a/Framework/DataHandling/src/LoadQKK.cpp b/Framework/DataHandling/src/LoadQKK.cpp
index 859b592c087dcf441b7443d5963c1562b2e607eb..316cffc185ab4b6e02656661ef7d28664ddee6ac 100644
--- a/Framework/DataHandling/src/LoadQKK.cpp
+++ b/Framework/DataHandling/src/LoadQKK.cpp
@@ -14,9 +14,7 @@
 
 #include <boost/math/special_functions/fpclassify.hpp>
 #include <Poco/File.h>
-#include <iostream>
 #include <fstream>
-#include <iomanip>
 
 using namespace Mantid::DataHandling;
 using namespace Mantid::API;
diff --git a/Framework/DataHandling/src/LoadRaw/isisraw.cpp b/Framework/DataHandling/src/LoadRaw/isisraw.cpp
index 6037ec23a60ae12f7ffbcacb65f8b3695f64bbac..475c96358d3637d62e0030ac41939bca61816f33 100644
--- a/Framework/DataHandling/src/LoadRaw/isisraw.cpp
+++ b/Framework/DataHandling/src/LoadRaw/isisraw.cpp
@@ -460,7 +460,17 @@ int ISISRAW::ioRAW(FILE *file, bool from_file, bool read_data) {
   //		ioRAW(file, &u_len, 1, from_file);
   if (from_file) {
     u_len = add.ad_data - add.ad_user - 2;
+
+    if (u_len < 0 || (add.ad_data < add.ad_user + 2)) {
+      // this will/would be used for memory allocation
+      std::cerr << "Error in u_len value read from file, it would be " << u_len
+                << "; where it is calculated as "
+                   "u_len = ad_data - ad_user - 2, where ad_data: "
+                << add.ad_data << ", ad_user: " << add.ad_user << std::endl;
+      return 0;
+    }
   }
+
   ioRAW(file, &u_dat, u_len, from_file);
   ioRAW(file, &ver8, 1, from_file);
   fgetpos(file, &dhdr_pos);
@@ -474,8 +484,12 @@ int ISISRAW::ioRAW(FILE *file, bool from_file, bool read_data) {
     if (from_file) {
       ndes = t_nper * (t_nsp1 + 1);
       ioRAW(file, &ddes, ndes, from_file);
-      for (i = 0; i < ndes; i++)
-        fseek(file, 4 * ddes[i].nwords, SEEK_CUR);
+      for (i = 0; i < ndes; i++) {
+        int zero = fseek(file, 4 * ddes[i].nwords, SEEK_CUR);
+        if (0 != zero)
+          std::cerr << "Failed to seek position in file for index: " << i
+                    << "\n";
+      }
     }
   } else if (dhdr.d_comp == 0) {
     ndata = t_nper * (t_nsp1 + 1) * (t_ntc1 + 1);
@@ -527,15 +541,38 @@ int ISISRAW::ioRAW(FILE *file, bool from_file, bool read_data) {
     dhdr.d_exp_filesize =
         uncomp_filesize /
         128; // in 512 byte blocks (vms default allocation unit)
-    fgetpos(file, &keep_pos);
+    int zero = fgetpos(file, &keep_pos);
+    if (!zero) {
+      std::cerr << "Error when getting file position: " << strerror(errno)
+                << std::endl;
+      return -1;
+    }
+
     // update section addresses
-    fsetpos(file, &add_pos);
+    zero = fsetpos(file, &add_pos);
+    if (!zero) {
+      std::cerr << "Error when setting file position: " << strerror(errno)
+                << std::endl;
+      return -1;
+    }
+
     ioRAW(file, &add, 1, from_file);
     // update data header and descriptors etc.
-    fsetpos(file, &dhdr_pos);
+    zero = fsetpos(file, &dhdr_pos);
+    if (!zero) {
+      std::cerr << "Error when setting file position to header: "
+                << strerror(errno) << std::endl;
+      return -1;
+    }
+
     ioRAW(file, &dhdr, 1, from_file);
     ioRAW(file, &ddes, ndes, from_file);
-    fsetpos(file, &keep_pos);
+    zero = fsetpos(file, &keep_pos);
+    if (!zero) {
+      std::cerr << "Error when restoring file position: " << strerror(errno)
+                << std::endl;
+      return -1;
+    }
   }
   return 0;
 }
@@ -669,16 +706,18 @@ int ISISRAW::ioRAW(FILE *file, LOG_LINE *s, int len, bool from_file) {
 
 /// stuff
 int ISISRAW::ioRAW(FILE *file, char *s, int len, bool from_file) {
-  size_t n;
   if ((len <= 0) || (s == 0)) {
     return 0;
   }
+
+  size_t n;
   if (from_file) {
     n = fread(s, sizeof(char), len, file);
     return static_cast<int>(n - len);
   } else {
     n = fwrite(s, sizeof(char), len, file);
   }
+
   return 0;
 }
 
@@ -687,11 +726,15 @@ int ISISRAW::ioRAW(FILE *file, int *s, int len, bool from_file) {
   if ((len <= 0) || (s == 0)) {
     return 0;
   }
+
+  size_t n;
   if (from_file) {
-    fread(s, sizeof(int), len, file);
+    n = fread(s, sizeof(int), len, file);
+    return static_cast<int>(n - len);
   } else {
-    fwrite(s, sizeof(int), len, file);
+    n = fwrite(s, sizeof(int), len, file);
   }
+
   return 0;
 }
 
@@ -700,10 +743,13 @@ int ISISRAW::ioRAW(FILE *file, uint32_t *s, int len, bool from_file) {
   if ((len <= 0) || (s == 0)) {
     return 0;
   }
+
+  size_t n;
   if (from_file) {
-    fread(s, sizeof(uint32_t), len, file);
+    n = fread(s, sizeof(uint32_t), len, file);
+    return static_cast<int>(n - len);
   } else {
-    fwrite(s, sizeof(uint32_t), len, file);
+    n = fwrite(s, sizeof(uint32_t), len, file);
   }
   return 0;
 }
@@ -714,12 +760,15 @@ int ISISRAW::ioRAW(FILE *file, float *s, int len, bool from_file) {
   if ((len <= 0) || (s == 0)) {
     return 0;
   }
+
+  size_t n;
   if (from_file) {
-    fread(s, sizeof(float), len, file);
+    n = fread(s, sizeof(float), len, file);
     vaxf_to_local(s, &len, &errcode);
+    return static_cast<int>(n - len);
   } else {
     local_to_vaxf(s, &len, &errcode);
-    fwrite(s, sizeof(float), len, file);
+    n = fwrite(s, sizeof(float), len, file);
     vaxf_to_local(s, &len, &errcode);
   }
   return 0;
@@ -900,36 +949,6 @@ int ISISRAW::readFromFile(const char *filename, bool read_data) {
   }
 }
 
-/// stuff
-int ISISRAW::writeToFile(const char *filename) {
-  unsigned char zero_pad[512];
-  memset(zero_pad, 0, sizeof(zero_pad));
-  remove(filename);
-#ifdef MS_VISUAL_STUDIO
-  FILE *output_file = NULL;
-  if (fopen_s(&output_file, filename, "w+bc") != 0) {
-    return -1;
-  }
-#else  //_WIN32
-  FILE *output_file = fopen(filename, "w+bc");
-#endif //_WIN32
-  if (output_file != NULL) {
-    ioRAW(output_file, false, 0);
-    fflush(output_file);
-    // we need to pad to a multiple of 512 bytes for VMS compatibility
-    fseek(output_file, 0, SEEK_END);
-    long pos = ftell(output_file);
-    if (pos % 512 > 0) {
-      int npad = 512 - pos % 512;
-      fwrite(zero_pad, 1, npad, output_file);
-    }
-    fclose(output_file);
-    return 0;
-  } else {
-    return -1;
-  }
-}
-
 /// stuff
 int ISISRAW::printInfo(std::ostream &os) {
   int i;
diff --git a/Framework/DataHandling/src/LoadRaw/isisraw.h b/Framework/DataHandling/src/LoadRaw/isisraw.h
index c7c419aac95c38cfaaefb20c7d6f262499901955..84d82a06fe282a491b652c79e9f084d907683ecc 100644
--- a/Framework/DataHandling/src/LoadRaw/isisraw.h
+++ b/Framework/DataHandling/src/LoadRaw/isisraw.h
@@ -373,7 +373,6 @@ public:
   int ioRAW(FILE *file, DDES_STRUCT **s, int len, bool from_file);
   int ioRAW(FILE *file, LOG_LINE **s, int len, bool from_file);
   int readFromFile(const char *filename, bool read_data = true);
-  int writeToFile(const char *filename);
   int printInfo(std::ostream &os);
   int getTimeChannels(float *rtcb1, int n);
 };
diff --git a/Framework/DataHandling/src/LoadRaw/isisraw2.cpp b/Framework/DataHandling/src/LoadRaw/isisraw2.cpp
index f4bbb1f41873c6d09032e9d21c667cd829995d36..331b26bb1f8bb3a6758834da87dc064b47ac0d5a 100644
--- a/Framework/DataHandling/src/LoadRaw/isisraw2.cpp
+++ b/Framework/DataHandling/src/LoadRaw/isisraw2.cpp
@@ -95,7 +95,17 @@ int ISISRAW2::ioRAW(FILE *file, bool from_file, bool read_data) {
   //		ISISRAW::ioRAW(file, &u_len, 1, from_file);
   if (from_file) {
     u_len = add.ad_data - add.ad_user - 2;
+
+    if (u_len < 0 || (add.ad_data < add.ad_user + 2)) {
+      // this will/would be used for memory allocation
+      g_log.error() << "Error in u_len value read from file, it would be "
+                    << u_len << "; where it is calculated as "
+                                "u_len = ad_data - ad_user - 2, where ad_data: "
+                    << add.ad_data << ", ad_user: " << add.ad_user << "\n";
+      throw std::runtime_error("Inconsistent value for the field u_len found");
+    }
   }
+
   ISISRAW::ioRAW(file, &u_dat, u_len, from_file);
   ISISRAW::ioRAW(file, &ver8, 1, from_file);
   fgetpos(file, &dhdr_pos);
@@ -115,8 +125,13 @@ int ISISRAW2::ioRAW(FILE *file, bool from_file, bool read_data) {
 /// @param file :: The file pointer
 /// @param i :: The amount of data to skip
 void ISISRAW2::skipData(FILE *file, int i) {
-  if (i < ndes)
-    fseek(file, 4 * ddes[i].nwords, SEEK_CUR);
+  if (i < ndes) {
+    int zero = fseek(file, 4 * ddes[i].nwords, SEEK_CUR);
+    if (0 != zero) {
+      g_log.warning() << "Failed to skip data from file, with value: " << i
+                      << "\n";
+    }
+  }
 }
 
 /// Read data
diff --git a/Framework/DataHandling/src/LoadSINQFocus.cpp b/Framework/DataHandling/src/LoadSINQFocus.cpp
index 096ebd88e5a0502a09025304770cc026c29b3071..59d15f805e84b121b1cac833ae5131c78b734f68 100644
--- a/Framework/DataHandling/src/LoadSINQFocus.cpp
+++ b/Framework/DataHandling/src/LoadSINQFocus.cpp
@@ -7,7 +7,6 @@
 
 #include <limits>
 #include <algorithm>
-#include <iostream>
 #include <vector>
 #include <cmath>
 
diff --git a/Framework/DataHandling/src/LoadSpice2D.cpp b/Framework/DataHandling/src/LoadSpice2D.cpp
index d3c4216fa836dbe4bd7ea0bcd2247be394cf0207..79219379943c9564c7345614c2e7ff3a7af5bb46 100644
--- a/Framework/DataHandling/src/LoadSpice2D.cpp
+++ b/Framework/DataHandling/src/LoadSpice2D.cpp
@@ -23,7 +23,6 @@
 #include <Poco/DOM/Text.h>
 #include <Poco/SAX/InputSource.h>
 
-#include <iostream>
 //-----------------------------------------------------------------------
 
 using Poco::XML::DOMParser;
diff --git a/Framework/DataHandling/src/SNSDataArchive.cpp b/Framework/DataHandling/src/SNSDataArchive.cpp
index 6045f308b664750a869d738b3239a9e859e8664a..028dcde170b592a6ae3672ea4e844d60a827ab44 100644
--- a/Framework/DataHandling/src/SNSDataArchive.cpp
+++ b/Framework/DataHandling/src/SNSDataArchive.cpp
@@ -1,7 +1,6 @@
 //----------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------
-#include <iostream>
 #include <sstream>
 
 #include "MantidKernel/Logger.h"
diff --git a/Framework/DataHandling/src/SaveCSV.cpp b/Framework/DataHandling/src/SaveCSV.cpp
index 9cef6163fd73f6052987747645028d5bd93f5eaf..d73643c83010381ad103c3e75ae2cd31ff594d64 100644
--- a/Framework/DataHandling/src/SaveCSV.cpp
+++ b/Framework/DataHandling/src/SaveCSV.cpp
@@ -27,7 +27,6 @@
 #include "MantidAPI/FileProperty.h"
 
 #include <fstream> // used to get ofstream
-#include <iomanip> // setw() used below
 
 /* @class SaveCSV
 
diff --git a/Framework/DataHandling/src/SaveDiffCal.cpp b/Framework/DataHandling/src/SaveDiffCal.cpp
index 66259ba0ad274d6856f16180cc48240a99e183ca..96c2cbe07747c32a9b817a67505126fa137752eb 100644
--- a/Framework/DataHandling/src/SaveDiffCal.cpp
+++ b/Framework/DataHandling/src/SaveDiffCal.cpp
@@ -30,7 +30,8 @@ DECLARE_ALGORITHM(SaveDiffCal)
 //----------------------------------------------------------------------------------------------
 /** Constructor
  */
-SaveDiffCal::SaveDiffCal() {}
+SaveDiffCal::SaveDiffCal()
+    : m_numValues(0), m_calibrationWS(), m_detidToIndex() {}
 
 //----------------------------------------------------------------------------------------------
 /** Destructor
diff --git a/Framework/DataHandling/src/SaveFocusedXYE.cpp b/Framework/DataHandling/src/SaveFocusedXYE.cpp
index 6da1189b5b82f5fe19fca15a3d58cf30a1c26d19..f6b917b15e21d2aaf92d1af68e3434b3aeae611a 100644
--- a/Framework/DataHandling/src/SaveFocusedXYE.cpp
+++ b/Framework/DataHandling/src/SaveFocusedXYE.cpp
@@ -8,7 +8,6 @@
 #include <Poco/File.h>
 #include <Poco/Path.h>
 #include <fstream>
-#include <iomanip>
 #include <cmath>
 #include <exception>
 
diff --git a/Framework/DataHandling/src/SaveFullprofResolution.cpp b/Framework/DataHandling/src/SaveFullprofResolution.cpp
index 057694d26f34084f38d9c9d58927a26df9275549..5ef18d5b0dbb77ae0f8b397b478ff89c5fc6c910 100644
--- a/Framework/DataHandling/src/SaveFullprofResolution.cpp
+++ b/Framework/DataHandling/src/SaveFullprofResolution.cpp
@@ -8,7 +8,6 @@
 #include <boost/algorithm/string.hpp>
 #include <Poco/File.h>
 
-#include <iomanip>
 #include <fstream>
 
 using namespace Mantid;
diff --git a/Framework/DataHandling/src/SaveGSS.cpp b/Framework/DataHandling/src/SaveGSS.cpp
index d3e1cb6520fd1fc1fb7a60533ab44baabbaf435b..3eaa53e20d4f04437f076959ffe3e940e1c2f0d8 100644
--- a/Framework/DataHandling/src/SaveGSS.cpp
+++ b/Framework/DataHandling/src/SaveGSS.cpp
@@ -11,7 +11,6 @@
 #include <Poco/File.h>
 #include <Poco/Path.h>
 #include <fstream>
-#include <iomanip>
 
 namespace Mantid {
 namespace DataHandling {
@@ -411,6 +410,7 @@ void writeLogValue(std::ostream &os, const Run &runinfo,
 void SaveGSS::writeHeaders(const std::string &format, std::stringstream &os,
                            double primaryflightpath) const {
   const Run &runinfo = inputWS->run();
+  std::ios::fmtflags fflags(os.flags());
 
   // Run number
   if (format.compare(SLOG) == 0) {
@@ -484,6 +484,8 @@ void SaveGSS::writeHeaders(const std::string &format, std::stringstream &os,
     os << "\n";
   }
 
+  os.flags(fflags);
+
   return;
 }
 
@@ -492,10 +494,12 @@ void SaveGSS::writeHeaders(const std::string &format, std::stringstream &os,
   */
 inline void writeBankLine(std::stringstream &out, const std::string &bintype,
                           const int banknum, const size_t datasize) {
+  std::ios::fmtflags fflags(out.flags());
   out << "BANK " << std::fixed << std::setprecision(0)
       << banknum // First bank should be 1 for GSAS; this can be changed
       << std::fixed << " " << datasize << std::fixed << " " << datasize
       << std::fixed << " " << bintype;
+  out.flags(fflags);
 }
 
 //----------------------------------------------------------------------------------------------
diff --git a/Framework/DataHandling/src/SaveNISTDAT.cpp b/Framework/DataHandling/src/SaveNISTDAT.cpp
index 38441e68e44ab90d19fe8c73af59ecc541a6a458..0b32dc7d6dcf8e41fed88f6c0715e9cdc582aa21 100644
--- a/Framework/DataHandling/src/SaveNISTDAT.cpp
+++ b/Framework/DataHandling/src/SaveNISTDAT.cpp
@@ -5,7 +5,6 @@
 #include "MantidAPI/FileProperty.h"
 #include "MantidAPI/WorkspaceValidators.h"
 #include <fstream> // used to get ofstream
-#include <iostream>
 
 namespace Mantid {
 namespace DataHandling {
diff --git a/Framework/DataHandling/src/SavePAR.cpp b/Framework/DataHandling/src/SavePAR.cpp
index d318f94f549b5072121b412dc0b0a41673fd668e..bf4ea3d2395a941f182cc0b72ebe719a69d24fa9 100644
--- a/Framework/DataHandling/src/SavePAR.cpp
+++ b/Framework/DataHandling/src/SavePAR.cpp
@@ -8,7 +8,6 @@
 
 #include <cstdio>
 #include <fstream>
-#include <iomanip>
 
 namespace Mantid {
 namespace DataHandling {
diff --git a/Framework/DataHandling/src/SavePDFGui.cpp b/Framework/DataHandling/src/SavePDFGui.cpp
index e6c1c2e622d94e525fbce57e4fd959bd4243b81f..5afcbc2d76bcc9e1aef9f24b8b38b8bf08d609fc 100644
--- a/Framework/DataHandling/src/SavePDFGui.cpp
+++ b/Framework/DataHandling/src/SavePDFGui.cpp
@@ -2,7 +2,6 @@
 #include "MantidAPI/FileProperty.h"
 #include "MantidKernel/MantidVersion.h"
 #include <fstream>
-#include <iomanip>
 
 namespace Mantid {
 namespace DataHandling {
diff --git a/Framework/DataHandling/src/SavePHX.cpp b/Framework/DataHandling/src/SavePHX.cpp
index 7c221896f8be4c88e1ae055a6dfd1bfad7bb027c..579ba691415232329674dca274aee32009a4a907 100644
--- a/Framework/DataHandling/src/SavePHX.cpp
+++ b/Framework/DataHandling/src/SavePHX.cpp
@@ -8,7 +8,6 @@
 
 #include <cstdio>
 #include <fstream>
-#include <iomanip>
 
 namespace Mantid {
 namespace DataHandling {
diff --git a/Framework/DataHandling/src/SaveRKH.cpp b/Framework/DataHandling/src/SaveRKH.cpp
index 33316a700ba158eaf07f5d19761ebac94d586452..0caf9bc73b08d734b1e07e9cdeb799c9b1501e43 100644
--- a/Framework/DataHandling/src/SaveRKH.cpp
+++ b/Framework/DataHandling/src/SaveRKH.cpp
@@ -7,8 +7,6 @@
 #include <Poco/LocalDateTime.h>
 #include <Poco/DateTimeFormatter.h>
 
-#include <iomanip>
-
 namespace Mantid {
 namespace DataHandling {
 
diff --git a/Framework/DataHandling/test/AppendGeometryToSNSNexusTest.h b/Framework/DataHandling/test/AppendGeometryToSNSNexusTest.h
index 14df378e7575cd321a132031ccc29bc906eaf5c7..4d8dc7386436b7b97358ec94991e4a70882f9fba 100644
--- a/Framework/DataHandling/test/AppendGeometryToSNSNexusTest.h
+++ b/Framework/DataHandling/test/AppendGeometryToSNSNexusTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidDataHandling/AppendGeometryToSNSNexus.h"
 
diff --git a/Framework/DataHandling/test/CheckMantidVersionTest.h b/Framework/DataHandling/test/CheckMantidVersionTest.h
index d6c1e17a95dc93acdedd0d93979488ee0e964ce3..d7cf6155fca679d6c730a2f7b7f5e55354adddb4 100644
--- a/Framework/DataHandling/test/CheckMantidVersionTest.h
+++ b/Framework/DataHandling/test/CheckMantidVersionTest.h
@@ -77,7 +77,8 @@ private:
         "\"https://api.github.com/users/peterfpeterson/received_events\",\n"
         "    \"type\": \"User\",\n"
         "    \"site_admin\": false\n"
-        "  }";
+        "  }\n"
+        "}";
 
     return outputString;
   }
diff --git a/Framework/DataHandling/test/CompressEventsTest.h b/Framework/DataHandling/test/CompressEventsTest.h
index 5523f08c4afc2f2f2e63b86e0f509ce66a691392..1c2981657a414f0a56850c200ced1b9dd6c6afd6 100644
--- a/Framework/DataHandling/test/CompressEventsTest.h
+++ b/Framework/DataHandling/test/CompressEventsTest.h
@@ -6,7 +6,6 @@
 #include "MantidDataHandling/CompressEvents.h"
 #include "MantidDataObjects/Workspace2D.h"
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
-#include <iostream>
 
 using Mantid::MantidVecPtr;
 using namespace Mantid::Kernel;
diff --git a/Framework/DataHandling/test/DetermineChunkingTest.h b/Framework/DataHandling/test/DetermineChunkingTest.h
index cf2f5bc2c6142c456743d6c3c3f6b48c668245e7..b15a648fa30b8751bfc4dd1e4ccfe52778001314 100644
--- a/Framework/DataHandling/test/DetermineChunkingTest.h
+++ b/Framework/DataHandling/test/DetermineChunkingTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidDataHandling/DetermineChunking.h"
 #include "MantidDataObjects/TableWorkspace.h"
diff --git a/Framework/DataHandling/test/DownloadInstrumentTest.h b/Framework/DataHandling/test/DownloadInstrumentTest.h
index 587b9fe1e47fa6d085dcb43ab83413d70280e5bd..fb5e0e482000d0a8efb3dc50aa4abd9157edb68f 100644
--- a/Framework/DataHandling/test/DownloadInstrumentTest.h
+++ b/Framework/DataHandling/test/DownloadInstrumentTest.h
@@ -10,7 +10,6 @@
 #include <Poco/File.h>
 #include <Poco/Path.h>
 
-#include <iostream>
 #include <fstream>
 #include <string>
 #include <cstdio>
diff --git a/Framework/DataHandling/test/FilterEventsByLogValuePreNexusTest.h b/Framework/DataHandling/test/FilterEventsByLogValuePreNexusTest.h
index 7cc915f7298bcff463344a31afe7092aca1f0791..0358926efa0edbd7bb46be3308424b57a6816aab 100644
--- a/Framework/DataHandling/test/FilterEventsByLogValuePreNexusTest.h
+++ b/Framework/DataHandling/test/FilterEventsByLogValuePreNexusTest.h
@@ -16,7 +16,6 @@
 #include "MantidKernel/TimeSeriesProperty.h"
 #include "MantidDataHandling/FilterEventsByLogValuePreNexus.h"
 #include <cxxtest/TestSuite.h>
-#include <iostream>
 #include <Poco/File.h>
 
 using namespace Mantid::Geometry;
diff --git a/Framework/DataHandling/test/GenerateGroupingPowderTest.h b/Framework/DataHandling/test/GenerateGroupingPowderTest.h
index f4476d6057a04f38bdc8625385be0f707aba919b..85b0c8fd37dfbeccc5609b5f5a3629e7697c4e76 100644
--- a/Framework/DataHandling/test/GenerateGroupingPowderTest.h
+++ b/Framework/DataHandling/test/GenerateGroupingPowderTest.h
@@ -4,9 +4,7 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
 #include <fstream>
-#include <iomanip>
 #include "MantidDataHandling/LoadEmptyInstrument.h"
 #include "MantidDataHandling/GenerateGroupingPowder.h"
 #include "MantidDataHandling/LoadDetectorsGroupingFile.h"
diff --git a/Framework/DataHandling/test/GroupDetectors2Test.h b/Framework/DataHandling/test/GroupDetectors2Test.h
index f6ba151d45ebaedfe3a48131cb3c9b2679f17451..0d1e297b86b85bdcfa52639486b6ebd40fd985f5 100644
--- a/Framework/DataHandling/test/GroupDetectors2Test.h
+++ b/Framework/DataHandling/test/GroupDetectors2Test.h
@@ -15,7 +15,6 @@
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
 #include <cxxtest/TestSuite.h>
 #include <fstream>
-#include <iostream>
 #include <numeric>
 #include <Poco/Path.h>
 #include "MantidDataHandling/MaskDetectors.h"
diff --git a/Framework/DataHandling/test/GroupDetectorsTest.h b/Framework/DataHandling/test/GroupDetectorsTest.h
index a8f801e769a6919c2e945e1ae44c0284e07ff4bf..ab826382895e670051a5c6cfda66279e687afb20 100644
--- a/Framework/DataHandling/test/GroupDetectorsTest.h
+++ b/Framework/DataHandling/test/GroupDetectorsTest.h
@@ -11,7 +11,6 @@
 #include "MantidGeometry/Instrument.h"
 #include "MantidGeometry/Instrument/Detector.h"
 #include "MantidGeometry/Instrument/DetectorGroup.h"
-#include <iostream>
 
 using Mantid::DataHandling::GroupDetectors;
 using Mantid::MantidVecPtr;
diff --git a/Framework/DataHandling/test/LoadCalFileTest.h b/Framework/DataHandling/test/LoadCalFileTest.h
index c673ee55dff66f2722883ff3ddc8939cbf39542a..6299545b388b1333c890ba3fc85b613977d196ea 100644
--- a/Framework/DataHandling/test/LoadCalFileTest.h
+++ b/Framework/DataHandling/test/LoadCalFileTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidDataHandling/LoadCalFile.h"
 #include "MantidDataObjects/GroupingWorkspace.h"
diff --git a/Framework/DataHandling/test/LoadDetectorInfoTest.h b/Framework/DataHandling/test/LoadDetectorInfoTest.h
index fec164099da7d0619a2041f313ee669dc76e6b2c..106258dba36758744cff9102c07278d90c9c4914 100644
--- a/Framework/DataHandling/test/LoadDetectorInfoTest.h
+++ b/Framework/DataHandling/test/LoadDetectorInfoTest.h
@@ -19,7 +19,6 @@
 #include <algorithm>
 #include <fstream>
 #include <vector>
-#include <iostream>
 #include <boost/lexical_cast.hpp>
 #include <nexus/NeXusFile.hpp>
 
diff --git a/Framework/DataHandling/test/LoadDetectorsGroupingFileTest.h b/Framework/DataHandling/test/LoadDetectorsGroupingFileTest.h
index e71c52d34afdbc2c7c4e4c2819d99b0895deeac3..90765cb64596b99fe15ba5777426106486a996e4 100644
--- a/Framework/DataHandling/test/LoadDetectorsGroupingFileTest.h
+++ b/Framework/DataHandling/test/LoadDetectorsGroupingFileTest.h
@@ -11,8 +11,6 @@
 #include "Poco/File.h"
 
 #include <cxxtest/TestSuite.h>
-#include <iostream>
-#include <iomanip>
 #include <fstream>
 
 using namespace Mantid;
diff --git a/Framework/DataHandling/test/LoadDspacemapTest.h b/Framework/DataHandling/test/LoadDspacemapTest.h
index d5714fe3713dadecf4b9bb5e57f800d1b7fc3fc5..d00455638b4fb0e6c1aa1a1cd2077560b1c4c5c8 100644
--- a/Framework/DataHandling/test/LoadDspacemapTest.h
+++ b/Framework/DataHandling/test/LoadDspacemapTest.h
@@ -10,8 +10,6 @@
 #include <cstring>
 #include <cxxtest/TestSuite.h>
 #include <fstream>
-#include <iomanip>
-#include <iostream>
 #include <vector>
 
 using namespace Mantid::DataHandling;
diff --git a/Framework/DataHandling/test/LoadEventNexusTest.h b/Framework/DataHandling/test/LoadEventNexusTest.h
index 7b53cf6a34a889f9260087e47f63d984462847f0..9ce546c2c3ad11681bb72ee28dcb039a008ef9cd 100644
--- a/Framework/DataHandling/test/LoadEventNexusTest.h
+++ b/Framework/DataHandling/test/LoadEventNexusTest.h
@@ -11,7 +11,6 @@
 #include "MantidKernel/TimeSeriesProperty.h"
 #include "MantidDataHandling/LoadEventNexus.h"
 #include <cxxtest/TestSuite.h>
-#include <iostream>
 
 using namespace Mantid::Geometry;
 using namespace Mantid::API;
diff --git a/Framework/DataHandling/test/LoadInstrumentTest.h b/Framework/DataHandling/test/LoadInstrumentTest.h
index b488f7c14586c018af3972250df1ff79555a2908..497edfa26b5c2cc8a3276688360886559228c599 100644
--- a/Framework/DataHandling/test/LoadInstrumentTest.h
+++ b/Framework/DataHandling/test/LoadInstrumentTest.h
@@ -17,7 +17,6 @@
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
 #include <cxxtest/TestSuite.h>
 #include <fstream>
-#include <iostream>
 #include <string>
 #include <vector>
 #include "MantidAPI/ExperimentInfo.h"
diff --git a/Framework/DataHandling/test/LoadMaskTest.h b/Framework/DataHandling/test/LoadMaskTest.h
index 4003dc57e5785e661032528e1290fa76a33a7e8e..a44631c89ccc8894e17885b2956c4b6cfe05ac24 100644
--- a/Framework/DataHandling/test/LoadMaskTest.h
+++ b/Framework/DataHandling/test/LoadMaskTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 #include <sstream>
 
 #include "boost/assign/list_of.hpp"
diff --git a/Framework/DataHandling/test/LoadNXSPETest.h b/Framework/DataHandling/test/LoadNXSPETest.h
index 2f878a61a5946ed682849b57ba9f6483e5c13f4f..f2c7994e83db5e2451a1b746dd750ea8315a5e8d 100644
--- a/Framework/DataHandling/test/LoadNXSPETest.h
+++ b/Framework/DataHandling/test/LoadNXSPETest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidDataHandling/LoadNXSPE.h"
 
diff --git a/Framework/DataHandling/test/LoadNexusLogsTest.h b/Framework/DataHandling/test/LoadNexusLogsTest.h
index 068c4a56b1470669870dff9f7ae201ee5cafc357..7e8f678637b6a91d589696c48e4d3f1d7a79e9c9 100644
--- a/Framework/DataHandling/test/LoadNexusLogsTest.h
+++ b/Framework/DataHandling/test/LoadNexusLogsTest.h
@@ -17,7 +17,6 @@ using namespace Mantid::DataHandling;
 
 #include <cxxtest/TestSuite.h>
 #include "MantidAPI/WorkspaceGroup.h"
-#include <iostream>
 
 class LoadNexusLogsTest : public CxxTest::TestSuite {
 public:
diff --git a/Framework/DataHandling/test/LoadParameterFileTest.h b/Framework/DataHandling/test/LoadParameterFileTest.h
index 55c38c44234792cba6d54f07c20b4e73df8950bf..8492f8086b89f8d6627e213e1021459dba9ffb76 100644
--- a/Framework/DataHandling/test/LoadParameterFileTest.h
+++ b/Framework/DataHandling/test/LoadParameterFileTest.h
@@ -12,7 +12,6 @@
 #include "MantidAPI/Algorithm.h"
 
 #include <vector>
-#include <iostream>
 
 using namespace Mantid::API;
 using namespace Mantid::Kernel;
diff --git a/Framework/DataHandling/test/LoadPreNexusTest.h b/Framework/DataHandling/test/LoadPreNexusTest.h
index 6b683bfb06d64d10cab4eff6ae118e41026cd311..ebaec312a33fe377d89468c01523a18517141d9c 100644
--- a/Framework/DataHandling/test/LoadPreNexusTest.h
+++ b/Framework/DataHandling/test/LoadPreNexusTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidDataHandling/LoadPreNexus.h"
 
diff --git a/Framework/DataHandling/test/LoadSNSNexusTest.h b/Framework/DataHandling/test/LoadSNSNexusTest.h
index 53c71ebbadff62e5c2b2ff34e27205c060c1b075..dc1ada623d3326bc69f12198b9f5e3e221950a3d 100644
--- a/Framework/DataHandling/test/LoadSNSNexusTest.h
+++ b/Framework/DataHandling/test/LoadSNSNexusTest.h
@@ -15,7 +15,6 @@ using namespace Mantid::Kernel;
 
 #include <cxxtest/TestSuite.h>
 #include "MantidAPI/WorkspaceGroup.h"
-#include <iostream>
 
 class LoadSNSNexusTest : public CxxTest::TestSuite {
 public:
diff --git a/Framework/DataHandling/test/LoadVulcanCalFileTest.h b/Framework/DataHandling/test/LoadVulcanCalFileTest.h
index 2e97a33fd059197e38585ddbe26bdc0dafa52e2c..c4855a01b93816753524ac0443e601ad1e911452 100644
--- a/Framework/DataHandling/test/LoadVulcanCalFileTest.h
+++ b/Framework/DataHandling/test/LoadVulcanCalFileTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidDataHandling/LoadVulcanCalFile.h"
 #include "MantidDataObjects/GroupingWorkspace.h"
diff --git a/Framework/DataHandling/test/MergeLogsTest.h b/Framework/DataHandling/test/MergeLogsTest.h
index 9676875b9e92b45f747054e54d52962ce11158e9..3983186be0450deadd48b0bba4b7d046439499ba 100644
--- a/Framework/DataHandling/test/MergeLogsTest.h
+++ b/Framework/DataHandling/test/MergeLogsTest.h
@@ -8,8 +8,6 @@
 #include "MantidAPI/WorkspaceFactory.h"
 #include "MantidKernel/TimeSeriesProperty.h"
 #include "MantidKernel/DateAndTime.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidDataHandling/MergeLogs.h"
 
diff --git a/Framework/DataHandling/test/ModifyDetectorDotDatFileTest.h b/Framework/DataHandling/test/ModifyDetectorDotDatFileTest.h
index 28f323b8d9d1ea7ad63454f369fd3f992b8e7f6c..025d4d4ef3f4089d6b44b5459e8217415afc2eaf 100644
--- a/Framework/DataHandling/test/ModifyDetectorDotDatFileTest.h
+++ b/Framework/DataHandling/test/ModifyDetectorDotDatFileTest.h
@@ -4,9 +4,7 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
 #include <sstream>
-#include <iomanip>
 
 #include "MantidDataHandling/ModifyDetectorDotDatFile.h"
 #include "MantidDataHandling/LoadEmptyInstrument.h"
diff --git a/Framework/DataHandling/test/MoveInstrumentComponentTest.h b/Framework/DataHandling/test/MoveInstrumentComponentTest.h
index f797f70b4e477447c2d1ac201f90dc8c5c105842..83b5522ab4c73d9bc92dd1557c5fc6e2acdd587e 100644
--- a/Framework/DataHandling/test/MoveInstrumentComponentTest.h
+++ b/Framework/DataHandling/test/MoveInstrumentComponentTest.h
@@ -15,7 +15,6 @@
 #include "MantidGeometry/Instrument/Component.h"
 #include "MantidGeometry/Instrument/Detector.h"
 #include <vector>
-#include <iostream>
 
 using namespace Mantid::API;
 using namespace Mantid::Kernel;
diff --git a/Framework/DataHandling/test/NexusTesterTest.h b/Framework/DataHandling/test/NexusTesterTest.h
index 3c7e10dca2f201da7c4d094da59225872941dce1..53b59b9a484d71a61a36146c4cf65c3240e3e3a3 100644
--- a/Framework/DataHandling/test/NexusTesterTest.h
+++ b/Framework/DataHandling/test/NexusTesterTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidDataHandling/NexusTester.h"
 #include <Poco/File.h>
diff --git a/Framework/DataHandling/test/ProcessDasNexusLogTest.h b/Framework/DataHandling/test/ProcessDasNexusLogTest.h
index 0751b97d0b8161800dea8f6363f3e062cd0fbb73..57034fe9926bcb8834198420f90c612547584324 100644
--- a/Framework/DataHandling/test/ProcessDasNexusLogTest.h
+++ b/Framework/DataHandling/test/ProcessDasNexusLogTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidDataHandling/ProcessDasNexusLog.h"
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
diff --git a/Framework/DataHandling/test/RawFileInfoTest.h b/Framework/DataHandling/test/RawFileInfoTest.h
index 6a6a4de6443788e556e5f5c2a0c6d650f494cd09..ad68b2485b0afdf7c8f313e03a2b738e300f6929 100644
--- a/Framework/DataHandling/test/RawFileInfoTest.h
+++ b/Framework/DataHandling/test/RawFileInfoTest.h
@@ -5,9 +5,6 @@
 #include "MantidDataHandling/RawFileInfo.h"
 #include "MantidAPI/ITableWorkspace.h"
 
-#include <iostream>
-#include <iomanip>
-
 using namespace Mantid::DataHandling;
 
 class RawFileInfoTest : public CxxTest::TestSuite {
diff --git a/Framework/DataHandling/test/RenameLogTest.h b/Framework/DataHandling/test/RenameLogTest.h
index 9a561afd1d996b8c6163a397573b5a6029967b23..4363e39e1751c9aa42f3cd7b931f5271aa09faaf 100644
--- a/Framework/DataHandling/test/RenameLogTest.h
+++ b/Framework/DataHandling/test/RenameLogTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidDataHandling/RenameLog.h"
 #include "MantidKernel/TimeSeriesProperty.h"
diff --git a/Framework/DataHandling/test/SaveCalFileTest.h b/Framework/DataHandling/test/SaveCalFileTest.h
index bf9edf3f913fb6f5e2ae430bc9ba6a08155060a0..cdd7025bb62c4c66ac33de8ed84cc96ef0be0039 100644
--- a/Framework/DataHandling/test/SaveCalFileTest.h
+++ b/Framework/DataHandling/test/SaveCalFileTest.h
@@ -12,8 +12,6 @@
 #include <cxxtest/TestSuite.h>
 #include <Poco/File.h>
 #include <fstream>
-#include <iomanip>
-#include <iostream>
 #include <iosfwd>
 
 using namespace Mantid::DataHandling;
diff --git a/Framework/DataHandling/test/SaveDaveGrpTest.h b/Framework/DataHandling/test/SaveDaveGrpTest.h
index a9d6fce08001a725f21ea7c2add7d86fb6a1340e..c3b009b45f0b07e6137bbcda114f1da24244b918 100644
--- a/Framework/DataHandling/test/SaveDaveGrpTest.h
+++ b/Framework/DataHandling/test/SaveDaveGrpTest.h
@@ -4,9 +4,7 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
 #include <fstream>
-#include <iomanip>
 #include "MantidDataHandling/LoadEventNexus.h"
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
 #include "MantidDataHandling/SaveDaveGrp.h"
diff --git a/Framework/DataHandling/test/SaveDetectorsGroupingTest.h b/Framework/DataHandling/test/SaveDetectorsGroupingTest.h
index cc66311ef92c90840647634e3b71f3b899893640..bd3b2f93e9e5c26922cf22bb9ef254401c002cc3 100644
--- a/Framework/DataHandling/test/SaveDetectorsGroupingTest.h
+++ b/Framework/DataHandling/test/SaveDetectorsGroupingTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidDataHandling/SaveDetectorsGrouping.h"
 #include "MantidDataHandling/LoadDetectorsGroupingFile.h"
diff --git a/Framework/DataHandling/test/SaveDspacemapTest.h b/Framework/DataHandling/test/SaveDspacemapTest.h
index 5a90c23d6266b13a618b0db982ba6a8c9fb26cb7..4b2bbffb535bd59aceb4cc4f44c27163f5ff21d5 100644
--- a/Framework/DataHandling/test/SaveDspacemapTest.h
+++ b/Framework/DataHandling/test/SaveDspacemapTest.h
@@ -8,8 +8,6 @@
 #include "MantidKernel/Timer.h"
 #include "MantidTestHelpers/ComponentCreationHelper.h"
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 #include <Poco/File.h>
 
 using namespace Mantid::DataHandling;
diff --git a/Framework/DataHandling/test/SaveFullprofResolutionTest.h b/Framework/DataHandling/test/SaveFullprofResolutionTest.h
index 7b5648dfa604a84724aa830a47be5b322e9354f0..c2da2add45ee3a28a2db169b951e6e92277c8353 100644
--- a/Framework/DataHandling/test/SaveFullprofResolutionTest.h
+++ b/Framework/DataHandling/test/SaveFullprofResolutionTest.h
@@ -10,7 +10,6 @@
 #include <Poco/File.h>
 
 #include <fstream>
-#include <iostream>
 
 using namespace std;
 using namespace Mantid;
diff --git a/Framework/DataHandling/test/SaveIsawDetCalTest.h b/Framework/DataHandling/test/SaveIsawDetCalTest.h
index 780f05166b8d4b97fe1aa66ad81fd0caff44122b..88c63a3e415b5621da479217ee00c05a5638936f 100644
--- a/Framework/DataHandling/test/SaveIsawDetCalTest.h
+++ b/Framework/DataHandling/test/SaveIsawDetCalTest.h
@@ -7,8 +7,6 @@
 #include "MantidKernel/System.h"
 #include "MantidKernel/Timer.h"
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 #include <Poco/File.h>
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
 
diff --git a/Framework/DataHandling/test/SaveMaskTest.h b/Framework/DataHandling/test/SaveMaskTest.h
index d2503727ad0f554306e4543822e80cabc86867ce..5f10a4447ccef6b98b2b9c928784e0fe429e8742 100644
--- a/Framework/DataHandling/test/SaveMaskTest.h
+++ b/Framework/DataHandling/test/SaveMaskTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidDataHandling/SaveMask.h"
 #include "MantidDataHandling/LoadMask.h"
diff --git a/Framework/DataHandling/test/XMLInstrumentParameterTest.h b/Framework/DataHandling/test/XMLInstrumentParameterTest.h
index 2cf0226dfa943284b02c635fa09ffeea6c7d32cb..4e022520d27dc7d60a663338d0723b6255371a84 100644
--- a/Framework/DataHandling/test/XMLInstrumentParameterTest.h
+++ b/Framework/DataHandling/test/XMLInstrumentParameterTest.h
@@ -11,8 +11,6 @@
 #include "MantidKernel/ConfigService.h"
 #include "MantidKernel/TimeSeriesProperty.h"
 
-#include <iostream>
-
 using namespace Mantid::API;
 using namespace Mantid::Kernel;
 using namespace Mantid::DataHandling;
diff --git a/Framework/DataObjects/inc/MantidDataObjects/CalculateReflectometryQxQz.h b/Framework/DataObjects/inc/MantidDataObjects/CalculateReflectometryQxQz.h
index 2656b0085f6924d57618e626b151cacf0d9d1508..7256f47e3bbb7c5b3a8a1936b742f8c057749b9f 100644
--- a/Framework/DataObjects/inc/MantidDataObjects/CalculateReflectometryQxQz.h
+++ b/Framework/DataObjects/inc/MantidDataObjects/CalculateReflectometryQxQz.h
@@ -22,7 +22,8 @@ public:
   /**
    Constructor
    */
-  CalculateReflectometryQxQz() : m_dirQx(0.0), m_dirQz(0.0) {}
+  CalculateReflectometryQxQz()
+      : m_cos_theta_i(0.0), m_sin_theta_i(0.0), m_dirQx(0.0), m_dirQz(0.0) {}
 
   /**
    Setter for the incident theta value require for the calculation. Internally
diff --git a/Framework/DataObjects/inc/MantidDataObjects/MDGridBox.tcc b/Framework/DataObjects/inc/MantidDataObjects/MDGridBox.tcc
index d03eb54542a77ee0bdd2b9cd5f04adcf3020215a..4de121711232aa6c6a24fd477c7118097ca62778 100644
--- a/Framework/DataObjects/inc/MantidDataObjects/MDGridBox.tcc
+++ b/Framework/DataObjects/inc/MantidDataObjects/MDGridBox.tcc
@@ -40,10 +40,10 @@ namespace DataObjects {
  */
 TMDE(MDGridBox)::MDGridBox(
     BoxController *const bc, const uint32_t depth,
-    const std::vector<
-        Mantid::Geometry::MDDimensionExtents<coord_t>> &extentsVector)
-    : MDBoxBase<MDE, nd>(bc, depth, UNDEF_SIZET, extentsVector),
-      numBoxes(0), m_Children(), diagonalSquared(0.f), nPoints(0) {
+    const std::vector<Mantid::Geometry::MDDimensionExtents<coord_t>> &
+        extentsVector)
+    : MDBoxBase<MDE, nd>(bc, depth, UNDEF_SIZET, extentsVector), numBoxes(0),
+      m_Children(), diagonalSquared(0.f), nPoints(0) {
   initGridBox();
 }
 
@@ -55,8 +55,8 @@ TMDE(MDGridBox)::MDGridBox(
 */
 TMDE(MDGridBox)::MDGridBox(
     boost::shared_ptr<API::BoxController> &bc, const uint32_t depth,
-    const std::vector<
-        Mantid::Geometry::MDDimensionExtents<coord_t>> &extentsVector)
+    const std::vector<Mantid::Geometry::MDDimensionExtents<coord_t>> &
+        extentsVector)
     : MDBoxBase<MDE, nd>(bc.get(), depth, UNDEF_SIZET, extentsVector),
       numBoxes(0), m_Children(), diagonalSquared(0.f), nPoints(0) {
   initGridBox();
@@ -68,17 +68,16 @@ template <typename MDE, size_t nd> size_t MDGridBox<MDE, nd>::initGridBox() {
         "MDGridBox::ctor(): No BoxController specified in box.");
 
   // How many is it split?
-  // If we are at the top level and we have a specific top level split, then set it.
-  boost::optional<std::vector<size_t>> splitTopInto = this->m_BoxController->getSplitTopInto();
-  if (this->getDepth() == 0 && splitTopInto)
-  {
+  // If we are at the top level and we have a specific top level split, then set
+  // it.
+  boost::optional<std::vector<size_t>> splitTopInto =
+      this->m_BoxController->getSplitTopInto();
+  if (this->getDepth() == 0 && splitTopInto) {
     for (size_t d = 0; d < nd; d++)
       split[d] = splitTopInto.get()[d];
-  }
-  else
-  {
-   for (size_t d = 0; d < nd; d++)
-    split[d] = this->m_BoxController->getSplitInto(d);
+  } else {
+    for (size_t d = 0; d < nd; d++)
+      split[d] = this->m_BoxController->getSplitInto(d);
   }
 
   // Compute sizes etc.
@@ -94,10 +93,9 @@ template <typename MDE, size_t nd> size_t MDGridBox<MDE, nd>::initGridBox() {
  * @param box :: MDBox containing the events to split
  */
 TMDE(MDGridBox)::MDGridBox(MDBox<MDE, nd> *box)
-    : MDBoxBase<MDE, nd>(*box, box->getBoxController()), split(),
-      splitCumul(), m_SubBoxSize(), numBoxes(0), m_Children(),
-      diagonalSquared(0.f), nPoints(0)
-{
+    : MDBoxBase<MDE, nd>(*box, box->getBoxController()), split(), splitCumul(),
+      m_SubBoxSize(), numBoxes(0), m_Children(), diagonalSquared(0.f),
+      nPoints(0) {
   size_t totalSize = initGridBox();
 
   double ChildVol(1);
@@ -188,10 +186,10 @@ void MDGridBox<MDE, nd>::fillBoxShell(const size_t tot,
  */
 TMDE(MDGridBox)::MDGridBox(const MDGridBox<MDE, nd> &other,
                            Mantid::API::BoxController *const otherBC)
-    : MDBoxBase<MDE, nd>(other, otherBC), numBoxes(other.numBoxes), m_Children(),
-      diagonalSquared(other.diagonalSquared), nPoints(other.nPoints) {
-  for (size_t d = 0; d < nd; d++) 
-  {
+    : MDBoxBase<MDE, nd>(other, otherBC), numBoxes(other.numBoxes),
+      m_Children(), diagonalSquared(other.diagonalSquared),
+      nPoints(other.nPoints) {
+  for (size_t d = 0; d < nd; d++) {
     split[d] = other.split[d];
     splitCumul[d] = other.splitCumul[d];
     m_SubBoxSize[d] = other.m_SubBoxSize[d];
@@ -415,7 +413,7 @@ TMDE(std::vector<MDE> *MDGridBox)::getEventsCopy() {
  */
 TMDE(void MDGridBox)::getBoxes(std::vector<API::IMDNode *> &outBoxes,
                                size_t maxDepth, bool leafOnly) {
- //Add this box, unless we only want the leaves
+  // Add this box, unless we only want the leaves
   if (!leafOnly)
     outBoxes.push_back(this);
 
@@ -1465,8 +1463,9 @@ TMDE(void MDGridBox)::integrateCylinder(
       coord_t out[nd];
       radiusTransform.apply(boxCenter, out);
       if (out[0] < std::sqrt(diagonalSquared * 0.72 + radius * radius) &&
-          std::fabs(out[1]) <
-              std::sqrt(diagonalSquared * 0.72 + 0.25 * length * length)) {
+          (nd >= 1 &&
+           std::fabs(out[1]) <
+               std::sqrt(diagonalSquared * 0.72 + 0.25 * length * length))) {
         // If the center is closer than the size of the box, then it MIGHT be
         // touching.
         // (We multiply by 0.72 (about sqrt(2)) to look for half the diagonal).
diff --git a/Framework/DataObjects/src/CoordTransformAffine.cpp b/Framework/DataObjects/src/CoordTransformAffine.cpp
index e9e0f9a688b2eb382fb126506862a84218a01e94..8f9584d60611d8494855d9ba7c35aa9cd2886a50 100644
--- a/Framework/DataObjects/src/CoordTransformAffine.cpp
+++ b/Framework/DataObjects/src/CoordTransformAffine.cpp
@@ -1,4 +1,3 @@
-#include <iostream>
 
 #include "MantidAPI/CoordTransform.h"
 #include "MantidDataObjects/CoordTransformAffine.h"
diff --git a/Framework/DataObjects/src/EventList.cpp b/Framework/DataObjects/src/EventList.cpp
index 0e4260274c51f30ffc7e0f5ef92655b603462e01..8dfbd6d9421904169c2016b3f5f11279c626469a 100644
--- a/Framework/DataObjects/src/EventList.cpp
+++ b/Framework/DataObjects/src/EventList.cpp
@@ -9,7 +9,6 @@
 #include <cfloat>
 
 #include <functional>
-#include <iostream>
 #include <limits>
 #include <math.h>
 #include <Poco/ScopedLock.h>
@@ -549,6 +548,7 @@ EventList &EventList::operator-=(const EventList &more_events) {
       minusHelper(this->weightedEvents, more_events.weightedEventsNoTime);
       break;
     }
+    break;
 
   case WEIGHTED_NOTIME:
     switch (more_events.getEventType()) {
@@ -562,6 +562,7 @@ EventList &EventList::operator-=(const EventList &more_events) {
       minusHelper(this->weightedEventsNoTime, more_events.weightedEventsNoTime);
       break;
     }
+    break;
   }
 
   // No guaranteed order
diff --git a/Framework/DataObjects/src/Events.cpp b/Framework/DataObjects/src/Events.cpp
index ffb9e0c32be66444983897ff87f1e350885b8f32..c348378709154eee116ba569d9bbdbf1cc4ab2f1 100644
--- a/Framework/DataObjects/src/Events.cpp
+++ b/Framework/DataObjects/src/Events.cpp
@@ -5,7 +5,6 @@
 #include "MantidKernel/Exception.h"
 #include "MantidKernel/DateAndTime.h"
 #include <functional>
-#include <iostream>
 #include <math.h>
 
 using std::ostream;
diff --git a/Framework/DataObjects/src/Histogram1D.cpp b/Framework/DataObjects/src/Histogram1D.cpp
index da29de62522ac388380e1d6e3cc44943fa098a4c..077adc23d521dc3918eed3ecc069da2e66043b0e 100644
--- a/Framework/DataObjects/src/Histogram1D.cpp
+++ b/Framework/DataObjects/src/Histogram1D.cpp
@@ -1,4 +1,3 @@
-#include <iostream>
 #include "MantidDataObjects/Histogram1D.h"
 #include "MantidKernel/Exception.h"
 #include "MantidAPI/WorkspaceFactory.h"
diff --git a/Framework/DataObjects/src/MDHistoWorkspaceIterator.cpp b/Framework/DataObjects/src/MDHistoWorkspaceIterator.cpp
index 9965a7d050731a517612282a0975edcaa791e746..87ad5e25ccdc9c2f2b6a49f9bee92cd90d46debd 100644
--- a/Framework/DataObjects/src/MDHistoWorkspaceIterator.cpp
+++ b/Framework/DataObjects/src/MDHistoWorkspaceIterator.cpp
@@ -199,8 +199,17 @@ void MDHistoWorkspaceIterator::init(
     for (size_t d = 0; d < m_nd; d++)
       m_center[d] = m_origin[d] + 0.5f * m_binWidth[d];
     // Skip on if the first point is NOT contained
-    if (!m_function->isPointContained(m_center))
-      next();
+    if (!m_function->isPointContained(m_center)) {
+      bool didNext = next();
+      if (!didNext && this->valid()) {
+        throw std::runtime_error(
+            "Inconsistency found initializing "
+            "MDHistoWorkspace iterator: this iterator should be valid, but "
+            "when tried to skip the "
+            "first point (not contained) could not iterate to "
+            "next point.");
+      }
+    }
   }
 
   // --- Calculate index permutations for neighbour finding face touching ---
@@ -293,9 +302,11 @@ bool MDHistoWorkspaceIterator::valid() const { return (m_pos < m_max); }
 /// @return true if you can continue iterating
 bool MDHistoWorkspaceIterator::next() {
   if (m_function) {
+    bool allIncremented = false;
     do {
       m_pos++;
-      Utils::NestedForLoop::Increment(m_nd, m_index, m_indexMax);
+      allIncremented =
+          Utils::NestedForLoop::Increment(m_nd, m_index, m_indexMax);
       // Calculate the center
       for (size_t d = 0; d < m_nd; d++) {
         m_center[d] =
@@ -304,7 +315,8 @@ bool MDHistoWorkspaceIterator::next() {
       }
       //        std::cout<<std::endl;
       // Keep incrementing until you are in the implicit function
-    } while (!m_function->isPointContained(m_center) && m_pos < m_max);
+    } while (!allIncremented && !m_function->isPointContained(m_center) &&
+             m_pos < m_max);
   } else {
     ++m_pos;
   }
diff --git a/Framework/DataObjects/src/PeakColumn.cpp b/Framework/DataObjects/src/PeakColumn.cpp
index b3d7e129cc927636043721605c3517a80c4892a8..7554f7f04ab8fa95178afe9f906f3cfffa88caf6 100644
--- a/Framework/DataObjects/src/PeakColumn.cpp
+++ b/Framework/DataObjects/src/PeakColumn.cpp
@@ -80,7 +80,13 @@ PeakColumn::PeakColumn(std::vector<Peak> &peaks, const std::string &name)
   this->m_name = name;
   this->m_type = typeFromName(name); // Throws if the name is unknown
   this->m_hklPrec = 2;
-  ConfigService::Instance().getValue("PeakColumn.hklPrec", this->m_hklPrec);
+  const std::string key = "PeakColumn.hklPrec";
+  int gotit = ConfigService::Instance().getValue(key, this->m_hklPrec);
+  if (!gotit)
+    g_log.information()
+        << "In PeakColumn constructor, did not find any value for '" << key
+        << "' from the Config Service. Using default: " << this->m_hklPrec
+        << "\n";
 }
 
 //----------------------------------------------------------------------------------------------
@@ -134,6 +140,7 @@ const std::type_info &PeakColumn::get_pointer_type_info() const {
 void PeakColumn::print(size_t index, std::ostream &s) const {
   Peak &peak = m_peaks[index];
 
+  std::ios::fmtflags fflags(s.flags());
   if (m_name == "RunNumber")
     s << peak.getRunNumber();
   else if (m_name == "DetID")
@@ -152,6 +159,7 @@ void PeakColumn::print(size_t index, std::ostream &s) const {
     s << std::fixed << std::setprecision(m_hklPrec) << peak.getL();
   } else
     s << peak.getValueByColName(m_name);
+  s.flags(fflags);
 }
 
 //-------------------------------------------------------------------------------------
diff --git a/Framework/DataObjects/src/PeaksWorkspace.cpp b/Framework/DataObjects/src/PeaksWorkspace.cpp
index 33bcd0d5000d73fafdda717204df636efa41d5d0..083c66123c4b9222af4c529934c007b27cdb7c9f 100644
--- a/Framework/DataObjects/src/PeaksWorkspace.cpp
+++ b/Framework/DataObjects/src/PeaksWorkspace.cpp
@@ -22,7 +22,6 @@
 #include <boost/shared_ptr.hpp>
 #include <exception>
 #include <fstream>
-#include <iostream>
 #include <math.h>
 #include <ostream>
 #include <stdio.h>
diff --git a/Framework/DataObjects/src/RebinnedOutput.cpp b/Framework/DataObjects/src/RebinnedOutput.cpp
index b6addfb0c0e60cff56d8f6025f82bcaed57d0ed0..3be5eff9d10632258dae16c3bbf99c00c7a2e6ca 100644
--- a/Framework/DataObjects/src/RebinnedOutput.cpp
+++ b/Framework/DataObjects/src/RebinnedOutput.cpp
@@ -3,7 +3,6 @@
 #include "MantidAPI/WorkspaceFactory.h"
 
 #include <algorithm>
-#include <iostream>
 
 namespace Mantid {
 namespace DataObjects {
diff --git a/Framework/DataObjects/src/TableWorkspace.cpp b/Framework/DataObjects/src/TableWorkspace.cpp
index 80290952df3b2ed7f6dd530f2b46e329dd357764..c352028bfd15d5f210bd0409cb2cb8dc000b6d85 100644
--- a/Framework/DataObjects/src/TableWorkspace.cpp
+++ b/Framework/DataObjects/src/TableWorkspace.cpp
@@ -4,7 +4,6 @@
 #include "MantidAPI/WorkspaceProperty.h"
 #include "MantidAPI/WorkspaceFactory.h"
 
-#include <iostream>
 #include <queue>
 
 namespace Mantid {
diff --git a/Framework/DataObjects/test/CoordTransformAlignedTest.h b/Framework/DataObjects/test/CoordTransformAlignedTest.h
index f15e0fe7a0ab22a0d80e04f22a7292f94fbd9bbe..746bebcae5d86836c2d7489730ff93e0770f00d0 100644
--- a/Framework/DataObjects/test/CoordTransformAlignedTest.h
+++ b/Framework/DataObjects/test/CoordTransformAlignedTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidDataObjects/CoordTransformAligned.h"
 #include "MantidKernel/Matrix.h"
diff --git a/Framework/DataObjects/test/CoordTransformDistanceTest.h b/Framework/DataObjects/test/CoordTransformDistanceTest.h
index 27774e7bf32d3917daca8497f5112a428cd1b61b..77ac156e205c6b197e3a68c7223f568a50d72777 100644
--- a/Framework/DataObjects/test/CoordTransformDistanceTest.h
+++ b/Framework/DataObjects/test/CoordTransformDistanceTest.h
@@ -5,8 +5,6 @@
 #include "MantidKernel/Timer.h"
 #include "MantidDataObjects/CoordTransformDistance.h"
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 #include "MantidAPI/CoordTransform.h"
 
 #include <boost/scoped_ptr.hpp>
diff --git a/Framework/DataObjects/test/EventWorkspaceMRUTest.h b/Framework/DataObjects/test/EventWorkspaceMRUTest.h
index 75dafe93107e6d6e1fa5aef751534ed8152d2c50..3d66875d8dc7762859b20c53531aab871808fb89 100644
--- a/Framework/DataObjects/test/EventWorkspaceMRUTest.h
+++ b/Framework/DataObjects/test/EventWorkspaceMRUTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidDataObjects/EventWorkspaceMRU.h"
 
diff --git a/Framework/DataObjects/test/GroupingWorkspaceTest.h b/Framework/DataObjects/test/GroupingWorkspaceTest.h
index de94e12bb9338086e989e970a2d134d6a13d4a12..ee0db8b637f01c9044689190e5a87fca61b795bc 100644
--- a/Framework/DataObjects/test/GroupingWorkspaceTest.h
+++ b/Framework/DataObjects/test/GroupingWorkspaceTest.h
@@ -7,8 +7,6 @@
 #include "MantidTestHelpers/ComponentCreationHelper.h"
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 
 using namespace Mantid;
 using namespace Mantid::API;
diff --git a/Framework/DataObjects/test/MDBinTest.h b/Framework/DataObjects/test/MDBinTest.h
index 58746ad2f118909cc3127cc1e0644feca5598aa5..451ddc9e0744980a5e384ab9f74b96e31e3fa82e 100644
--- a/Framework/DataObjects/test/MDBinTest.h
+++ b/Framework/DataObjects/test/MDBinTest.h
@@ -6,8 +6,6 @@
 #include "MantidDataObjects/MDBin.h"
 #include "MantidDataObjects/MDEventFactory.h"
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 
 using namespace Mantid;
 using namespace Mantid::DataObjects;
diff --git a/Framework/DataObjects/test/MDBoxBaseTest.h b/Framework/DataObjects/test/MDBoxBaseTest.h
index fe6cf91509931dfd3e6474dac604e1c9baf10684..1efac0d88690ba2b4b3a4f0d5784ffac4cab44b1 100644
--- a/Framework/DataObjects/test/MDBoxBaseTest.h
+++ b/Framework/DataObjects/test/MDBoxBaseTest.h
@@ -7,8 +7,6 @@
 #include "MantidKernel/Timer.h"
 #include "MantidDataObjects/MDBoxBase.h"
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 #include <Poco/File.h>
 #include "MantidAPI/CoordTransform.h"
 
diff --git a/Framework/DataObjects/test/MDBoxIteratorTest.h b/Framework/DataObjects/test/MDBoxIteratorTest.h
index 54f0c4ef0bda4ea4a0fe9f5367ed5161730309cd..cebfb6ab66fb58d0cf6ad7959874d99f6b87cda6 100644
--- a/Framework/DataObjects/test/MDBoxIteratorTest.h
+++ b/Framework/DataObjects/test/MDBoxIteratorTest.h
@@ -12,8 +12,6 @@
 #include "MantidDataObjects/MDBox.h"
 #include "MantidTestHelpers/MDEventsTestHelper.h"
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 #include <gmock/gmock.h>
 
 using namespace Mantid::DataObjects;
diff --git a/Framework/DataObjects/test/MDEventFactoryTest.h b/Framework/DataObjects/test/MDEventFactoryTest.h
index 5d9a1486e995cac057546d2b75e9aee657851acb..35dddb546641612b946513a97fe91074fbd6af60 100644
--- a/Framework/DataObjects/test/MDEventFactoryTest.h
+++ b/Framework/DataObjects/test/MDEventFactoryTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include <MantidKernel/Timer.h>
 #include <MantidKernel/System.h>
-#include <iostream>
-#include <iomanip>
 
 #include <MantidDataObjects/MDEventFactory.h>
 
diff --git a/Framework/DataObjects/test/MDGridBoxTest.h b/Framework/DataObjects/test/MDGridBoxTest.h
index 0f8321bc99bbc1eda16f00ee65593960191b32c0..343c1507c852f2e6ab8abfb95b0fb7f4d9458916 100644
--- a/Framework/DataObjects/test/MDGridBoxTest.h
+++ b/Framework/DataObjects/test/MDGridBoxTest.h
@@ -27,7 +27,6 @@
 #include <boost/random/variate_generator.hpp>
 #include <cmath>
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
 #include <map>
 #include <memory>
 #include <Poco/File.h>
diff --git a/Framework/DataObjects/test/MDHistoWorkspaceTest.h b/Framework/DataObjects/test/MDHistoWorkspaceTest.h
index 34e0819e614dfabc65c96e2a8370d2369ca13f07..d289a06ffa2282df2b0ad7dd226cb9f36885f281 100644
--- a/Framework/DataObjects/test/MDHistoWorkspaceTest.h
+++ b/Framework/DataObjects/test/MDHistoWorkspaceTest.h
@@ -16,8 +16,6 @@
 #include <boost/scoped_array.hpp>
 #include <boost/scoped_ptr.hpp>
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 #include "MantidAPI/ExperimentInfo.h"
 #include "MantidKernel/Strings.h"
 
diff --git a/Framework/DataObjects/test/MDLeanEventTest.h b/Framework/DataObjects/test/MDLeanEventTest.h
index 6bda924df6433bf4dbc0e7b176eb6d02851a98db..89b3bf02ed8404f6341c967cb5fdd1ddcfc5426b 100644
--- a/Framework/DataObjects/test/MDLeanEventTest.h
+++ b/Framework/DataObjects/test/MDLeanEventTest.h
@@ -5,8 +5,6 @@
 #include "MantidKernel/Timer.h"
 #include "MantidDataObjects/MDLeanEvent.h"
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 
 #include <boost/scoped_array.hpp>
 
diff --git a/Framework/DataObjects/test/OffsetsWorkspaceTest.h b/Framework/DataObjects/test/OffsetsWorkspaceTest.h
index 64525613150722aca0f2a0798cf9e1e624c73f9a..08f5bff01aa0ce8691a045bfd08e5373725ad446 100644
--- a/Framework/DataObjects/test/OffsetsWorkspaceTest.h
+++ b/Framework/DataObjects/test/OffsetsWorkspaceTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidDataObjects/OffsetsWorkspace.h"
 #include "MantidTestHelpers/ComponentCreationHelper.h"
diff --git a/Framework/DataObjects/test/PeakColumnTest.h b/Framework/DataObjects/test/PeakColumnTest.h
index 0c68f2805ff2ee97dd7278e3969a6dfb16e541da..247db3453822bf3475f0a308d581cdab0660cbb3 100644
--- a/Framework/DataObjects/test/PeakColumnTest.h
+++ b/Framework/DataObjects/test/PeakColumnTest.h
@@ -8,8 +8,6 @@
 #include "MantidTestHelpers/ComponentCreationHelper.h"
 
 #include <boost/make_shared.hpp>
-#include <iostream>
-#include <iomanip>
 
 using namespace Mantid::DataObjects;
 
diff --git a/Framework/DataObjects/test/PeakTest.h b/Framework/DataObjects/test/PeakTest.h
index e2e41b04aa4d42f601128b258bbca09e59ddf128..43043ba0b1c10fec8ccb54d7441e8b03aa2a5119 100644
--- a/Framework/DataObjects/test/PeakTest.h
+++ b/Framework/DataObjects/test/PeakTest.h
@@ -10,8 +10,6 @@
 #include "MantidKernel/V3D.h"
 #include "MantidKernel/PhysicalConstants.h"
 #include "MantidGeometry/Instrument/ReferenceFrame.h"
-#include <iostream>
-#include <iomanip>
 #include <gmock/gmock.h>
 
 #include "MantidDataObjects/Peak.h"
diff --git a/Framework/DataObjects/test/PeaksWorkspaceTest.h b/Framework/DataObjects/test/PeaksWorkspaceTest.h
index dccfacf8b750eb1ed90998f95811b68ebe28fd5e..3ffb18821ed63a22a906b908c50c422ce1bf54ac 100644
--- a/Framework/DataObjects/test/PeaksWorkspaceTest.h
+++ b/Framework/DataObjects/test/PeaksWorkspaceTest.h
@@ -5,9 +5,7 @@
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
 #include "MantidAPI/FileProperty.h"
-#include <iostream>
 #include <fstream>
-#include <iomanip>
 #include <stdio.h>
 #include <cmath>
 #include "MantidDataObjects/PeaksWorkspace.h"
diff --git a/Framework/DataObjects/test/RebinnedOutputTest.h b/Framework/DataObjects/test/RebinnedOutputTest.h
index 41a3c5e3df6c9ca7753b5d83d27c0cbae345c8e5..87535e4f83f825a106610eec549648e46bf7f326 100644
--- a/Framework/DataObjects/test/RebinnedOutputTest.h
+++ b/Framework/DataObjects/test/RebinnedOutputTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidDataObjects/RebinnedOutput.h"
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
diff --git a/Framework/DataObjects/test/SpecialWorkspace2DTest.h b/Framework/DataObjects/test/SpecialWorkspace2DTest.h
index 6ecb30dbf29b315a67321bd5e303512d6cd85dc8..9598500b31560a7431da88ae9ef797a53952a208 100644
--- a/Framework/DataObjects/test/SpecialWorkspace2DTest.h
+++ b/Framework/DataObjects/test/SpecialWorkspace2DTest.h
@@ -8,8 +8,6 @@
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
 #include "MantidAPI/WorkspaceProperty.h"
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 
 using namespace Mantid::DataObjects;
 using namespace Mantid::Geometry;
diff --git a/Framework/DataObjects/test/SplittersWorkspaceTest.h b/Framework/DataObjects/test/SplittersWorkspaceTest.h
index a667a0715f99b46986ea980b25d7cf3fe00cc906..45f52e9334e7cd73ad1f9368fda2e53b376731df 100644
--- a/Framework/DataObjects/test/SplittersWorkspaceTest.h
+++ b/Framework/DataObjects/test/SplittersWorkspaceTest.h
@@ -5,8 +5,6 @@
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
 #include "MantidAPI/WorkspaceProperty.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidDataObjects/SplittersWorkspace.h"
 
diff --git a/Framework/DataObjects/test/TableColumnTest.h b/Framework/DataObjects/test/TableColumnTest.h
index 26288968aabac768073955cff8d7bf47b8a22f96..1e33aa1324719f2a40aa43e6cc5a550ecf7a8ba7 100644
--- a/Framework/DataObjects/test/TableColumnTest.h
+++ b/Framework/DataObjects/test/TableColumnTest.h
@@ -8,7 +8,6 @@
 #include "MantidTestHelpers/ComponentCreationHelper.h"
 
 #include <boost/make_shared.hpp>
-#include <iostream>
 
 using namespace Mantid::DataObjects;
 
diff --git a/Framework/GPUAlgorithms/test/GPUAlgorithmTest.h b/Framework/GPUAlgorithms/test/GPUAlgorithmTest.h
index c92156a57737ef7c9b6c6e40b0b5aea6c2a44687..8128dd5080266e481eeefd410ff444d5b753ca0b 100644
--- a/Framework/GPUAlgorithms/test/GPUAlgorithmTest.h
+++ b/Framework/GPUAlgorithms/test/GPUAlgorithmTest.h
@@ -4,7 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
 #include <iomanip>
 
 #include "MantidGPUAlgorithms/GPUAlgorithm.h"
diff --git a/Framework/GPUAlgorithms/test/GPUTesterTest.h b/Framework/GPUAlgorithms/test/GPUTesterTest.h
index e1014f011366e77deff1deaa0216288b74ac9292..70e00ec653f5aac0ad04aa26f78d760aa38d699c 100644
--- a/Framework/GPUAlgorithms/test/GPUTesterTest.h
+++ b/Framework/GPUAlgorithms/test/GPUTesterTest.h
@@ -4,7 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
 #include <iomanip>
 
 #include "MantidGPUAlgorithms/GPUTester.h"
diff --git a/Framework/Geometry/inc/MantidGeometry/Crystal/SymmetryOperationFactory.h b/Framework/Geometry/inc/MantidGeometry/Crystal/SymmetryOperationFactory.h
index eabe3833aea905a12a8c8e4c174800ff5ec768d1..7a348ca0714e503a5f47be15dbb56d9b9290dcb0 100644
--- a/Framework/Geometry/inc/MantidGeometry/Crystal/SymmetryOperationFactory.h
+++ b/Framework/Geometry/inc/MantidGeometry/Crystal/SymmetryOperationFactory.h
@@ -1,16 +1,15 @@
 #ifndef MANTID_GEOMETRY_SYMMETRYOPERATIONFACTORY_H_
 #define MANTID_GEOMETRY_SYMMETRYOPERATIONFACTORY_H_
 
+#include <list>
+#include <map>
+
 #include "MantidGeometry/DllConfig.h"
 #include "MantidKernel/SingletonHolder.h"
 #include "MantidGeometry/Crystal/SymmetryOperation.h"
 #include "MantidGeometry/Crystal/SymmetryOperationSymbolParser.h"
 #include "MantidKernel/RegistrationHelper.h"
 
-#include <list>
-#include <map>
-#include <iostream>
-
 namespace Mantid {
 namespace Geometry {
 /**
diff --git a/Framework/Geometry/src/Crystal/IndexingUtils.cpp b/Framework/Geometry/src/Crystal/IndexingUtils.cpp
index 65d194797e790a40d3b121ecae51509c698c5bb4..dbd81b746f307617f0a1bb1b631b7ae53ceba55b 100644
--- a/Framework/Geometry/src/Crystal/IndexingUtils.cpp
+++ b/Framework/Geometry/src/Crystal/IndexingUtils.cpp
@@ -3,7 +3,6 @@
 #include "MantidKernel/Quat.h"
 #include <boost/math/special_functions/fpclassify.hpp>
 #include "MantidGeometry/Crystal/OrientedLattice.h"
-#include <iostream>
 #include <stdexcept>
 #include <algorithm>
 
diff --git a/Framework/Geometry/src/Crystal/NiggliCell.cpp b/Framework/Geometry/src/Crystal/NiggliCell.cpp
index baf61f0b7e33472c586f1dd2ef3037e42b1a616d..bb91bf0167070d508fdb153610699a31bdf8af3d 100644
--- a/Framework/Geometry/src/Crystal/NiggliCell.cpp
+++ b/Framework/Geometry/src/Crystal/NiggliCell.cpp
@@ -3,7 +3,6 @@
 #include "MantidKernel/Quat.h"
 #include <boost/math/special_functions/fpclassify.hpp>
 #include "MantidGeometry/Crystal/OrientedLattice.h"
-#include <iostream>
 #include <stdexcept>
 #include <algorithm>
 
diff --git a/Framework/Geometry/src/Crystal/PointGroup.cpp b/Framework/Geometry/src/Crystal/PointGroup.cpp
index e0805c6529cd039ca1c80c8803e5b5a5ae4a95ab..85ff7e7dee15c76c8aa5945cd10c4be0929577af 100644
--- a/Framework/Geometry/src/Crystal/PointGroup.cpp
+++ b/Framework/Geometry/src/Crystal/PointGroup.cpp
@@ -4,7 +4,6 @@
 #include <set>
 #include <boost/make_shared.hpp>
 #include <boost/algorithm/string.hpp>
-#include <iostream>
 
 #include "MantidGeometry/Crystal/PointGroupFactory.h"
 #include "MantidGeometry/Crystal/SymmetryOperationFactory.h"
diff --git a/Framework/Geometry/src/Crystal/ScalarUtils.cpp b/Framework/Geometry/src/Crystal/ScalarUtils.cpp
index 7dda5e72a8a311f0fbb3378a27db1d0cef784ada..e92b977edef531ba35d5a1092e8df1dc1ffe07e4 100644
--- a/Framework/Geometry/src/Crystal/ScalarUtils.cpp
+++ b/Framework/Geometry/src/Crystal/ScalarUtils.cpp
@@ -1,6 +1,5 @@
 /* File: ScalarUtils.cpp */
 
-#include <iostream>
 #include <stdexcept>
 #include "MantidGeometry/Crystal/ScalarUtils.h"
 #include "MantidGeometry/Crystal/ReducedCell.h"
@@ -230,7 +229,7 @@ ConventionalCell ScalarUtils::GetCellForForm(const DblMatrix &UB,
   if (allowPermutations) {
     double angle_tolerance = 2.0;
     double length_factor = 1.05;
-    UB_list = GetRelatedUBs(UB, angle_tolerance, length_factor);
+    UB_list = GetRelatedUBs(UB, length_factor, angle_tolerance);
   } else {
     // Get exact form requested and not permutations
     UB_list.push_back(UB);
diff --git a/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp b/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp
index cdc50169d55ad5ab98597068d3a5a4ced1b04ddb..f4c9afef815111745fea386715ae9a79b4d531ea 100644
--- a/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp
+++ b/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp
@@ -1554,7 +1554,15 @@ void InstrumentDefinitionParser::populateIdList(Poco::XML::Element *pE,
             increment = atoi((pIDElem->getAttribute("step")).c_str());
 
           // check the start end and increment values are sensible
-          if (((endID - startID) / increment) < 0) {
+          if (0 == increment) {
+            std::stringstream ss;
+            ss << "The step element cannot be zero, found step: " << increment;
+
+            throw Kernel::Exception::InstrumentDefinitionError(ss.str(),
+                                                               filename);
+          }
+          int numSteps = (endID - startID) / increment;
+          if (numSteps < 0) {
             std::stringstream ss;
             ss << "The start, end, and step elements do not allow a single id "
                   "in the idlist entry - ";
@@ -1565,7 +1573,7 @@ void InstrumentDefinitionParser::populateIdList(Poco::XML::Element *pE,
                                                                filename);
           }
 
-          idList.vec.reserve((endID - startID) / increment);
+          idList.vec.reserve(numSteps);
           for (int i = startID; i != endID + increment; i += increment) {
             idList.vec.push_back(i);
           }
@@ -2301,7 +2309,9 @@ void InstrumentDefinitionParser::createNeutronicInstrument() {
             mapTypeNameToShape.find(shapeName);
         if (shapeIt != mapTypeNameToShape.end()) {
           // Change the shape on the current component to the one requested
-          dynamic_cast<ObjComponent *>(it->first)->setShape(shapeIt->second);
+          auto objCmpt = dynamic_cast<ObjComponent *>(it->first);
+          if (objCmpt)
+            objCmpt->setShape(shapeIt->second);
         } else {
           throw Exception::InstrumentDefinitionError(
               "Requested type " + shapeName + " not defined in IDF");
diff --git a/Framework/Geometry/src/Math/Acomp.cpp b/Framework/Geometry/src/Math/Acomp.cpp
index 0788103182bd08ed8d4202180f43ed171f722ee3..75c5fb5fe2be6d8d76bc081899ffbf8b4e10774a 100644
--- a/Framework/Geometry/src/Math/Acomp.cpp
+++ b/Framework/Geometry/src/Math/Acomp.cpp
@@ -366,7 +366,8 @@ Assumes that the component is sorted and inserts appropiately.
     for (acp = AX.Comp.begin(); acp != AX.Comp.end(); ++acp) {
       std::vector<Acomp>::iterator cpt;
       cpt = std::lower_bound(Comp.begin(), Comp.end(), *acp);
-      if (cpt == Comp.end() || *cpt != *aup) // Only insert if new
+      if (cpt == Comp.end() ||
+          (AX.Units.end() != aup && *cpt != *aup)) // Only insert if new
         Comp.insert(cpt, *acp);
     }
     return;
@@ -981,6 +982,9 @@ It is set on exit (to the EPI)
           break;
       }
 
+      if (PIactive.end() == px)
+        continue;
+
       EPI.push_back(PIform[*px]);
       // remove all minterm that the EPI covered
       for (ddx = DNFactive.begin(); ddx != DNFactive.end(); ++ddx)
diff --git a/Framework/Geometry/src/Math/BnId.cpp b/Framework/Geometry/src/Math/BnId.cpp
index 25a999388cb556f39dac36496cb77df09b1f7b84..556e536328f8335cbaa46035cff0c20b17e8cfeb 100644
--- a/Framework/Geometry/src/Math/BnId.cpp
+++ b/Framework/Geometry/src/Math/BnId.cpp
@@ -1,6 +1,4 @@
 #include <fstream>
-#include <iomanip>
-#include <iostream>
 #include <cmath>
 #include <vector>
 #include <set>
diff --git a/Framework/Geometry/src/Math/PolyBase.cpp b/Framework/Geometry/src/Math/PolyBase.cpp
index eac6ba5b99a7b0fb476bc5bed2e86b2f2860906f..b3738109c6f350986650c2eeba1589f1e7381a80 100644
--- a/Framework/Geometry/src/Math/PolyBase.cpp
+++ b/Framework/Geometry/src/Math/PolyBase.cpp
@@ -1,4 +1,3 @@
-#include <iostream>
 #include <cmath>
 #include <complex>
 #include <vector>
diff --git a/Framework/Geometry/src/Math/PolygonIntersection.cpp b/Framework/Geometry/src/Math/PolygonIntersection.cpp
index f18f0c27a411980dd9ba5042ffd25b532e6860e1..29d1b209a9db0d6ad6b97927a9d4deb757cd4ada 100644
--- a/Framework/Geometry/src/Math/PolygonIntersection.cpp
+++ b/Framework/Geometry/src/Math/PolygonIntersection.cpp
@@ -7,8 +7,6 @@
 #include "MantidKernel/Logger.h"
 #include "MantidKernel/V2D.h"
 
-#include <iostream>
-
 using namespace Mantid::Kernel;
 
 namespace Mantid {
diff --git a/Framework/Geometry/src/Math/RotCounter.cpp b/Framework/Geometry/src/Math/RotCounter.cpp
index 7a56cae785b97cb973c54b7ab832ea696e9b15a8..387a1041f871ed866bd8ce84c8092176dbbd08ac 100644
--- a/Framework/Geometry/src/Math/RotCounter.cpp
+++ b/Framework/Geometry/src/Math/RotCounter.cpp
@@ -1,6 +1,4 @@
 #include <fstream>
-#include <iomanip>
-#include <iostream>
 #include <algorithm>
 #include <iterator>
 #include <vector>
diff --git a/Framework/Geometry/src/Objects/Object.cpp b/Framework/Geometry/src/Objects/Object.cpp
index e6ab975dda916bb686a74b0efc4530155844cac6..d7bccf922d68d8ae460d4ef200e57dec7ee257a5 100644
--- a/Framework/Geometry/src/Objects/Object.cpp
+++ b/Framework/Geometry/src/Objects/Object.cpp
@@ -221,11 +221,13 @@ int Object::complementaryObject(const int Cnum, std::string &Ln) {
   std::string::size_type posB;
   posB = Ln.find_first_of("()", posA);
   if (posB == std::string::npos)
-    throw std::runtime_error("Object::complemenet :: " + Ln);
+    throw std::runtime_error("Object::complement :: " + Ln);
 
   brackCnt = (Ln[posB] == '(') ? 1 : 0;
   while (posB != std::string::npos && brackCnt) {
     posB = Ln.find_first_of("()", posB);
+    if (posB == std::string::npos)
+      break;
     brackCnt += (Ln[posB] == '(') ? 1 : -1;
     posB++;
   }
@@ -242,7 +244,7 @@ int Object::complementaryObject(const int Cnum, std::string &Ln) {
     return 1;
   }
 
-  throw std::runtime_error("Object::complemenet :: " + Part);
+  throw std::runtime_error("Object::complement :: " + Part);
   return 0;
 }
 
diff --git a/Framework/Geometry/src/Objects/RuleItems.cpp b/Framework/Geometry/src/Objects/RuleItems.cpp
index ebac656d63dc2f0c0fbc336d9085383382801cf8..505fda685eefb8cb1668c676c0785172bb42886c 100644
--- a/Framework/Geometry/src/Objects/RuleItems.cpp
+++ b/Framework/Geometry/src/Objects/RuleItems.cpp
@@ -1,6 +1,4 @@
 #include <fstream>
-#include <iomanip>
-#include <iostream>
 #include <complex>
 #include <cmath>
 #include <vector>
diff --git a/Framework/Geometry/src/Objects/Track.cpp b/Framework/Geometry/src/Objects/Track.cpp
index 8bfb529d73086bc33f91f11160d66ebe336ba0ca..ccb4c9dca1a7969d2514c42b9dfa9474a4993414 100644
--- a/Framework/Geometry/src/Objects/Track.cpp
+++ b/Framework/Geometry/src/Objects/Track.cpp
@@ -6,7 +6,6 @@
 
 #include <cmath>
 #include <algorithm>
-#include <iostream>
 
 namespace Mantid {
 namespace Geometry {
diff --git a/Framework/Geometry/src/Rendering/vtkGeometryCacheReader.cpp b/Framework/Geometry/src/Rendering/vtkGeometryCacheReader.cpp
index 76dd2da3ea2906d7bf49c01d7aae535247804325..ddfc5d61177d547f9f04b0bdcbeb9d373539900b 100644
--- a/Framework/Geometry/src/Rendering/vtkGeometryCacheReader.cpp
+++ b/Framework/Geometry/src/Rendering/vtkGeometryCacheReader.cpp
@@ -6,7 +6,6 @@
 #include <Poco/SAX/InputSource.h>
 #include <Poco/Exception.h>
 #include <Poco/DOM/Element.h>
-#include <iostream>
 
 using Poco::XML::DOMParser;
 using Poco::XML::InputSource;
diff --git a/Framework/Geometry/src/Rendering/vtkGeometryCacheWriter.cpp b/Framework/Geometry/src/Rendering/vtkGeometryCacheWriter.cpp
index 2054aaad0899ec99e3f73983ff15096ee26e6e49..91cd38f113ba74cbf03f04173cc6b9e8948b80de 100644
--- a/Framework/Geometry/src/Rendering/vtkGeometryCacheWriter.cpp
+++ b/Framework/Geometry/src/Rendering/vtkGeometryCacheWriter.cpp
@@ -1,5 +1,4 @@
 #include <fstream>
-#include <iostream>
 #include <sstream>
 
 #include "MantidGeometry/Rendering/vtkGeometryCacheWriter.h"
diff --git a/Framework/Geometry/src/Surfaces/Cone.cpp b/Framework/Geometry/src/Surfaces/Cone.cpp
index c40f71e018ce5c827bf6ba4dff2cdee7002005f1..c584fe7daf6219fe6c88706a00f36312d92aebb7 100644
--- a/Framework/Geometry/src/Surfaces/Cone.cpp
+++ b/Framework/Geometry/src/Surfaces/Cone.cpp
@@ -1,6 +1,4 @@
 #include <fstream>
-#include <iomanip>
-#include <iostream>
 #include <sstream>
 #include <cmath>
 #include <complex>
diff --git a/Framework/Geometry/src/Surfaces/Torus.cpp b/Framework/Geometry/src/Surfaces/Torus.cpp
index 77cf5ea14f9724c35bd4c27b904cd98cf7e9a69e..2f8ed1d860da8cd65e01d6f37e4e7664ff1aa4a8 100644
--- a/Framework/Geometry/src/Surfaces/Torus.cpp
+++ b/Framework/Geometry/src/Surfaces/Torus.cpp
@@ -1,6 +1,4 @@
 #include <fstream>
-#include <iomanip>
-#include <iostream>
 #include <string>
 #include <sstream>
 #include <cmath>
diff --git a/Framework/Geometry/test/BoundingBoxTest.h b/Framework/Geometry/test/BoundingBoxTest.h
index a071493595c75f74aa7feed18c96d3c32678468c..12071a5b559a0d646a1f11bc5abec90765c0b92c 100644
--- a/Framework/Geometry/test/BoundingBoxTest.h
+++ b/Framework/Geometry/test/BoundingBoxTest.h
@@ -5,7 +5,6 @@
 #include "MantidGeometry/Objects/BoundingBox.h"
 #include "MantidGeometry/Objects/Track.h"
 #include "MantidKernel/Timer.h"
-#include <iostream>
 
 using namespace Mantid;
 using namespace Mantid::Geometry;
diff --git a/Framework/Geometry/test/CompAssemblyTest.h b/Framework/Geometry/test/CompAssemblyTest.h
index fd3602f6097cdc3014ef1ffb795379e9eb99a8f9..1e69012097a679c430a6c6a50b6f9074a76bf0ab 100644
--- a/Framework/Geometry/test/CompAssemblyTest.h
+++ b/Framework/Geometry/test/CompAssemblyTest.h
@@ -3,7 +3,6 @@
 
 #include <cxxtest/TestSuite.h>
 #include <cmath>
-#include <iostream>
 #include <string>
 #include "MantidGeometry/Instrument/CompAssembly.h"
 #include "MantidKernel/V3D.h"
diff --git a/Framework/Geometry/test/ComponentParserTest.h b/Framework/Geometry/test/ComponentParserTest.h
index 1f23e83ad62124f7065243d47510de81c197bce4..d8732db12453024ecd57147780038f2ab26146d9 100644
--- a/Framework/Geometry/test/ComponentParserTest.h
+++ b/Framework/Geometry/test/ComponentParserTest.h
@@ -7,8 +7,6 @@
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/V3D.h"
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 #include <Poco/SAX/SAXParser.h>
 #include <sstream>
 #include "MantidKernel/CPUTimer.h"
diff --git a/Framework/Geometry/test/ComponentTest.h b/Framework/Geometry/test/ComponentTest.h
index 4137d5bf3d82342fd1896a683eada8c3f2627025..479ec51f31da3220fda70fca2522f00d4074e4d0 100644
--- a/Framework/Geometry/test/ComponentTest.h
+++ b/Framework/Geometry/test/ComponentTest.h
@@ -3,7 +3,6 @@
 
 #include <cxxtest/TestSuite.h>
 #include <cmath>
-#include <iostream>
 #include <string>
 #include "MantidGeometry/Instrument/Component.h"
 #include "MantidKernel/V3D.h"
diff --git a/Framework/Geometry/test/ConventionalCellTest.h b/Framework/Geometry/test/ConventionalCellTest.h
index adb468c13f2668f9824bf9989e9f6816f10e0dd6..69d2b965b4159f465fa787f497750f7a8cd92349 100644
--- a/Framework/Geometry/test/ConventionalCellTest.h
+++ b/Framework/Geometry/test/ConventionalCellTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include <MantidKernel/Timer.h>
 #include <MantidKernel/System.h>
-#include <iostream>
-#include <iomanip>
 #include <MantidKernel/V3D.h>
 #include <MantidKernel/Matrix.h>
 
diff --git a/Framework/Geometry/test/DetectorTest.h b/Framework/Geometry/test/DetectorTest.h
index f7c2495e2bc27b2e1d15272b180789eae37d9875..c9181e9192c6138a23d8449207327460821b2660 100644
--- a/Framework/Geometry/test/DetectorTest.h
+++ b/Framework/Geometry/test/DetectorTest.h
@@ -6,7 +6,6 @@
 #include "MantidGeometry/Instrument/Detector.h"
 #include "MantidGeometry/Instrument/Component.h"
 #include <cmath>
-#include <iostream>
 
 using namespace Mantid::Geometry;
 using Mantid::Kernel::V3D;
diff --git a/Framework/Geometry/test/GoniometerTest.h b/Framework/Geometry/test/GoniometerTest.h
index 9ae9bddf5f62f7a94c2afcbcc072b2d1609e3719..7cfad5d1b3fb4dfaac13bceeaa4b28c1b3f75f3c 100644
--- a/Framework/Geometry/test/GoniometerTest.h
+++ b/Framework/Geometry/test/GoniometerTest.h
@@ -3,7 +3,6 @@
 
 #include <cxxtest/TestSuite.h>
 #include "MantidGeometry/Instrument/Goniometer.h"
-#include <iostream>
 #include <stdexcept>
 #include <string>
 #include "MantidKernel/Quat.h"
diff --git a/Framework/Geometry/test/IndexingUtilsTest.h b/Framework/Geometry/test/IndexingUtilsTest.h
index 57449f7b04aef88e0626df657e2355b152b2eb92..f1ed265dda4b9bde93a3394fc37bd06cc3d8cbd6 100644
--- a/Framework/Geometry/test/IndexingUtilsTest.h
+++ b/Framework/Geometry/test/IndexingUtilsTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include <MantidKernel/Timer.h>
 #include <MantidKernel/System.h>
-#include <iostream>
-#include <iomanip>
 #include <MantidKernel/V3D.h>
 #include <MantidKernel/Matrix.h>
 #include "MantidGeometry/Crystal/OrientedLattice.h"
diff --git a/Framework/Geometry/test/MDBoxImplicitFunctionTest.h b/Framework/Geometry/test/MDBoxImplicitFunctionTest.h
index 28ba764bda03d81d87bbd3b3d0860c837237e2f8..e27544409c8f17e2117c039d93023797d735ae22 100644
--- a/Framework/Geometry/test/MDBoxImplicitFunctionTest.h
+++ b/Framework/Geometry/test/MDBoxImplicitFunctionTest.h
@@ -6,8 +6,6 @@
 #include "MantidKernel/System.h"
 #include "MantidKernel/Timer.h"
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 
 using namespace Mantid;
 using namespace Mantid::Geometry;
diff --git a/Framework/Geometry/test/MDHistoDimensionTest.h b/Framework/Geometry/test/MDHistoDimensionTest.h
index 63474366e71feb31ac8cd55fc15750397225417a..f6dca8e74baeeebf6aeb7b03aec7c71b1cc1d11c 100644
--- a/Framework/Geometry/test/MDHistoDimensionTest.h
+++ b/Framework/Geometry/test/MDHistoDimensionTest.h
@@ -7,8 +7,6 @@
 #include "MantidKernel/System.h"
 #include "MantidKernel/Timer.h"
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 
 using namespace Mantid;
 using namespace Mantid::Geometry;
diff --git a/Framework/Geometry/test/MDPlaneTest.h b/Framework/Geometry/test/MDPlaneTest.h
index 05b165291f843fa7eb46e6ff5efaf39fb925c7dc..8004fa018dd1a38d75fc3b6e36820ecdc094289d 100644
--- a/Framework/Geometry/test/MDPlaneTest.h
+++ b/Framework/Geometry/test/MDPlaneTest.h
@@ -5,8 +5,6 @@
 #include "MantidKernel/System.h"
 #include "MantidKernel/Timer.h"
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 #include "MantidKernel/VMD.h"
 
 using namespace Mantid;
diff --git a/Framework/Geometry/test/NearestNeighboursFactoryTest.h b/Framework/Geometry/test/NearestNeighboursFactoryTest.h
index 775478822a2d66aae1a45a8950467895a9d06b08..6230725124021dc0c95d5712007ee363732f387f 100644
--- a/Framework/Geometry/test/NearestNeighboursFactoryTest.h
+++ b/Framework/Geometry/test/NearestNeighboursFactoryTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidGeometry/Instrument/NearestNeighboursFactory.h"
 #include "MantidTestHelpers/ComponentCreationHelper.h"
diff --git a/Framework/Geometry/test/NiggliCellTest.h b/Framework/Geometry/test/NiggliCellTest.h
index d21190d49674d51eca5b40cb3893729e4800f06d..63611e2186286d820852357a2a8a3a9afaaaa619 100644
--- a/Framework/Geometry/test/NiggliCellTest.h
+++ b/Framework/Geometry/test/NiggliCellTest.h
@@ -2,8 +2,6 @@
 #define MANTID_GEOMETRY_NiggliCellTEST_H_
 
 #include <cxxtest/TestSuite.h>
-#include <iostream>
-#include <iomanip>
 #include "MantidKernel/Matrix.h"
 #include "MantidGeometry/Crystal/NiggliCell.h"
 #include "MantidGeometry/Crystal/OrientedLattice.h"
diff --git a/Framework/Geometry/test/ObjCompAssemblyTest.h b/Framework/Geometry/test/ObjCompAssemblyTest.h
index 178682005c61f3996836dc2d35c95df9833cc77d..1acc727c0e74fac213b40fb6bbb6ac7f1c580892 100644
--- a/Framework/Geometry/test/ObjCompAssemblyTest.h
+++ b/Framework/Geometry/test/ObjCompAssemblyTest.h
@@ -3,7 +3,6 @@
 
 #include <cxxtest/TestSuite.h>
 #include <cmath>
-#include <iostream>
 #include <string>
 #include "MantidGeometry/Instrument/ObjCompAssembly.h"
 #include "MantidKernel/V3D.h"
diff --git a/Framework/Geometry/test/ObjectTest.h b/Framework/Geometry/test/ObjectTest.h
index 310d397050826794553db08562a0caf77ef09ec1..2c80fd8a7580ad11658eff9a983c7ff8eb744602 100644
--- a/Framework/Geometry/test/ObjectTest.h
+++ b/Framework/Geometry/test/ObjectTest.h
@@ -7,7 +7,6 @@
 #include <vector>
 #include <algorithm>
 #include <ctime>
-#include <iomanip>
 
 #include <boost/shared_ptr.hpp>
 
diff --git a/Framework/Geometry/test/OrientedLatticeTest.h b/Framework/Geometry/test/OrientedLatticeTest.h
index d2536f13fd73e55e8afddebc91e7d8985964742b..487231edeec3de4c8cc5637df5c6d38a8453afbc 100644
--- a/Framework/Geometry/test/OrientedLatticeTest.h
+++ b/Framework/Geometry/test/OrientedLatticeTest.h
@@ -2,8 +2,6 @@
 #define MANTID_GEOMETRY_ORIENTEDLATTICETEST_H_
 
 #include <cxxtest/TestSuite.h>
-#include <iostream>
-#include <iomanip>
 #include "MantidKernel/Matrix.h"
 #include "MantidGeometry/Crystal/OrientedLattice.h"
 #include "MantidTestHelpers/NexusTestHelper.h"
diff --git a/Framework/Geometry/test/ParCompAssemblyTest.h b/Framework/Geometry/test/ParCompAssemblyTest.h
index 048ca5fb8420d5c9dc7db27df993f12a0f071e24..bd9212db670654af6d13df7756267c8f88c30590 100644
--- a/Framework/Geometry/test/ParCompAssemblyTest.h
+++ b/Framework/Geometry/test/ParCompAssemblyTest.h
@@ -3,7 +3,6 @@
 
 #include <cxxtest/TestSuite.h>
 #include <cmath>
-#include <iostream>
 #include <string>
 #include "MantidGeometry/Instrument/CompAssembly.h"
 #include "MantidGeometry/Instrument/CompAssembly.h"
diff --git a/Framework/Geometry/test/ParComponentFactoryTest.h b/Framework/Geometry/test/ParComponentFactoryTest.h
index 950f0efeb087491a1737ad6971290742cbd016ca..0fb537e000a2612503ce87bc94c0e1a7e78cd94a 100644
--- a/Framework/Geometry/test/ParComponentFactoryTest.h
+++ b/Framework/Geometry/test/ParComponentFactoryTest.h
@@ -7,8 +7,6 @@
 #include "MantidKernel/Timer.h"
 #include "MantidTestHelpers/ComponentCreationHelper.h"
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 
 using namespace Mantid::Geometry;
 
diff --git a/Framework/Geometry/test/ParObjCompAssemblyTest.h b/Framework/Geometry/test/ParObjCompAssemblyTest.h
index 2efae136a5d4b89f9d2d2f53553e9136390b45a6..dd42abb3f8159039cccf4635116e33d3cb08e9a0 100644
--- a/Framework/Geometry/test/ParObjCompAssemblyTest.h
+++ b/Framework/Geometry/test/ParObjCompAssemblyTest.h
@@ -3,7 +3,6 @@
 
 #include <cxxtest/TestSuite.h>
 #include <cmath>
-#include <iostream>
 #include <string>
 #include "MantidGeometry/Instrument/ObjCompAssembly.h"
 #include "MantidGeometry/Instrument/ObjCompAssembly.h"
diff --git a/Framework/Geometry/test/ParametrizedComponentTest.h b/Framework/Geometry/test/ParametrizedComponentTest.h
index 467950faf55d0f05e2fe56e4815a9aff54ee61d3..b9120c7a335946ab2dc947f69dc8e1ae9bfb73d8 100644
--- a/Framework/Geometry/test/ParametrizedComponentTest.h
+++ b/Framework/Geometry/test/ParametrizedComponentTest.h
@@ -3,7 +3,6 @@
 
 #include <cxxtest/TestSuite.h>
 #include <cmath>
-#include <iostream>
 #include <string>
 #include <boost/make_shared.hpp>
 #include "MantidGeometry/Instrument/Component.h"
diff --git a/Framework/Geometry/test/PointGroupTest.h b/Framework/Geometry/test/PointGroupTest.h
index 6256893a3cf8d783ad8aeb19e9dacc501cc9591e..406a4508cbeba6cf9e551d51dc3c80014c75b7ee 100644
--- a/Framework/Geometry/test/PointGroupTest.h
+++ b/Framework/Geometry/test/PointGroupTest.h
@@ -7,8 +7,6 @@
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/Strings.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 #include "MantidGeometry/Crystal/PointGroupFactory.h"
 #include "MantidGeometry/Crystal/PointGroup.h"
 #include <boost/lexical_cast.hpp>
diff --git a/Framework/Geometry/test/RectangularDetectorPixelTest.h b/Framework/Geometry/test/RectangularDetectorPixelTest.h
index 04fd8a6593e8b7bab16c4fd56e2167502c4d761e..83b920ad7e8ae801d5cb3cb610addc598a97701b 100644
--- a/Framework/Geometry/test/RectangularDetectorPixelTest.h
+++ b/Framework/Geometry/test/RectangularDetectorPixelTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidGeometry/Instrument/RectangularDetectorPixel.h"
 
diff --git a/Framework/Geometry/test/RectangularDetectorTest.h b/Framework/Geometry/test/RectangularDetectorTest.h
index ee6903e0b456286e51bf0bf83b8bf99544d9a08d..a0c1ca0b9641c44f04622b67366f491b96a3fb91 100644
--- a/Framework/Geometry/test/RectangularDetectorTest.h
+++ b/Framework/Geometry/test/RectangularDetectorTest.h
@@ -3,7 +3,6 @@
 
 #include <cxxtest/TestSuite.h>
 #include <cmath>
-#include <iostream>
 #include <string>
 #include "MantidGeometry/Instrument/RectangularDetector.h"
 #include "MantidKernel/V3D.h"
diff --git a/Framework/Geometry/test/ReducedCellTest.h b/Framework/Geometry/test/ReducedCellTest.h
index cf2f44bcf77f04755f3ad9a780da44c803a4af0c..3065f6553b8f4bfef760bcf488dd61c673304bf6 100644
--- a/Framework/Geometry/test/ReducedCellTest.h
+++ b/Framework/Geometry/test/ReducedCellTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include <MantidKernel/Timer.h>
 #include <MantidKernel/System.h>
-#include <iostream>
-#include <iomanip>
 #include <MantidKernel/V3D.h>
 #include <MantidKernel/Matrix.h>
 
diff --git a/Framework/Geometry/test/ReferenceFrameTest.h b/Framework/Geometry/test/ReferenceFrameTest.h
index 69cc05033f470f815ad481a8f9b2904d188b8e12..f203819da2d9f77200d5c7ae6c7e8db1d8142632 100644
--- a/Framework/Geometry/test/ReferenceFrameTest.h
+++ b/Framework/Geometry/test/ReferenceFrameTest.h
@@ -5,8 +5,6 @@
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
 #include "MantidKernel/V3D.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidGeometry/Instrument/ReferenceFrame.h"
 
diff --git a/Framework/Geometry/test/ReflectionConditionTest.h b/Framework/Geometry/test/ReflectionConditionTest.h
index 2e34272915650aca3e73e16b0136e66dd52ebff6..ba8a2582881d160185ea962ae026cc953743472b 100644
--- a/Framework/Geometry/test/ReflectionConditionTest.h
+++ b/Framework/Geometry/test/ReflectionConditionTest.h
@@ -5,8 +5,6 @@
 #include "MantidKernel/System.h"
 #include "MantidKernel/Timer.h"
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 #include <set>
 
 using namespace Mantid::Geometry;
diff --git a/Framework/Geometry/test/ScalarUtilsTest.h b/Framework/Geometry/test/ScalarUtilsTest.h
index a428b760331d2d5e4450f4bc62b86f1781d93cbd..1bc65f8e32dba06728ce01f90608ea62f14c723a 100644
--- a/Framework/Geometry/test/ScalarUtilsTest.h
+++ b/Framework/Geometry/test/ScalarUtilsTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include <MantidKernel/Timer.h>
 #include <MantidKernel/System.h>
-#include <iostream>
-#include <iomanip>
 #include <MantidKernel/V3D.h>
 #include <MantidKernel/Matrix.h>
 
diff --git a/Framework/Geometry/test/UnitCellTest.h b/Framework/Geometry/test/UnitCellTest.h
index e05a25f66eb5ea15a161005dd2f7b48e35055d76..b2ddd021baa71004dc95c8b2ea218dde28dd5c7e 100644
--- a/Framework/Geometry/test/UnitCellTest.h
+++ b/Framework/Geometry/test/UnitCellTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include <MantidKernel/Timer.h>
 #include <MantidKernel/System.h>
-#include <iostream>
-#include <iomanip>
 #include <MantidKernel/Matrix.h>
 
 #include <MantidGeometry/Crystal/UnitCell.h>
diff --git a/Framework/Geometry/test/XMLInstrumentParameterTest.h b/Framework/Geometry/test/XMLInstrumentParameterTest.h
index a6d4d47cd7fe70be96a5c68fdd35cd1a9e3defda..e09348f8176ba66db8662ebc67b6d53bbee3c779 100644
--- a/Framework/Geometry/test/XMLInstrumentParameterTest.h
+++ b/Framework/Geometry/test/XMLInstrumentParameterTest.h
@@ -6,8 +6,6 @@
 #include "MantidKernel/System.h"
 #include "MantidKernel/Timer.h"
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 #include <boost/shared_ptr.hpp>
 #include <boost/make_shared.hpp>
 
diff --git a/Framework/ICat/inc/MantidICat/GSoap/stdsoap2.h b/Framework/ICat/inc/MantidICat/GSoap/stdsoap2.h
index b3d143893045d72c4eb796465af862d9b7612449..e80b4e0c43ffab7ddf841a67d471edd142b5e435 100644
--- a/Framework/ICat/inc/MantidICat/GSoap/stdsoap2.h
+++ b/Framework/ICat/inc/MantidICat/GSoap/stdsoap2.h
@@ -639,7 +639,6 @@ A commercial use license is available from Genivia, Inc., contact@genivia.com
 
 #if defined(__cplusplus) && !defined(WITH_LEAN) && !defined(WITH_COMPAT)
 #include <string>
-#include <iostream>
 #endif
 
 #ifdef WITH_NOHTTP
diff --git a/Framework/ICat/src/GSoap/stdsoap2.cpp b/Framework/ICat/src/GSoap/stdsoap2.cpp
index b6eda2bb1b90a6411f9df79d9ab14733110b021d..252bc7ae6514f1f8380bd35f9c89fcc5e46abd54 100644
--- a/Framework/ICat/src/GSoap/stdsoap2.cpp
+++ b/Framework/ICat/src/GSoap/stdsoap2.cpp
@@ -59,6 +59,10 @@ A commercial use license is available from Genivia, Inc., contact@genivia.com
 
 #include "MantidICat/GSoap/stdsoap2.h"
 
+#if defined(__cplusplus) && !defined(WITH_LEAN) && !defined(WITH_COMPAT)
+#include <iostream>
+#endif
+
 #if defined(VXWORKS) && defined(WM_SECURE_KEY_STORAGE)
 #include <ipcom_key_db.h>
 #endif
@@ -2344,7 +2348,7 @@ int SOAP_FMAC2 soap_resolve(struct soap *soap) {
       } else if (*ip->id == '#') {
         DBGLOG(TEST,
                SOAP_MESSAGE(fdebug, "Missing data for id='%s'\n", ip->id));
-        strcpy(soap->id, ip->id + 1);
+        strncpy(soap->id, ip->id + 1, sizeof(soap->id));
         return soap->error = SOAP_MISSING_ID;
       }
     }
@@ -2382,7 +2386,7 @@ int SOAP_FMAC2 soap_resolve(struct soap *soap) {
                                         "location=%p level=%u,%u id='%s'\n",
                                 ip->type, p, ip->level, fp->level, ip->id));
             while (ip->level < k) {
-              void **q = (void **)soap_malloc(soap, sizeof(q));
+              void **q = (void **)soap_malloc(soap, sizeof(*q));
               if (!q)
                 return soap->error;
               *q = p;
@@ -3203,7 +3207,7 @@ const char *SOAP_FMAC2 soap_ssl_error(struct soap *soap, int ret) {
   int err = SSL_get_error(soap->ssl, ret);
   const char *msg = soap_code_str(h_ssl_error_codes, err);
   if (msg)
-    strcpy(soap->msgbuf, msg);
+    strncpy(soap->msgbuf, msg, sizeof(soap->msgbuf));
   else
     return ERR_error_string(err, soap->msgbuf);
   if (ERR_peek_error()) {
@@ -6045,7 +6049,7 @@ static int http_post(struct soap *soap, const char *endpoint, const char *host,
       sprintf(soap->tmpbuf, "[%s]", host); /* RFC 2732 */
     else
 #endif
-      strcpy(soap->tmpbuf, host);
+      strncpy(soap->tmpbuf, host, sizeof(soap->tmpbuf));
   }
   if ((err = soap->fposthdr(soap, "Host", soap->tmpbuf)))
     return err;
@@ -8157,7 +8161,7 @@ void *SOAP_FMAC2 soap_id_lookup(struct soap *soap, const char *id, void **p,
                         "Resolved href='%s' type=%d location=%p (%u bytes)\n",
                         id, t, ip->ptr, (unsigned int)n));
     if (ip->type != t) {
-      strcpy(soap->id, id);
+      strncpy(soap->id, id, sizeof(soap->id));
       soap->error = SOAP_HREF;
       DBGLOG(TEST,
              SOAP_MESSAGE(
@@ -8184,9 +8188,11 @@ void *SOAP_FMAC2 soap_id_lookup(struct soap *soap, const char *id, void **p,
       void *s, **r = &ip->link;
       q = (void **)ip->link;
       while (q) {
-        *r = (void *)soap_malloc(soap, sizeof(void *));
-        if (!*r)
+        void **tmp = (void **)soap_malloc(soap, sizeof(void *));
+        if (!tmp)
           return NULL;
+        *r = (void *)tmp;
+
         s = *q;
         *q = *r;
         r = (void **)*r;
@@ -8259,7 +8265,7 @@ void *SOAP_FMAC2 soap_id_forward(struct soap *soap, const char *href, void *p,
                                 "size=%lu level=%u got type=%d size=%lu\n",
                         href, ip->type, (unsigned long)ip->size, k, st,
                         (unsigned long)n));
-    strcpy(soap->id, href);
+    strncpy(soap->id, href, sizeof(soap->id));
     soap->error = SOAP_HREF;
     return NULL;
   }
@@ -8351,12 +8357,12 @@ soap_id_enter(struct soap *soap, const char *id, void *p, int t, size_t n,
                                 "size=%lu level=%u got type=%d size=%lu\n",
                         id, ip->type, (unsigned long)ip->size, k, t,
                         (unsigned long)n));
-    strcpy(soap->id, id);
+    strncpy(soap->id, id, sizeof(soap->id));
     soap->error = SOAP_HREF;
     return NULL;
   } else if (ip->ptr) {
     DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Multiply defined id='%s'\n", id));
-    strcpy(soap->id, id);
+    strncpy(soap->id, id, sizeof(soap->id));
     soap->error = SOAP_DUPLICATE_ID;
     return NULL;
   } else {
@@ -10036,7 +10042,7 @@ int SOAP_FMAC2 soap_element_start_end_out(struct soap *soap, const char *tag) {
   if (soap->mode & SOAP_XML_CANONICAL) {
     struct soap_nlist *np;
     for (tp = soap->attributes; tp; tp = tp->next) {
-      if (tp->visible && tp->name)
+      if (tp->visible && tp->name[0])
         soap_utilize_ns(soap, tp->name);
     }
     for (np = soap->nlist; np; np = np->next) {
@@ -11044,7 +11050,7 @@ int SOAP_FMAC2 soap_peek_element(struct soap *soap) {
           soap->arraySize[sizeof(soap->arrayType) - 1] = '\0';
           soap->arrayType[sizeof(soap->arrayType) - 1] = '\0';
         } else if (!soap_match_tag(soap, tp->name, "SOAP-ENC:offset"))
-          strncpy(soap->arrayOffset, tp->value, sizeof(soap->arrayOffset));
+          strncpy(soap->arrayOffset, tp->value, sizeof(soap->arrayOffset) - 1);
         else if (!soap_match_tag(soap, tp->name, "SOAP-ENC:position"))
           soap->position = soap_getposition(tp->value, soap->positions);
         else if (!soap_match_tag(soap, tp->name, "SOAP-ENC:root"))
@@ -16056,18 +16062,24 @@ int SOAP_FMAC2 soap_puthttphdr(struct soap *soap, int status, size_t count) {
       } else
         strcat(soap->tmpbuf, s);
       if (soap->mime.start) {
-        strcat(soap->tmpbuf, "\"; start=\"");
-        strcat(soap->tmpbuf, soap->mime.start);
+        const char startStr[] = "\"; start=\"";
+        strcat(soap->tmpbuf, startStr);
+        strncat(soap->tmpbuf, soap->mime.start,
+                sizeof(soap->tmpbuf) - sizeof(startStr));
       }
       strcat(soap->tmpbuf, "\"");
       if (r) {
-        strcat(soap->tmpbuf, "; start-info=\"");
-        strcat(soap->tmpbuf, r);
-        strcat(soap->tmpbuf, "\"");
+        const char startInfoStr[] = "; start-info=\"";
+        size_t lenStart = sizeof(soap->tmpbuf) - sizeof(startInfoStr);
+        strncat(soap->tmpbuf, startInfoStr, lenStart);
+        size_t lenR = lenStart - strnlen(r, lenStart);
+        strncat(soap->tmpbuf, r, lenR);
+        size_t lenEnd = lenR - 1;
+        strncat(soap->tmpbuf, "\"", lenEnd);
       }
       s = soap->tmpbuf;
     } else
-      s = strcpy(soap->tmpbuf, s);
+      s = strncpy(soap->tmpbuf, s, sizeof(soap->tmpbuf));
     if (status == SOAP_OK && soap->version == 2 && soap->action &&
         strlen(soap->action) + strlen(s) < sizeof(soap->tmpbuf) - 80)
       sprintf(soap->tmpbuf + strlen(s), "; action=\"%s\"", soap->action);
diff --git a/Framework/Kernel/inc/MantidKernel/ANN/ANN.h b/Framework/Kernel/inc/MantidKernel/ANN/ANN.h
index db5de2b1e41320925b0544ca7a346b8df966d42d..30d66ac44a7fda27459bfd92bfa513a01d9fc04a 100644
--- a/Framework/Kernel/inc/MantidKernel/ANN/ANN.h
+++ b/Framework/Kernel/inc/MantidKernel/ANN/ANN.h
@@ -107,10 +107,10 @@
 //  basic includes
 //----------------------------------------------------------------------
 
-#include <cstdlib>  // standard lib includes
-#include <cmath>    // math includes
-#include <iostream> // I/O streams
-#include <cstring>  // C-style strings
+#include <cstdlib> // standard lib includes
+#include <cmath>   // math includes
+#include <iosfwd>  // I/O streams
+#include <cstring> // C-style strings
 
 //----------------------------------------------------------------------
 // Limits
diff --git a/Framework/Kernel/inc/MantidKernel/PropertyManagerOwner.h b/Framework/Kernel/inc/MantidKernel/PropertyManagerOwner.h
index 7a095862e9ce2aad426bcb01da21b7910b545aa2..ada32918cb12d35a2b41a9359cce28e8c18ca112 100644
--- a/Framework/Kernel/inc/MantidKernel/PropertyManagerOwner.h
+++ b/Framework/Kernel/inc/MantidKernel/PropertyManagerOwner.h
@@ -65,7 +65,9 @@ public:
   void setPropertyOrdinal(const int &index, const std::string &value);
 
   /// Make m_properties point to the same PropertyManager as po.
-  void copyPropertiesFrom(const PropertyManagerOwner &po) { *this = po; }
+  virtual void copyPropertiesFrom(const PropertyManagerOwner &po) {
+    *this = po;
+  }
 
   bool existsProperty(const std::string &name) const;
   bool validateProperties() const;
diff --git a/Framework/Kernel/src/ANN/ANN.cpp b/Framework/Kernel/src/ANN/ANN.cpp
index 67f9c84987efd4b2b1e84affd8e403d78b6fe35b..3cba35cc6c6c6ba5a6c811683917d91b1de35f4d 100644
--- a/Framework/Kernel/src/ANN/ANN.cpp
+++ b/Framework/Kernel/src/ANN/ANN.cpp
@@ -27,6 +27,7 @@
 //----------------------------------------------------------------------
 
 #include <cstdlib>                    // C standard lib defs
+#include <iostream>                   // I/O streams
 #include "MantidKernel/ANN/ANNx.h"    // all ANN includes
 #include "MantidKernel/ANN/ANNperf.h" // ANN Perf Header
 
diff --git a/Framework/Kernel/src/ANN/kd_dump.cpp b/Framework/Kernel/src/ANN/kd_dump.cpp
index 203a443249f79c5ed1a24aa84dcac9c33ae2d1b0..eb99a37d414ff2aaefaad18ba3f2f46450b7553c 100644
--- a/Framework/Kernel/src/ANN/kd_dump.cpp
+++ b/Framework/Kernel/src/ANN/kd_dump.cpp
@@ -34,6 +34,8 @@
 #include "kd_tree.h" // kd-tree declarations
 #include "bd_tree.h" // bd-tree declarations
 
+#include <limits>
+
 using namespace std; // make std:: available
 
 //----------------------------------------------------------------------
@@ -332,6 +334,15 @@ annReadDump(istream &in,              // input stream
     for (j = 0; j < the_dim; j++) { // read bounding box low
       in >> the_bnd_box_hi[j];
     }
+
+    if (0 > the_n_pts ||
+        static_cast<size_t>(std::numeric_limits<int>::max()) <=
+            static_cast<size_t>(the_n_pts / sizeof(ANNidx))) {
+      annError("Too big number of elements for the point index array. This "
+               "would cause an overflow when allocating memory",
+               ANNabort);
+    }
+
     the_pidx = new ANNidx[the_n_pts]; // allocate point index array
     int next_idx = 0;                 // number of indices filled
                                       // read the tree and indices
@@ -429,6 +440,16 @@ static ANNkd_ptr annReadTree(istream &in,           // input stream
     int n_bnds;   // number of bounding sides
     in >> n_bnds; // number of bounding sides
                   // allocate bounds array
+
+    if (0 > n_bnds ||
+        static_cast<size_t>(std::numeric_limits<int>::max()) <=
+            static_cast<size_t>(n_bnds / sizeof(ANNorthHalfSpace))) {
+      annError("Too big number of bounding sides, would cause overflow when "
+               "allocating memory",
+               ANNabort);
+      exit(0);
+    }
+
     ANNorthHSArray bds = new ANNorthHalfSpace[n_bnds];
     for (int i = 0; i < n_bnds; i++) {
       int sd;               // which side
diff --git a/Framework/Kernel/src/Atom.cpp b/Framework/Kernel/src/Atom.cpp
index 7a9e2551517b3de90b58f93b514b58d07efdd2c2..43452e3b8d6467c8a4c33a1f2d586910165169f7 100644
--- a/Framework/Kernel/src/Atom.cpp
+++ b/Framework/Kernel/src/Atom.cpp
@@ -1,5 +1,4 @@
 #include <algorithm>
-#include <iostream> // REMOVE
 #include <sstream>
 #include <stdexcept>
 #include "MantidKernel/Atom.h"
diff --git a/Framework/Kernel/src/DateValidator.cpp b/Framework/Kernel/src/DateValidator.cpp
index 2ff99628903731dcf38e75d971c67852a1f8c550..5362fb247e217211a577736781841c1057ccacfe 100644
--- a/Framework/Kernel/src/DateValidator.cpp
+++ b/Framework/Kernel/src/DateValidator.cpp
@@ -28,6 +28,9 @@ struct tm getTimeValue(const std::string &sDate, std::string &error) {
   timeinfo.tm_wday = 0;
   timeinfo.tm_yday = 0;
   timeinfo.tm_isdst = -1;
+#ifndef _WIN32
+  timeinfo.tm_gmtoff = 0;
+#endif
 
   std::basic_string<char>::size_type index, off = 0;
   int day, month, year;
diff --git a/Framework/Kernel/src/DllOpen.cpp b/Framework/Kernel/src/DllOpen.cpp
index 927e518eac7df182180cb0f55d0da10ad47a2a09..e66b0dced4b5b1714d7988834008ec8a09160939 100644
--- a/Framework/Kernel/src/DllOpen.cpp
+++ b/Framework/Kernel/src/DllOpen.cpp
@@ -1,5 +1,4 @@
 #include <string>
-#include <iostream>
 
 /*
  If the OS is Windows then LoadLibrary, GetProcAddress and FreeLibrary are used.
diff --git a/Framework/Kernel/src/Exception.cpp b/Framework/Kernel/src/Exception.cpp
index ee12a3b5d95a6b68f7bd9fe3825158b2c11cf47a..26e6e194942991c765de3e0bed348d5e4764c77a 100644
--- a/Framework/Kernel/src/Exception.cpp
+++ b/Framework/Kernel/src/Exception.cpp
@@ -1,4 +1,3 @@
-#include <iostream>
 #include <sstream>
 #include "MantidKernel/Exception.h"
 
diff --git a/Framework/Kernel/src/FacilityInfo.cpp b/Framework/Kernel/src/FacilityInfo.cpp
index b85fb675073190996a71f4ab9fa71dc90a6401c5..9a42c5a20839d19cba3db33d3a9db7852cb8215c 100644
--- a/Framework/Kernel/src/FacilityInfo.cpp
+++ b/Framework/Kernel/src/FacilityInfo.cpp
@@ -2,7 +2,6 @@
 // Includes
 //----------------------------------------------------------------------
 #include <algorithm>
-#include <iostream>
 
 #include "MantidKernel/FacilityInfo.h"
 #include "MantidKernel/ConfigService.h"
diff --git a/Framework/Kernel/src/LibraryManager.cpp b/Framework/Kernel/src/LibraryManager.cpp
index 438e55b9b1d016d31908b5824f22886a5ea992b7..da72c1042cb65c1941276552fe625c0181efb42c 100644
--- a/Framework/Kernel/src/LibraryManager.cpp
+++ b/Framework/Kernel/src/LibraryManager.cpp
@@ -1,4 +1,3 @@
-#include <iostream>
 
 #include "MantidKernel/ConfigService.h"
 #include "MantidKernel/DllOpen.h"
diff --git a/Framework/Kernel/src/Matrix.cpp b/Framework/Kernel/src/Matrix.cpp
index f4e1adc13197297776e06c33da66c50614498298..014284f04c4da6b769c33f2d1157cb0390e3f336 100644
--- a/Framework/Kernel/src/Matrix.cpp
+++ b/Framework/Kernel/src/Matrix.cpp
@@ -158,17 +158,20 @@ Matrix<T>::Matrix(const Matrix<T> &A, const size_t nrow, const size_t ncol)
     throw Kernel::Exception::IndexError(ncol, A.ny,
                                         "Matrix::Constructor without col");
   setMem(nx, ny);
-  size_t iR(0);
-  for (size_t i = 0; i <= nx; i++) {
-    if (i != nrow) {
-      size_t jR(0);
-      for (size_t j = 0; j <= ny; j++) {
-        if (j != ncol) {
-          V[iR][jR] = A.V[i][j];
-          jR++;
+  if (V) {
+    size_t iR(0);
+    for (size_t i = 0; i <= nx; i++) {
+      if (i != nrow) {
+        size_t jR(0);
+        for (size_t j = 0; j <= ny; j++) {
+          if (j != ncol) {
+
+            V[iR][jR] = A.V[i][j];
+            jR++;
+          }
         }
+        iR++;
       }
-      iR++;
     }
   }
 }
diff --git a/Framework/Kernel/src/Memory.cpp b/Framework/Kernel/src/Memory.cpp
index a1f11272d0ac8ca2f642115b8bd1e441366ca495..448b22767877e15c80932f654fd6d317fae79479 100644
--- a/Framework/Kernel/src/Memory.cpp
+++ b/Framework/Kernel/src/Memory.cpp
@@ -1,8 +1,6 @@
 #include "MantidKernel/Memory.h"
 #include "MantidKernel/Logger.h"
 
-#include <iostream>
-#include <iomanip>
 #include <sstream>
 
 #ifdef __linux__
diff --git a/Framework/Kernel/src/NetworkProxyOSX.cpp b/Framework/Kernel/src/NetworkProxyOSX.cpp
index b3dbeb96dbc9dded88e2029784f5664d176298a9..5bdae5c9c297078640f34c5be7d481dee3fc852e 100644
--- a/Framework/Kernel/src/NetworkProxyOSX.cpp
+++ b/Framework/Kernel/src/NetworkProxyOSX.cpp
@@ -5,7 +5,6 @@
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <CoreFoundation/CoreFoundation.h>
 #include <CFNetwork/CFProxySupport.h>
-#include <iostream>
 #include <sstream>
 #include <string>
 #include <vector>
diff --git a/Framework/Kernel/src/NeutronAtom.cpp b/Framework/Kernel/src/NeutronAtom.cpp
index 03874b20567f64528a9cde28317cfeeb01480b99..4469af38fb770fe88a084f6a1eab6c803ecabb84 100644
--- a/Framework/Kernel/src/NeutronAtom.cpp
+++ b/Framework/Kernel/src/NeutronAtom.cpp
@@ -4,7 +4,6 @@
 #include "MantidKernel/NeutronAtom.h"
 #include "MantidKernel/PhysicalConstants.h"
 #include <algorithm>
-#include <iostream> // REMOVE
 #include <sstream>
 #include <stdexcept>
 #include <boost/math/special_functions/fpclassify.hpp>
diff --git a/Framework/Kernel/src/ProxyInfo.cpp b/Framework/Kernel/src/ProxyInfo.cpp
index 1299ff719d8c1b81e5dc8a6d2592b662c537395c..c34da7a9411eb39b398ea93b3054f749d17e8496 100644
--- a/Framework/Kernel/src/ProxyInfo.cpp
+++ b/Framework/Kernel/src/ProxyInfo.cpp
@@ -1,6 +1,5 @@
 #include "MantidKernel/ProxyInfo.h"
 #include <stdexcept>
-#include <iostream>
 
 namespace Mantid {
 namespace Kernel {
diff --git a/Framework/Kernel/src/Strings.cpp b/Framework/Kernel/src/Strings.cpp
index c396f0e02c9b9179337274b07a24758d49aabed5..c2bf98bd5ac359c668662ad04aab5db601603e03 100644
--- a/Framework/Kernel/src/Strings.cpp
+++ b/Framework/Kernel/src/Strings.cpp
@@ -11,7 +11,6 @@
 
 #include <cmath>
 #include <fstream>
-#include <iomanip>
 
 using std::size_t;
 
diff --git a/Framework/Kernel/src/ThreadSafeLogStream.cpp b/Framework/Kernel/src/ThreadSafeLogStream.cpp
index e487fe13169a12b03237808fdea8a943162b9e4a..23eceb0c53eef5544e24bd5fc04bf1f8db227871 100644
--- a/Framework/Kernel/src/ThreadSafeLogStream.cpp
+++ b/Framework/Kernel/src/ThreadSafeLogStream.cpp
@@ -2,7 +2,6 @@
 // Includes
 //-----------------------------------------------
 #include "MantidKernel/ThreadSafeLogStream.h"
-#include <iostream>
 
 using namespace Mantid::Kernel;
 
diff --git a/Framework/Kernel/src/V3D.cpp b/Framework/Kernel/src/V3D.cpp
index 0d504d14bec5e04587d15b7f7926880a05733493..fc9ef31b403d5923fdb627ecd8687344d357bd96 100644
--- a/Framework/Kernel/src/V3D.cpp
+++ b/Framework/Kernel/src/V3D.cpp
@@ -1,4 +1,3 @@
-#include <iostream>
 #include <cmath>
 #include <float.h>
 #include <vector>
diff --git a/Framework/Kernel/src/VectorHelper.cpp b/Framework/Kernel/src/VectorHelper.cpp
index 71a917e2628e76750d6f9e67d0b0ee217bc6fe55..61aedadfc83fefb11da536e3229170dc378d050e 100644
--- a/Framework/Kernel/src/VectorHelper.cpp
+++ b/Framework/Kernel/src/VectorHelper.cpp
@@ -3,7 +3,6 @@
 
 #include "MantidKernel/VectorHelper.h"
 #include <algorithm>
-#include <iostream>
 #include <numeric>
 #include <sstream>
 #include <boost/algorithm/string.hpp>
diff --git a/Framework/Kernel/test/ArrayLengthValidatorTest.h b/Framework/Kernel/test/ArrayLengthValidatorTest.h
index fee68f88eb36cf7df2ccb4345bd990a9750be547..11f5912f56b56009e15028c6b49fafda04b5065a 100644
--- a/Framework/Kernel/test/ArrayLengthValidatorTest.h
+++ b/Framework/Kernel/test/ArrayLengthValidatorTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 #include <vector>
 
 #include "MantidKernel/ArrayLengthValidator.h"
diff --git a/Framework/Kernel/test/BoseEinsteinDistributionTest.h b/Framework/Kernel/test/BoseEinsteinDistributionTest.h
index 8648aca16e781cebae037bd859cb1d10b1f5e0db..38809270e4610ce1cae724b1dc473f50c20d184b 100644
--- a/Framework/Kernel/test/BoseEinsteinDistributionTest.h
+++ b/Framework/Kernel/test/BoseEinsteinDistributionTest.h
@@ -6,9 +6,6 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include <iostream>
-#include <iomanip>
-
 class BoseEinsteinDistributionTest : public CxxTest::TestSuite {
 public:
   void test_Standard_Distribution_Gives_Correct_Value_Away_From_Edge() {
diff --git a/Framework/Kernel/test/CPUTimerTest.h b/Framework/Kernel/test/CPUTimerTest.h
index 4e7ce55ff50a9af6541c8ca93050a8e6460679d2..802291637de8183b9e630b26cc747d586f9ac01b 100644
--- a/Framework/Kernel/test/CPUTimerTest.h
+++ b/Framework/Kernel/test/CPUTimerTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidKernel/CPUTimer.h"
 
diff --git a/Framework/Kernel/test/CompositeValidatorTest.h b/Framework/Kernel/test/CompositeValidatorTest.h
index c13f5f990999f3a4021dca837102cd488cf83cb6..72f33a82d16bc9d0fd6d262e51ca374b057105b9 100644
--- a/Framework/Kernel/test/CompositeValidatorTest.h
+++ b/Framework/Kernel/test/CompositeValidatorTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidKernel/CompositeValidator.h"
 #include "MantidKernel/BoundedValidator.h"
diff --git a/Framework/Kernel/test/DiskBufferISaveableTest.h b/Framework/Kernel/test/DiskBufferISaveableTest.h
index b75dbfba8bf0bb56d4c096d9197f8083ed08923e..d6c674ec2860962343651c2fa12d5722e5301fca 100644
--- a/Framework/Kernel/test/DiskBufferISaveableTest.h
+++ b/Framework/Kernel/test/DiskBufferISaveableTest.h
@@ -13,8 +13,6 @@
 #include <boost/multi_index/mem_fun.hpp>
 #include <boost/multi_index/sequenced_index.hpp>
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 
 using namespace Mantid;
 using namespace Mantid::Kernel;
diff --git a/Framework/Kernel/test/DiskBufferTest.h b/Framework/Kernel/test/DiskBufferTest.h
index 8da5e7cc4e300aa0df0d927dfe6ce4561a94f4e9..82a451b6ffc6870fd1b7fc13948048a69d833e0f 100644
--- a/Framework/Kernel/test/DiskBufferTest.h
+++ b/Framework/Kernel/test/DiskBufferTest.h
@@ -13,8 +13,6 @@
 #include <boost/multi_index/mem_fun.hpp>
 #include <boost/multi_index/sequenced_index.hpp>
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 
 using namespace Mantid;
 using namespace Mantid::Kernel;
diff --git a/Framework/Kernel/test/EnabledWhenPropertyTest.h b/Framework/Kernel/test/EnabledWhenPropertyTest.h
index af3453572a2335fcd2bcce083b4490b80a96fd04..20caf9b265779c621e59133c88cc061453eb00b4 100644
--- a/Framework/Kernel/test/EnabledWhenPropertyTest.h
+++ b/Framework/Kernel/test/EnabledWhenPropertyTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidKernel/EnabledWhenProperty.h"
 #include "MantidKernel/PropertyManager.h"
diff --git a/Framework/Kernel/test/FreeBlockTest.h b/Framework/Kernel/test/FreeBlockTest.h
index 9cf27660d301a82c85a6556004cd0c0aeef95cac..1cf4e7408db6d6d197123bca277f90b6d9fcd550 100644
--- a/Framework/Kernel/test/FreeBlockTest.h
+++ b/Framework/Kernel/test/FreeBlockTest.h
@@ -5,8 +5,6 @@
 #include "MantidKernel/System.h"
 #include "MantidKernel/Timer.h"
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 
 using namespace Mantid;
 using namespace Mantid::Kernel;
diff --git a/Framework/Kernel/test/FunctionTaskTest.h b/Framework/Kernel/test/FunctionTaskTest.h
index b1ce5a461081200257dfc83002c9ae0d5e68d419..ff7054fa190719905c45b676defe03a3973630c8 100644
--- a/Framework/Kernel/test/FunctionTaskTest.h
+++ b/Framework/Kernel/test/FunctionTaskTest.h
@@ -7,9 +7,6 @@
 #include "MantidKernel/Task.h"
 #include "MantidKernel/FunctionTask.h"
 
-#include <iostream>
-#include <iomanip>
-
 using namespace Mantid::Kernel;
 
 /** Functions for use by the tasks */
diff --git a/Framework/Kernel/test/HermitePolynomialsTest.h b/Framework/Kernel/test/HermitePolynomialsTest.h
index 8e11b8279bfe37a52f1b043cb87f39ead8743f1f..7cfde2e885efa143f3bf5660067bf725f3b7008c 100644
--- a/Framework/Kernel/test/HermitePolynomialsTest.h
+++ b/Framework/Kernel/test/HermitePolynomialsTest.h
@@ -2,7 +2,6 @@
 #define MANTID_KERNEL_HERMITEPOLYNOMIALSTEST_H_
 
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
 #include "MantidKernel/Math/Distributions/HermitePolynomials.h"
 
 class HermitePolynomialsTest : public CxxTest::TestSuite {
diff --git a/Framework/Kernel/test/IPropertySettingsTest.h b/Framework/Kernel/test/IPropertySettingsTest.h
index 3183c96e0d1dc62b28be4fc4123bafd061a8acb9..bb1e4afebba871bbb15805038853b4d21c1212f6 100644
--- a/Framework/Kernel/test/IPropertySettingsTest.h
+++ b/Framework/Kernel/test/IPropertySettingsTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 #include "MantidKernel/IPropertySettings.h"
 
 using namespace Mantid;
diff --git a/Framework/Kernel/test/ISaveableTest.h b/Framework/Kernel/test/ISaveableTest.h
index 2c053fef2c6174fe4971a8afb3ffe0b38dde63ec..14be0493129e2fcf3e062e2a094a7659d8341901 100644
--- a/Framework/Kernel/test/ISaveableTest.h
+++ b/Framework/Kernel/test/ISaveableTest.h
@@ -5,8 +5,6 @@
 #include "MantidKernel/System.h"
 #include "MantidKernel/Timer.h"
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 
 using namespace Mantid;
 
diff --git a/Framework/Kernel/test/LogParserTest.h b/Framework/Kernel/test/LogParserTest.h
index 558b1c2bd8faaf2adca6403ea137a6c0875103ed..0cf62d8730c89ef30b35c9ec78626360841e8e02 100644
--- a/Framework/Kernel/test/LogParserTest.h
+++ b/Framework/Kernel/test/LogParserTest.h
@@ -3,7 +3,6 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include <iostream>
 #include <fstream>
 
 #include "MantidKernel/LogParser.h"
diff --git a/Framework/Kernel/test/MagneticFormFactorTableTest.h b/Framework/Kernel/test/MagneticFormFactorTableTest.h
index 1762991bdfb25ba87980528285a20cf6662ff199..1d660d419e635a62a49b871ce6bb465f5fd44ce9 100644
--- a/Framework/Kernel/test/MagneticFormFactorTableTest.h
+++ b/Framework/Kernel/test/MagneticFormFactorTableTest.h
@@ -6,8 +6,6 @@
 
 #include <boost/scoped_ptr.hpp>
 
-#include <iomanip>
-
 using Mantid::PhysicalConstants::MagneticFormFactorTable;
 
 class MagneticFormFactorTableTest : public CxxTest::TestSuite {
diff --git a/Framework/Kernel/test/MemoryTest.h b/Framework/Kernel/test/MemoryTest.h
index c2e55c723f63f4870bacdd64586982bf64ac0709..4b515aa9a277a10b2452da378d236f52f4322060 100644
--- a/Framework/Kernel/test/MemoryTest.h
+++ b/Framework/Kernel/test/MemoryTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidKernel/Memory.h"
 #include "MantidKernel/MultiThreaded.h"
diff --git a/Framework/Kernel/test/MutexTest.h b/Framework/Kernel/test/MutexTest.h
index 2f52b64eac2d45988310fbd9d5ab5b2ac43159bf..47194481d641533003258aba139b9fe259425796 100644
--- a/Framework/Kernel/test/MutexTest.h
+++ b/Framework/Kernel/test/MutexTest.h
@@ -5,7 +5,6 @@
 #include "MantidKernel/MultiThreaded.h"
 #include "MantidKernel/ThreadPool.h"
 #include "MantidKernel/FunctionTask.h"
-#include <iostream>
 #include "MantidKernel/CPUTimer.h"
 #include <Poco/RWLock.h>
 using namespace Mantid::Kernel;
diff --git a/Framework/Kernel/test/ProgressBaseTest.h b/Framework/Kernel/test/ProgressBaseTest.h
index cecacc02982b5a7cd4a826ce7a52c2844150fc39..ac58b058210985420321a3bd68ada7c86d6a9841 100644
--- a/Framework/Kernel/test/ProgressBaseTest.h
+++ b/Framework/Kernel/test/ProgressBaseTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidKernel/ProgressBase.h"
 
diff --git a/Framework/Kernel/test/ProgressTextTest.h b/Framework/Kernel/test/ProgressTextTest.h
index e70ab338386cf17b660216143bd68faa30b53f43..03432ae35fd58cfdd877e0cf38daa08138d4191b 100644
--- a/Framework/Kernel/test/ProgressTextTest.h
+++ b/Framework/Kernel/test/ProgressTextTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 #include <cstdlib>
 
 #include "MantidKernel/ProgressText.h"
diff --git a/Framework/Kernel/test/StdoutChannelTest.h b/Framework/Kernel/test/StdoutChannelTest.h
index e0ef37350d8875bfc478351183b98b575e9fd753..3c24efdf4ecf160e4b86478c2b36da005a1aa19d 100644
--- a/Framework/Kernel/test/StdoutChannelTest.h
+++ b/Framework/Kernel/test/StdoutChannelTest.h
@@ -5,7 +5,6 @@
 
 #include "MantidKernel/StdoutChannel.h"
 #include "MantidKernel/Logger.h"
-#include <iostream>
 #include <Poco/Logger.h>
 #include <Poco/NullChannel.h>
 #include <Poco/AutoPtr.h>
diff --git a/Framework/Kernel/test/TaskTest.h b/Framework/Kernel/test/TaskTest.h
index b9d2fc3f0a1050aa543c8032815fc17e21135741..975a27f179e93dcfe4576d66fcbccbe2f8d1f80f 100644
--- a/Framework/Kernel/test/TaskTest.h
+++ b/Framework/Kernel/test/TaskTest.h
@@ -6,9 +6,6 @@
 #include <MantidKernel/Timer.h>
 #include "MantidKernel/Task.h"
 
-#include <iostream>
-#include <iomanip>
-
 using namespace Mantid::Kernel;
 
 namespace TaskTestNamespace {
diff --git a/Framework/Kernel/test/ThreadPoolRunnableTest.h b/Framework/Kernel/test/ThreadPoolRunnableTest.h
index 009dae5e2b8c40fece751eaa4921eb080b10a37f..9d7470406d7de456048cb68bf22c068cb4f32ff0 100644
--- a/Framework/Kernel/test/ThreadPoolRunnableTest.h
+++ b/Framework/Kernel/test/ThreadPoolRunnableTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include <MantidKernel/Timer.h>
 #include <MantidKernel/System.h>
-#include <iostream>
-#include <iomanip>
 
 #include <MantidKernel/ThreadPoolRunnable.h>
 #include <MantidKernel/ThreadScheduler.h>
diff --git a/Framework/Kernel/test/ThreadPoolTest.h b/Framework/Kernel/test/ThreadPoolTest.h
index c8aaca80a53e0963993b41410820afc983b280a8..624221f4cfdbc1c57ca439e897e72884a90af002 100644
--- a/Framework/Kernel/test/ThreadPoolTest.h
+++ b/Framework/Kernel/test/ThreadPoolTest.h
@@ -13,8 +13,6 @@
 
 #include <boost/bind.hpp>
 #include <boost/make_shared.hpp>
-#include <iostream>
-#include <iomanip>
 #include <Poco/Mutex.h>
 #include <cstdlib>
 
diff --git a/Framework/Kernel/test/ThreadSchedulerMutexesTest.h b/Framework/Kernel/test/ThreadSchedulerMutexesTest.h
index 9c8166f6795ad7713d1d00adef340b6253daff62..bc74c0d5dd6256175b3fe1fd5d36388b86a20c71 100644
--- a/Framework/Kernel/test/ThreadSchedulerMutexesTest.h
+++ b/Framework/Kernel/test/ThreadSchedulerMutexesTest.h
@@ -5,8 +5,6 @@
 #include <MantidKernel/Timer.h>
 #include <MantidKernel/System.h>
 #include <boost/make_shared.hpp>
-#include <iostream>
-#include <iomanip>
 
 #include <MantidKernel/ThreadSchedulerMutexes.h>
 
diff --git a/Framework/Kernel/test/ThreadSchedulerTest.h b/Framework/Kernel/test/ThreadSchedulerTest.h
index 16786463bf19d92497f7c98c3ef75de4c5a332f8..31d6e7f7b29465af685ac9c0cdf83ac373f1da50 100644
--- a/Framework/Kernel/test/ThreadSchedulerTest.h
+++ b/Framework/Kernel/test/ThreadSchedulerTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include <MantidKernel/Timer.h>
 #include <MantidKernel/System.h>
-#include <iostream>
-#include <iomanip>
 
 #include <MantidKernel/ThreadScheduler.h>
 #include <MantidKernel/Task.h>
diff --git a/Framework/Kernel/test/UnitConversionTest.h b/Framework/Kernel/test/UnitConversionTest.h
index f3b0a259c7b4dae6fb661cb33db16feb68da93ae..369caac852ad64d24fd85e11192719c38fc3b8c3 100644
--- a/Framework/Kernel/test/UnitConversionTest.h
+++ b/Framework/Kernel/test/UnitConversionTest.h
@@ -6,8 +6,6 @@
 #include "MantidKernel/Exception.h"
 #include "MantidKernel/PhysicalConstants.h"
 
-#include <iomanip>
-
 using Mantid::Kernel::UnitConversion;
 
 class UnitConversionTest : public CxxTest::TestSuite {
diff --git a/Framework/Kernel/test/UtilsTest.h b/Framework/Kernel/test/UtilsTest.h
index fd76bb7e91bed37c52d64f4a4149d674e14706a7..767a1a4b4dd2835ff42151c18dfe8cc4ce5df69f 100644
--- a/Framework/Kernel/test/UtilsTest.h
+++ b/Framework/Kernel/test/UtilsTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidKernel/Utils.h"
 
diff --git a/Framework/Kernel/test/VMDTest.h b/Framework/Kernel/test/VMDTest.h
index 27ac5cc6087a7326551f026156cfe36609580d96..0d550ab59a508ebce516b1ca4b6b48ed55d047b2 100644
--- a/Framework/Kernel/test/VMDTest.h
+++ b/Framework/Kernel/test/VMDTest.h
@@ -5,8 +5,6 @@
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
 #include <cmath>
-#include <iostream>
-#include <iomanip>
 
 #include "MantidKernel/VMD.h"
 
diff --git a/Framework/Kernel/test/VectorHelperTest.h b/Framework/Kernel/test/VectorHelperTest.h
index 2573f0b11e962c396acdca2dd289834c62d1e2ec..16f9f4b86a2f79e2fe41a07dc55323e44066e000 100644
--- a/Framework/Kernel/test/VectorHelperTest.h
+++ b/Framework/Kernel/test/VectorHelperTest.h
@@ -5,8 +5,6 @@
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/VectorHelper.h"
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 #include <boost/assign/list_of.hpp>
 
 using namespace Mantid::Kernel;
diff --git a/Framework/Kernel/test/VisibleWhenPropertyTest.h b/Framework/Kernel/test/VisibleWhenPropertyTest.h
index 1ed5da48cd5bcc75fc86adb8a01bd7c13f83ca7d..197009c33bdc9c841ba2cd705ee024caed7ea845 100644
--- a/Framework/Kernel/test/VisibleWhenPropertyTest.h
+++ b/Framework/Kernel/test/VisibleWhenPropertyTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidKernel/VisibleWhenProperty.h"
 #include "MantidKernel/PropertyManagerOwner.h"
diff --git a/Framework/LiveData/src/ADARA/ADARAParser.cpp b/Framework/LiveData/src/ADARA/ADARAParser.cpp
index 8fe1652ecb61c1985e1538b85869fc1c8d029b3f..1fe48e4b00b4755d3c0e3a73e5c25c8caf289e86 100644
--- a/Framework/LiveData/src/ADARA/ADARAParser.cpp
+++ b/Framework/LiveData/src/ADARA/ADARAParser.cpp
@@ -9,7 +9,7 @@ using namespace ADARA;
 
 Parser::Parser(unsigned int initial_buffer_size, unsigned int max_pkt_size)
     : m_size(initial_buffer_size), m_max_size(max_pkt_size), m_len(0),
-      m_restart_offset(0), m_oversize_len(0) {
+      m_restart_offset(0), m_oversize_len(0), m_oversize_offset(0) {
   m_buffer = new uint8_t[initial_buffer_size];
   m_discarded_packets.clear();
 }
diff --git a/Framework/LiveData/src/ISISHistoDataListener.cpp b/Framework/LiveData/src/ISISHistoDataListener.cpp
index d962ecea3eafff1aabb5550675c27bf898669eba..b211f601a4eb5dd334c87e053d597a875164d35d 100644
--- a/Framework/LiveData/src/ISISHistoDataListener.cpp
+++ b/Framework/LiveData/src/ISISHistoDataListener.cpp
@@ -181,6 +181,10 @@ boost::shared_ptr<Workspace> ISISHistoDataListener::extractData() {
   getFloatArray("RRPB", floatBuffer, 32);
   const double protonCharge = floatBuffer[8];
 
+  if (m_timeRegime < 0)
+    throw std::runtime_error("The value of the time regime variable is "
+                             "negative. This is an Internal inconsistency.");
+
   // find out the number of histograms in the output workspace
   const size_t numberOfHistograms =
       m_specList.empty() ? m_numberOfSpectra[m_timeRegime] : m_specList.size();
diff --git a/Framework/LiveData/src/LoadDAE/isisds_command.cpp b/Framework/LiveData/src/LoadDAE/isisds_command.cpp
index 790c2391b29ba8394be8f545f77d2e4e4fa1eeb6..b54ea2c9781699874f8f7b5c3b9b3cc1ba9209b8 100644
--- a/Framework/LiveData/src/LoadDAE/isisds_command.cpp
+++ b/Framework/LiveData/src/LoadDAE/isisds_command.cpp
@@ -145,8 +145,14 @@ SOCKET isisds_send_open(const char *host, ISISDSAccessMode access_type,
   if (s == INVALID_SOCKET) {
     return INVALID_SOCKET;
   }
-  setsockopt(s, SOL_SOCKET, SO_KEEPALIVE, (char *)&setkeepalive,
-             sizeof(setkeepalive));
+
+  int zero = setsockopt(s, SOL_SOCKET, SO_KEEPALIVE, (char *)&setkeepalive,
+                        sizeof(setkeepalive));
+  if (0 != zero) {
+    closesocket(s);
+    return INVALID_SOCKET;
+  }
+
   if (connect(s, (struct sockaddr *)&address, sizeof(address)) == -1) {
     closesocket(s);
     return INVALID_SOCKET;
diff --git a/Framework/LiveData/test/LiveDataAlgorithmTest.h b/Framework/LiveData/test/LiveDataAlgorithmTest.h
index a3eb949773fcdee51a810d6fe7b34e526d136aa6..0e2b7344b381ddaa4b09cdbadf40dab822f75423 100644
--- a/Framework/LiveData/test/LiveDataAlgorithmTest.h
+++ b/Framework/LiveData/test/LiveDataAlgorithmTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 #include "MantidLiveData/LiveDataAlgorithm.h"
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
 #include "MantidTestHelpers/FacilityHelper.h"
diff --git a/Framework/LiveData/test/LoadLiveDataTest.h b/Framework/LiveData/test/LoadLiveDataTest.h
index 91b69f5ad0ec7a4693c19dd7aed8d051fcf991ba..77bdef423f6cb70ec7abff8bc81c80ccec2d0570 100644
--- a/Framework/LiveData/test/LoadLiveDataTest.h
+++ b/Framework/LiveData/test/LoadLiveDataTest.h
@@ -7,8 +7,6 @@
 #include "MantidKernel/System.h"
 #include "MantidKernel/Timer.h"
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 #include <numeric>
 #include "MantidDataObjects/Workspace2D.h"
 #include "MantidKernel/ConfigService.h"
diff --git a/Framework/LiveData/test/MonitorLiveDataTest.h b/Framework/LiveData/test/MonitorLiveDataTest.h
index fc9d1e9a653e7809b43829021a78677f74e913ba..0fdd7f94b60b762ca57152ba142c5f37a6407838 100644
--- a/Framework/LiveData/test/MonitorLiveDataTest.h
+++ b/Framework/LiveData/test/MonitorLiveDataTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidLiveData/MonitorLiveData.h"
 #include "MantidAPI/AlgorithmManager.h"
diff --git a/Framework/LiveData/test/StartLiveDataTest.h b/Framework/LiveData/test/StartLiveDataTest.h
index 8f7729d14eea1dde91094dd99bbcdc97688a64b4..023343ebd11be6149873e508b8dd7c9c1df932bf 100644
--- a/Framework/LiveData/test/StartLiveDataTest.h
+++ b/Framework/LiveData/test/StartLiveDataTest.h
@@ -6,8 +6,6 @@
 #include "MantidKernel/System.h"
 #include "MantidKernel/Timer.h"
 #include <cxxtest/TestSuite.h>
-#include <iomanip>
-#include <iostream>
 #include "MantidKernel/SingletonHolder.h"
 #include "MantidAPI/AlgorithmManager.h"
 #include "MantidAPI/FrameworkManager.h"
diff --git a/Framework/MDAlgorithms/CMakeLists.txt b/Framework/MDAlgorithms/CMakeLists.txt
index f3e9e4d04a2db2271f828af463f363f2364f2462..8725b21a5ce0ae0f8beeca48f7506a054beffeb4 100644
--- a/Framework/MDAlgorithms/CMakeLists.txt
+++ b/Framework/MDAlgorithms/CMakeLists.txt
@@ -12,6 +12,7 @@ set ( SRC_FILES
 	src/CentroidPeaksMD.cpp
 	src/CentroidPeaksMD2.cpp
 	src/CloneMDWorkspace.cpp
+    src/CompactMD.cpp
 	src/CompareMDWorkspaces.cpp
 	src/ConvToMDBase.cpp
 	src/ConvToMDEventsWS.cpp
@@ -136,6 +137,7 @@ set ( INC_FILES
 	inc/MantidMDAlgorithms/CentroidPeaksMD2.h
 	inc/MantidMDAlgorithms/CloneMDWorkspace.h
 	inc/MantidMDAlgorithms/CompareMDWorkspaces.h
+    inc/MantidMDAlgorithms/CompactMD.h
 	inc/MantidMDAlgorithms/ConvToMDBase.h
 	inc/MantidMDAlgorithms/ConvertCWPDMDToSpectra.h
 	inc/MantidMDAlgorithms/ConvertCWSDExpToMomentum.h
@@ -257,6 +259,7 @@ set ( TEST_FILES
 	CentroidPeaksMDTest.h
 	CloneMDWorkspaceTest.h
 	CompareMDWorkspacesTest.h
+    CompactMDTest.h
 	ConvertCWPDMDToSpectraTest.h
 	ConvertCWSDExpToMomentumTest.h
 	ConvertCWSDMDtoHKLTest.h
diff --git a/Framework/MDAlgorithms/inc/MantidMDAlgorithms/CompactMD.h b/Framework/MDAlgorithms/inc/MantidMDAlgorithms/CompactMD.h
new file mode 100644
index 0000000000000000000000000000000000000000..c206f73b5409e0178a836f0d32a3a30d67014c16
--- /dev/null
+++ b/Framework/MDAlgorithms/inc/MantidMDAlgorithms/CompactMD.h
@@ -0,0 +1,65 @@
+#ifndef MANTID_MDALGORITHMS_COMPACTMD_H_
+#define MANTID_MDALGORITHMS_COMPACTMD_H_
+
+/** An algorithm used to crop an MDHistoWorkspace based on the first
+    non-zero signals found in each dimension.
+
+  @author Matt King
+  @date 02-10-2015
+
+  Copyright &copy; 2015 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge
+  National Laboratory & European Spallation Source
+
+  This file is part of Mantid.
+
+  Mantid is free software; you can 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.
+
+  Mantid is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU 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/>.
+
+  File change history is stored at: <https://github.com/mantidproject/mantid>
+  Code Documentation is available at: <http://doxygen.mantidproject.org>
+*/
+
+#include "MantidAPI/IMDHistoWorkspace.h"
+#include "MantidDataObjects/MDHistoWorkspace.h"
+#include "MantidMDAlgorithms/CutMD.h"
+#include "MantidAPI/Algorithm.h"
+#include "boost/shared_ptr.hpp"
+namespace Mantid {
+namespace MDAlgorithms {
+class DLLExport CompactMD : public API::Algorithm {
+public:
+  CompactMD(){};
+  ~CompactMD(){};
+
+  virtual void init();
+  virtual void exec();
+  /// Algorithm's name for identification
+  const std::string name() const { return "CompactMD"; }
+  /// Summary of algorithms purpose
+  const std::string summary() const {
+    return "Crops an MDHistoWorkspace based on the first non-zero signals "
+           "giving a more focussed area of interest.";
+  }
+  const std::string category() const { return "MDAlgorithms"; }
+  /// Algorithm's version for identification
+  int version() const { return 1; }
+  /// Finding the extents of the first non-zero signals.
+  void
+  findFirstNonZeroMinMaxExtents(Mantid::API::IMDHistoWorkspace_sptr inputWs,
+                                std::vector<Mantid::coord_t> &minVec,
+                                std::vector<Mantid::coord_t> &maxVec);
+};
+}
+}
+
+#endif // MANTID_MDALGORITHMS_COMPACTMD_H_
\ No newline at end of file
diff --git a/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Integrate3DEvents.h b/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Integrate3DEvents.h
index 2d2b6398fcbc13ef8930008df57da0b01eb015e7..d5a3c71fc66da3866275f0cd6a87bf0c4b5050e5 100644
--- a/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Integrate3DEvents.h
+++ b/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Integrate3DEvents.h
@@ -127,10 +127,10 @@ private:
   double detectorQ(std::vector<Kernel::V3D> E1Vec,
                    const Mantid::Kernel::V3D QLabFrame, std::vector<double> &r);
   // Private data members
-  PeakQMap peak_qs;         // hashtable with peak Q-vectors
-  EventListMap event_lists; // hashtable with lists of events for each peak
-  Kernel::DblMatrix UBinv;  // matrix mapping from Q to h,k,l
-  double radius;            // size of sphere to use for events around a peak
+  PeakQMap m_peak_qs;         // hashtable with peak Q-vectors
+  EventListMap m_event_lists; // hashtable with lists of events for each peak
+  Kernel::DblMatrix m_UBinv;  // matrix mapping from Q to h,k,l
+  double m_radius;            // size of sphere to use for events around a peak
 };
 
 } // namespace MDAlgorithms
diff --git a/Framework/MDAlgorithms/inc/MantidMDAlgorithms/LoadILLAsciiHelper.h b/Framework/MDAlgorithms/inc/MantidMDAlgorithms/LoadILLAsciiHelper.h
index f4e5d2fadaf3ddee29820c6de4fc596aac9881da..d2005ab91e8df6e47da8fd2229014e77737d649a 100644
--- a/Framework/MDAlgorithms/inc/MantidMDAlgorithms/LoadILLAsciiHelper.h
+++ b/Framework/MDAlgorithms/inc/MantidMDAlgorithms/LoadILLAsciiHelper.h
@@ -3,7 +3,6 @@
 
 #include "MantidMDAlgorithms/DllConfig.h"
 
-#include <iostream>
 #include <fstream>
 #include <vector>
 #include <string>
diff --git a/Framework/MDAlgorithms/src/CompactMD.cpp b/Framework/MDAlgorithms/src/CompactMD.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..7c815d5277ff64361e8487fe54f330c038b1f0bd
--- /dev/null
+++ b/Framework/MDAlgorithms/src/CompactMD.cpp
@@ -0,0 +1,140 @@
+#include "MantidMDAlgorithms/CompactMD.h"
+#include "MantidAPI/IMDIterator.h"
+using namespace Mantid::API;
+using namespace Mantid::Geometry;
+using namespace Mantid::Kernel;
+
+namespace {
+/**
+ * helper method to create a string from min and max extents (with non-zero
+ * signals) ready to be used as the PBins for IntegrateMDHistoWorkspace
+ * algorithm in
+ * exec
+ * @param minVector : Vector containing the minimum extents that we will crop
+ * to.
+ * @param maxVector : Vector containing the maximum extents that we will crop
+ * to.
+ * @param inputWs : Used in the calculation from centre to bin edges
+ * @return : a string vector of binning parameters for IntegrateMDHistoWorkspace
+ * to take as input.
+*/
+std::vector<std::string>
+createPBinStringVector(std::vector<Mantid::coord_t> minVector,
+                       std::vector<Mantid::coord_t> maxVector,
+                       IMDHistoWorkspace_sptr inputWs) {
+  size_t numDims = inputWs->getNumDims();
+  std::vector<std::string> pBinStrVector;
+  for (size_t iter = 0; iter < numDims; iter++) {
+    if (minVector[iter] >= maxVector[iter]) {
+      std::cerr << "Minimum extent of non-zero signal must be LESS than the "
+                   "maximum extent with non-zero signal" << std::endl;
+    }
+    // creating pbin string using Min and Max Centre positions
+    auto pBinStr = boost::lexical_cast<std::string>(
+                       minVector[iter] -
+                       (inputWs->getDimension(iter)->getBinWidth() * 0.5)) +
+                   ",0," +
+                   boost::lexical_cast<std::string>(
+                       maxVector[iter] +
+                       (inputWs->getDimension(iter)->getBinWidth() * 0.5));
+    pBinStrVector.push_back(pBinStr);
+  }
+  return pBinStrVector;
+}
+}
+
+namespace Mantid {
+namespace MDAlgorithms {
+
+DECLARE_ALGORITHM(CompactMD)
+
+/**
+* Finding the centre points of Bins with non-zero signal values
+* we then compare this centre to minimum and maximum centres we have
+* to get the minimum and maximum extents of the workspace that has non-zero
+* signal values in the Bins.
+* @param inputWs : The workspace that will be iterated over to find the extents.
+* @param minVec : Vector used to stored the minimum extent in each dimension
+* @param maxVec : Vector used to stored the maximum extents in each dimension
+*/
+
+void CompactMD::findFirstNonZeroMinMaxExtents(
+    IMDHistoWorkspace_sptr inputWs, std::vector<Mantid::coord_t> &minVec,
+    std::vector<Mantid::coord_t> &maxVec) {
+  auto ws_iter = inputWs->createIterator();
+  do {
+    if (ws_iter->getSignal() == 0) {
+      // if signal is 0 then go to next index
+      continue;
+    } else {
+      // we have found a non-zero signal we need to compare
+      // the position of the bin with our Min and Max values
+      auto current_index = ws_iter->getLinearIndex();
+      auto current_center = inputWs->getCenter(current_index);
+      for (size_t index = 0; index < inputWs->getNumDims(); index++) {
+        if (current_center[index] > maxVec[index]) {
+          // set new maximum
+          maxVec[index] = current_center[index];
+        }
+        if (current_center[index] < minVec[index]) {
+          // set new minimum
+          minVec[index] = current_center[index];
+        }
+      }
+    }
+  } while (ws_iter->next());
+}
+
+/**
+* Initiliase the algorithm's properties.
+*/
+void CompactMD::init() {
+  // input workspace to compact
+  declareProperty(new WorkspaceProperty<IMDHistoWorkspace>("InputWorkspace", "",
+                                                           Direction::Input),
+                  "MDHistoWorkspace to compact");
+  // output workspace that will have been compacted
+  declareProperty(new WorkspaceProperty<IMDHistoWorkspace>(
+                      "OutputWorkspace", "", Direction::Output),
+                  "Output compacted workspace");
+}
+/**
+* Execute the algorithm.
+*/
+void CompactMD::exec() {
+  const IMDHistoWorkspace_sptr input_ws = this->getProperty("InputWorkspace");
+  IMDWorkspace_sptr out_ws;
+
+  const size_t nDimensions = input_ws->getNumDims();
+  std::vector<Mantid::coord_t> minVector;
+  std::vector<Mantid::coord_t> maxVector;
+
+  // fill the min/max vectors with values per dimension.
+  for (size_t index = 0; index < nDimensions; index++) {
+    minVector.push_back(input_ws->getDimension(index)->getMaximum());
+    maxVector.push_back(input_ws->getDimension(index)->getMinimum());
+  }
+  // start our search for the first non-zero signal index.
+  findFirstNonZeroMinMaxExtents(input_ws, minVector, maxVector);
+  auto pBinStrings = createPBinStringVector(minVector, maxVector, input_ws);
+  // creating IntegrateMDHistoWorkspace algorithm to crop our workspace.
+  auto cut_alg = this->createChildAlgorithm("IntegrateMDHistoWorkspace");
+  cut_alg->setProperty("InputWorkspace", input_ws);
+  cut_alg->setProperty("OutputWorkspace", "temp");
+  // setting property PxBin depending on the number of dimensions the
+  // input workspace has.
+  for (size_t iter = 0; iter < input_ws->getNumDims(); iter++) {
+    std::string propertyString =
+        "P" + boost::lexical_cast<std::string>(iter + 1) + "Bin";
+    cut_alg->setProperty(propertyString, pBinStrings[iter]);
+  }
+  cut_alg->execute();
+
+  // retrieve the output workspace from IntegrateMDHistoWorkspace
+  IMDHistoWorkspace_sptr temp = cut_alg->getProperty("OutputWorkspace");
+  out_ws = temp;
+  // set output workspace of CompactMD to output of IntegrateMDHistoWorkspace
+  this->setProperty("OutputWorkspace", out_ws);
+}
+}
+}
\ No newline at end of file
diff --git a/Framework/MDAlgorithms/src/ConvertCWSDExpToMomentum.cpp b/Framework/MDAlgorithms/src/ConvertCWSDExpToMomentum.cpp
index 22dbba796e0b2327e3e9c1001a853fab34678c0e..22507befa430a047f4f1cb757bc943df762b53df 100644
--- a/Framework/MDAlgorithms/src/ConvertCWSDExpToMomentum.cpp
+++ b/Framework/MDAlgorithms/src/ConvertCWSDExpToMomentum.cpp
@@ -24,7 +24,8 @@ DECLARE_ALGORITHM(ConvertCWSDExpToMomentum)
 /** Constructor
  */
 ConvertCWSDExpToMomentum::ConvertCWSDExpToMomentum()
-    : m_iColFilename(2), m_iColStartDetID(3), m_setQRange(true) {}
+    : m_iColFilename(2), m_iColStartDetID(3), m_setQRange(true),
+      m_isBaseName(false) {}
 
 //----------------------------------------------------------------------------------------------
 /** Destructor
@@ -201,13 +202,15 @@ void ConvertCWSDExpToMomentum::addMDEvents(bool usevirtual) {
   // Check whether to add / or \ to m_dataDir
   std::string sep("");
   if (m_dataDir.size() > 0) {
-    // Determine system
-    bool isWindows(false);
+// Determine system
 #if _WIN64
-    isWindows = true;
-#elif _WIND32
-    isWindows = true;
+    const bool isWindows = true;
+#elif _WIN32
+    const bool isWindows = true;
+#else
+    const bool isWindows = false;
 #endif
+
     if (isWindows && *m_dataDir.rbegin() != '\\') {
       sep = "\\";
     } else if (!isWindows && *m_dataDir.rbegin() != '/')
diff --git a/Framework/MDAlgorithms/src/ConvertToReflectometryQ.cpp b/Framework/MDAlgorithms/src/ConvertToReflectometryQ.cpp
index 1431b38ae0e1e338d1d4035d2b67584c9cba4ff4..fe2dfbcc3e23ed987c6f0bb5d042c46f8b37ded7 100644
--- a/Framework/MDAlgorithms/src/ConvertToReflectometryQ.cpp
+++ b/Framework/MDAlgorithms/src/ConvertToReflectometryQ.cpp
@@ -353,40 +353,54 @@ void ConvertToReflectometryQ::exec() {
 
   TableWorkspace_sptr vertexes =
       boost::make_shared<Mantid::DataObjects::TableWorkspace>();
-
+  Progress transSelectionProg(this, 0.0, 0.1, 2);
   if (outputAsMDWorkspace) {
+    transSelectionProg.report("Choosing Transformation");
     if (transMethod == centerTransform()) {
       auto outputMDWS = transform->executeMD(inputWs, bc);
+      Progress transPerformProg(this, 0.1, 0.7, 5);
+      transPerformProg.report("Performed transformation");
       // Copy ExperimentInfo (instrument, run, sample) to the output WS
       ExperimentInfo_sptr ei(inputWs->cloneExperimentInfo());
       outputMDWS->addExperimentInfo(ei);
       outputWS = outputMDWS;
     } else if (transMethod == normPolyTransform()) {
+      Progress transPerformProg(this, 0.1, 0.7, 5);
       const bool dumpVertexes = this->getProperty("DumpVertexes");
       auto vertexesTable = vertexes;
       // perform the normalised polygon transformation
+      transPerformProg.report("Performing Transformation");
       auto normPolyTrans = transform->executeNormPoly(
           inputWs, vertexesTable, dumpVertexes, outputDimensions);
       // copy any experiment info from input workspace
       normPolyTrans->copyExperimentInfoFrom(inputWs.get());
       // produce MDHistoWorkspace from normPolyTrans workspace.
+      Progress outputToMDProg(this, 0.7, 0.75, 10);
       auto outputMDWS = transform->executeMDNormPoly(normPolyTrans);
       ExperimentInfo_sptr ei(normPolyTrans->cloneExperimentInfo());
       outputMDWS->addExperimentInfo(ei);
       outputWS = outputMDWS;
+      outputToMDProg.report("Successfully output to MD");
     } else {
       throw std::runtime_error("Unknown rebinning method: " + transMethod);
     }
   } else if (transMethod == normPolyTransform()) {
+    transSelectionProg.report("Choosing Transformation");
+    Progress transPerformProg(this, 0.1, 0.7, 5);
     const bool dumpVertexes = this->getProperty("DumpVertexes");
     auto vertexesTable = vertexes;
     // perform the normalised polygon transformation
+    transPerformProg.report("Performing Transformation");
     auto output2DWS = transform->executeNormPoly(
         inputWs, vertexesTable, dumpVertexes, outputDimensions);
     // copy any experiment info from input workspace
     output2DWS->copyExperimentInfoFrom(inputWs.get());
     outputWS = output2DWS;
+    transPerformProg.report("Transformation Complete");
   } else if (transMethod == centerTransform()) {
+    transSelectionProg.report("Choosing Transformation");
+    Progress transPerformProg(this, 0.1, 0.7, 5);
+    transPerformProg.report("Performing Transformation");
     auto output2DWS = transform->execute(inputWs);
     output2DWS->copyExperimentInfoFrom(inputWs.get());
     outputWS = output2DWS;
@@ -397,6 +411,8 @@ void ConvertToReflectometryQ::exec() {
   // Execute the transform and bind to the output.
   setProperty("OutputWorkspace", outputWS);
   setProperty("OutputVertexes", vertexes);
+  Progress setPropertyProg(this, 0.8, 1.0, 2);
+  setPropertyProg.report("Success");
 }
 
 } // namespace Mantid
diff --git a/Framework/MDAlgorithms/src/FindPeaksMD.cpp b/Framework/MDAlgorithms/src/FindPeaksMD.cpp
index 1e94707a155f447cab458f8d4b2e3528fef25294..ba70dd4bedd2239fcf40c699cdac43d92045abe3 100644
--- a/Framework/MDAlgorithms/src/FindPeaksMD.cpp
+++ b/Framework/MDAlgorithms/src/FindPeaksMD.cpp
@@ -215,12 +215,15 @@ FindPeaksMD::createPeak(const Mantid::Kernel::V3D &Q, const double binCount) {
   boost::shared_ptr<DataObjects::Peak> p;
   if (dimType == QLAB) {
     // Build using the Q-lab-frame constructor
-    p = boost::shared_ptr<DataObjects::Peak>(new Peak(inst, Q));
+    p = boost::make_shared<Peak>(inst, Q);
     // Save gonio matrix for later
     p->setGoniometerMatrix(m_goniometer);
   } else if (dimType == QSAMPLE) {
     // Build using the Q-sample-frame constructor
-    p = boost::shared_ptr<DataObjects::Peak>(new Peak(inst, Q, m_goniometer));
+    p = boost::make_shared<Peak>(inst, Q, m_goniometer);
+  } else {
+    throw std::invalid_argument(
+        "Cannot Integrate peaks unless the dimension is QLAB or QSAMPLE");
   }
 
   try { // Look for a detector
diff --git a/Framework/MDAlgorithms/src/ImportMDEventWorkspace.cpp b/Framework/MDAlgorithms/src/ImportMDEventWorkspace.cpp
index a4efd01bb0b495f0c56ad4e300adbc3226beba5a..8aab04ee8dbf02e05f695e30c90b2100fb472a3a 100644
--- a/Framework/MDAlgorithms/src/ImportMDEventWorkspace.cpp
+++ b/Framework/MDAlgorithms/src/ImportMDEventWorkspace.cpp
@@ -1,6 +1,5 @@
 #include "MantidMDAlgorithms/ImportMDEventWorkspace.h"
 
-#include <iostream>
 #include <fstream>
 
 #include "MantidAPI/FileProperty.h"
@@ -267,7 +266,13 @@ void ImportMDEventWorkspace::exec() {
       m_nDimensions + 4; // signal, error, run_no, detector_no
   m_IsFullDataObjects = (nActualColumns == columnsForFullEvents);
 
-  m_nDataObjects = posDiffMDEvent / nActualColumns;
+  if (0 == nActualColumns) {
+    m_nDataObjects = 0;
+    g_log.warning() << "The number of actual columns found in the file "
+                       "(exlcuding comments) is zero" << std::endl;
+  } else {
+    m_nDataObjects = posDiffMDEvent / nActualColumns;
+  }
 
   // Get the min and max extents in each dimension.
   std::vector<double> extentMins(m_nDimensions);
diff --git a/Framework/MDAlgorithms/src/ImportMDHistoWorkspace.cpp b/Framework/MDAlgorithms/src/ImportMDHistoWorkspace.cpp
index 15f5a9a509f02a065b4283e6c88fe78e3b8b98be..86c15fc3b05b07f906ef23c84d4676e85ce1f41a 100644
--- a/Framework/MDAlgorithms/src/ImportMDHistoWorkspace.cpp
+++ b/Framework/MDAlgorithms/src/ImportMDHistoWorkspace.cpp
@@ -2,7 +2,6 @@
 #include "MantidAPI/FileProperty.h"
 
 #include <deque>
-#include <iostream>
 #include <fstream>
 #include <iterator>
 
diff --git a/Framework/MDAlgorithms/src/Integrate3DEvents.cpp b/Framework/MDAlgorithms/src/Integrate3DEvents.cpp
index 8c1bf115599b74073af6a619828ab287548ebb83..372e9b1ad95a59e2852b7522d4b4e3602fc6a41b 100644
--- a/Framework/MDAlgorithms/src/Integrate3DEvents.cpp
+++ b/Framework/MDAlgorithms/src/Integrate3DEvents.cpp
@@ -1,5 +1,4 @@
 #include <math.h>
-#include <iostream>
 #include <fstream>
 #include <boost/math/special_functions/round.hpp>
 #include <boost/make_shared.hpp>
@@ -36,14 +35,14 @@ using Mantid::Kernel::V3D;
 Integrate3DEvents::Integrate3DEvents(
     std::vector<std::pair<double, V3D>> const &peak_q_list,
     DblMatrix const &UBinv, double radius) {
-  this->UBinv = UBinv;
-  this->radius = radius;
+  m_UBinv = UBinv;
+  m_radius = radius;
 
   int64_t hkl_key;
   for (size_t it = 0; it != peak_q_list.size(); ++it) {
     hkl_key = getHklKey(peak_q_list[it].second);
     if (hkl_key != 0) // only save if hkl != (0,0,0)
-      peak_qs[hkl_key] = peak_q_list[it].second;
+      m_peak_qs[hkl_key] = peak_q_list[it].second;
   }
 }
 
@@ -125,7 +124,12 @@ Integrate3DEvents::ellipseIntegrateEvents(
     return boost::make_shared<NoShape>();
   }
 
-  std::vector<std::pair<double, V3D>> &some_events = event_lists[hkl_key];
+  auto pos = m_event_lists.find(hkl_key);
+  if (m_event_lists.end() == pos)
+    return boost::make_shared<NoShape>();
+  ;
+
+  std::vector<std::pair<double, V3D>> &some_events = pos->second;
 
   if (some_events.size() < 3) // if there are not enough events to
   {                           // find covariance matrix, return
@@ -133,14 +137,14 @@ Integrate3DEvents::ellipseIntegrateEvents(
   }
 
   DblMatrix cov_matrix(3, 3);
-  makeCovarianceMatrix(some_events, cov_matrix, radius);
+  makeCovarianceMatrix(some_events, cov_matrix, m_radius);
 
   std::vector<V3D> eigen_vectors;
   getEigenVectors(cov_matrix, eigen_vectors);
 
   std::vector<double> sigmas;
   for (int i = 0; i < 3; i++) {
-    sigmas.push_back(stdDev(some_events, eigen_vectors[i], radius));
+    sigmas.push_back(stdDev(some_events, eigen_vectors[i], m_radius));
   }
 
   bool invalid_peak = false;
@@ -393,7 +397,7 @@ int64_t Integrate3DEvents::getHklKey2(V3D const &hkl) {
  *  @param q_vector  The q_vector to be mapped to h,k,l
  */
 int64_t Integrate3DEvents::getHklKey(V3D const &q_vector) {
-  V3D hkl = UBinv * q_vector;
+  V3D hkl = m_UBinv * q_vector;
   int h = boost::math::iround<double>(hkl[0]);
   int k = boost::math::iround<double>(hkl[1]);
   int l = boost::math::iround<double>(hkl[2]);
@@ -425,15 +429,15 @@ void Integrate3DEvents::addEvent(std::pair<double, V3D> event_Q,
   if (hkl_key == 0) // don't keep events associated with 0,0,0
     return;
 
-  auto peak_it = peak_qs.find(hkl_key);
-  if (peak_it != peak_qs.end()) {
+  auto peak_it = m_peak_qs.find(hkl_key);
+  if (peak_it != m_peak_qs.end()) {
     if (!peak_it->second.nullVector()) {
       if (hkl_integ)
-        event_Q.second = event_Q.second - UBinv * peak_it->second;
+        event_Q.second = event_Q.second - m_UBinv * peak_it->second;
       else
         event_Q.second = event_Q.second - peak_it->second;
-      if (event_Q.second.norm() < radius) {
-        event_lists[hkl_key].push_back(event_Q);
+      if (event_Q.second.norm() < m_radius) {
+        m_event_lists[hkl_key].push_back(event_Q);
       }
     }
   }
@@ -512,8 +516,8 @@ PeakShapeEllipsoid_const_sptr Integrate3DEvents::ellipseIntegrateEvents(
     // if necessary restrict the background ellipsoid
     // to lie within the specified sphere, and adjust
     // the other sizes, proportionally
-    if (r3 * max_sigma > radius) {
-      r3 = radius / max_sigma;
+    if (r3 * max_sigma > m_radius) {
+      r3 = m_radius / max_sigma;
       r1 = r3 * 0.79370053f; // This value for r1 and r2 makes the background
       r2 = r1;               // shell volume equal to the peak region volume.
     }
diff --git a/Framework/MDAlgorithms/src/IntegrateMDHistoWorkspace.cpp b/Framework/MDAlgorithms/src/IntegrateMDHistoWorkspace.cpp
index 711de48f4bf03d29ae298d0aaebf6c47f0f01693..ee80f5f9e527c13dde9b8612a768c4c3cde20b58 100644
--- a/Framework/MDAlgorithms/src/IntegrateMDHistoWorkspace.cpp
+++ b/Framework/MDAlgorithms/src/IntegrateMDHistoWorkspace.cpp
@@ -104,7 +104,7 @@ Mantid::coord_t getPrecisionCorrectedCoordinate(Mantid::coord_t position,
 
   // Check if the relative deviation is larger than 1e-6
   const auto deviation = fabs((nearest - position) / binWidth);
-  const auto tolerance = 1e-6;
+  const auto tolerance = 1e-5;
   Mantid::coord_t coordinate(position);
   if (deviation < tolerance) {
     coordinate = nearest;
@@ -195,6 +195,7 @@ MDHistoWorkspace_sptr createShapedOutput(IMDHistoWorkspace const *const inWS,
               binning.back()) /*max*/); // Set custom min, max and nbins.
     } else if (i < pbins.size() && similarBinning(pbins[i])) {
       auto binning = pbins[i];
+
       Mantid::coord_t pMin = static_cast<Mantid::coord_t>(binning.front());
       Mantid::coord_t pMax = static_cast<Mantid::coord_t>(binning.back());
       size_t numberOfBins;
@@ -386,6 +387,10 @@ void IntegrateMDHistoWorkspace::exec() {
         // Create a thread-local input iterator.
         boost::scoped_ptr<MDHistoWorkspaceIterator> inIterator(
             dynamic_cast<MDHistoWorkspaceIterator *>(inWS->createIterator()));
+        if (!inIterator) {
+          throw std::runtime_error(
+              "Could not convert IMDIterator to a MDHistoWorkspaceIterator");
+        }
 
         /*
         We jump to the iterator position which is closest in the model
diff --git a/Framework/MDAlgorithms/src/LoadILLAscii.cpp b/Framework/MDAlgorithms/src/LoadILLAscii.cpp
index 835d1fe1868e3c0418d8980bf2187d5933fa4bfb..86aaa741729dfb73a32c08a17dbdd53ef4908b40 100644
--- a/Framework/MDAlgorithms/src/LoadILLAscii.cpp
+++ b/Framework/MDAlgorithms/src/LoadILLAscii.cpp
@@ -24,7 +24,6 @@
 #include <algorithm>
 #include <iterator> // std::distance
 #include <sstream>
-#include <iostream>
 #include <fstream>
 #include <stdio.h>
 #include <string.h>
diff --git a/Framework/MDAlgorithms/src/LoadSQW.cpp b/Framework/MDAlgorithms/src/LoadSQW.cpp
index 9df4976713119d2a4f29dabf0b30d306124e71aa..b3bc63d11e5ade978e0c4abcdba21b605c8c4abc 100644
--- a/Framework/MDAlgorithms/src/LoadSQW.cpp
+++ b/Framework/MDAlgorithms/src/LoadSQW.cpp
@@ -13,7 +13,6 @@
 #include "MantidKernel/ThreadScheduler.h"
 #include "MantidMDAlgorithms/LoadSQW.h"
 #include "MantidAPI/RegisterFileLoader.h"
-#include <iostream>
 #include <cfloat>
 #include "MantidDataObjects/MDBox.h"
 #include "MantidDataObjects/BoxControllerNeXusIO.h"
diff --git a/Framework/MDAlgorithms/test/AndMDTest.h b/Framework/MDAlgorithms/test/AndMDTest.h
index c7be7993349d7090a737fbcea2e29a5621fbc65a..24d050ac45b32a92a5195cfdb103ae8a1a08077a 100644
--- a/Framework/MDAlgorithms/test/AndMDTest.h
+++ b/Framework/MDAlgorithms/test/AndMDTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidMDAlgorithms/AndMD.h"
 #include "MantidTestHelpers/BinaryOperationMDTestHelper.h"
diff --git a/Framework/MDAlgorithms/test/CompactMDTest.h b/Framework/MDAlgorithms/test/CompactMDTest.h
new file mode 100644
index 0000000000000000000000000000000000000000..2629ac5f2f70ecac62b99e666ce107a88a3692b9
--- /dev/null
+++ b/Framework/MDAlgorithms/test/CompactMDTest.h
@@ -0,0 +1,274 @@
+#ifndef MANTID_MDALGORITHMS_COMPACTMDTEST_H_
+#define MANTID_MDALGORITHMS_COMPACTMDTEST_H_
+#include <cxxtest/TestSuite.h>
+
+#include "MantidMDAlgorithms/CompactMD.h"
+#include "MantidDataObjects/MDHistoWorkspace.h"
+#include "MantidTestHelpers/MDEventsTestHelper.h"
+
+using Mantid::MDAlgorithms::CompactMD;
+using namespace Mantid::API;
+
+//==================
+// Functional Tests
+//==================
+class CompactMDTest : public CxxTest::TestSuite {
+public:
+  // This pair of boilerplate methods prevent the suite being created statically
+  // This means the constructor isn't called when running other tests
+  static CompactMDTest *createSuite() { return new CompactMDTest(); }
+  static void destroySuite(CompactMDTest *suite) { delete suite; }
+
+  void test_Init() {
+    CompactMD alg;
+    TSM_ASSERT_THROWS_NOTHING("Instance of CompactMD threw: ",
+                              alg.initialize());
+    TSM_ASSERT("Instance of CompactMD was not initialised: ",
+               alg.isInitialized());
+  }
+  void
+  test_all_non_zero_signals_are_kept_with_data_concentrated_in_the_centre() {
+    /*
+     *testing the effectiveness of CompactMD when the data looks like this:
+     *------------------
+     * Input structure:
+     *------------------
+     *  -------------
+     *  |   |///|   |
+     *  -------------
+     * -3-2-1 0 1 2 3
+     *---------------------------
+     * Expected output structure:
+     *----------------------------
+     * should trim until the first non-zero value.
+     *    -----
+     *    |///|
+     *    -----
+     *  -1  0  1
+     */
+
+    using namespace Mantid::DataObjects;
+    const size_t numDims = 1;
+    const double signal = 0.0;
+    const double errorSquared = 1.3;
+    size_t numBins[static_cast<int>(numDims)] = {3};
+    Mantid::coord_t min[static_cast<int>(numDims)] = {-3};
+    Mantid::coord_t max[static_cast<int>(numDims)] = {3};
+    const std::string name("test");
+    auto inWS = MDEventsTestHelper::makeFakeMDHistoWorkspaceGeneral(
+        numDims, signal, errorSquared, numBins, min, max, name);
+    inWS->setSignalAt(1, 1.0); // set middle bin signal to one
+    CompactMD alg;
+    alg.setChild(true);
+    alg.setRethrows(true);
+    alg.initialize();
+    alg.setProperty("InputWorkspace", inWS);
+    alg.setProperty("OutputWorkspace", "out");
+    alg.execute();
+    // output workspace should be cropped so extents ~ [-1,1]
+    IMDHistoWorkspace_sptr outputWorkspace = alg.getProperty("OutputWorkspace");
+    TSM_ASSERT_EQUALS("Should have a signal of 1.0: ",
+                      outputWorkspace->getSignalAt(0), 1);
+    TSM_ASSERT_EQUALS("Minimum should be cropped to -1: ",
+                      outputWorkspace->getDimension(0)->getMinimum(), -1.0);
+    TSM_ASSERT_EQUALS("Maximum should be cropped to 1: ",
+                      outputWorkspace->getDimension(0)->getMaximum(), 1.0);
+    TSM_ASSERT_EQUALS("Number of Bins should be 1 : ",
+                      outputWorkspace->getDimension(0)->getNBins(), 1.0);
+    TSM_ASSERT_EQUALS("Bin width should be consistent: ",
+                      outputWorkspace->getDimension(0)->getBinWidth(),
+                      inWS->getDimension(0)->getBinWidth());
+  }
+  void test_all_non_zero_signals_are_kept_with_data_in_each_corner() {
+    /*
+     *testing the effectiveness of CompactMD when the data looks like this:
+     *-----------------------------------
+     * Input structure: 2D HistoWorkspace
+     *-----------------------------------
+     *  ------------- -3
+     *  |/a/|   |/b/| -2
+     *  ------------- -1
+     *  |   |   |   |  0
+     *  -------------  1
+     *  |/c/|   |/d/|  2
+     *  -------------  3
+     * -3-2-1 0 1 2 3
+     *----------------------------
+     * Expected output structure:
+     *----------------------------
+     * should not trim the workspace at all.
+     *  ------------- -3
+     *  |/a/|   |/b/| -2
+     *  ------------- -1
+     *  |   |   |   |  0
+     *  -------------  1
+     *  |/c/|   |/d/|  2
+     *  -------------  3
+     * -3-2-1 0 1 2 3
+     */
+    using namespace Mantid::DataObjects;
+    const size_t numDims = 2;
+    const double signal = 0.0;
+    const double errorSquared = 1.2;
+    size_t numBins[static_cast<int>(numDims)] = {3, 3};
+    Mantid::coord_t min[static_cast<int>(numDims)] = {-3, -3};
+    Mantid::coord_t max[static_cast<int>(numDims)] = {3, 3};
+    const std::string name("test");
+    auto inWS = MDEventsTestHelper::makeFakeMDHistoWorkspaceGeneral(
+        numDims, signal, errorSquared, numBins, min, max, name);
+    inWS->setSignalAt(0, 1.0); // cell a
+    inWS->setSignalAt(2, 1.0); // cell b
+    inWS->setSignalAt(6, 1.0); // cell c
+    inWS->setSignalAt(8, 1.0); // cell d
+
+    CompactMD alg;
+    alg.setChild(true);
+    alg.setRethrows(true);
+    alg.initialize();
+    alg.setProperty("InputWorkspace", inWS);
+    alg.setProperty("OutputWorkspace", "out");
+    alg.execute();
+    IMDHistoWorkspace_sptr outputWorkspace = alg.getProperty("OutputWorkspace");
+    /*TSM_ASSERT_EQUALS("Should have a signal of 1.0: ",
+                      outputWorkspace->getSignalAt(0), 1);
+    TSM_ASSERT_EQUALS("Should have a signal of 1.0: ",
+                      outputWorkspace->getSignalAt(2), 1);
+    TSM_ASSERT_EQUALS("Should have a signal of 1.0: ",
+                      outputWorkspace->getSignalAt(6), 1);
+    TSM_ASSERT_EQUALS("Should have a signal of 1.0: ",
+                      outputWorkspace->getSignalAt(8), 1);
+    TSM_ASSERT_EQUALS("Minimum for dim 0 should be consistent: ",
+                      outputWorkspace->getDimension(0)->getMinimum(),
+                      inWS->getDimension(0)->getMinimum());
+    TSM_ASSERT_EQUALS("Maximum for dim 0 should be consistent: ",
+                      outputWorkspace->getDimension(0)->getMaximum(),
+                      inWS->getDimension(0)->getMaximum());
+    TSM_ASSERT_EQUALS("Minimum for dim 1 should be consistent:",
+                      outputWorkspace->getDimension(1)->getMinimum(),
+                      inWS->getDimension(1)->getMinimum());
+    TSM_ASSERT_EQUALS("Maximum for dim 1 should be consistent: ",
+                      outputWorkspace->getDimension(1)->getMaximum(),
+                      inWS->getDimension(1)->getMaximum());
+    TSM_ASSERT_EQUALS("Number of Bins for dim 0 should be consistent : ",
+                      outputWorkspace->getDimension(0)->getNBins(),
+                      inWS->getDimension(0)->getNBins());
+    TSM_ASSERT_EQUALS("Number of Bins for dim 1 should be consistent : ",
+                      outputWorkspace->getDimension(1)->getNBins(),
+                      inWS->getDimension(1)->getNBins());
+    TSM_ASSERT_EQUALS("Bin width for dim 0 should be consistent: ",
+                      outputWorkspace->getDimension(0)->getBinWidth(),
+                      inWS->getDimension(0)->getBinWidth());
+    TSM_ASSERT_EQUALS("Bin width for dim 1 should be consistent: ",
+                      outputWorkspace->getDimension(1)->getBinWidth(),
+                      inWS->getDimension(1)->getBinWidth());*/
+  }
+
+  void
+  test_all_non_zero_signals_are_kept_when_data_is_concentrated_in_one_half_of_the_workspace() {
+    /*
+     *testing the effectiveness of CompactMD when the data looks like this:
+     *------------------
+     * Input structure:
+     *------------------
+     *  -------------
+     *  |///|   |   |
+     *  -------------
+     * -3-2-1 0 1 2 3
+     *---------------------------
+     * Expected output structure:
+     *----------------------------
+     * should trim until the first non-zero value.
+     *  -----
+     *  |///|
+     *  -----
+     *  1 2 3
+     */
+
+    using namespace Mantid::DataObjects;
+    const size_t numDims = 1;
+    const double signal = 0.0;
+    const double errorSquared = 1.3;
+    size_t numBins[static_cast<int>(numDims)] = {3};
+    Mantid::coord_t min[static_cast<int>(numDims)] = {-3};
+    Mantid::coord_t max[static_cast<int>(numDims)] = {3};
+    const std::string name("test");
+    auto inWS = MDEventsTestHelper::makeFakeMDHistoWorkspaceGeneral(
+        numDims, signal, errorSquared, numBins, min, max, name);
+    inWS->setSignalAt(0, 1.0); // set right-most bin signal to one
+    CompactMD alg;
+    alg.setChild(true);
+    alg.setRethrows(true);
+    alg.initialize();
+    alg.setProperty("InputWorkspace", inWS);
+    alg.setProperty("OutputWorkspace", "out");
+    TS_ASSERT_THROWS_NOTHING(alg.execute());
+    IMDHistoWorkspace_sptr outputWorkspace = alg.getProperty("OutputWorkspace");
+    TS_ASSERT(outputWorkspace);
+    TSM_ASSERT_EQUALS("Should have a signal of 1.0: ",
+                      outputWorkspace->getSignalAt(0), 1);
+    TSM_ASSERT_EQUALS("Minimum should be cut to 1: ",
+                      outputWorkspace->getDimension(0)->getMinimum(), -3.0);
+    TSM_ASSERT_EQUALS("Maximum should still be 3: ",
+                      outputWorkspace->getDimension(0)->getMaximum(), -1.0);
+    TSM_ASSERT_EQUALS("Number of Bins should be 1 : ",
+                      outputWorkspace->getDimension(0)->getNBins(), 1);
+    TSM_ASSERT_EQUALS("Bin width should be consistent: ",
+                      outputWorkspace->getDimension(0)->getBinWidth(),
+                      inWS->getDimension(0)->getBinWidth());
+  }
+  void test_compact_md_throws_when_loading_empty_workspace() {
+    using namespace Mantid::DataObjects;
+    const size_t numDims = 1;
+    const double signal = 0.0;
+    const double errorSquared = 1.3;
+    size_t numBins[static_cast<int>(numDims)] = {3};
+    Mantid::coord_t min[static_cast<int>(numDims)] = {-3};
+    Mantid::coord_t max[static_cast<int>(numDims)] = {3};
+    const std::string name("test");
+    auto inWS = MDEventsTestHelper::makeFakeMDHistoWorkspaceGeneral(
+        numDims, signal, errorSquared, numBins, min, max, name);
+    CompactMD alg;
+    alg.setChild(true);
+    alg.setRethrows(true);
+    alg.initialize();
+    alg.setProperty("InputWorkspace", inWS);
+    alg.setProperty("OutputWorkspace", "out");
+    TS_ASSERT_THROWS(alg.execute(), std::runtime_error &);
+  }
+};
+//===================
+// Performance Tests
+//===================
+using namespace Mantid::DataObjects;
+class CompactMDTestPerformance : public CxxTest::TestSuite {
+
+private:
+  MDHistoWorkspace_sptr m_ws;
+
+public:
+  // This pair of boilerplate methods prevent the suite being created statically
+  // This means the constructor isn't called when running other tests
+  static CompactMDTestPerformance *createSuite() {
+    return new CompactMDTestPerformance();
+  }
+  static void destroySuite(CompactMDTestPerformance *suite) { delete suite; }
+
+  CompactMDTestPerformance() {
+    // Create a 4D workspace.
+    m_ws = MDEventsTestHelper::makeFakeMDHistoWorkspace(
+        1.0 /*signal*/, 4 /*nd*/, 100 /*nbins*/, 10 /*max*/, 1.0 /*error sq*/);
+  }
+  void test_execute_4d() {
+    CompactMD alg;
+    alg.setChild(true);
+    alg.setRethrows(true);
+    alg.initialize();
+    alg.setProperty("InputWorkspace", m_ws);
+    alg.setProperty("OutputWorkspace", "out");
+    alg.execute();
+    IMDHistoWorkspace_sptr outWS = alg.getProperty("OutputWorkspace");
+    TS_ASSERT(outWS);
+  }
+};
+
+#endif // !MANTID_MDALGORITHMS_COMPACTMDTEST_H_
diff --git a/Framework/MDAlgorithms/test/CreateMDHistoWorkspaceTest.h b/Framework/MDAlgorithms/test/CreateMDHistoWorkspaceTest.h
index 304d0f4e74def943b018bd08832812b946e29ad4..534d7b00cde935fba25e9f0769a7a1da88c3c7e7 100644
--- a/Framework/MDAlgorithms/test/CreateMDHistoWorkspaceTest.h
+++ b/Framework/MDAlgorithms/test/CreateMDHistoWorkspaceTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidMDAlgorithms/CreateMDHistoWorkspace.h"
 
diff --git a/Framework/MDAlgorithms/test/DivideMDTest.h b/Framework/MDAlgorithms/test/DivideMDTest.h
index 472b23933a91ff5aef9fc2b8bf8d3bae241be8ab..da0c61996aca83f817369e0172b232aa33a99238 100644
--- a/Framework/MDAlgorithms/test/DivideMDTest.h
+++ b/Framework/MDAlgorithms/test/DivideMDTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidMDAlgorithms/DivideMD.h"
 #include "MantidTestHelpers/BinaryOperationMDTestHelper.h"
diff --git a/Framework/MDAlgorithms/test/ExponentialMDTest.h b/Framework/MDAlgorithms/test/ExponentialMDTest.h
index 44cd338b998611b29404fa0ff61a6245a1de6a15..fedef53adb58eb003365266a01f7c53b6b7bf066 100644
--- a/Framework/MDAlgorithms/test/ExponentialMDTest.h
+++ b/Framework/MDAlgorithms/test/ExponentialMDTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidMDAlgorithms/ExponentialMD.h"
 #include "MantidTestHelpers/BinaryOperationMDTestHelper.h"
diff --git a/Framework/MDAlgorithms/test/GreaterThanMDTest.h b/Framework/MDAlgorithms/test/GreaterThanMDTest.h
index 5ee14f9c0b34b9116b4e6e9555a362408175f18b..a05aea3a7cd4563f0c441687b1af43f996a9fae8 100644
--- a/Framework/MDAlgorithms/test/GreaterThanMDTest.h
+++ b/Framework/MDAlgorithms/test/GreaterThanMDTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidMDAlgorithms/GreaterThanMD.h"
 #include "MantidTestHelpers/BinaryOperationMDTestHelper.h"
diff --git a/Framework/MDAlgorithms/test/LogarithmMDTest.h b/Framework/MDAlgorithms/test/LogarithmMDTest.h
index dd6741aae479777d63e45b2f0d654cd3626848c3..d70a16b110dd34c7d36673ba1d73639addeff519 100644
--- a/Framework/MDAlgorithms/test/LogarithmMDTest.h
+++ b/Framework/MDAlgorithms/test/LogarithmMDTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidMDAlgorithms/LogarithmMD.h"
 #include "MantidDataObjects/MDHistoWorkspace.h"
diff --git a/Framework/MDAlgorithms/test/PowerMDTest.h b/Framework/MDAlgorithms/test/PowerMDTest.h
index c461d190b87a4f9ceeb713c40f80dfc0646eb44e..33608b09b034ffa5906a499688c0d95e0ef248d0 100644
--- a/Framework/MDAlgorithms/test/PowerMDTest.h
+++ b/Framework/MDAlgorithms/test/PowerMDTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidMDAlgorithms/PowerMD.h"
 #include "MantidTestHelpers/BinaryOperationMDTestHelper.h"
diff --git a/Framework/MDAlgorithms/test/ReflectometryTransformPTest.h b/Framework/MDAlgorithms/test/ReflectometryTransformPTest.h
index d446d23200ecd8ec3a125e400be4f2b1caee7f31..f6af57673dc8709cfa32b32df0a0fda860606e9b 100644
--- a/Framework/MDAlgorithms/test/ReflectometryTransformPTest.h
+++ b/Framework/MDAlgorithms/test/ReflectometryTransformPTest.h
@@ -5,8 +5,6 @@
 #include <cmath>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 #include "MantidMDAlgorithms/ReflectometryTransformP.h"
 
 using namespace Mantid::DataObjects;
diff --git a/Framework/MDAlgorithms/test/SlicingAlgorithmTest.h b/Framework/MDAlgorithms/test/SlicingAlgorithmTest.h
index d2673dca505613912b08b650adcdff1f3bd6bad3..762ffd5f2d12c660586fb3b8f01095fac3a46d4d 100644
--- a/Framework/MDAlgorithms/test/SlicingAlgorithmTest.h
+++ b/Framework/MDAlgorithms/test/SlicingAlgorithmTest.h
@@ -9,8 +9,6 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include <iomanip>
-
 using namespace Mantid::API;
 using namespace Mantid::DataObjects;
 using namespace Mantid::Geometry;
diff --git a/Framework/Nexus/test/NexusAPITest.h b/Framework/Nexus/test/NexusAPITest.h
index 003ac5e4795f414929282d5ad254552a23712cb3..256f4854338b55f432aebac764ca7211ee14afb9 100644
--- a/Framework/Nexus/test/NexusAPITest.h
+++ b/Framework/Nexus/test/NexusAPITest.h
@@ -17,7 +17,6 @@
 
 #include <cmath>
 #include <Poco/File.h>
-#include <iostream>
 #include <string>
 #include <sstream>
 #include <cstring>
diff --git a/Framework/PythonInterface/inc/MantidPythonInterface/api/WorkspacePropertyExporter.h b/Framework/PythonInterface/inc/MantidPythonInterface/api/WorkspacePropertyExporter.h
index f28cb82152330306db9044da42922b1e994284c0..aff1c6a9507ca2431c3838f5558181fc7933a5b9 100644
--- a/Framework/PythonInterface/inc/MantidPythonInterface/api/WorkspacePropertyExporter.h
+++ b/Framework/PythonInterface/inc/MantidPythonInterface/api/WorkspacePropertyExporter.h
@@ -134,10 +134,10 @@ template <typename WorkspaceType> struct WorkspacePropertyExporter {
                   API::PropertyMode::Type, API::LockMode::Type>(
             args("name", "defaultValue", "direction", "optional", "locking")))
         // These variants require the validator object to be cloned
-        .def("__init__",
-             make_constructor(
-                 &createPropertyWithValidator, default_call_policies(),
-                 args("name", "defaultValue", "direction", "validator")))
+        .def("__init__", make_constructor(&createPropertyWithValidator,
+                                          default_call_policies(),
+                                          (arg("name"), arg("defaultValue"),
+                                           arg("direction"), arg("validator"))))
         .def("__init__",
              make_constructor(&createPropertyWithOptionalFlag,
                               default_call_policies(),
@@ -148,7 +148,7 @@ template <typename WorkspaceType> struct WorkspacePropertyExporter {
                               default_call_policies(),
                               args("name", "defaultValue", "direction",
                                    "optional", "locking", "validator")))
-        .def("isOptional", &TypedWorkspaceProperty::isOptional,
+        .def("isOptional", &TypedWorkspaceProperty::isOptional, arg("self"),
              "Returns true if the property has been marked as optional")
 
         .add_property("value", &value);
diff --git a/Framework/PythonInterface/inc/MantidPythonInterface/kernel/DataServiceExporter.h b/Framework/PythonInterface/inc/MantidPythonInterface/kernel/DataServiceExporter.h
index 5de200f77772535379d80f49cc8303345a0d4aba..90679c67007c4a433a9654ac8c4b214633f45354 100644
--- a/Framework/PythonInterface/inc/MantidPythonInterface/kernel/DataServiceExporter.h
+++ b/Framework/PythonInterface/inc/MantidPythonInterface/kernel/DataServiceExporter.h
@@ -66,30 +66,37 @@ template <typename SvcType, typename SvcPtrType> struct DataServiceExporter {
     auto classType =
         PythonType(pythonClassName, no_init)
             .def("add", &DataServiceExporter::addItem,
+                 (arg("self"), arg("name"), arg("item")),
                  "Adds the given object to the service with the given name. If "
                  "the name/object exists it will raise an error.")
             .def("addOrReplace", &DataServiceExporter::addOrReplaceItem,
+                 (arg("self"), arg("name"), arg("item")),
                  "Adds the given object to the service with the given name. "
                  "The the name exists the object is replaced.")
-            .def("doesExist", &SvcType::doesExist,
+            .def("doesExist", &SvcType::doesExist, (arg("self"), arg("name")),
                  "Returns True if the object is found in the service.")
             .def("retrieve", &DataServiceExporter::retrieveOrKeyError,
+                 (arg("self"), arg("name")),
                  "Retrieve the named object. Raises an exception if the name "
                  "does not exist")
-            .def("remove", &SvcType::remove, "Remove a named object")
-            .def("clear", &SvcType::clear,
+            .def("remove", &SvcType::remove, (arg("self"), arg("name")),
+                 "Remove a named object")
+            .def("clear", &SvcType::clear, arg("self"),
                  "Removes all objects managed by the service.")
-            .def("size", &SvcType::size,
+            .def("size", &SvcType::size, arg("self"),
                  "Returns the number of objects within the service")
             .def("getObjectNames", &DataServiceExporter::getObjectNamesAsList,
+                 arg("self"),
                  "Return the list of names currently known to the ADS")
 
             // Make it act like a dictionary
-            .def("__len__", &SvcType::size)
-            .def("__getitem__", &DataServiceExporter::retrieveOrKeyError)
-            .def("__setitem__", &DataServiceExporter::addOrReplaceItem)
-            .def("__contains__", &SvcType::doesExist)
-            .def("__delitem__", &SvcType::remove);
+            .def("__len__", &SvcType::size, arg("self"))
+            .def("__getitem__", &DataServiceExporter::retrieveOrKeyError,
+                 (arg("self"), arg("name")))
+            .def("__setitem__", &DataServiceExporter::addOrReplaceItem,
+                 (arg("self"), arg("name"), arg("item")))
+            .def("__contains__", &SvcType::doesExist, arg("self"))
+            .def("__delitem__", &SvcType::remove, (arg("self"), arg("name")));
 
     return classType;
   }
diff --git a/Framework/PythonInterface/inc/MantidPythonInterface/kernel/TypedValidatorExporter.h b/Framework/PythonInterface/inc/MantidPythonInterface/kernel/TypedValidatorExporter.h
index e876486b65ce12d54ea8a1a57c5e651db2a7a722..aed38b70fe762cec3f5f3df0fa9c7fc1038125f5 100644
--- a/Framework/PythonInterface/inc/MantidPythonInterface/kernel/TypedValidatorExporter.h
+++ b/Framework/PythonInterface/inc/MantidPythonInterface/kernel/TypedValidatorExporter.h
@@ -39,7 +39,7 @@ template <typename Type> struct TypedValidatorExporter {
 
     class_<TypedValidator<Type>, bases<IValidator>, boost::noncopyable>(
         pythonClassName, no_init)
-        .def("isValid", &IValidator::isValid<Type>,
+        .def("isValid", &IValidator::isValid<Type>, (arg("self"), arg("value")),
              "Returns an empty string if the value is considered valid, "
              "otherwise a string defining the error is returned.");
   }
diff --git a/Framework/PythonInterface/mantid/api/src/Exports/Algorithm.cpp b/Framework/PythonInterface/mantid/api/src/Exports/Algorithm.cpp
index 0aa43a5125cda02fbee15246c8a18a000b34103e..44b07a508d7484ec85fd0d0b15371ab40f1f85c4 100644
--- a/Framework/PythonInterface/mantid/api/src/Exports/Algorithm.cpp
+++ b/Framework/PythonInterface/mantid/api/src/Exports/Algorithm.cpp
@@ -42,7 +42,11 @@ typedef void (*declarePropertyType3)(boost::python::object &self,
 typedef void (*declarePropertyType4)(boost::python::object &self,
                                      const std::string &,
                                      const boost::python::object &, const int);
-
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunknown-pragmas"
+#pragma clang diagnostic ignored "-Wunused-local-typedef"
+#endif
 // Overload types
 BOOST_PYTHON_FUNCTION_OVERLOADS(declarePropertyType1_Overload,
                                 PythonAlgorithm::declarePyAlgProperty, 2, 3)
@@ -50,7 +54,9 @@ BOOST_PYTHON_FUNCTION_OVERLOADS(declarePropertyType2_Overload,
                                 PythonAlgorithm::declarePyAlgProperty, 3, 6)
 BOOST_PYTHON_FUNCTION_OVERLOADS(declarePropertyType3_Overload,
                                 PythonAlgorithm::declarePyAlgProperty, 4, 5)
-
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
 /**
  * Map a CancelException to a Python KeyboardInterupt
  * @param exc A cancel exception to translate. Unused here as the message is
@@ -77,22 +83,19 @@ void export_leaf_classes() {
       .def("fromString", &Algorithm::fromString,
            "Initialize the algorithm from a string representation")
       .staticmethod("fromString")
-
       .def("createChildAlgorithm", &Algorithm::createChildAlgorithm,
-           (arg("name"), arg("startProgress") = -1.0, arg("endProgress") = -1.0,
-            arg("enableLogging") = true, arg("version") = -1),
+           (arg("self"), arg("name"), arg("startProgress") = -1.0,
+            arg("endProgress") = -1.0, arg("enableLogging") = true,
+            arg("version") = -1),
            "Creates and intializes a named child algorithm. Output workspaces "
            "are given a dummy name.")
-
       .def("declareProperty",
            (declarePropertyType1)&PythonAlgorithm::declarePyAlgProperty,
            declarePropertyType1_Overload(
                (arg("self"), arg("prop"), arg("doc") = "")))
-
       .def("enableHistoryRecordingForChild",
-           &Algorithm::enableHistoryRecordingForChild, (args("on")),
+           &Algorithm::enableHistoryRecordingForChild, (arg("self"), arg("on")),
            "Turns history recording on or off for an algorithm.")
-
       .def("declareProperty",
            (declarePropertyType2)&PythonAlgorithm::declarePyAlgProperty,
            declarePropertyType2_Overload(
@@ -102,7 +105,6 @@ void export_leaf_classes() {
                "Declares a named property where the type is taken from "
                "the type of the defaultValue and mapped to an appropriate C++ "
                "type"))
-
       .def("declareProperty",
            (declarePropertyType3)&PythonAlgorithm::declarePyAlgProperty,
            declarePropertyType3_Overload(
@@ -111,23 +113,22 @@ void export_leaf_classes() {
                "Declares a named property where the type is taken from the "
                "type "
                "of the defaultValue and mapped to an appropriate C++ type"))
-
       .def("declareProperty",
            (declarePropertyType4)&PythonAlgorithm::declarePyAlgProperty,
            (arg("self"), arg("name"), arg("defaultValue"),
             arg("direction") = Direction::Input),
            "Declares a named property where the type is taken from the type "
            "of the defaultValue and mapped to an appropriate C++ type")
-
-      .def("getLogger", &PythonAlgorithm::getLogger,
+      .def("getLogger", &PythonAlgorithm::getLogger, arg("self"),
            return_value_policy<reference_existing_object>(),
            "Returns a reference to this algorithm's logger")
-      .def("log", &PythonAlgorithm::getLogger,
+      .def("log", &PythonAlgorithm::getLogger, arg("self"),
            return_value_policy<reference_existing_object>(),
            "Returns a reference to this algorithm's logger") // Traditional name
 
       // deprecated methods
       .def("setWikiSummary", &PythonAlgorithm::setWikiSummary,
+           (arg("self"), arg("summary")),
            "(Deprecated.) Set summary for the help.");
 
   // Prior to version 3.2 there was a separate C++ PythonAlgorithm class that
diff --git a/Framework/PythonInterface/mantid/api/src/Exports/AlgorithmFactory.cpp b/Framework/PythonInterface/mantid/api/src/Exports/AlgorithmFactory.cpp
index 48b3811552796c151162c47efb7a013fbd5415aa..16596444d5052301e09371c9ef001fdf29eb5665 100644
--- a/Framework/PythonInterface/mantid/api/src/Exports/AlgorithmFactory.cpp
+++ b/Framework/PythonInterface/mantid/api/src/Exports/AlgorithmFactory.cpp
@@ -99,8 +99,15 @@ void subscribe(AlgorithmFactoryImpl &self, const boost::python::object &obj) {
   // from the FileLoaderRegistry
   FileLoaderRegistry::Instance().unsubscribe(descr.first, descr.second);
 }
-
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunknown-pragmas"
+#pragma clang diagnostic ignored "-Wunused-local-typedef"
+#endif
 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(existsOverloader, exists, 1, 2)
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
 
 ///@endcond
 }
@@ -118,12 +125,15 @@ void export_AlgorithmFactory() {
                             "an option to specify the version"))
 
       .def("getRegisteredAlgorithms", &getRegisteredAlgorithms,
+           (arg("self"), arg("include_hidden")),
            "Returns a Python dictionary of currently registered algorithms")
       .def("highestVersion", &AlgorithmFactoryImpl::highestVersion,
+           (arg("self"), arg("algorithm_name")),
            "Returns the highest version of the named algorithm. Throws "
            "ValueError if no algorithm can be found")
-      .def("subscribe", &subscribe, "Register a Python class derived from "
-                                    "PythonAlgorithm into the factory")
+      .def("subscribe", &subscribe, (arg("self"), arg("object")),
+           "Register a Python class derived from "
+           "PythonAlgorithm into the factory")
 
       .def("Instance", &AlgorithmFactory::Instance,
            return_value_policy<reference_existing_object>(),
diff --git a/Framework/PythonInterface/mantid/api/src/Exports/AlgorithmHistory.cpp b/Framework/PythonInterface/mantid/api/src/Exports/AlgorithmHistory.cpp
index 8c886db7e8e024996dfda59da964188d8b61eb96..05a5f7045434a46b2bbd1ba14e0f7e9a2b35ec6a 100644
--- a/Framework/PythonInterface/mantid/api/src/Exports/AlgorithmHistory.cpp
+++ b/Framework/PythonInterface/mantid/api/src/Exports/AlgorithmHistory.cpp
@@ -58,40 +58,42 @@ void export_AlgorithmHistory() {
   register_ptr_to_python<Mantid::API::AlgorithmHistory_sptr>();
 
   class_<AlgorithmHistory>("AlgorithmHistory", no_init)
-      .def("name", &AlgorithmHistory::name,
+      .def("name", &AlgorithmHistory::name, arg("self"),
            return_value_policy<copy_const_reference>(),
            "Returns the name of the algorithm.")
 
-      .def("version", &AlgorithmHistory::version,
+      .def("version", &AlgorithmHistory::version, arg("self"),
            return_value_policy<copy_const_reference>(),
            "Returns the version of the algorithm.")
 
       .def("executionDuration", &AlgorithmHistory::executionDuration,
-           "Returns the execution duration of the algorithm.")
+           arg("self"), "Returns the execution duration of the algorithm.")
 
-      .def("executionDate", &AlgorithmHistory::executionDate,
+      .def("executionDate", &AlgorithmHistory::executionDate, arg("self"),
            "Returns the execution date of the algorithm.")
 
-      .def("execCount", &AlgorithmHistory::execCount,
+      .def("execCount", &AlgorithmHistory::execCount, arg("self"),
            return_value_policy<copy_const_reference>(),
            "Returns the execution number of the algorithm.")
 
-      .def("childHistorySize", &AlgorithmHistory::childHistorySize,
+      .def("childHistorySize", &AlgorithmHistory::childHistorySize, arg("self"),
            "Returns the number of the child algorithms.")
 
       .def("getChildAlgorithmHistory",
-           &AlgorithmHistory::getChildAlgorithmHistory, arg("index"),
+           &AlgorithmHistory::getChildAlgorithmHistory,
+           (arg("self"), arg("index")),
            "Returns the child algorithm at the given index in the history")
 
-      .def("getChildHistories", &getChildrenAsList, "Returns a list of child "
-                                                    "algorithm histories for "
-                                                    "this algorithm history.")
+      .def("getChildHistories", &getChildrenAsList, arg("self"),
+           "Returns a list of child "
+           "algorithm histories for "
+           "this algorithm history.")
 
-      .def("getProperties", &getPropertiesAsList,
+      .def("getProperties", &getPropertiesAsList, arg("self"),
            "Returns properties for this algorithm history.")
 
       .def("getChildAlgorithm", &AlgorithmHistory::getChildAlgorithm,
-           arg("index"),
+           (arg("self"), arg("index")),
            "Returns the algorithm at the given index in the history")
       // ----------------- Operators --------------------------------------
       .def(self_ns::str(self));
diff --git a/Framework/PythonInterface/mantid/api/src/Exports/AlgorithmManager.cpp b/Framework/PythonInterface/mantid/api/src/Exports/AlgorithmManager.cpp
index f827fd3728ba1ebccc8943358a1da9c8f7a28563..283b71e128e716988c2c52cc63c09f788932503f 100644
--- a/Framework/PythonInterface/mantid/api/src/Exports/AlgorithmManager.cpp
+++ b/Framework/PythonInterface/mantid/api/src/Exports/AlgorithmManager.cpp
@@ -57,12 +57,20 @@ boost::python::list runningInstancesOf(AlgorithmManagerImpl &self,
 
 ///@cond
 //------------------------------------------------------------------------------------------------------
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunknown-pragmas"
+#pragma clang diagnostic ignored "-Wunused-local-typedef"
+#endif
 /// Define overload generators
 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(create_overloads,
                                        AlgorithmManagerImpl::create, 1, 2)
 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(createUnmanaged_overloads,
                                        AlgorithmManagerImpl::createUnmanaged, 1,
                                        2)
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
 ///@endcond
 }
 
@@ -78,22 +86,25 @@ void export_AlgorithmManager() {
           .def("createUnmanaged", &AlgorithmManagerImpl::createUnmanaged,
                createUnmanaged_overloads((arg("name"), arg("version")),
                                          "Creates an unmanaged algorithm."))
-          .def("size", &AlgorithmManagerImpl::size,
+          .def("size", &AlgorithmManagerImpl::size, arg("self"),
                "Returns the number of managed algorithms")
           .def("setMaxAlgorithms", &AlgorithmManagerImpl::setMaxAlgorithms,
+               (arg("self"), arg("n")),
                "Set the maximum number of allowed managed algorithms")
-          .def("getAlgorithm", &getAlgorithm,
+          .def("getAlgorithm", &getAlgorithm, (arg("self"), arg("id_holder")),
                "Return the algorithm instance identified by the given id.")
-          .def("removeById", &removeById,
+          .def("removeById", &removeById, (arg("self"), arg("id_holder")),
                "Remove an algorithm from the managed list")
           .def("newestInstanceOf", &AlgorithmManagerImpl::newestInstanceOf,
+               (arg("self"), arg("algorithm_name")),
                "Returns the newest created instance of the named algorithm")
           .def("runningInstancesOf", &runningInstancesOf,
+               (arg("self"), arg("algorithm_name")),
                "Returns a list of managed algorithm instances that are "
                "currently executing")
-          .def("clear", &AlgorithmManagerImpl::clear,
+          .def("clear", &AlgorithmManagerImpl::clear, arg("self"),
                "Clears the current list of managed algorithms")
-          .def("cancelAll", &AlgorithmManagerImpl::cancelAll,
+          .def("cancelAll", &AlgorithmManagerImpl::cancelAll, arg("self"),
                "Requests that all currently running algorithms be cancelled");
 
   // Instance method
diff --git a/Framework/PythonInterface/mantid/api/src/Exports/Axis.cpp b/Framework/PythonInterface/mantid/api/src/Exports/Axis.cpp
index 0df0e6417b49f3a387dacbd0df445430981119e2..664da1fb0da97aea7d9a3bfca91669d1b2683fa9 100644
--- a/Framework/PythonInterface/mantid/api/src/Exports/Axis.cpp
+++ b/Framework/PythonInterface/mantid/api/src/Exports/Axis.cpp
@@ -25,9 +25,19 @@ namespace {
 namespace bpl = boost::python;
 
 //------------------------------- Overload macros ---------------------------
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunknown-pragmas"
+#pragma clang diagnostic ignored "-Wunused-local-typedef"
+#endif
+
 // Overloads for operator() function which has 1 optional argument
 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(Axis_getValue, Axis::getValue, 1, 2)
 
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
 /**
  * Extract the axis values as a sequence. A numpy array is used if the
  * data is numerical or a simple python list is used if the data is a string
@@ -73,33 +83,41 @@ void export_Axis() {
 
   // Class
   class_<Axis, boost::noncopyable>("MantidAxis", no_init)
-      .def("length", &Axis::length, "Returns the length of the axis")
+      .def("length", &Axis::length, arg("self"),
+           "Returns the length of the axis")
       .def("title", (const std::string &(Axis::*)() const) & Axis::title,
-           return_value_policy<copy_const_reference>(), "Get the axis title")
-      .def("isSpectra", &Axis::isSpectra,
+           arg("self"), return_value_policy<copy_const_reference>(),
+           "Get the axis title")
+      .def("isSpectra", &Axis::isSpectra, arg("self"),
            "Returns true if this is a SpectraAxis")
-      .def("isNumeric", &Axis::isNumeric,
+      .def("isNumeric", &Axis::isNumeric, arg("self"),
            "Returns true if this is a NumericAxis")
-      .def("isText", &Axis::isText, "Returns true if this is a TextAxis")
-      .def("label", &Axis::label, "Return the axis label")
+      .def("isText", &Axis::isText, arg("self"),
+           "Returns true if this is a TextAxis")
+      .def("label", &Axis::label, (arg("self"), arg("index")),
+           "Return the axis label")
       .def("getUnit", (const Unit_sptr &(Axis::*)() const) & Axis::unit,
-           return_value_policy<copy_const_reference>(),
+           arg("self"), return_value_policy<copy_const_reference>(),
            "Returns the unit object for the axis")
       .def("getValue", &Axis::getValue,
-           Axis_getValue(args("index", "vertical_index"),
+           Axis_getValue((arg("self"), arg("index"), arg("vertical_index")),
                          "Returns the value at the given point on the Axis. "
                          "The vertical axis index [default=0]"))
-      .def("extractValues", &extractAxisValues,
+      .def("extractValues", &extractAxisValues, arg("self"),
            "Return a numpy array of the axis values")
-      .def("setUnit", &Axis::setUnit,
+      .def("setUnit", &Axis::setUnit, (arg("self"), arg("unit_name")),
            return_value_policy<copy_const_reference>(),
            "Set the unit for this axis by name.")
-      .def("setValue", &Axis::setValue, "Set a value at the given index")
-      .def("getMin", &Axis::getMin, "Get min value specified on the axis")
-      .def("getMax", &Axis::getMax, "Get max value specified on the axis")
+      .def("setValue", &Axis::setValue,
+           (arg("self"), arg("index"), arg("value")),
+           "Set a value at the given index")
+      .def("getMin", &Axis::getMin, arg("self"),
+           "Get min value specified on the axis")
+      .def("getMax", &Axis::getMax, arg("self"),
+           "Get max value specified on the axis")
       //------------------------------------ Special methods
       //------------------------------------
-      .def("__len__", &Axis::length);
+      .def("__len__", &Axis::length, arg("self"));
 }
 
 // --------------------------------------------------------------------------------------------
@@ -118,7 +136,8 @@ void export_NumericAxis() {
   /// Exported so that Boost.Python can give back a NumericAxis class when an
   /// Axis* is returned
   class_<NumericAxis, bases<Axis>, boost::noncopyable>("NumericAxis", no_init)
-      .def("create", &createNumericAxis, return_internal_reference<>(),
+      .def("create", &createNumericAxis, arg("length"),
+           return_internal_reference<>(),
            "Creates a new NumericAxis of a specified length")
       .staticmethod("create");
 }
@@ -141,7 +160,8 @@ void export_BinEdgeAxis() {
   /// Axis* is returned
   class_<BinEdgeAxis, bases<NumericAxis>, boost::noncopyable>("BinEdgeAxis",
                                                               no_init)
-      .def("create", &createBinEdgeAxis, return_internal_reference<>(),
+      .def("create", &createBinEdgeAxis, arg("length"),
+           return_internal_reference<>(),
            "Creates a new BinEdgeAxis of a specified length")
       .staticmethod("create");
 }
@@ -159,9 +179,13 @@ Axis *createTextAxis(int length) { return new Mantid::API::TextAxis(length); }
 
 void export_TextAxis() {
   class_<TextAxis, bases<Axis>, boost::noncopyable>("TextAxis", no_init)
-      .def("setLabel", &TextAxis::setLabel, "Set the label at the given entry")
-      .def("label", &TextAxis::label, "Return the label at the given position")
-      .def("create", &createTextAxis, return_internal_reference<>(),
+      .def("setLabel", &TextAxis::setLabel,
+           (arg("self"), arg("index"), arg("label")),
+           "Set the label at the given entry")
+      .def("label", &TextAxis::label, (arg("self"), arg("index")),
+           "Return the label at the given position")
+      .def("create", &createTextAxis, arg("length"),
+           return_internal_reference<>(),
            "Creates a new TextAxis of a specified length")
       .staticmethod("create");
 }
diff --git a/Framework/PythonInterface/mantid/api/src/Exports/BoxController.cpp b/Framework/PythonInterface/mantid/api/src/Exports/BoxController.cpp
index 7caf592a3ea586aad1dc6544bb2b80c7024c543b..af6debd38bd7864bcda9671f74e9e7979deeeed6 100644
--- a/Framework/PythonInterface/mantid/api/src/Exports/BoxController.cpp
+++ b/Framework/PythonInterface/mantid/api/src/Exports/BoxController.cpp
@@ -11,24 +11,28 @@ void export_BoxController() {
   register_ptr_to_python<boost::shared_ptr<BoxController>>();
 
   class_<BoxController, boost::noncopyable>("BoxController", no_init)
-      .def("getNDims", &BoxController::getNDims, "Get # of dimensions")
-      .def("getSplitThreshold", &BoxController::getSplitThreshold,
+      .def("getNDims", &BoxController::getNDims, arg("self"),
+           "Get # of dimensions")
+      .def("getSplitThreshold", &BoxController::getSplitThreshold, arg("self"),
            "Return the splitting threshold, in # of events")
       .def("getSplitInto", &BoxController::getSplitInto,
+           (arg("self"), arg("dim")),
            "Return into how many to split along a dimension")
-      .def("getMaxDepth", &BoxController::getMaxDepth,
+      .def("getMaxDepth", &BoxController::getMaxDepth, arg("self"),
            "Return the max recursion depth allowed for grid box splitting.")
       .def("getTotalNumMDBoxes", &BoxController::getTotalNumMDBoxes,
+           arg("self"),
            "Return the total number of MD Boxes, irrespective of depth")
       .def("getTotalNumMDGridBoxes", &BoxController::getTotalNumMDGridBoxes,
+           arg("self"),
            "Return the total number of MDGridBox'es, irrespective of depth")
-      .def("getAverageDepth", &BoxController::getAverageDepth,
+      .def("getAverageDepth", &BoxController::getAverageDepth, arg("self"),
            "Return the average recursion depth of gridding.")
-      .def("isFileBacked", &BoxController::isFileBacked,
+      .def("isFileBacked", &BoxController::isFileBacked, arg("self"),
            "Return True if the MDEventWorkspace is backed by a file ")
-      .def("getFilename", &BoxController::getFilename,
+      .def("getFilename", &BoxController::getFilename, arg("self"),
            "Return  the full path to the file open as the file-based back or "
            "empty string if no file back-end is initiated")
-      .def("useWriteBuffer", &BoxController::useWriteBuffer,
+      .def("useWriteBuffer", &BoxController::useWriteBuffer, arg("self"),
            "Return true if the MRU should be used");
 }
diff --git a/Framework/PythonInterface/mantid/api/src/Exports/DataProcessorAlgorithm.cpp b/Framework/PythonInterface/mantid/api/src/Exports/DataProcessorAlgorithm.cpp
index 1dacf9c7bc503e3455d541b358f1beb3dac72b61..00c8a38090785a1306a40883c221b28f3dffbcd5 100644
--- a/Framework/PythonInterface/mantid/api/src/Exports/DataProcessorAlgorithm.cpp
+++ b/Framework/PythonInterface/mantid/api/src/Exports/DataProcessorAlgorithm.cpp
@@ -25,61 +25,72 @@ void export_DataProcessorAlgorithm() {
       "DataProcessorAlgorithm", "Base class workflow-type algorithms")
 
       .def("setLoadAlg", &DataProcessorAdapter::setLoadAlgProxy,
+           (arg("self"), arg("alg")),
            "Set the name of the algorithm called using the load() method "
            "[Default=Load]")
 
       .def("setLoadAlgFileProp", &DataProcessorAdapter::setLoadAlgFilePropProxy,
+           (arg("self"), arg("file_prop_name")),
            "Set the name of the file property for the load algorithm when "
            "using "
            "the load() method [Default=Filename]")
 
       .def("setAccumAlg", &DataProcessorAdapter::setAccumAlgProxy,
+           (arg("self"), arg("alg")),
            "Set the name of the algorithm called to accumulate a chunk of "
            "processed data [Default=Plus]")
 
       .def("determineChunk", &DataProcessorAdapter::determineChunkProxy,
+           (arg("self"), arg("file_name")),
            "Return a TableWorkspace containing the information on how to split "
            "the "
            "input file when processing in chunks")
 
       .def("loadChunk", &DataProcessorAdapter::loadChunkProxy,
-           "Load a chunk of data")
+           (arg("self"), arg("row_index")), "Load a chunk of data")
 
       .def("load", (loadOverload1)&DataProcessorAdapter::loadProxy,
+           (arg("self"), arg("input_data")),
            "Loads the given file or workspace data and returns the workspace. "
            "The output is not stored in the AnalysisDataService.")
 
       .def("load", (loadOverload2)&DataProcessorAdapter::loadProxy,
+           (arg("self"), arg("input_data"), arg("load_quite")),
            "Loads the given file or workspace data and returns the workspace. "
            "If loadQuiet=True then output is not stored in the "
            "AnalysisDataService.")
 
       .def("splitInput", &DataProcessorAdapter::splitInputProxy,
-           return_value_policy<VectorToNumpy>())
+           (arg("self"), arg("input")), return_value_policy<VectorToNumpy>())
 
-      .def("forwardProperties", &DataProcessorAdapter::forwardPropertiesProxy)
+      .def("forwardProperties", &DataProcessorAdapter::forwardPropertiesProxy,
+           arg("self"))
 
       .def("getProcessProperties",
            &DataProcessorAdapter::getProcessPropertiesProxy,
+           (arg("self"), arg("property_manager")),
            "Returns the named property manager from the service or creates "
            "a new one if it does not exist")
 
       .def("assemble", &DataProcessorAdapter::assembleProxy,
+           (arg("self"), arg("partial_wsname"), arg("output_wsname")),
            "If an MPI build, assemble the partial workspaces from all MPI "
            "processes. "
            "Otherwise, simply returns the input workspace")
 
       .def("saveNexus", &DataProcessorAdapter::saveNexusProxy,
+           (arg("self"), arg("output_wsname"), arg("output_filename")),
            "Save a workspace as a nexus file. If this is an MPI build then "
            "saving only "
            "happens for the main thread.")
 
       .def("isMainThread", &DataProcessorAdapter::isMainThreadProxy,
+           arg("self"),
            "Returns true if this algorithm is the main thread for an MPI "
            "build. For "
            "non-MPI build it always returns true")
 
-      .def("getNThreads", &DataProcessorAdapter::getNThreadsProxy,
+      .def("getNThreads", &DataProcessorAdapter::getNThreadsProxy, arg("self"),
            "Returns the number of running MPI processes in an MPI build or 1 "
            "for "
            "a non-MPI build");
diff --git a/Framework/PythonInterface/mantid/api/src/Exports/ExperimentInfo.cpp b/Framework/PythonInterface/mantid/api/src/Exports/ExperimentInfo.cpp
index 758c1c8e2a933bc2f15a62470d37281966dac503..926a6d0b31e49e4e9970553c29118e819f30f7fd 100644
--- a/Framework/PythonInterface/mantid/api/src/Exports/ExperimentInfo.cpp
+++ b/Framework/PythonInterface/mantid/api/src/Exports/ExperimentInfo.cpp
@@ -10,9 +10,17 @@ using Mantid::API::ExperimentInfo;
 using Mantid::PythonInterface::Policies::RemoveConstSharedPtr;
 using namespace boost::python;
 
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunknown-pragmas"
+#pragma clang diagnostic ignored "-Wunused-local-typedef"
+#endif
 /// Overload generator for getInstrumentFilename
 BOOST_PYTHON_FUNCTION_OVERLOADS(getInstrumentFilename_Overload,
                                 ExperimentInfo::getInstrumentFilename, 1, 2)
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
 
 void export_ExperimentInfo() {
   register_ptr_to_python<boost::shared_ptr<ExperimentInfo>>();
diff --git a/Framework/PythonInterface/mantid/api/src/Exports/FileFinder.cpp b/Framework/PythonInterface/mantid/api/src/Exports/FileFinder.cpp
index f762919cdf1a63339a14da24330e4208426b954c..6d216cc065028263cc2edb49956b08f50b7456bc 100644
--- a/Framework/PythonInterface/mantid/api/src/Exports/FileFinder.cpp
+++ b/Framework/PythonInterface/mantid/api/src/Exports/FileFinder.cpp
@@ -8,18 +8,26 @@ using Mantid::API::FileFinderImpl;
 using namespace boost::python;
 
 namespace {
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunknown-pragmas"
+#pragma clang diagnostic ignored "-Wunused-local-typedef"
+#endif
 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(getFullPathOverloader, getFullPath, 1, 2)
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
 }
 
 void export_FileFinder() {
   class_<FileFinderImpl, boost::noncopyable>("FileFinderImpl", no_init)
       .def("getFullPath", &FileFinderImpl::getFullPath,
            getFullPathOverloader(
-               (arg("path"), arg("ignoreDirs") = false),
+               (arg("self"), arg("path"), arg("ignoreDirs") = false),
                "Return a full path to the given file if it can be found within "
                "datasearch.directories paths. Directories can be ignored with "
                "ignoreDirs=True. An empty string is returned otherwise."))
-      .def("findRuns", &FileFinderImpl::findRuns,
+      .def("findRuns", &FileFinderImpl::findRuns, (arg("self"), arg("hintstr")),
            "Find a list of files file given a hint. "
            "The hint can be a comma separated list of run numbers and can also "
            "include ranges of runs, e.g. 123-135 or equivalently 123-35"
diff --git a/Framework/PythonInterface/mantid/api/src/Exports/FileLoaderRegistry.cpp b/Framework/PythonInterface/mantid/api/src/Exports/FileLoaderRegistry.cpp
index 5935cb7aae9932ac57f2f9c6f8ce18203e867f2d..baa9c3e8a188627728b20dfa745d7dd2cdfbaee7 100644
--- a/Framework/PythonInterface/mantid/api/src/Exports/FileLoaderRegistry.cpp
+++ b/Framework/PythonInterface/mantid/api/src/Exports/FileLoaderRegistry.cpp
@@ -10,9 +10,10 @@ void export_FileLoaderRegistry() {
   class_<FileLoaderRegistryImpl, boost::noncopyable>("FileLoaderRegistryImpl",
                                                      no_init)
       .def("canLoad", &FileLoaderRegistryImpl::canLoad,
+           (arg("self"), arg("algorithm_name"), arg("file_name")),
            "Perform a check that that the given algorithm can load the file")
       .def("Instance", &FileLoaderRegistry::Instance,
            return_value_policy<reference_existing_object>(),
            "Returns a reference to the FileLoaderRegistry singleton instance")
       .staticmethod("Instance");
-}
\ No newline at end of file
+}
diff --git a/Framework/PythonInterface/mantid/api/src/Exports/FrameworkManager.cpp b/Framework/PythonInterface/mantid/api/src/Exports/FrameworkManager.cpp
index 1e31d32096f1b312b05f7f5cfff115ab486ccf85..d6df442a862bd0060019dd70b7ef395c26ec8a73 100644
--- a/Framework/PythonInterface/mantid/api/src/Exports/FrameworkManager.cpp
+++ b/Framework/PythonInterface/mantid/api/src/Exports/FrameworkManager.cpp
@@ -12,31 +12,34 @@ void export_FrameworkManager() {
   class_<FrameworkManagerImpl, boost::noncopyable>("FrameworkManagerImpl",
                                                    no_init)
       .def("setNumOMPThreadsToConfigValue",
-           &FrameworkManagerImpl::setNumOMPThreadsToConfigValue,
+           &FrameworkManagerImpl::setNumOMPThreadsToConfigValue, arg("self"),
            "Sets the number of OpenMP threads to the value specified in the "
            "config file")
 
       .def("setNumOMPThreads", &FrameworkManagerImpl::setNumOMPThreads,
+           (arg("self"), arg("nthread")),
            "Set the number of OpenMP threads to the given value")
 
       .def("getNumOMPThreads", &FrameworkManagerImpl::getNumOMPThreads,
+           arg("self"),
            "Returns the number of OpenMP threads that will be used.")
 
-      .def("clear", &FrameworkManagerImpl::clear,
+      .def("clear", &FrameworkManagerImpl::clear, arg("self"),
            "Clear all memory held by Mantid")
 
       .def("clearAlgorithms", &FrameworkManagerImpl::clearAlgorithms,
+           arg("self"),
            "Clear memory held by algorithms (does not include workspaces)")
 
-      .def("clearData", &FrameworkManagerImpl::clearData,
+      .def("clearData", &FrameworkManagerImpl::clearData, arg("self"),
            "Clear memory held by the data service (essentially all workspaces, "
            "including hidden)")
 
       .def("clearInstruments", &FrameworkManagerImpl::clearInstruments,
-           "Clear memory held by the cached instruments")
+           arg("self"), "Clear memory held by the cached instruments")
 
       .def("clearPropertyManagers",
-           &FrameworkManagerImpl::clearPropertyManagers,
+           &FrameworkManagerImpl::clearPropertyManagers, arg("self"),
            "Clear memory held by the PropertyManagerDataService")
 
       .def("Instance", &FrameworkManager::Instance,
diff --git a/Framework/PythonInterface/mantid/api/src/Exports/FunctionFactory.cpp b/Framework/PythonInterface/mantid/api/src/Exports/FunctionFactory.cpp
index 2d94e8f7aea8f4484f240f8b13488aa68e7a6d44..7735fc15decf7418218e07c3b204f3235ef4774c 100644
--- a/Framework/PythonInterface/mantid/api/src/Exports/FunctionFactory.cpp
+++ b/Framework/PythonInterface/mantid/api/src/Exports/FunctionFactory.cpp
@@ -89,15 +89,15 @@ void export_FunctionFactory() {
 
   class_<FunctionFactoryImpl, boost::noncopyable>("FunctionFactoryImpl",
                                                   no_init)
-      .def("getFunctionNames", &getFunctionNames,
+      .def("getFunctionNames", &getFunctionNames, arg("self"),
            "Returns a list of the currently available functions")
       .def("createFunction", &FunctionFactoryImpl::createFunction,
+           (arg("self"), arg("type")),
            "Return a pointer to the requested function")
-      .def("subscribe", &subscribe,
+      .def("subscribe", &subscribe, (arg("self"), arg("object")),
            "Register a Python class derived from IFunction into the factory")
       .def("unsubscribe", &FunctionFactoryImpl::unsubscribe,
-           "Remove a type from the factory")
-
+           (arg("self"), arg("class_name")), "Remove a type from the factory")
       .def("Instance", &FunctionFactory::Instance,
            return_value_policy<reference_existing_object>(),
            "Returns a reference to the FunctionFactory singleton")
diff --git a/Framework/PythonInterface/mantid/api/src/Exports/IAlgorithm.cpp b/Framework/PythonInterface/mantid/api/src/Exports/IAlgorithm.cpp
index e2be117bf9a2e743ff79c79dfc3e2a0e5843cf51..009ca30fb110ff5ede255104d493cfe8e16fcbdf 100644
--- a/Framework/PythonInterface/mantid/api/src/Exports/IAlgorithm.cpp
+++ b/Framework/PythonInterface/mantid/api/src/Exports/IAlgorithm.cpp
@@ -302,89 +302,102 @@ void export_ialgorithm() {
 
   class_<IAlgorithm, bases<IPropertyManager>, boost::noncopyable>(
       "IAlgorithm", "Interface for all algorithms", no_init)
-      .def("name", &IAlgorithm::name, "Returns the name of the algorithm")
-      .def("alias", &IAlgorithm::alias, "Return the aliases for the algorithm")
-      .def("version", &IAlgorithm::version,
+      .def("name", &IAlgorithm::name, arg("self"),
+           "Returns the name of the algorithm")
+      .def("alias", &IAlgorithm::alias, arg("self"),
+           "Return the aliases for the algorithm")
+      .def("version", &IAlgorithm::version, arg("self"),
            "Returns the version number of the algorithm")
-      .def("cancel", &IAlgorithm::cancel,
+      .def("cancel", &IAlgorithm::cancel, arg("self"),
            "Request that the algorithm stop running")
-      .def("category", &IAlgorithm::category,
+      .def("category", &IAlgorithm::category, arg("self"),
            "Returns the category containing the algorithm")
-      .def("categories", &IAlgorithm::categories,
+      .def("categories", &IAlgorithm::categories, arg("self"),
            "Returns the list of categories this algorithm belongs to")
-      .def("summary", &IAlgorithm::summary,
+      .def("summary", &IAlgorithm::summary, arg("self"),
            "Returns a summary message describing the algorithm")
-      .def("workspaceMethodName", &IAlgorithm::workspaceMethodName,
+      .def("workspaceMethodName", &IAlgorithm::workspaceMethodName, arg("self"),
            "Returns a name that will be used when attached as a workspace "
            "method. Empty string indicates do not attach")
-      .def("workspaceMethodOn", &IAlgorithm::workspaceMethodOn,
+      .def("workspaceMethodOn", &IAlgorithm::workspaceMethodOn, arg("self"),
            return_value_policy<VectorToNumpy>(), // creates a list for strings
            "Returns a set of class names that will have the method attached. "
            "Empty list indicates all types")
       .def("workspaceMethodInputProperty",
-           &IAlgorithm::workspaceMethodInputProperty,
+           &IAlgorithm::workspaceMethodInputProperty, arg("self"),
            "Returns the name of the input workspace property used by the "
            "calling object")
-      .def("getAlgorithmID", &getAlgorithmID,
+      .def("getAlgorithmID", &getAlgorithmID, arg("self"),
            "Returns a unique identifier for this algorithm object")
-      .def("docString", &createDocString,
+      .def("docString", &createDocString, arg("self"),
            "Returns a doc string for the algorithm")
       .def("mandatoryProperties", &getInputPropertiesWithMandatoryFirst,
+           arg("self"),
            "Returns a list of input and in/out property names that is ordered "
            "such that the mandatory properties are first followed by the "
            "optional ones.")
-      .def("orderedProperties", &getAlgorithmPropertiesOrdered,
+      .def("orderedProperties", &getAlgorithmPropertiesOrdered, arg("self"),
            "Return a list of input, in/out and output properties "
            "such that the mandatory properties are first followed by the "
            "optional ones.")
-      .def("outputProperties", &getOutputProperties,
+      .def("outputProperties", &getOutputProperties, arg("self"),
            "Returns a list of the output properties on the algorithm")
-      .def("isInitialized", &IAlgorithm::isInitialized,
+      .def("isInitialized", &IAlgorithm::isInitialized, arg("self"),
            "Returns True if the algorithm is initialized, False otherwise")
-      .def("isExecuted", &IAlgorithm::isExecuted,
+      .def("isExecuted", &IAlgorithm::isExecuted, arg("self"),
            "Returns True if the algorithm has been executed successfully, "
            "False otherwise")
-      .def("isLogging", &IAlgorithm::isLogging, "Returns True if the "
-                                                "algorithm's logger is turned "
-                                                "on, False otherwise")
-      .def("isRunning", &IAlgorithm::isRunning, "Returns True if the algorithm "
-                                                "is considered to be running, "
-                                                "False otherwise")
-      .def("setChild", &IAlgorithm::setChild,
+      .def("isLogging", &IAlgorithm::isLogging, arg("self"),
+           "Returns True if the "
+           "algorithm's logger is turned "
+           "on, False otherwise")
+      .def("isRunning", &IAlgorithm::isRunning, arg("self"),
+           "Returns True if the algorithm "
+           "is considered to be running, "
+           "False otherwise")
+      .def("setChild", &IAlgorithm::setChild, (arg("self"), arg("is_child")),
            "If true this algorithm is run as a child algorithm. There will be "
            "no logging and nothing is stored in the Analysis Data Service")
       .def("enableHistoryRecordingForChild",
            &IAlgorithm::enableHistoryRecordingForChild,
+           (arg("self"), arg("on")),
            "If true then history will be recorded regardless of the child "
            "status")
       .def("setAlgStartupLogging", &IAlgorithm::setAlgStartupLogging,
+           (arg("self"), arg("enabled")),
            "If true then allow logging of start and end messages")
       .def("getAlgStartupLogging", &IAlgorithm::getAlgStartupLogging,
-           "Returns true if logging of start and end messages")
+           arg("self"), "Returns true if logging of start and end messages")
       .def("setAlwaysStoreInADS", &IAlgorithm::setAlwaysStoreInADS,
+           (arg("self"), arg("do_store")),
            "If true then even child algorithms will have their workspaces "
            "stored in the ADS.")
-      .def("isChild", &IAlgorithm::isChild,
+      .def("isChild", &IAlgorithm::isChild, arg("self"),
            "Returns True if the algorithm has been marked to run as a child. "
            "If True then Output workspaces "
            "are NOT stored in the Analysis Data Service but must be retrieved "
            "from the property.")
-      .def("setLogging", &IAlgorithm::setLogging, "Toggle logging on/off.")
-      .def("setRethrows", &IAlgorithm::setRethrows)
-      .def("initialize", &IAlgorithm::initialize, "Initializes the algorithm")
-      .def("validateInputs", &IAlgorithm::validateInputs,
+      .def("setLogging", &IAlgorithm::setLogging, (arg("self"), arg("value")),
+           "Toggle logging on/off.")
+      .def("setRethrows", &IAlgorithm::setRethrows,
+           (arg("self"), arg("rethrow")), "To query whether an algorithm "
+                                          "should rethrow exceptions when "
+                                          "executing.")
+      .def("initialize", &IAlgorithm::initialize, arg("self"),
+           "Initializes the algorithm")
+      .def("validateInputs", &IAlgorithm::validateInputs, arg("self"),
            "Cross-check all inputs and return any errors as a dictionary")
-      .def("execute", &executeProxy,
+      .def("execute", &executeProxy, arg("self"),
            "Runs the algorithm and returns whether it has been successful")
       // 'Private' static methods
-      .def("_algorithmInThread", &_algorithmInThread)
+      .def("_algorithmInThread", &_algorithmInThread, arg("thread_id"))
       .staticmethod("_algorithmInThread")
       // Special methods
-      .def("__str__", &IAlgorithm::toString)
+      .def("__str__", &IAlgorithm::toString, arg("self"))
 
       // deprecated methods
-      .def("getOptionalMessage", &getOptionalMessage,
+      .def("getOptionalMessage", &getOptionalMessage, arg("self"),
            "Returns the optional user message attached to the algorithm")
-      .def("getWikiSummary", &getWikiSummary,
+      .def("getWikiSummary", &getWikiSummary, arg("self"),
            "Returns the summary found on the wiki page");
 }
diff --git a/Framework/PythonInterface/mantid/api/src/Exports/IFunction.cpp b/Framework/PythonInterface/mantid/api/src/Exports/IFunction.cpp
index 77761eb93936d24f8948d8cb9c6fdd1604d6f813..4805e9a712f33945ff66e444d5968e5cd0d0e139 100644
--- a/Framework/PythonInterface/mantid/api/src/Exports/IFunction.cpp
+++ b/Framework/PythonInterface/mantid/api/src/Exports/IFunction.cpp
@@ -34,6 +34,11 @@ PyObject *getCategories(IFunction &self) {
 // -- Set property overloads --
 // setProperty(index,value,explicit)
 typedef void (IFunction::*setParameterType1)(size_t, const double &value, bool);
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunknown-pragmas"
+#pragma clang diagnostic ignored "-Wunused-local-typedef"
+#endif
 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(setParameterType1_Overloads,
                                        setParameter, 2, 3)
 // setProperty(index,value,explicit)
@@ -41,7 +46,9 @@ typedef void (IFunction::*setParameterType2)(const std::string &,
                                              const double &value, bool);
 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(setParameterType2_Overloads,
                                        setParameter, 2, 3)
-
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
 ///@endcond
 }
 
@@ -51,82 +58,96 @@ void export_IFunction() {
 
   class_<IFunction, IFunctionAdapter, boost::noncopyable>(
       "IFunction", "Base class for all functions", no_init)
-      .def("name", &IFunction::name, "Return the name of the function")
+      .def("name", &IFunction::name, arg("self"),
+           "Return the name of the function")
 
-      .def("category", &IFunctionAdapter::category,
+      .def("category", &IFunctionAdapter::category, arg("self"),
            "Return a semi-colon(;) separated string for the categories this "
            "class should belong to. For sub-categories use a \\ separator")
 
-      .def("initialize", &IFunction::initialize,
+      .def("initialize", &IFunction::initialize, arg("self"),
            "Declares any parameters and attributes on the function")
 
-      .def("getCategories", &getCategories,
+      .def("getCategories", &getCategories, arg("self"),
            "Returns a list of the categories for an algorithm")
 
-      .def("nAttributes", &IFunction::nAttributes,
+      .def("nAttributes", &IFunction::nAttributes, arg("self"),
            "Return the number of attributes (non-fitting arguments)")
 
-      .def("attributeNames", &IFunction::getAttributeNames,
+      .def("attributeNames", &IFunction::getAttributeNames, arg("self"),
            "The names of all the attributes")
 
-      .def("nParams", &IFunction::nParams, "Return the number of parameters")
+      .def("nParams", &IFunction::nParams, arg("self"),
+           "Return the number of parameters")
 
-      .def("parameterName", &IFunction::parameterName,
+      .def("parameterName", &IFunction::parameterName, (arg("self"), arg("i")),
            "Return the name of the ith parameter")
 
       .def("paramDescription", &IFunction::parameterDescription,
-           "Return a description of the ith parameter")
+           (arg("self"), arg("i")), "Return a description of the ith parameter")
 
       .def("isExplicitlySet", &IFunction::isExplicitlySet,
+           (arg("self"), arg("i")),
            "Return whether the ith parameter needs to be explicitely set")
 
       .def("getParameterValue",
            (double (IFunction::*)(size_t) const) & IFunction::getParameter,
-           "Get the value of the ith parameter")
+           (arg("self"), arg("i")), "Get the value of the ith parameter")
 
       .def("getParameterValue",
            (double (IFunction::*)(const std::string &) const) &
                IFunction::getParameter,
-           "Get the value of the named parameter")
+           (arg("self"), arg("name")), "Get the value of the named parameter")
 
       .def("setParameter", (setParameterType1)&IFunction::setParameter,
-           setParameterType1_Overloads("Sets the value of the ith parameter"))
+           setParameterType1_Overloads(
+               (arg("self"), arg("i"), arg("value"), arg("explicitlySet")),
+               "Sets the value of the ith parameter"))
 
       .def("setParameter", (setParameterType2)&IFunction::setParameter,
-           setParameterType2_Overloads("Sets the value of the named parameter"))
+           setParameterType2_Overloads(
+               (arg("self"), arg("name"), arg("value"), arg("explicitlySet")),
+               "Sets the value of the named parameter"))
 
       .def("declareAttribute", &IFunctionAdapter::declareAttribute,
+           (arg("self"), arg("name"), arg("default_value")),
            "Declare an attribute with an initial value")
 
       .def("getAttributeValue",
            (PyObject * (IFunctionAdapter::*)(const std::string &)) &
                IFunctionAdapter::getAttributeValue,
+           (arg("self"), arg("name")),
            "Return the value of the named attribute")
 
       .def("declareParameter", &IFunctionAdapter::declareFitParameter,
+           (arg("self"), arg("name"), arg("init_value"), arg("description")),
            "Declare a fitting parameter settings its default value & "
            "description")
 
       .def("declareParameter", &IFunctionAdapter::declareFitParameterNoDescr,
+           (arg("self"), arg("name"), arg("init_value")),
            "Declare a fitting parameter settings its default value")
 
       .def("declareParameter", &IFunctionAdapter::declareFitParameterZeroInit,
+           (arg("self"), arg("name")),
            "Declare a fitting parameter settings its default value to 0.0")
 
       //-- Deprecated functions that have the wrong names --
-      .def("categories", &getCategories,
+      .def("categories", &getCategories, arg("self"),
            "Returns a list of the categories for an algorithm")
-      .def("numParams", &IFunction::nParams, "Return the number of parameters")
-      .def("getParamName", &IFunction::parameterName,
+      .def("numParams", &IFunction::nParams, arg("self"),
+           "Return the number of parameters")
+      .def("getParamName", &IFunction::parameterName, (arg("self"), arg("i")),
            "Return the name of the ith parameter")
       .def("getParamDescr", &IFunction::parameterDescription,
-           "Return a description of the ith parameter")
+           (arg("self"), arg("i")), "Return a description of the ith parameter")
       .def("getParamExplicit", &IFunction::isExplicitlySet,
+           (arg("self"), arg("i")),
            "Return whether the ith parameter needs to be explicitely set")
       .def("getParamValue",
            (double (IFunction::*)(std::size_t) const) & IFunction::getParameter,
-           "Get the value of the ith parameter")
+           (arg("self"), arg("i")), "Get the value of the ith parameter")
       //-- Python special methods --
-      .def("__repr__", &IFunction::asString,
+      .def("__repr__", &IFunction::asString, arg("self"),
            "Return a string representation of the function");
 }
diff --git a/Framework/PythonInterface/mantid/api/src/Exports/IFunction1D.cpp b/Framework/PythonInterface/mantid/api/src/Exports/IFunction1D.cpp
index b610b945ffb3ccb664e1fd82870631607349008c..a435fc7b192eadaad8060c02817d251d5bd2cf59 100644
--- a/Framework/PythonInterface/mantid/api/src/Exports/IFunction1D.cpp
+++ b/Framework/PythonInterface/mantid/api/src/Exports/IFunction1D.cpp
@@ -18,6 +18,7 @@ void export_IFunction1D() {
       .def("function1D",
            (object (IFunction1DAdapter::*)(const object &) const) &
                IFunction1DAdapter::function1D,
+           (arg("self"), arg("xvals")),
            "Calculate the values of the function for the given x values and "
            "returns them");
 }
diff --git a/Framework/PythonInterface/mantid/api/src/Exports/IMDEventWorkspace.cpp b/Framework/PythonInterface/mantid/api/src/Exports/IMDEventWorkspace.cpp
index bd69cd0dab31b54c2ede7e5b609a0471b05bdde8..4bd404f62e4b60fe2af7038ce00b91a43326241e 100644
--- a/Framework/PythonInterface/mantid/api/src/Exports/IMDEventWorkspace.cpp
+++ b/Framework/PythonInterface/mantid/api/src/Exports/IMDEventWorkspace.cpp
@@ -12,15 +12,15 @@ void export_IMDEventWorkspace() {
   // IMDEventWorkspace class
   class_<IMDEventWorkspace, bases<IMDWorkspace, MultipleExperimentInfos>,
          boost::noncopyable>("IMDEventWorkspace", no_init)
-      .def("getNPoints", &IMDEventWorkspace::getNPoints,
+      .def("getNPoints", &IMDEventWorkspace::getNPoints, arg("self"),
            "Returns the total number of points (events) in this workspace")
 
-      .def("getNumDims", &IMDEventWorkspace::getNumDims,
+      .def("getNumDims", &IMDEventWorkspace::getNumDims, arg("self"),
            "Returns the number of dimensions in this workspace")
 
       .def("getBoxController", (BoxController_sptr (IMDEventWorkspace::*)()) &
                                    IMDEventWorkspace::getBoxController,
-           "Returns the BoxController used in this workspace");
+           arg("self"), "Returns the BoxController used in this workspace");
 
   RegisterWorkspacePtrToPython<IMDEventWorkspace>();
 }
diff --git a/Framework/PythonInterface/mantid/api/src/Exports/IMDHistoWorkspace.cpp b/Framework/PythonInterface/mantid/api/src/Exports/IMDHistoWorkspace.cpp
index 3852f7080de7fc94c761795836bf827b22994e65..f64840efaf7bd9f7a3266ade3d528054fdb18aa4 100644
--- a/Framework/PythonInterface/mantid/api/src/Exports/IMDHistoWorkspace.cpp
+++ b/Framework/PythonInterface/mantid/api/src/Exports/IMDHistoWorkspace.cpp
@@ -167,55 +167,65 @@ void export_IMDHistoWorkspace() {
   // IMDHistoWorkspace class
   class_<IMDHistoWorkspace, bases<IMDWorkspace, MultipleExperimentInfos>,
          boost::noncopyable>("IMDHistoWorkspace", no_init)
-      .def("getSignalArray", &getSignalArrayAsNumpyArray,
+      .def("getSignalArray", &getSignalArrayAsNumpyArray, arg("self"),
            "Returns a read-only numpy array containing the signal values")
 
       .def("getErrorSquaredArray", &getErrorSquaredArrayAsNumpyArray,
+           arg("self"),
            "Returns a read-only numpy array containing the square of the error "
            "values")
 
-      .def("getNumEventsArray", &getNumEventsArrayAsNumpyArray,
+      .def("getNumEventsArray", &getNumEventsArrayAsNumpyArray, arg("self"),
            "Returns a read-only numpy array containing the number of MD events "
            "in each bin")
 
       .def("signalAt", &IMDHistoWorkspace::signalAt,
+           (arg("self"), arg("index")),
            return_value_policy<copy_non_const_reference>(),
            "Return a reference to the signal at the linear index")
 
       .def("errorSquaredAt", &IMDHistoWorkspace::errorSquaredAt,
+           (arg("self"), arg("index")),
            return_value_policy<copy_non_const_reference>(),
            "Return the squared-errors at the linear index")
 
       .def("setSignalAt", &IMDHistoWorkspace::setSignalAt,
+           (arg("self"), arg("index"), arg("value")),
            "Sets the signal at the specified index.")
 
       .def("setErrorSquaredAt", &IMDHistoWorkspace::setErrorSquaredAt,
+           (arg("self"), arg("index"), arg("value")),
            "Sets the squared-error at the specified index.")
 
       .def("setSignalArray", &setSignalArray,
+           (arg("self"), arg("signalValues")),
            "Sets the signal from a numpy array. The sizes must match the "
            "current workspace sizes. A ValueError is thrown if not")
 
-      .def("setErrorSquaredArray", &setErrorSquaredArray,
+      .def("setErrorSquaredArray", &setErrorSquaredArray, arg("self"),
            "Sets the square of the errors from a numpy array. The sizes must "
            "match the current workspace sizes. A ValueError is thrown if not")
 
       .def("setTo", &IMDHistoWorkspace::setTo,
+           (arg("self"), arg("signal"), arg("error_squared"),
+            arg("num_events")),
            "Sets all signals/errors in the workspace to the given values")
 
       .def("getInverseVolume", &IMDHistoWorkspace::getInverseVolume,
-           return_value_policy<return_by_value>(),
+           arg("self"), return_value_policy<return_by_value>(),
            "Return the inverse of volume of EACH cell in the workspace.")
 
       .def("getLinearIndex",
            (size_t (IMDHistoWorkspace::*)(size_t, size_t) const) &
                IMDHistoWorkspace::getLinearIndex,
+           (arg("self"), arg("index1"), arg("index2")),
            return_value_policy<return_by_value>(),
            "Get the 1D linear index from the 2D array")
 
       .def("getLinearIndex",
            (size_t (IMDHistoWorkspace::*)(size_t, size_t, size_t) const) &
                IMDHistoWorkspace::getLinearIndex,
+           (arg("self"), arg("index1"), arg("index2"), arg("index3")),
            return_value_policy<return_by_value>(),
            "Get the 1D linear index from the 3D array")
 
@@ -223,10 +233,13 @@ void export_IMDHistoWorkspace() {
            (size_t (IMDHistoWorkspace::*)(size_t, size_t, size_t, size_t)
                 const) &
                IMDHistoWorkspace::getLinearIndex,
+           (arg("self"), arg("index1"), arg("index2"), arg("index3"),
+            arg("index4")),
            return_value_policy<return_by_value>(),
            "Get the 1D linear index from the 4D array")
 
       .def("getCenter", &IMDHistoWorkspace::getCenter,
+           (arg("self"), arg("linear_index")),
            return_value_policy<return_by_value>(),
            "Return the position of the center of a bin at a given position");
 
diff --git a/Framework/PythonInterface/mantid/api/src/Exports/IMDWorkspace.cpp b/Framework/PythonInterface/mantid/api/src/Exports/IMDWorkspace.cpp
index 3c8921df6623a7b4dee6c9abeb6324acb7341798..989089801c34318f3e7087c81f2a3221bd553a33 100644
--- a/Framework/PythonInterface/mantid/api/src/Exports/IMDWorkspace.cpp
+++ b/Framework/PythonInterface/mantid/api/src/Exports/IMDWorkspace.cpp
@@ -25,17 +25,17 @@ void export_IMDWorkspace() {
   // EventWorkspace class
   class_<IMDWorkspace, bases<Workspace, MDGeometry>, boost::noncopyable>(
       "IMDWorkspace", no_init)
-      .def("getNPoints", &IMDWorkspace::getNPoints, args("self"),
+      .def("getNPoints", &IMDWorkspace::getNPoints, arg("self"),
            "Returns the total number of points within the workspace")
-      .def("getNEvents", &IMDWorkspace::getNEvents, args("self"),
+      .def("getNEvents", &IMDWorkspace::getNEvents, arg("self"),
            "Returns the total number of events, contributed to the workspace")
       .def("getSpecialCoordinateSystem",
-           &IMDWorkspace::getSpecialCoordinateSystem, args("self"),
+           &IMDWorkspace::getSpecialCoordinateSystem, arg("self"),
            "Returns the special coordinate system of the workspace")
       .def("displayNormalization", &IMDWorkspace::displayNormalization,
            args("self"), "Returns the visual normalization of the workspace.")
       .def("displayNormalizationHisto",
-           &IMDWorkspace::displayNormalizationHisto, args("self"),
+           &IMDWorkspace::displayNormalizationHisto, arg("self"),
            "For MDEventWorkspaces returns the visual normalization of dervied "
            "MDHistoWorkspaces."
            "For all others returns the same as displayNormalization.");
diff --git a/Framework/PythonInterface/mantid/api/src/Exports/IMaskWorkspace.cpp b/Framework/PythonInterface/mantid/api/src/Exports/IMaskWorkspace.cpp
index 66affb607c0e136f9da7bbfb99b7d421020880b1..7090972a851786d4d7cf28c5e48773cfe1146485 100644
--- a/Framework/PythonInterface/mantid/api/src/Exports/IMaskWorkspace.cpp
+++ b/Framework/PythonInterface/mantid/api/src/Exports/IMaskWorkspace.cpp
@@ -28,12 +28,13 @@ bool isMaskedFromList(const IMaskWorkspace &self,
 
 void export_IMaskWorkspace() {
   class_<IMaskWorkspace, boost::noncopyable>("IMaskWorkspace", no_init)
-      .def("getNumberMasked", &IMaskWorkspace::getNumberMasked,
+      .def("getNumberMasked", &IMaskWorkspace::getNumberMasked, arg("self"),
            "Returns the number of masked pixels in the workspace")
       .def("isMasked", (bool (IMaskWorkspace::*)(const Mantid::detid_t) const) &
                            IMaskWorkspace::isMasked,
+           (arg("self"), arg("detector_id")),
            "Returns whether the given detector ID is masked")
-      .def("isMasked", isMaskedFromList,
+      .def("isMasked", isMaskedFromList, (arg("self"), arg("detector_id_list")),
            "Returns whether all of the given detector ID list are masked");
 
   // register pointers
diff --git a/Framework/PythonInterface/mantid/api/src/Exports/IPeak.cpp b/Framework/PythonInterface/mantid/api/src/Exports/IPeak.cpp
index 13ace3dced290717e05e3ff3888be2e1c5603115..f3e42c14c3f26423d58cb51961c44b632746c78a 100644
--- a/Framework/PythonInterface/mantid/api/src/Exports/IPeak.cpp
+++ b/Framework/PythonInterface/mantid/api/src/Exports/IPeak.cpp
@@ -36,95 +36,111 @@ void export_IPeak() {
   register_ptr_to_python<IPeak *>();
 
   class_<IPeak, boost::noncopyable>("IPeak", no_init)
-      .def("getDetectorID", &IPeak::getDetectorID,
+      .def("getDetectorID", &IPeak::getDetectorID, arg("self"),
            "Get the ID of the detector at the center of the peak")
-      .def("setDetectorID", &IPeak::setDetectorID,
+      .def("setDetectorID", &IPeak::setDetectorID, (arg("self"), arg("det_id")),
            "Set the detector ID and look up and cache values related to it.")
-      .def("getRunNumber", &IPeak::getRunNumber,
+      .def("getRunNumber", &IPeak::getRunNumber, arg("self"),
            "Return the run number this peak was measured at")
       .def("setRunNumber", &IPeak::setRunNumber,
+           (arg("self"), arg("run_number")),
            "Set the run number that measured this peak")
-      .def("getMonitorCount", &IPeak::getMonitorCount,
+      .def("getMonitorCount", &IPeak::getMonitorCount, arg("self"),
            "Get the monitor count set for this peak")
       .def("setMonitorCount", &IPeak::setMonitorCount,
+           (arg("self"), arg("monitor_count")),
            "Set the monitor count for this peak")
-      .def("getH", &IPeak::getH, "Get the H index of the peak")
-      .def("getK", &IPeak::getK, "Get the K index of the peak")
-      .def("getL", &IPeak::getL, "Get the L index of the peak")
-      .def("getHKL", &IPeak::getHKL, "Get HKL as a V3D object")
+      .def("getH", &IPeak::getH, arg("self"), "Get the H index of the peak")
+      .def("getK", &IPeak::getK, arg("self"), "Get the K index of the peak")
+      .def("getL", &IPeak::getL, arg("self"), "Get the L index of the peak")
+      .def("getHKL", &IPeak::getHKL, arg("self"), "Get HKL as a V3D object")
       .def("setHKL", (void (IPeak::*)(double, double, double)) & IPeak::setHKL,
+           (arg("self"), arg("h"), arg("k"), arg("l")),
            "Set the HKL values of this peak")
-      .def("setH", &IPeak::setH, "Get the H index of the peak")
-      .def("setK", &IPeak::setK, "Get the K index of the peak")
-      .def("setL", &IPeak::setL, "Get the L index of the peak")
-      .def("getQLabFrame", &IPeak::getQLabFrame,
+      .def("setH", &IPeak::setH, (arg("self"), arg("h")),
+           "Get the H index of the peak")
+      .def("setK", &IPeak::setK, (arg("self"), arg("k")),
+           "Get the K index of the peak")
+      .def("setL", &IPeak::setL, (arg("self"), arg("l")),
+           "Get the L index of the peak")
+      .def("getQLabFrame", &IPeak::getQLabFrame, arg("self"),
            "Return the Q change (of the lattice, k_i - k_f) for this peak.\n"
            "The Q is in the Lab frame: the goniometer rotation was NOT taken "
            "out.\n"
            "Note: There is no 2*pi factor used, so \\|Q| = 1/wavelength.")
-      .def("findDetector", &IPeak::findDetector,
+      .def("findDetector", &IPeak::findDetector, arg("self"),
            "Using the instrument set in the peak, perform ray tracing to find "
            "the exact detector.")
-      .def("getQSampleFrame", &IPeak::getQSampleFrame,
+      .def("getQSampleFrame", &IPeak::getQSampleFrame, arg("self"),
            "Return the Q change (of the lattice, k_i - k_f) for this peak."
            "The Q is in the Sample frame: the goniometer rotation WAS taken "
            "out. ")
-      .def("setQLabFrame", setQLabFrame1, "Set the peak using the peak's "
-                                          "position in reciprocal space, in "
-                                          "the lab frame.")
+      .def("setQLabFrame", setQLabFrame1, (arg("self"), arg("qlab_frame")),
+           "Set the peak using the peak's "
+           "position in reciprocal space, in "
+           "the lab frame.")
       .def("setQLabFrame", setQLabFrame2,
+           (arg("self"), arg("qlab_frame"), arg("distance")),
            "Set the peak using the peak's position in reciprocal space, in the "
            "lab frame. Detector distance explicitly supplied.") // two argument
                                                                 // overload
-      .def("setQSampleFrame", setQSampleFrame1, "Set the peak using the peak's "
+      .def("setQSampleFrame", setQSampleFrame1,
+           (arg("self"), arg("qsample_frame")), "Set the peak using the peak's "
                                                 "position in reciprocal space, "
                                                 "in the sample frame.")
       .def("setQSampleFrame", setQSampleFrame2,
+           (arg("self"), arg("qsample_frame"), arg("distance")),
            "Set the peak using the peak's position in reciprocal space, in the "
            "sample frame. Detector distance explicitly supplied.")
       .def("setWavelength", &IPeak::setWavelength,
+           (arg("self"), arg("wave_length")),
            "Set the incident wavelength of the neutron. Calculates the energy "
            "from this assuming elastic scattering.")
-      .def("getWavelength", &IPeak::getWavelength,
+      .def("getWavelength", &IPeak::getWavelength, arg("self"),
            "Return the incident wavelength")
-      .def("getScattering", &IPeak::getScattering,
+      .def("getScattering", &IPeak::getScattering, arg("self"),
            "Calculate the scattering angle of the peak")
-      .def("getDSpacing", &IPeak::getDSpacing,
+      .def("getDSpacing", &IPeak::getDSpacing, arg("self"),
            "Calculate the d-spacing of the peak, in 1/Angstroms")
-      .def("getTOF", &IPeak::getTOF, "Calculate the time of flight (in "
-                                     "microseconds) of the neutrons for this "
-                                     "peak")
-      .def("getInitialEnergy", &IPeak::getInitialEnergy,
+      .def("getTOF", &IPeak::getTOF, arg("self"),
+           "Calculate the time of flight (in "
+           "microseconds) of the neutrons for this "
+           "peak")
+      .def("getInitialEnergy", &IPeak::getInitialEnergy, arg("self"),
            "Get the initial (incident) neutron energy")
-      .def("getFinalEnergy", &IPeak::getFinalEnergy,
+      .def("getFinalEnergy", &IPeak::getFinalEnergy, arg("self"),
            "Get the final neutron energy")
       .def("setInitialEnergy", &IPeak::setInitialEnergy,
+           (arg("self"), arg("initial_energy")),
            "Set the initial (incident) neutron energy")
       .def("setFinalEnergy", &IPeak::setFinalEnergy,
-           "Set the final neutron energy")
-      .def("getIntensity", &IPeak::getIntensity,
+           (arg("self"), arg("final_energy")), "Set the final neutron energy")
+      .def("getIntensity", &IPeak::getIntensity, arg("self"),
            "Return the integrated peak intensity")
-      .def("getSigmaIntensity", &IPeak::getSigmaIntensity,
+      .def("getSigmaIntensity", &IPeak::getSigmaIntensity, arg("self"),
            "Return the error on the integrated peak intensity")
       .def("setIntensity", &IPeak::setIntensity,
-           "Set the integrated peak intensity")
+           (arg("self"), arg("intensity")), "Set the integrated peak intensity")
       .def("setSigmaIntensity", &IPeak::setSigmaIntensity,
+           (arg("self"), arg("sigma_intensity")),
            "Set the error on the integrated peak intensity")
-      .def("getBinCount", &IPeak::getBinCount,
+      .def("getBinCount", &IPeak::getBinCount, arg("self"),
            "Return the # of counts in the bin at its peak")
-      .def("setBinCount", &IPeak::setBinCount,
+      .def("setBinCount", &IPeak::setBinCount, (arg("self"), arg("bin_count")),
            "Set the # of counts in the bin at its peak")
-      .def("getRow", &IPeak::getRow, "For RectangularDetectors only, returns "
-                                     "the row (y) of the pixel of the "
-                                     "detector.")
-      .def("getCol", &IPeak::getCol, "For RectangularDetectors only, returns "
-                                     "the column (x) of the pixel of the "
-                                     "detector.")
-      .def("getDetPos", &IPeak::getDetPos,
+      .def("getRow", &IPeak::getRow, arg("self"),
+           "For RectangularDetectors only, returns "
+           "the row (y) of the pixel of the "
+           "detector.")
+      .def("getCol", &IPeak::getCol, arg("self"),
+           "For RectangularDetectors only, returns "
+           "the column (x) of the pixel of the "
+           "detector.")
+      .def("getDetPos", &IPeak::getDetPos, arg("self"),
            "Return the detector position vector")
-      .def("getL1", &IPeak::getL1,
+      .def("getL1", &IPeak::getL1, arg("self"),
            "Return the L1 flight path length (source to sample), in meters. ")
-      .def("getL2", &IPeak::getL2,
+      .def("getL2", &IPeak::getL2, arg("self"),
            "Return the L2 flight path length (sample to detector), in meters.")
-      .def("getPeakShape", getPeakShape, "Get the peak shape");
+      .def("getPeakShape", getPeakShape, arg("self"), "Get the peak shape");
 }
diff --git a/Framework/PythonInterface/mantid/api/src/Exports/IPeakFunction.cpp b/Framework/PythonInterface/mantid/api/src/Exports/IPeakFunction.cpp
index f98e84fb8ec7b29d732c1f0626a252e2a9604872..3ac4f6332732a278c3b3ffaa9371cdb41d21edf9 100644
--- a/Framework/PythonInterface/mantid/api/src/Exports/IPeakFunction.cpp
+++ b/Framework/PythonInterface/mantid/api/src/Exports/IPeakFunction.cpp
@@ -14,11 +14,13 @@ void export_IPeakFunction() {
       .def("functionLocal",
            (object (IPeakFunctionAdapter::*)(const object &) const) &
                IPeakFunction::functionLocal,
+           (arg("self"), arg("vec_x")),
            "Calculate the values of the function for the given x values. The "
            "output should be stored in the out array")
-      .def("intensity", &IPeakFunction::intensity,
+      .def("intensity", &IPeakFunction::intensity, arg("self"),
            "Returns the integral intensity of the peak function.")
       .def("setIntensity", &IPeakFunction::setIntensity,
+           (arg("self"), arg("new_intensity")),
            "Changes the integral intensity of the peak function by setting its "
            "height.");
 }
diff --git a/Framework/PythonInterface/mantid/api/src/Exports/IPeaksWorkspace.cpp b/Framework/PythonInterface/mantid/api/src/Exports/IPeaksWorkspace.cpp
index cedd6732c37158cc1c9d6e074d721bd5203735f8..392d246c8fc1f0b33b63ddbeb98e747aabadd1de 100644
--- a/Framework/PythonInterface/mantid/api/src/Exports/IPeaksWorkspace.cpp
+++ b/Framework/PythonInterface/mantid/api/src/Exports/IPeaksWorkspace.cpp
@@ -40,29 +40,33 @@ void export_IPeaksWorkspace() {
   // IPeaksWorkspace class
   class_<IPeaksWorkspace, bases<ITableWorkspace, ExperimentInfo>,
          boost::noncopyable>("IPeaksWorkspace", no_init)
-      .def("getNumberPeaks", &IPeaksWorkspace::getNumberPeaks,
+      .def("getNumberPeaks", &IPeaksWorkspace::getNumberPeaks, arg("self"),
            "Returns the number of peaks within the workspace")
-      .def("addPeak", &IPeaksWorkspace::addPeak, "Add a peak to the workspace")
+      .def("addPeak", &IPeaksWorkspace::addPeak, (arg("self"), arg("peak")),
+           "Add a peak to the workspace")
       .def("removePeak", &IPeaksWorkspace::removePeak,
-           "Remove a peak from the workspace")
+           (arg("self"), arg("peak_num")), "Remove a peak from the workspace")
       .def("getPeak", &IPeaksWorkspace::getPeakPtr,
-           return_internal_reference<>(), "Returns a peak at the given index")
-      .def("createPeak", createPeakQLab,
+           (arg("self"), arg("peak_num")), return_internal_reference<>(),
+           "Returns a peak at the given index")
+      .def("createPeak", createPeakQLab, (arg("self"), arg("data")),
            return_value_policy<manage_new_object>(),
            "Create a Peak and return it from its coordinates in the QLab frame")
       .def("createPeak", createPeakQLabWithDistance,
+           (arg("self"), arg("data"), arg("detector_distance")),
            return_value_policy<manage_new_object>(),
            "Create a Peak and return it from its coordinates in the QLab "
            "frame, detector-sample distance explicitly provided")
-      .def("createPeakHKL", createPeakHKL,
+      .def("createPeakHKL", createPeakHKL, (arg("self"), arg("data")),
            return_value_policy<manage_new_object>(),
            "Create a Peak and return it from its coordinates in the HKL frame")
       .def("hasIntegratedPeaks", &IPeaksWorkspace::hasIntegratedPeaks,
-           "Determine if the peaks have been integrated")
-      .def("getRun", &IPeaksWorkspace::mutableRun,
+           arg("self"), "Determine if the peaks have been integrated")
+      .def("getRun", &IPeaksWorkspace::mutableRun, arg("self"),
            return_internal_reference<>(),
            "Return the Run object for this workspace")
       .def("peakInfoNumber", &IPeaksWorkspace::peakInfoNumber,
+           (arg("self"), arg("qlab_frame"), arg("lab_coordinate")),
            "Peak info number at Q vector for this workspace");
 
   //-------------------------------------------------------------------------------------------------
diff --git a/Framework/PythonInterface/mantid/api/src/Exports/ISpectrum.cpp b/Framework/PythonInterface/mantid/api/src/Exports/ISpectrum.cpp
index 1e27e7f78036b3a1a341ac103b9f1a0c747bec1f..3afbf36902caa3b24d84fadceb531e4cddd67ca3 100644
--- a/Framework/PythonInterface/mantid/api/src/Exports/ISpectrum.cpp
+++ b/Framework/PythonInterface/mantid/api/src/Exports/ISpectrum.cpp
@@ -12,21 +12,24 @@ void export_ISpectrum() {
 
   class_<ISpectrum, boost::noncopyable>("ISpectrum", no_init)
       .def("hasDetectorID", &ISpectrum::hasDetectorID,
+           (arg("self"), arg("det_id")),
            "Returns True if the spectrum contain the given spectrum number")
-      .def("getSpectrumNo", &ISpectrum::getSpectrumNo,
+      .def("getSpectrumNo", &ISpectrum::getSpectrumNo, arg("self"),
            "Returns the spectrum number of this spectrum")
       .def("getDetectorIDs", (const std::set<detid_t> &(ISpectrum::*)() const) &
                                  ISpectrum::getDetectorIDs,
-           return_value_policy<copy_const_reference>(),
+           arg("self"), return_value_policy<copy_const_reference>(),
            "Returns a list of detector IDs for this spectrum")
       .def("addDetectorID", &ISpectrum::addDetectorID,
-           "Add a detector ID to this spectrum")
+           (arg("self"), arg("det_id")), "Add a detector ID to this spectrum")
       .def("setDetectorID", &ISpectrum::setDetectorID,
-           "Set the given ID has the only")
-      .def("clearDetectorIDs", &ISpectrum::clearDetectorIDs,
+           (arg("self"), arg("det_id")), "Set the given ID has the only")
+      .def("clearDetectorIDs", &ISpectrum::clearDetectorIDs, arg("self"),
            "Clear the set of detector IDs")
       .def("setSpectrumNo", &ISpectrum::setSpectrumNo,
+           (arg("self"), arg("num")),
            "Set the spectrum number for this spectrum")
-      .def("hasDx", &ISpectrum::hasDx, "Returns True if the spectrum uses the "
-                                       "DX (X Error) array, else False.");
+      .def("hasDx", &ISpectrum::hasDx, arg("self"),
+           "Returns True if the spectrum uses the "
+           "DX (X Error) array, else False.");
 }
diff --git a/Framework/PythonInterface/mantid/api/src/Exports/ISplittersWorkspace.cpp b/Framework/PythonInterface/mantid/api/src/Exports/ISplittersWorkspace.cpp
index 55585283456e84176d06a1bc53b33b0f37a287a1..2ace16a65bb1aac998660d10ba45565d1a2e88c1 100644
--- a/Framework/PythonInterface/mantid/api/src/Exports/ISplittersWorkspace.cpp
+++ b/Framework/PythonInterface/mantid/api/src/Exports/ISplittersWorkspace.cpp
@@ -11,7 +11,7 @@ void export_ISplittersWorkspace() {
   class_<ISplittersWorkspace, boost::noncopyable>("ISplittersWorkspace",
                                                   no_init)
       .def("getNumberSplitters", &ISplittersWorkspace::getNumberSplitters,
-           "Returns the number of splitters within the workspace");
+           arg("self"), "Returns the number of splitters within the workspace");
 
   // register pointers
   RegisterWorkspacePtrToPython<ISplittersWorkspace>();
diff --git a/Framework/PythonInterface/mantid/api/src/Exports/ITableWorkspace.cpp b/Framework/PythonInterface/mantid/api/src/Exports/ITableWorkspace.cpp
index 8280d0fb2512acd690f46edcfa72fcfb2ede005a..853166f3094888aba80258dd77e561a5fbfe564b 100644
--- a/Framework/PythonInterface/mantid/api/src/Exports/ITableWorkspace.cpp
+++ b/Framework/PythonInterface/mantid/api/src/Exports/ITableWorkspace.cpp
@@ -338,51 +338,55 @@ void export_ITableWorkspace() {
 
   class_<ITableWorkspace, bases<Workspace>, boost::noncopyable>(
       "ITableWorkspace", iTableWorkspace_docstring.c_str(), no_init)
-      .def("addColumn", &addColumn, (arg("type"), arg("name")),
+      .def("addColumn", &addColumn, (arg("self"), arg("type"), arg("name")),
            "Add a named column with the given type. Recognized types are: "
            "int,float,double,bool,str,V3D,long64")
 
-      .def("removeColumn", &ITableWorkspace::removeColumn, (arg("name")),
-           "Remove the named column")
+      .def("removeColumn", &ITableWorkspace::removeColumn,
+           (arg("self"), arg("name")), "Remove the named column")
 
-      .def("columnCount", &ITableWorkspace::columnCount,
+      .def("columnCount", &ITableWorkspace::columnCount, arg("self"),
            "Returns the number of columns in the workspace")
 
-      .def("rowCount", &ITableWorkspace::rowCount,
+      .def("rowCount", &ITableWorkspace::rowCount, arg("self"),
            "Returns the number of rows within the workspace")
 
-      .def("setRowCount", &ITableWorkspace::setRowCount, (arg("count")),
+      .def("setRowCount", &ITableWorkspace::setRowCount,
+           (arg("self"), arg("count")),
            "Resize the table to contain count rows")
 
-      .def("__len__", &ITableWorkspace::rowCount,
+      .def("__len__", &ITableWorkspace::rowCount, arg("self"),
            "Returns the number of rows within the workspace")
 
-      .def("getColumnNames", &ITableWorkspace::getColumnNames,
+      .def("getColumnNames", &ITableWorkspace::getColumnNames, arg("self"),
            boost::python::return_value_policy<VectorToNumpy>(),
            "Return a list of the column names")
 
-      .def("keys", &ITableWorkspace::getColumnNames,
+      .def("keys", &ITableWorkspace::getColumnNames, arg("self"),
            boost::python::return_value_policy<VectorToNumpy>(),
            "Return a list of the column names")
 
-      .def("column", &column,
+      .def("column", &column, (arg("self"), arg("column")),
            "Return all values of a specific column as a list")
 
-      .def("row", &row, "Return all values of a specific row as a dict")
+      .def("row", &row, (arg("self"), arg("row")),
+           "Return all values of a specific row as a dict")
 
-      .def("addRow", &addRowFromDict,
+      .def("addRow", &addRowFromDict, (arg("self"), arg("row_items_dict")),
            "Appends a row with the values from the dictionary")
 
-      .def("addRow", &addRowFromList,
+      .def("addRow", &addRowFromList, (arg("self"), arg("row_items_list")),
            "Appends a row with the values from the given list. "
            "It it assumed that the items are in the correct order for the "
            "defined columns")
 
-      .def("cell", &cell, "Return the given cell. If the first argument is a "
-                          "number then it is interpreted as a row otherwise it "
-                          "is interpreted as a column name")
+      .def("cell", &cell, (arg("self"), arg("value"), arg("row_or_column")),
+           "Return the given cell. If the first argument is a "
+           "number then it is interpreted as a row otherwise it "
+           "is interpreted as a column name")
 
-      .def("setCell", &setCell,
+      .def("setCell", &setCell, (arg("self"), arg("row_or_column"),
+                                 arg("column_or_row"), arg("value")),
            "Sets the value of a given cell. If the first argument is a "
            "number then it is interpreted as a row otherwise it is interpreted "
            "as a column name");
diff --git a/Framework/PythonInterface/mantid/api/src/Exports/IWorkspaceProperty.cpp b/Framework/PythonInterface/mantid/api/src/Exports/IWorkspaceProperty.cpp
index 525d92c8448be014be0f277607eff7b2593beeb8..8e50a5b573226ff8e8a6707bca688bf8555f6c7b 100644
--- a/Framework/PythonInterface/mantid/api/src/Exports/IWorkspaceProperty.cpp
+++ b/Framework/PythonInterface/mantid/api/src/Exports/IWorkspaceProperty.cpp
@@ -6,8 +6,8 @@ void export_IWorkspaceProperty() {
   using Mantid::API::IWorkspaceProperty;
 
   class_<IWorkspaceProperty, boost::noncopyable>("IWorkspaceProperty", no_init)
-      .def("isOptional", &IWorkspaceProperty::isOptional,
+      .def("isOptional", &IWorkspaceProperty::isOptional, arg("self"),
            "Is the input workspace property optional")
-      .def("isLocking", &IWorkspaceProperty::isLocking,
+      .def("isLocking", &IWorkspaceProperty::isLocking, arg("self"),
            "Will the workspace be locked when starting an algorithm");
 }
diff --git a/Framework/PythonInterface/mantid/api/src/Exports/Jacobian.cpp b/Framework/PythonInterface/mantid/api/src/Exports/Jacobian.cpp
index 732cae6fca5c6feaec3b64c6d969d5ffbaa4067f..e9d0eb07cfbfb1e91c8151f51e009ff885a90daf 100644
--- a/Framework/PythonInterface/mantid/api/src/Exports/Jacobian.cpp
+++ b/Framework/PythonInterface/mantid/api/src/Exports/Jacobian.cpp
@@ -9,11 +9,12 @@ void export_Jacobian() {
   register_ptr_to_python<Jacobian *>();
 
   class_<Jacobian, boost::noncopyable>("Jacobian", no_init)
-      .def("set", &Jacobian::set, (arg("iy"), arg("ip"), arg("value")),
+      .def("set", &Jacobian::set,
+           (arg("self"), arg("iy"), arg("ip"), arg("value")),
            "Set an element of the Jacobian matrix where iy=index of data "
            "point, ip=index of parameter.")
 
-      .def("get", &Jacobian::get, (arg("iy"), arg("ip")),
+      .def("get", &Jacobian::get, (arg("self"), arg("iy"), arg("ip")),
            "Return the given element of the Jacobian matrix where iy=index of "
            "data point, ip=index of parameter.");
 }
diff --git a/Framework/PythonInterface/mantid/api/src/Exports/MDGeometry.cpp b/Framework/PythonInterface/mantid/api/src/Exports/MDGeometry.cpp
index 2c62473353409541efc3e8d1a815ac758c4ad425..c739bc51666f77b172acb054c3266249488ec7d7 100644
--- a/Framework/PythonInterface/mantid/api/src/Exports/MDGeometry.cpp
+++ b/Framework/PythonInterface/mantid/api/src/Exports/MDGeometry.cpp
@@ -35,88 +35,94 @@ boost::python::list getNonIntegratedDimensionsAsPyList(const MDGeometry &self) {
 
 void export_MDGeometry() {
   class_<MDGeometry, boost::noncopyable>("MDGeometry", no_init)
-      .def("getNumDims", &MDGeometry::getNumDims,
+      .def("getNumDims", &MDGeometry::getNumDims, arg("self"),
            "Returns the number of dimensions present")
 
-      .def("getDimension", &MDGeometry::getDimension, (args("index")),
+      .def("getDimension", &MDGeometry::getDimension,
+           (arg("self"), arg("index")),
            return_value_policy<RemoveConstSharedPtr>(),
            "Returns the description of the dimension at the given index "
            "(starts from 0). Raises RuntimeError if index is out of range.")
 
-      .def("getDimensionWithId", &MDGeometry::getDimensionWithId, (args("id")),
+      .def("getDimensionWithId", &MDGeometry::getDimensionWithId,
+           (arg("self"), arg("id")),
            return_value_policy<RemoveConstSharedPtr>(),
            "Returns the description of the dimension with the given id string. "
            "Raises ValueError if the string is not a known id.")
 
       .def("getDimensionIndexByName", &MDGeometry::getDimensionIndexByName,
-           (args("name")), "Returns the index of the dimension with the given "
-                           "name. Raises RuntimeError if the name does not "
-                           "exist.")
+           (arg("self"), arg("name")),
+           "Returns the index of the dimension with the given "
+           "name. Raises RuntimeError if the name does not "
+           "exist.")
 
       .def("getDimensionIndexById", &MDGeometry::getDimensionIndexById,
-           (args("id")), "Returns the index of the dimension with the given "
-                         "ID. Raises RuntimeError if the name does not exist.")
+           (arg("self"), arg("id")),
+           "Returns the index of the dimension with the given "
+           "ID. Raises RuntimeError if the name does not exist.")
 
       .def("getNonIntegratedDimensions", &getNonIntegratedDimensionsAsPyList,
+           arg("self"),
            "Returns the description objects of the non-integrated dimension as "
            "a python list of IMDDimension.")
 
-      .def("estimateResolution", &MDGeometry::estimateResolution,
+      .def("estimateResolution", &MDGeometry::estimateResolution, arg("self"),
            return_value_policy<VectorToNumpy>(),
            "Returns a numpy array containing the width of the smallest bin in "
            "each dimension")
 
-      .def("getXDimension", &MDGeometry::getXDimension,
+      .def("getXDimension", &MDGeometry::getXDimension, arg("self"),
            return_value_policy<RemoveConstSharedPtr>(),
            "Returns the dimension description mapped to X")
 
-      .def("getYDimension", &MDGeometry::getYDimension,
+      .def("getYDimension", &MDGeometry::getYDimension, arg("self"),
            return_value_policy<RemoveConstSharedPtr>(),
            "Returns the dimension description mapped to Y")
 
-      .def("getZDimension", &MDGeometry::getZDimension,
+      .def("getZDimension", &MDGeometry::getZDimension, arg("self"),
            return_value_policy<RemoveConstSharedPtr>(),
            "Returns the dimension description mapped to Z")
 
-      .def("getTDimension", &MDGeometry::getTDimension,
+      .def("getTDimension", &MDGeometry::getTDimension, arg("self"),
            return_value_policy<RemoveConstSharedPtr>(),
            "Returns the dimension description mapped to time")
 
-      .def("getGeometryXML", &MDGeometry::getGeometryXML,
+      .def("getGeometryXML", &MDGeometry::getGeometryXML, arg("self"),
            "Returns an XML representation, as a string, of the geometry of the "
            "workspace")
 
       .def("getBasisVector",
            (const Mantid::Kernel::VMD &(MDGeometry::*)(size_t) const) &
                MDGeometry::getBasisVector,
-           (args("index")), return_value_policy<copy_const_reference>(),
+           (arg("self"), arg("index")),
+           return_value_policy<copy_const_reference>(),
            "Returns a VMD object defining the basis vector for the specified "
            "dimension")
 
       .def("hasOriginalWorkspace", &MDGeometry::hasOriginalWorkspace,
-           (args("index")),
+           (arg("self"), arg("index")),
            "Returns True if there is a source workspace at the given index")
 
       .def("numOriginalWorkspaces", &MDGeometry::numOriginalWorkspaces,
-           "Returns the number of source workspaces attached")
+           arg("self"), "Returns the number of source workspaces attached")
 
       .def("getOriginalWorkspace", &MDGeometry::getOriginalWorkspace,
-           (args("index")),
+           (arg("self"), arg("index")),
            "Returns the source workspace attached at the given index")
 
       .def("getOrigin", (const Mantid::Kernel::VMD &(MDGeometry::*)() const) &
                             MDGeometry::getOrigin,
-           return_value_policy<copy_const_reference>(),
+           arg("self"), return_value_policy<copy_const_reference>(),
            "Returns the vector of the origin (in the original workspace) that "
            "corresponds to 0,0,0... in this workspace")
 
       .def("getNumberTransformsFromOriginal",
-           &MDGeometry::getNumberTransformsFromOriginal,
+           &MDGeometry::getNumberTransformsFromOriginal, arg("self"),
            "Returns the number of transformations from original workspace "
            "coordinate systems")
 
       .def("getNumberTransformsToOriginal",
-           &MDGeometry::getNumberTransformsToOriginal,
+           &MDGeometry::getNumberTransformsToOriginal, arg("self"),
            "Returns the number of transformations to original workspace "
            "coordinate systems")
 
diff --git a/Framework/PythonInterface/mantid/api/src/Exports/MatrixWorkspace.cpp b/Framework/PythonInterface/mantid/api/src/Exports/MatrixWorkspace.cpp
index 0047015ad1c0e5fb397956107fe4ec08d21411c4..fbb754ab25819191b32321b6a3133e9441408f20 100644
--- a/Framework/PythonInterface/mantid/api/src/Exports/MatrixWorkspace.cpp
+++ b/Framework/PythonInterface/mantid/api/src/Exports/MatrixWorkspace.cpp
@@ -34,10 +34,17 @@ typedef return_value_policy<VectorRefToNumpy<WrapReadWrite>>
     return_readwrite_numpy;
 
 //------------------------------- Overload macros ---------------------------
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunknown-pragmas"
+#pragma clang diagnostic ignored "-Wunused-local-typedef"
+#endif
 // Overloads for binIndexOf function which has 1 optional argument
 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(MatrixWorkspace_binIndexOfOverloads,
                                        MatrixWorkspace::binIndexOf, 1, 2)
-
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
 /**
  * Set the values from an python array-style object into the given spectrum in
  * the workspace
@@ -150,10 +157,10 @@ void export_MatrixWorkspace() {
          boost::noncopyable>("MatrixWorkspace", no_init)
       //--------------------------------------- Meta information
       //-----------------------------------------------------------------------
-      .def("blocksize", &MatrixWorkspace::blocksize, args("self"),
+      .def("blocksize", &MatrixWorkspace::blocksize, arg("self"),
            "Returns size of the Y data array")
       .def("getNumberHistograms", &MatrixWorkspace::getNumberHistograms,
-           args("self"), "Returns the number of spectra in the workspace")
+           arg("self"), "Returns the number of spectra in the workspace")
       .def("binIndexOf", &MatrixWorkspace::binIndexOf,
            MatrixWorkspace_binIndexOfOverloads(
                (arg("self"), arg("xvalue"), arg("workspaceIndex")),
@@ -161,73 +168,79 @@ void export_MatrixWorkspace() {
                "workspace_index is optional [default=0]"))
       .def("detectorTwoTheta",
            (getDetectorSignature)&MatrixWorkspace::detectorTwoTheta,
-           args("self", "det"),
+           (arg("self"), arg("det")),
            "Returns the two theta value for a given detector")
       .def("detectorSignedTwoTheta",
            (getDetectorSignature)&MatrixWorkspace::detectorSignedTwoTheta,
-           args("self", "det"),
+           (arg("self"), arg("det")),
            "Returns the signed two theta value for given detector")
       .def("getSpectrum", (ISpectrum * (MatrixWorkspace::*)(const size_t)) &
                               MatrixWorkspace::getSpectrum,
-           return_internal_reference<>(), args("self", "workspaceIndex"),
+           (arg("self"), arg("workspaceIndex")), return_internal_reference<>(),
            "Return the spectra at the given workspace index.")
       .def("getIndexFromSpectrumNumber",
-           &MatrixWorkspace::getIndexFromSpectrumNumber, args("self"),
+           &MatrixWorkspace::getIndexFromSpectrumNumber,
+           (arg("self"), arg("spec_no")),
            "Returns workspace index correspondent to the given spectrum "
            "number. Throws if no such spectrum is present in the workspace")
       .def("getDetector", &MatrixWorkspace::getDetector,
            return_value_policy<RemoveConstSharedPtr>(),
-           args("self", "workspaceIndex"), "Return the Detector or "
-                                           "DetectorGroup that is linked to "
-                                           "the given workspace index")
-      .def("getRun", &MatrixWorkspace::mutableRun,
-           return_internal_reference<>(), args("self"),
+           (arg("self"), arg("workspaceIndex")),
+           "Return the Detector or "
+           "DetectorGroup that is linked to "
+           "the given workspace index")
+      .def("getRun", &MatrixWorkspace::mutableRun, arg("self"),
+           return_internal_reference<>(),
            "Return the Run object for this workspace")
-      .def("axes", &MatrixWorkspace::axes, args("self"),
+      .def("axes", &MatrixWorkspace::axes, arg("self"),
            "Returns the number of axes attached to the workspace")
-      .def("getAxis", &MatrixWorkspace::getAxis, return_internal_reference<>(),
-           args("self", "axis_index"))
-      .def("isHistogramData", &MatrixWorkspace::isHistogramData, args("self"),
+      .def("getAxis", &MatrixWorkspace::getAxis,
+           (arg("self"), arg("axis_index")), return_internal_reference<>(),
+           "Get a pointer to a workspace axis")
+      .def("isHistogramData", &MatrixWorkspace::isHistogramData, arg("self"),
            "Returns True if this is considered to be binned data.")
       .def("isDistribution", (const bool &(MatrixWorkspace::*)() const) &
                                  MatrixWorkspace::isDistribution,
-           return_value_policy<copy_const_reference>(), args("self"),
+           arg("self"), return_value_policy<copy_const_reference>(),
            "Returns the status of the distribution flag")
-      .def("YUnit", &MatrixWorkspace::YUnit, args("self"),
+      .def("YUnit", &MatrixWorkspace::YUnit, arg("self"),
            "Returns the current Y unit for the data (Y axis) in the workspace")
-      .def("YUnitLabel", &MatrixWorkspace::YUnitLabel, args("self"),
+      .def("YUnitLabel", &MatrixWorkspace::YUnitLabel, arg("self"),
            "Returns the caption for the Y axis")
 
       // Deprecated
-      .def("getNumberBins", &getNumberBinsDeprecated, args("self"),
+      .def("getNumberBins", &getNumberBinsDeprecated, arg("self"),
            "Returns size of the Y data array (deprecated, use blocksize "
            "instead)")
-      .def("getSampleDetails", &getSampleDetailsDeprecated,
-           return_internal_reference<>(), args("self"),
+      .def("getSampleDetails", &getSampleDetailsDeprecated, arg("self"),
+           return_internal_reference<>(),
            "Return the Run object for this workspace (deprecated, use getRun "
            "instead)")
 
       //--------------------------------------- Setters
       //------------------------------------
       .def("setYUnitLabel", &MatrixWorkspace::setYUnitLabel,
-           args("self", "newLabel"),
+           (arg("self"), arg("newLabel")),
            "Sets a new caption for the data (Y axis) in the workspace")
-      .def("setYUnit", &MatrixWorkspace::setYUnit, args("self", "newUnit"),
+      .def("setYUnit", &MatrixWorkspace::setYUnit,
+           (arg("self"), arg("newUnit")),
            "Sets a new unit for the data (Y axis) in the workspace")
       .def("setDistribution", (bool &(MatrixWorkspace::*)(const bool)) &
                                   MatrixWorkspace::isDistribution,
-           return_value_policy<return_by_value>(), args("self", "newVal"),
+           (arg("self"), arg("newVal")), return_value_policy<return_by_value>(),
            "Set distribution flag. If True the workspace has been divided by "
            "the bin-width.")
       .def("replaceAxis", &MatrixWorkspace::replaceAxis,
-           args("self", "axisIndex", "newAxis"))
+           (arg("self"), arg("axisIndex"), arg("newAxis")),
+           "Replaces one of the workspace's axes with the new one provided.")
 
       //--------------------------------------- Read spectrum data
       //-------------------------
-      .def("readX", &MatrixWorkspace::readX, return_readonly_numpy(),
-           args("self", "workspaceIndex"), "Creates a read-only numpy wrapper "
-                                           "around the original X data at the "
-                                           "given index")
+      .def("readX", &MatrixWorkspace::readX,
+           (arg("self"), arg("workspaceIndex")), return_readonly_numpy(),
+           "Creates a read-only numpy wrapper "
+           "around the original X data at the "
+           "given index")
       .def("readY", &MatrixWorkspace::readY, return_readonly_numpy(),
            args("self", "workspaceIndex"), "Creates a read-only numpy wrapper "
                                            "around the original Y data at the "
diff --git a/Framework/PythonInterface/mantid/api/src/Exports/MultipleExperimentInfos.cpp b/Framework/PythonInterface/mantid/api/src/Exports/MultipleExperimentInfos.cpp
index e1ee933671887581dcfb37ed06065f2045ba4643..1635dd5d4cc22a15a23e6c5c364668734bbd86f4 100644
--- a/Framework/PythonInterface/mantid/api/src/Exports/MultipleExperimentInfos.cpp
+++ b/Framework/PythonInterface/mantid/api/src/Exports/MultipleExperimentInfos.cpp
@@ -12,8 +12,9 @@ void export_MultipleExperimentInfos() {
       .def("getExperimentInfo",
            (ExperimentInfo_sptr (MultipleExperimentInfos::*)(const uint16_t)) &
                MultipleExperimentInfos::getExperimentInfo,
+           (arg("self"), arg("run_index")),
            "Return the experiment info at the given index.")
       .def("getNumExperimentInfo",
-           &MultipleExperimentInfos::getNumExperimentInfo,
+           &MultipleExperimentInfos::getNumExperimentInfo, arg("self"),
            "Return the number of experiment info objects,");
 }
diff --git a/Framework/PythonInterface/mantid/api/src/Exports/Projection.cpp b/Framework/PythonInterface/mantid/api/src/Exports/Projection.cpp
index 080bed5db9c13e75709f93e262432f96f35f05b7..0973bf8190b35b423e6065bea29cadcf4c3531e4 100644
--- a/Framework/PythonInterface/mantid/api/src/Exports/Projection.cpp
+++ b/Framework/PythonInterface/mantid/api/src/Exports/Projection.cpp
@@ -114,21 +114,23 @@ void export_Projection() {
            "of u and v.")
       .def("__init__", make_constructor(&projCtor3),
            "Constructs a 3 dimensional projection")
-      .def("getOffset", &Projection::getOffset,
+      .def("getOffset", &Projection::getOffset, (arg("self"), arg("nd")),
            "Returns the offset for the given dimension", args("dimension"))
-      .def("getAxis", &Projection::getAxis,
+      .def("getAxis", &Projection::getAxis, (arg("self"), arg("nd")),
            "Returns the axis for the given dimension", args("dimension"))
-      .def("getType", &getUnit, "Returns the unit for the given dimension",
-           args("dimension"))
+      .def("getType", &getUnit, (arg("self"), arg("dimension")),
+           "Returns the unit for the given dimension")
       .def("setOffset", &Projection::setOffset,
+           (arg("self"), arg("nd"), arg("offset")),
            "Sets the offset for the given dimension",
            args("dimension", "offset"))
       .def("setAxis", &Projection::setAxis,
-           "Sets the axis for the given dimension", args("dimension", "axis"))
-      .def("setAxis", &projSetAxis, "Sets the axis for the given dimension",
-           args("dimension", "axis"))
-      .def("setType", &setUnit, "Sets the unit for the given dimension",
-           args("dimension", "unit"))
+           (arg("self"), arg("dimension"), arg("axis")),
+           "Sets the axis for the given dimension")
+      .def("setAxis", &projSetAxis, (arg("self"), arg("nd"), arg("data")),
+           "Sets the axis for the given dimension")
+      .def("setType", &setUnit, (arg("self"), arg("dimension"), arg("unit")),
+           "Sets the unit for the given dimension")
       .add_property(
            "u", make_function(&Projection::U, return_internal_reference<>(),
                               boost::mpl::vector2<V3D &, Projection &>()),
diff --git a/Framework/PythonInterface/mantid/api/src/Exports/Run.cpp b/Framework/PythonInterface/mantid/api/src/Exports/Run.cpp
index 8f8548bbcc57f1bd0fc0ca70815263ec4b454a43..bc950c6e2ff6754c95539fd6a278f394a995040d 100644
--- a/Framework/PythonInterface/mantid/api/src/Exports/Run.cpp
+++ b/Framework/PythonInterface/mantid/api/src/Exports/Run.cpp
@@ -116,67 +116,77 @@ void export_Run() {
 
   // Run class
   class_<Run, boost::noncopyable>("Run", no_init)
-      .def("getProtonCharge", &Run::getProtonCharge,
+      .def("getProtonCharge", &Run::getProtonCharge, arg("self"),
            "Return the total good proton charge for the run")
 
-      .def("integrateProtonCharge", &Run::integrateProtonCharge,
+      .def("integrateProtonCharge", &Run::integrateProtonCharge, arg("self"),
            "Return the total good proton charge for the run")
 
-      .def("hasProperty", &Run::hasProperty,
+      .def("hasProperty", &Run::hasProperty, (arg("self"), arg("name")),
            "Returns True if the given log value is contained within the run")
 
-      .def("getProperty", &Run::getProperty,
+      .def("getProperty", &Run::getProperty, (arg("self"), arg("name")),
            return_value_policy<return_by_value>(), "Returns the named property "
                                                    "(log value). Use '.value' "
                                                    "to return the value.")
 
-      .def("getProperties", &Run::getProperties, return_internal_reference<>(),
+      .def("getProperties", &Run::getProperties, arg("self"),
+           return_internal_reference<>(),
            "Return the list of run properties managed by this object.")
 
       .def("getLogData",
            (Property * (Run::*)(const std::string &) const) & Run::getLogData,
-           return_value_policy<return_by_value>(),
+           (arg("self"), arg("name")), return_value_policy<return_by_value>(),
            "Returns the named log. Use '.value' to return the value. The same "
            "as getProperty.")
 
       .def("getLogData",
            (const std::vector<Property *> &(Run::*)() const) & Run::getLogData,
-           return_internal_reference<>(),
+           arg("self"), return_internal_reference<>(),
            "Return the list of logs for this run. The same as getProperties.")
 
       .def("getGoniometer",
            (const Mantid::Geometry::Goniometer &(Run::*)() const) &
                Run::getGoniometer,
-           return_value_policy<reference_existing_object>(),
+           arg("self"), return_value_policy<reference_existing_object>(),
            "Get the oriented lattice for this sample")
 
-      .def("addProperty", &addProperty, "Adds a property with the given name "
-                                        "and value. If replace=True then an "
-                                        "existing property is overwritten")
+      .def("addProperty", &addProperty,
+           (arg("self"), arg("name"), arg("value"), arg("replace")),
+           "Adds a property with the given name "
+           "and value. If replace=True then an "
+           "existing property is overwritten")
 
       .def("addProperty", &addPropertyWithUnit,
+           (arg("self"), arg("name"), arg("value"), arg("units"),
+            arg("replace")),
            "Adds a property with the given name, value and unit. If "
            "replace=True then an existing property is overwritten")
 
       .def("setStartAndEndTime", &Run::setStartAndEndTime,
+           (arg("self"), arg("start"), arg("end")),
            "Set the start and end time of the run")
 
-      .def("startTime", &Run::startTime,
+      .def("startTime", &Run::startTime, arg("self"),
            "Return the total starting time of the run.")
 
-      .def("endTime", &Run::endTime, "Return the total ending time of the run.")
+      .def("endTime", &Run::endTime, arg("self"),
+           "Return the total ending time of the run.")
 
       //--------------------------- Dictionary
       // access----------------------------
-      .def("get", &getWithDefault, "Returns the value pointed to by the key or "
-                                   "None if it does not exist")
-      .def("get", &get,
+      .def("get", &getWithDefault, (arg("self"), arg("key"), arg("default")),
+           "Returns the value pointed to by the key or "
+           "None if it does not exist")
+      .def("get", &get, (arg("self"), arg("key")),
            "Returns the value pointed to by the key or the default value given")
-      .def("keys", &keys, "Returns the names of the properties as list")
-      .def("__contains__", &Run::hasProperty)
-      .def("__getitem__", &Run::getProperty,
+      .def("keys", &keys, arg("self"),
+           "Returns the names of the properties as list")
+      .def("__contains__", &Run::hasProperty, (arg("self"), arg("name")))
+      .def("__getitem__", &Run::getProperty, (arg("self"), arg("name")),
            return_value_policy<return_by_value>())
-      .def("__setitem__", &addOrReplaceProperty)
+      .def("__setitem__", &addOrReplaceProperty,
+           (arg("self"), arg("name"), arg("value")))
 
       ;
 }
diff --git a/Framework/PythonInterface/mantid/api/src/Exports/Sample.cpp b/Framework/PythonInterface/mantid/api/src/Exports/Sample.cpp
index cbf45afe13a4c246126189710d15d03a218f85e2..baa9826478dbad9a4c9ee7b2065d468a7cfedf01 100644
--- a/Framework/PythonInterface/mantid/api/src/Exports/Sample.cpp
+++ b/Framework/PythonInterface/mantid/api/src/Exports/Sample.cpp
@@ -16,35 +16,41 @@ void export_Sample() {
 
   class_<Sample, boost::noncopyable>("Sample", no_init)
       .def("getName", &Sample::getName,
-           return_value_policy<copy_const_reference>(),
+           return_value_policy<copy_const_reference>(), arg("self"),
            "Returns the string name of the sample")
       .def("getOrientedLattice", (const OrientedLattice &(Sample::*)() const) &
                                      Sample::getOrientedLattice,
-           return_value_policy<reference_existing_object>(),
+           arg("self"), return_value_policy<reference_existing_object>(),
            "Get the oriented lattice for this sample")
-      .def("hasOrientedLattice", &Sample::hasOrientedLattice,
+      .def("hasOrientedLattice", &Sample::hasOrientedLattice, arg("self"),
            "Returns True if this sample has an oriented lattice, false "
            "otherwise")
-      .def("size", &Sample::size,
+      .def("size", &Sample::size, arg("self"),
            "Return the number of samples contained within this sample")
       // Required for ISIS SANS reduction until the full sample geometry is
       // defined on loading
-      .def("getGeometryFlag", &Sample::getGeometryFlag,
+      .def("getGeometryFlag", &Sample::getGeometryFlag, arg("self"),
            "Return the geometry flag.")
-      .def("getThickness", &Sample::getThickness, "Return the thickness in mm")
-      .def("getHeight", &Sample::getHeight, "Return the height in mm")
-      .def("getWidth", &Sample::getWidth, "Return the width in mm")
+      .def("getThickness", &Sample::getThickness, arg("self"),
+           "Return the thickness in mm")
+      .def("getHeight", &Sample::getHeight, arg("self"),
+           "Return the height in mm")
+      .def("getWidth", &Sample::getWidth, arg("self"), "Return the width in mm")
       .def("getMaterial",
            (const Material &(Sample::*)() const)(&Sample::getMaterial),
-           return_value_policy<reference_existing_object>(),
+           arg("self"), return_value_policy<reference_existing_object>(),
            "The material the sample is composed of")
       .def("setGeometryFlag", &Sample::setGeometryFlag,
-           "Set the geometry flag.")
-      .def("setThickness", &Sample::setThickness, "Set the thickness in mm.")
-      .def("setHeight", &Sample::setHeight, "Set the height in mm.")
-      .def("setWidth", &Sample::setWidth, "Set the width in mm.")
+           (arg("self"), arg("geom_id")), "Set the geometry flag.")
+      .def("setThickness", &Sample::setThickness, (arg("self"), arg("thick")),
+           "Set the thickness in mm.")
+      .def("setHeight", &Sample::setHeight, (arg("self"), arg("height")),
+           "Set the height in mm.")
+      .def("setWidth", &Sample::setWidth, (arg("self"), arg("width")),
+           "Set the width in mm.")
       // -------------------------Operators
       // -------------------------------------
-      .def("__len__", &Sample::size)
+      .def("__len__", &Sample::size, arg("self"),
+           "Gets the number of samples in this collection")
       .def("__getitem__", &Sample::operator[], return_internal_reference<>());
 }
diff --git a/Framework/PythonInterface/mantid/api/src/Exports/ScriptRepository.cpp b/Framework/PythonInterface/mantid/api/src/Exports/ScriptRepository.cpp
index 91979d2a4981d49db39845bc3dc316c1bd95b463..2422b6c7a81b3dace66d938011db87ac2ac29173 100644
--- a/Framework/PythonInterface/mantid/api/src/Exports/ScriptRepository.cpp
+++ b/Framework/PythonInterface/mantid/api/src/Exports/ScriptRepository.cpp
@@ -196,11 +196,15 @@ Arguments:\n\
   ///@todo better description
   class_<ScriptRepository, boost::noncopyable>("ScriptRepository", repo_desc,
                                                no_init)
-      .def("install", &ScriptRepository::install, install_desc)
-      .def("listFiles", &getListFiles, list_files_desc)
-      .def("fileInfo", &getInfo, file_info_desc)
-      .def("description", &getDescription, file_description_desc)
-      .def("fileStatus", &getStatus, file_status_desc)
-      .def("download", &ScriptRepository::download, download_desc)
-      .def("update", &ScriptRepository::check4Update, update_desc);
+      .def("install", &ScriptRepository::install,
+           (arg("self"), arg("local_path")), install_desc)
+      .def("listFiles", &getListFiles, arg("self"), list_files_desc)
+      .def("fileInfo", &getInfo, (arg("self"), arg("path")), file_info_desc)
+      .def("description", &getDescription, (arg("self"), arg("path")),
+           file_description_desc)
+      .def("fileStatus", &getStatus, (arg("self"), arg("path")),
+           file_status_desc)
+      .def("download", &ScriptRepository::download,
+           (arg("self"), arg("file_path")), download_desc)
+      .def("update", &ScriptRepository::check4Update, arg("self"), update_desc);
 }
diff --git a/Framework/PythonInterface/mantid/api/src/Exports/ScriptRepositoryFactory.cpp b/Framework/PythonInterface/mantid/api/src/Exports/ScriptRepositoryFactory.cpp
index 0f572e8bf639040dd0f7d8e74c9347f270ee083d..91eef3e80418280995943a92161a2537dded62a9 100644
--- a/Framework/PythonInterface/mantid/api/src/Exports/ScriptRepositoryFactory.cpp
+++ b/Framework/PythonInterface/mantid/api/src/Exports/ScriptRepositoryFactory.cpp
@@ -19,6 +19,7 @@ void export_ScriptRepositoryFactory() {
   class_<ScriptRepositoryFactoryImpl, boost::noncopyable>(
       "ScriptRepositoryFactory", no_init)
       .def("create", &ScriptRepositoryFactoryImpl::create,
+           (arg("self"), arg("class_name")),
            "Return a pointer to the ScriptRepository object")
       .def("Instance", &ScriptRepositoryFactory::Instance,
            return_value_policy<reference_existing_object>(),
diff --git a/Framework/PythonInterface/mantid/api/src/Exports/Workspace.cpp b/Framework/PythonInterface/mantid/api/src/Exports/Workspace.cpp
index 04e52cc2d1278d5a60d6fb28ab6712f6b9f52424..a399b9ca775cb9cdad79cff7a4b904cef7f48692 100644
--- a/Framework/PythonInterface/mantid/api/src/Exports/Workspace.cpp
+++ b/Framework/PythonInterface/mantid/api/src/Exports/Workspace.cpp
@@ -14,32 +14,43 @@ using namespace boost::python;
 
 namespace {
 ///@cond
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunknown-pragmas"
+#pragma clang diagnostic ignored "-Wunused-local-typedef"
+#endif
 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(Workspace_isDirtyOverloads,
                                        Workspace::isDirty, 0, 1)
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
 ///@endcond
 }
 
 void export_Workspace() {
   class_<Workspace, bases<DataItem>, boost::noncopyable>("Workspace", no_init)
       .def("getName", &Workspace::getName,
-           return_value_policy<copy_const_reference>(), args("self"),
+           return_value_policy<copy_const_reference>(), arg("self"),
            "Returns the name of the workspace. This could be an empty string")
-      .def("getTitle", &Workspace::getTitle, args("self"),
+      .def("getTitle", &Workspace::getTitle, arg("self"),
            "Returns the title of the workspace")
-      .def("setTitle", &Workspace::setTitle, args("self", "title"))
-      .def("getComment", &Workspace::getComment,
+      .def("setTitle", &Workspace::setTitle, (arg("self"), arg("title")),
+           "Set the title of the workspace")
+      .def("getComment", &Workspace::getComment, arg("self"),
            return_value_policy<copy_const_reference>(),
            "Returns the comment field on the workspace")
-      .def("setComment", &Workspace::setComment, args("self", "comment"))
+      .def("setComment", &Workspace::setComment, (arg("self"), arg("comment")),
+           "Set the comment field of the workspace")
       .def("isDirty", &Workspace::isDirty,
-           Workspace_isDirtyOverloads(arg("n"), "True if the workspace has run "
-                                                "more than n algorithms "
-                                                "(Default=1)"))
-      .def("getMemorySize", &Workspace::getMemorySize, args("self"),
+           Workspace_isDirtyOverloads((arg("self"), arg("n")),
+                                      "True if the workspace has run "
+                                      "more than n algorithms "
+                                      "(Default=1)"))
+      .def("getMemorySize", &Workspace::getMemorySize, arg("self"),
            "Returns the memory footprint of the workspace in KB")
       .def("getHistory", (const WorkspaceHistory &(Workspace::*)() const) &
                              Workspace::getHistory,
-           return_value_policy<reference_existing_object>(), args("self"),
+           arg("self"), return_value_policy<reference_existing_object>(),
            "Return read-only access to the workspace history");
 
   // register pointers
diff --git a/Framework/PythonInterface/mantid/api/src/Exports/WorkspaceFactory.cpp b/Framework/PythonInterface/mantid/api/src/Exports/WorkspaceFactory.cpp
index b77d3cc8a152a36926b9619fbb7cd84fd177162c..94373c2f9d16a87446c5864760cd9c88aa1aeea8 100644
--- a/Framework/PythonInterface/mantid/api/src/Exports/WorkspaceFactory.cpp
+++ b/Framework/PythonInterface/mantid/api/src/Exports/WorkspaceFactory.cpp
@@ -40,10 +40,18 @@ Workspace_sptr createFromParentPtr(WorkspaceFactoryImpl &self,
 }
 
 /// Overload generator for create
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunknown-pragmas"
+#pragma clang diagnostic ignored "-Wunused-local-typedef"
+#endif
 BOOST_PYTHON_FUNCTION_OVERLOADS(createFromParent_Overload, createFromParentPtr,
                                 2, 5)
 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(createTable_Overload, createTable, 0, 1)
 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(createPeaks_Overload, createPeaks, 0, 1)
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
 }
 
 void export_WorkspaceFactory() {
@@ -62,22 +70,26 @@ void export_WorkspaceFactory() {
   class_<WorkspaceFactoryImpl, boost::noncopyable>("WorkspaceFactoryImpl",
                                                    no_init)
       .def("create", &createFromParentPtr,
-           createFromParent_Overload(
-               createFromParentDoc, (arg("parent"), arg("NVectors") = -1,
-                                     arg("XLength") = -1, arg("YLength") = -1)))
+           createFromParent_Overload(createFromParentDoc,
+                                     (arg("self"), arg("parent"),
+                                      arg("NVectors") = -1, arg("XLength") = -1,
+                                      arg("YLength") = -1)))
 
       .def("create", (createFromScratchPtr)&WorkspaceFactoryImpl::create,
            createFromScratchDoc, return_value_policy<AsType<Workspace_sptr>>(),
-           (arg("className"), arg("NVectors"), arg("XLength"), arg("YLength")))
+           (arg("self"), arg("className"), arg("NVectors"), arg("XLength"),
+            arg("YLength")))
 
       .def("createTable", &WorkspaceFactoryImpl::createTable,
-           createTable_Overload("Creates an empty TableWorkspace",
-                                (arg("className") = "TableWorkspace"))
+           createTable_Overload(
+               "Creates an empty TableWorkspace",
+               (arg("self"), arg("className") = "TableWorkspace"))
                [return_value_policy<AsType<Workspace_sptr>>()])
 
       .def("createPeaks", &WorkspaceFactoryImpl::createPeaks,
-           createPeaks_Overload("Creates an empty PeaksWorkspace",
-                                (arg("className") = "PeaksWorkspace"))
+           createPeaks_Overload(
+               "Creates an empty PeaksWorkspace",
+               (arg("self"), arg("className") = "PeaksWorkspace"))
                [return_value_policy<AsType<Workspace_sptr>>()])
 
       .def("Instance", &WorkspaceFactory::Instance,
diff --git a/Framework/PythonInterface/mantid/api/src/Exports/WorkspaceGroup.cpp b/Framework/PythonInterface/mantid/api/src/Exports/WorkspaceGroup.cpp
index 702a7fe490a02376198838b30531fd34f70347cd..8c15d0331d17f326bcc93695ee46b4d083c8f017 100644
--- a/Framework/PythonInterface/mantid/api/src/Exports/WorkspaceGroup.cpp
+++ b/Framework/PythonInterface/mantid/api/src/Exports/WorkspaceGroup.cpp
@@ -13,22 +13,26 @@ void export_WorkspaceGroup() {
   class_<WorkspaceGroup, bases<Workspace>, boost::noncopyable>("WorkspaceGroup",
                                                                no_init)
       .def("getNumberOfEntries", &WorkspaceGroup::getNumberOfEntries,
-           "Returns the number of entries in the group")
-      .def("getNames", &WorkspaceGroup::getNames,
+           arg("self"), "Returns the number of entries in the group")
+      .def("getNames", &WorkspaceGroup::getNames, arg("self"),
            "Returns the names of the entries in the group")
       .def("contains",
            (bool (WorkspaceGroup::*)(const std::string &wsName) const) &
                WorkspaceGroup::contains,
+           (arg("self"), arg("workspace")),
            "Returns true if the given name is in the group")
-      .def("add", &WorkspaceGroup::add, "Add a name to the group")
-      .def("size", &WorkspaceGroup::size,
+      .def("add", &WorkspaceGroup::add, (arg("self"), arg("workspace_name")),
+           "Add a name to the group")
+      .def("size", &WorkspaceGroup::size, arg("self"),
            "Returns the number of workspaces contained in the group")
-      .def("remove", &WorkspaceGroup::remove, "Remove a name from the group")
+      .def("remove", &WorkspaceGroup::remove,
+           (arg("self"), arg("workspace_name")), "Remove a name from the group")
       .def("getItem", (Workspace_sptr (WorkspaceGroup::*)(const size_t) const) &
                           WorkspaceGroup::getItem,
+           (arg("self"), arg("workspace_name")),
            return_value_policy<Policies::ToWeakPtr>(),
            "Returns the item at the given index")
-      .def("isMultiPeriod", &WorkspaceGroup::isMultiperiod,
+      .def("isMultiPeriod", &WorkspaceGroup::isMultiperiod, arg("self"),
            "Retuns true if the workspace group is multi-period")
       // ------------ Operators --------------------------------
       .def("__len__", &WorkspaceGroup::getNumberOfEntries)
diff --git a/Framework/PythonInterface/mantid/api/src/Exports/WorkspaceHistory.cpp b/Framework/PythonInterface/mantid/api/src/Exports/WorkspaceHistory.cpp
index ad3133315cf8f163ccbd0f643d94ee004166d8d1..9a32321b85fe93b711c88e770ae089e673720b86 100644
--- a/Framework/PythonInterface/mantid/api/src/Exports/WorkspaceHistory.cpp
+++ b/Framework/PythonInterface/mantid/api/src/Exports/WorkspaceHistory.cpp
@@ -38,27 +38,31 @@ void export_WorkspaceHistory() {
 
   class_<WorkspaceHistory, boost::noncopyable>("WorkspaceHistory", no_init)
 
-      .def("getAlgorithmHistories", &getHistoriesAsList,
+      .def("getAlgorithmHistories", &getHistoriesAsList, arg("self"),
            "Returns a list of algorithm histories for this workspace history.")
 
       .def("getAlgorithmHistory", &WorkspaceHistory::getAlgorithmHistory,
-           arg("index"), return_value_policy<Policies::RemoveConstSharedPtr>(),
+           (arg("self"), arg("index")),
+           return_value_policy<Policies::RemoveConstSharedPtr>(),
            "Returns the algorithm history at the given index in the history")
 
-      .def("size", &WorkspaceHistory::size,
+      .def("size", &WorkspaceHistory::size, arg("self"),
            "Returns the number of algorithms in the immediate history")
 
-      .def("empty", &WorkspaceHistory::empty,
+      .def("empty", &WorkspaceHistory::empty, arg("self"),
            "Returns whether the history has any entries")
 
-      .def("lastAlgorithm", &WorkspaceHistory::lastAlgorithm,
+      .def("lastAlgorithm", &WorkspaceHistory::lastAlgorithm, arg("self"),
            "Returns the last algorithm run on this workspace so that its "
            "properties can be accessed")
 
       .def("getAlgorithm", &WorkspaceHistory::getAlgorithm,
+           (arg("self"), arg("index")),
            "Returns the algorithm at the given index in the history")
 
       // ----------------- Operators --------------------------------------
-      .def("__getitem__", &WorkspaceHistory::getAlgorithm)
+      .def("__getitem__", &WorkspaceHistory::getAlgorithm,
+           (arg("self"), arg("index")),
+           "Create an algorithm from a history record at a given index")
       .def(self_ns::str(self));
 }
diff --git a/Framework/PythonInterface/mantid/geometry/src/Exports/BoundingBox.cpp b/Framework/PythonInterface/mantid/geometry/src/Exports/BoundingBox.cpp
index 47d718238f0c619778f94be92788e7ba868cf79c..52eb111ecf2762d427a04ebb3d880ff732e19084 100644
--- a/Framework/PythonInterface/mantid/geometry/src/Exports/BoundingBox.cpp
+++ b/Framework/PythonInterface/mantid/geometry/src/Exports/BoundingBox.cpp
@@ -9,39 +9,40 @@ using namespace boost::python;
 void export_BoundingBox() {
   class_<BoundingBox>("BoundingBox", "Constructs a zero-sized box")
       .def(init<double, double, double, double, double, double>(
-          (arg("xmax"), arg("ymax"), arg("zmax"), arg("xmin"), arg("ymin"),
-           arg("zmin")),
+          (arg("self"), arg("xmax"), arg("ymax"), arg("zmax"), arg("xmin"),
+           arg("ymin"), arg("zmin")),
           "Constructs a box from the six given points"))
 
-      .def("minPoint", &BoundingBox::minPoint,
+      .def("minPoint", &BoundingBox::minPoint, arg("self"),
            return_value_policy<copy_const_reference>(),
            "Returns a V3D containing the values of the minimum of the box. See "
            "mantid.kernel.V3D")
 
-      .def("maxPoint", &BoundingBox::maxPoint,
+      .def("maxPoint", &BoundingBox::maxPoint, arg("self"),
            return_value_policy<copy_const_reference>(),
            "Returns a V3D containing the values of the minimum of the box. See "
            "mantid.kernel.V3D")
 
-      .def("centrePoint", &BoundingBox::centrePoint,
+      .def("centrePoint", &BoundingBox::centrePoint, arg("self"),
            "Returns a V3D containing the coordinates of the centre point. See "
            "mantid.kernel.V3D")
 
-      .def("width", &BoundingBox::width, "Returns a V3D containing the widths "
-                                         "for each dimension. See "
-                                         "mantid.kernel.V3D")
+      .def("width", &BoundingBox::width, arg("self"),
+           "Returns a V3D containing the widths "
+           "for each dimension. See "
+           "mantid.kernel.V3D")
 
-      .def("isNull", &BoundingBox::isNull,
+      .def("isNull", &BoundingBox::isNull, arg("self"),
            "Returns true if the box has no dimensions that have been set")
 
-      .def("isPointInside", &BoundingBox::isPointInside,
+      .def("isPointInside", &BoundingBox::isPointInside, arg("self"),
            "Returns true if the given point is inside the object. See "
            "mantid.kernel.V3D")
 
       .def("doesLineIntersect",
            (bool (BoundingBox::*)(const V3D &, const V3D &) const) &
                BoundingBox::doesLineIntersect,
-           (arg("startPoint"), arg("lineDir")),
+           (arg("self"), arg("startPoint"), arg("lineDir")),
            "Returns true if the line given by the starting point & direction "
            "vector passes through the box");
 }
diff --git a/Framework/PythonInterface/mantid/geometry/src/Exports/Component.cpp b/Framework/PythonInterface/mantid/geometry/src/Exports/Component.cpp
index 5ad6c63e6d0715de3c948aa0857a4e78f618ca66..77b295f76a19e855e7abd89b2e65515276e89676 100644
--- a/Framework/PythonInterface/mantid/geometry/src/Exports/Component.cpp
+++ b/Framework/PythonInterface/mantid/geometry/src/Exports/Component.cpp
@@ -7,6 +7,11 @@ using Mantid::Geometry::IComponent;
 using namespace boost::python;
 
 namespace {
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunknown-pragmas"
+#pragma clang diagnostic ignored "-Wunused-local-typedef"
+#endif
 // Default parameter function overloads
 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(Component_getParameterNames,
                                        Component::getParameterNames, 0, 1)
@@ -36,45 +41,62 @@ BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(Component_getParamShortDescription,
 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(Component_getParamDescription,
                                        Component::getParamDescription, 1, 2)
 }
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
 
 void export_Component() {
   class_<Component, bases<IComponent>, boost::noncopyable>("Component", no_init)
       .def("getParameterNames", &Component::getParameterNames,
-           Component_getParameterNames())
-      .def("hasParameter", &Component::hasParameter, Component_hasParameter())
+           Component_getParameterNames((arg("self"), arg("recursive") = true)))
+      .def("hasParameter", &Component::hasParameter,
+           Component_hasParameter(
+               (arg("self"), arg("name"), arg("recursive") = true)))
       .def("getNumberParameter", &Component::getNumberParameter,
-           Component_getNumberParameter())
+           Component_getNumberParameter(
+               (arg("self"), arg("pname"), arg("recursive") = true)))
       .def("getBoolParameter", &Component::getBoolParameter,
-           Component_getBoolParameter())
+           Component_getBoolParameter(
+               (arg("self"), arg("pname"), arg("recursive") = true)))
       .def("getPositionParameter", &Component::getPositionParameter,
-           Component_getPositionParameter())
+           Component_getPositionParameter(
+               (arg("self"), arg("pname"), arg("recursive") = true)))
       .def("getRotationParameter", &Component::getRotationParameter,
-           Component_getRotationParameter())
+           Component_getRotationParameter(
+               (arg("self"), arg("pname"), arg("recursive") = true)))
       .def("getStringParameter", &Component::getStringParameter,
-           Component_getStringParameter())
+           Component_getStringParameter(
+               (arg("self"), arg("pname"), arg("recursive") = true)))
       .def("getIntParameter", &Component::getIntParameter,
-           Component_getIntParameter())
+           Component_getIntParameter(
+               (arg("self"), arg("pname"), arg("recursive") = true)))
       //
-      .def("getRotation", &Component::getRotation, Component_getRotation())
+      .def("getRotation", &Component::getRotation,
+           Component_getRotation(arg("self")))
       .def("getRelativePos", &Component::getRelativePos,
-           Component_getRelativePos())
+           Component_getRelativePos(arg("self")))
       //
       .def("getParamShortDescription", &Component::getParamShortDescription,
-           Component_getParamShortDescription())
+           Component_getParamShortDescription(
+               (arg("self"), arg("pname"), arg("recursive") = true)))
       .def("getParamDescription", &Component::getParamDescription,
-           Component_getParamDescription())
-      .def("getShortDescription", &Component::getShortDescription,
+           Component_getParamDescription(
+               (arg("self"), arg("pname"), arg("recursive") = true)))
+
+      .def("getShortDescription", &Component::getShortDescription, arg("self"),
            "Return the short description of current parameterized component")
-      .def("getDescription", &Component::getDescription,
+      .def("getDescription", &Component::getDescription, arg("self"),
            "Return the description of current parameterized component")
       .def("setDescription", &Component::setDescription,
+           (arg("self"), arg("descr")),
            "Set component's description, works only if the component is "
            "parameterized component")
 
       // HACK -- python should return parameters regardless of type. this is
       // untill rows below do not work
       .def("getParameterType", &Component::getParameterType,
-           Component_getParameterType())
+           Component_getParameterType(
+               (arg("self"), arg("pname"), arg("recursive") = true)))
       //// this does not work for some obvious or not obvious reasons
       //.def("getParameter", &Component::getNumberParameter,
       // Component_getNumberParameter())
diff --git a/Framework/PythonInterface/mantid/geometry/src/Exports/DetectorGroup.cpp b/Framework/PythonInterface/mantid/geometry/src/Exports/DetectorGroup.cpp
index fe6107d725d865dd6248c4e34129de1970f47e1d..2a9be545cbb2fc04e75905bdc732db599aa5869b 100644
--- a/Framework/PythonInterface/mantid/geometry/src/Exports/DetectorGroup.cpp
+++ b/Framework/PythonInterface/mantid/geometry/src/Exports/DetectorGroup.cpp
@@ -8,8 +8,8 @@ using namespace boost::python;
 void export_DetectorGroup() {
   class_<DetectorGroup, bases<IDetector>, boost::noncopyable>("DetectorGroup",
                                                               no_init)
-      .def("getDetectorIDs", &DetectorGroup::getDetectorIDs,
+      .def("getDetectorIDs", &DetectorGroup::getDetectorIDs, arg("self"),
            "Returns the list of detector IDs within this group")
-      .def("getNameSeparator", &DetectorGroup::getNameSeparator,
+      .def("getNameSeparator", &DetectorGroup::getNameSeparator, arg("self"),
            "Returns separator for list of names of detectors");
 }
diff --git a/Framework/PythonInterface/mantid/geometry/src/Exports/Goniometer.cpp b/Framework/PythonInterface/mantid/geometry/src/Exports/Goniometer.cpp
index 184ca40caf1c17fbcf4a54d0f95c9972e8dfed47..cf01cad70f650daf90365084fb77c668afc84ed2 100644
--- a/Framework/PythonInterface/mantid/geometry/src/Exports/Goniometer.cpp
+++ b/Framework/PythonInterface/mantid/geometry/src/Exports/Goniometer.cpp
@@ -13,9 +13,17 @@ using namespace boost::python;
 namespace //<unnamed>
     {
 ///@cond
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunknown-pragmas"
+#pragma clang diagnostic ignored "-Wunused-local-typedef"
+#endif
 // define overloaded functions
 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(getEulerAngles_overloads,
                                        Goniometer::getEulerAngles, 0, 1)
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
 ///@endcond
 
 /// Set the U vector via a numpy array
@@ -37,6 +45,6 @@ void export_Goniometer() {
            getEulerAngles_overloads(args("self", "convention"),
                                     "Default convention is \'YZX\'. Universal "
                                     "goniometer is \'YZY\'"))
-      .def("getR", &Goniometer::getR, return_readonly_numpy())
-      .def("setR", &setR);
+      .def("getR", &Goniometer::getR, arg("self"), return_readonly_numpy())
+      .def("setR", &setR, (arg("self"), arg("rot")));
 }
diff --git a/Framework/PythonInterface/mantid/geometry/src/Exports/Group.cpp b/Framework/PythonInterface/mantid/geometry/src/Exports/Group.cpp
index cc83d3c6c3de24031536b9e297a3b2049257e35e..28565ab5935ed0fbe38202afe72b96b047313d6d 100644
--- a/Framework/PythonInterface/mantid/geometry/src/Exports/Group.cpp
+++ b/Framework/PythonInterface/mantid/geometry/src/Exports/Group.cpp
@@ -64,25 +64,35 @@ void export_Group() {
       .value("Associativity", Group::Associativity);
 
   class_<Group, boost::noncopyable>("Group", no_init)
-      .def("__init__", make_constructor(&constructGroupFromString),
+      .def("__init__",
+           make_constructor(&constructGroupFromString, default_call_policies(),
+                            (arg("symmetryOperationString"))),
            "Construct a group from the provided initializer string.")
-      .def("__init__", make_constructor(&constructGroupFromVector),
+      .def("__init__",
+           make_constructor(&constructGroupFromVector, default_call_policies(),
+                            (arg("symmetryOperationVector"))),
            "Construct a group from the provided symmetry operation list.")
-      .def("__init__", make_constructor(&constructGroupFromPythonList),
+      .def("__init__", make_constructor(&constructGroupFromPythonList,
+                                        default_call_policies(),
+                                        (arg("symmetryOperationList"))),
            "Construct a group from a python generated symmetry operation list.")
-      .def("getOrder", &Group::order, "Returns the order of the group.")
-      .def("getCoordinateSystem", &Group::getCoordinateSystem,
+      .def("getOrder", &Group::order, arg("self"),
+           "Returns the order of the group.")
+      .def("getCoordinateSystem", &Group::getCoordinateSystem, arg("self"),
            "Returns the type of coordinate system to distinguish groups with "
            "hexagonal system definition.")
-      .def("getSymmetryOperations", &Group::getSymmetryOperations,
+      .def("getSymmetryOperations", &Group::getSymmetryOperations, arg("self"),
            "Returns the symmetry operations contained in the group.")
       .def("getSymmetryOperationStrings", &getSymmetryOperationStrings,
+           arg("self"),
            "Returns the x,y,z-strings for the contained symmetry operations.")
       .def("containsOperation", &Group::containsOperation,
+           (arg("self"), arg("operation")),
            "Checks whether a SymmetryOperation is included in Group.")
-      .def("isGroup", &Group::isGroup, "Checks whether the contained symmetry "
-                                       "operations fulfill the group axioms.")
-      .def("fulfillsAxiom", &Group::fulfillsAxiom,
+      .def("isGroup", &Group::isGroup, arg("self"),
+           "Checks whether the contained symmetry "
+           "operations fulfill the group axioms.")
+      .def("fulfillsAxiom", &Group::fulfillsAxiom, (arg("self"), arg("axiom")),
            "Checks if the contained symmetry operations fulfill the specified "
            "group axiom.");
 }
diff --git a/Framework/PythonInterface/mantid/geometry/src/Exports/ICompAssembly.cpp b/Framework/PythonInterface/mantid/geometry/src/Exports/ICompAssembly.cpp
index bc8d4d2cec5779576dd9e2826a345c1cb12821b7..32e39ed16f535e568e236c64ae2cb23c558f3046 100644
--- a/Framework/PythonInterface/mantid/geometry/src/Exports/ICompAssembly.cpp
+++ b/Framework/PythonInterface/mantid/geometry/src/Exports/ICompAssembly.cpp
@@ -11,8 +11,9 @@ void export_ICompAssembly() {
 
   class_<ICompAssembly, boost::python::bases<IComponent>, boost::noncopyable>(
       "ICompAssembly", no_init)
-      .def("nelements", &ICompAssembly::nelements,
+      .def("nelements", &ICompAssembly::nelements, arg("self"),
            "Returns the number of elements in the assembly")
-      .def("__getitem__", &ICompAssembly::operator[],
+      .def("__getitem__",
+           &ICompAssembly::operator[], (arg("self"), arg("index")),
            "Return the component at the given index");
 }
diff --git a/Framework/PythonInterface/mantid/geometry/src/Exports/IComponent.cpp b/Framework/PythonInterface/mantid/geometry/src/Exports/IComponent.cpp
index ff0a91941229fe8a31096d5813371858ab8d374f..d6052b1728b8222a660fcca8861641bc14afa51f 100644
--- a/Framework/PythonInterface/mantid/geometry/src/Exports/IComponent.cpp
+++ b/Framework/PythonInterface/mantid/geometry/src/Exports/IComponent.cpp
@@ -29,16 +29,18 @@ void export_IComponent() {
   register_ptr_to_python<boost::shared_ptr<IComponent>>();
 
   class_<IComponent, boost::noncopyable>("IComponent", no_init)
-      .def("getPos", &IComponent::getPos,
+      .def("getPos", &IComponent::getPos, arg("self"),
            "Returns the absolute position of the component")
-      .def("getDistance", &getDistance, "Returns the distance, in metres, "
-                                        "between this and the given component")
-      .def("getName", &IComponent::getName, "Returns the name of the component")
-      .def("getFullName", &IComponent::getFullName,
+      .def("getDistance", &getDistance, (arg("self"), arg("other")),
+           "Returns the distance, in metres, "
+           "between this and the given component")
+      .def("getName", &IComponent::getName, arg("self"),
+           "Returns the name of the component")
+      .def("getFullName", &IComponent::getFullName, arg("self"),
            "Returns full path name of component")
-      .def("type", &IComponent::type,
+      .def("type", &IComponent::type, arg("self"),
            "Returns the type of the component represented as a string")
-      .def("getRelativeRot", &IComponent::getRelativeRot,
+      .def("getRelativeRot", &IComponent::getRelativeRot, arg("self"),
            return_value_policy<copy_const_reference>(),
            "Returns the relative rotation as a Quat");
 }
diff --git a/Framework/PythonInterface/mantid/geometry/src/Exports/IDetector.cpp b/Framework/PythonInterface/mantid/geometry/src/Exports/IDetector.cpp
index 8bb8d0299891a3bd402d20f054313c877b2902c8..669fbd06ccd3263a61b79cddffa4ed6e0f5b5795 100644
--- a/Framework/PythonInterface/mantid/geometry/src/Exports/IDetector.cpp
+++ b/Framework/PythonInterface/mantid/geometry/src/Exports/IDetector.cpp
@@ -11,18 +11,19 @@ void export_IDetector() {
 
   class_<IDetector, bases<IObjComponent>, boost::noncopyable>("IDetector",
                                                               no_init)
-      .def("getID", &IDetector::getID, "Returns the detector ID")
-      .def("isMasked", &IDetector::isMasked, "Returns the value of the masked "
-                                             "flag. True means ignore this "
-                                             "detector")
-      .def("isMonitor", &IDetector::isMonitor,
+      .def("getID", &IDetector::getID, arg("self"), "Returns the detector ID")
+      .def("isMasked", &IDetector::isMasked, arg("self"),
+           "Returns the value of the masked flag. True means ignore this "
+           "detector")
+      .def("isMonitor", &IDetector::isMonitor, arg("self"),
            "Returns True if the detector is marked as a monitor in the IDF")
-      .def("solidAngle", &IDetector::solidAngle, "Return the solid angle in "
-                                                 "steradians between this "
-                                                 "detector and an observer")
+      .def("solidAngle", &IDetector::solidAngle, (arg("self"), arg("observer")),
+           "Return the solid angle in steradians between this "
+           "detector and an observer")
       .def("getTwoTheta", &IDetector::getTwoTheta,
+           (arg("self"), arg("observer"), arg("axis")),
            "Calculate the angle between this detector, another component and "
            "an axis")
-      .def("getPhi", &IDetector::getPhi,
+      .def("getPhi", &IDetector::getPhi, arg("self"),
            "Returns the azimuthal angle of this detector");
 }
diff --git a/Framework/PythonInterface/mantid/geometry/src/Exports/IMDDimension.cpp b/Framework/PythonInterface/mantid/geometry/src/Exports/IMDDimension.cpp
index 7f32083e78fdf64734a7f246a1f820ed853d69ee..77f8f1778ea5f7e5b13d3488d92f118368ddae2b 100644
--- a/Framework/PythonInterface/mantid/geometry/src/Exports/IMDDimension.cpp
+++ b/Framework/PythonInterface/mantid/geometry/src/Exports/IMDDimension.cpp
@@ -39,24 +39,24 @@ void export_IMDDimension() {
   register_ptr_to_python<boost::shared_ptr<IMDDimension>>();
 
   class_<IMDDimension, boost::noncopyable>("IMDDimension", no_init)
-      .def("getName", &IMDDimension::getName, "Return the name of the "
-                                              "dimension as can be displayed "
-                                              "along the axis")
-      .def("getMaximum", &IMDDimension::getMaximum,
+      .def("getName", &IMDDimension::getName, arg("self"),
+           "Return the name of the dimension as can be displayed "
+           "along the axis")
+      .def("getMaximum", &IMDDimension::getMaximum, arg("self"),
            "Return the maximum extent of this dimension")
-      .def("getMinimum", &IMDDimension::getMinimum,
+      .def("getMinimum", &IMDDimension::getMinimum, arg("self"),
            "Return the maximum extent of this dimension")
-      .def("getNBins", &IMDDimension::getNBins,
+      .def("getNBins", &IMDDimension::getNBins, arg("self"),
            "Return the number of bins dimension have (an integrated has one). "
            "A axis directed along dimension would have getNBins+1 axis points.")
-      .def("getX", &IMDDimension::getX,
+      .def("getX", &IMDDimension::getX, (arg("self"), arg("ind")),
            "Return coordinate of the axis at the given index")
-      .def("getDimensionId", &IMDDimension::getDimensionId,
+      .def("getDimensionId", &IMDDimension::getDimensionId, arg("self"),
            "Return a short name which identify the dimension among other "
            "dimension."
            "A dimension can be usually find by its ID and various  ")
-      .def("getUnits", &getUnitsAsStr,
+      .def("getUnits", &getUnitsAsStr, arg("self"),
            "Return the units associated with this dimension.")
-      .def("getMDFrame", &getMDFrame,
+      .def("getMDFrame", &getMDFrame, arg("self"),
            "Return the multidimensional frame for this dimension.");
 }
diff --git a/Framework/PythonInterface/mantid/geometry/src/Exports/IObjComponent.cpp b/Framework/PythonInterface/mantid/geometry/src/Exports/IObjComponent.cpp
index cf9a708a50efb951e0509784e099ca1c7d90a383..fe184670cb1d98c8599a96ee53409e82c426e0ae 100644
--- a/Framework/PythonInterface/mantid/geometry/src/Exports/IObjComponent.cpp
+++ b/Framework/PythonInterface/mantid/geometry/src/Exports/IObjComponent.cpp
@@ -25,6 +25,7 @@ void export_IObjComponent() {
 
   class_<IObjComponent, boost::python::bases<IComponent>, boost::noncopyable>(
       "IObjComponent", no_init)
-      .def("shape", &getShape, "Get the object that represents the physical "
-                               "shape of this component");
+      .def("shape", &getShape, arg("self"), "Get the object that represents "
+                                            "the physical shape of this "
+                                            "component");
 }
diff --git a/Framework/PythonInterface/mantid/geometry/src/Exports/Instrument.cpp b/Framework/PythonInterface/mantid/geometry/src/Exports/Instrument.cpp
index d7ba822270890191a23ac0612aea78464ad82b17..d082519344c6fb4c5b6e68d58ed979e01f4ad589 100644
--- a/Framework/PythonInterface/mantid/geometry/src/Exports/Instrument.cpp
+++ b/Framework/PythonInterface/mantid/geometry/src/Exports/Instrument.cpp
@@ -15,41 +15,39 @@ void export_Instrument() {
 
   class_<Instrument, bases<CompAssembly>, boost::noncopyable>("Instrument",
                                                               no_init)
-      .def("getSample", &Instrument::getSample,
+      .def("getSample", &Instrument::getSample, arg("self"),
            return_value_policy<RemoveConstSharedPtr>(),
            "Return the object that represents the sample")
 
-      .def("getSource", &Instrument::getSource,
+      .def("getSource", &Instrument::getSource, arg("self"),
            return_value_policy<RemoveConstSharedPtr>(),
            "Return the object that represents the source")
 
       .def("getComponentByName",
            (boost::shared_ptr<IComponent>(Instrument::*)(const std::string &)) &
                Instrument::getComponentByName,
-           "Returns the named component")
+           (arg("self"), arg("cname")), "Returns the named component")
 
       .def("getDetector", (boost::shared_ptr<IDetector>(
                               Instrument::*)(const detid_t &) const) &
                               Instrument::getDetector,
+           (arg("self"), arg("detector_id")),
            "Returns the detector with the given ID")
 
       .def("getReferenceFrame",
            (boost::shared_ptr<const ReferenceFrame>(Instrument::*)()) &
                Instrument::getReferenceFrame,
-           return_value_policy<RemoveConstSharedPtr>(),
+           arg("self"), return_value_policy<RemoveConstSharedPtr>(),
            "Returns the reference frame attached that defines the instrument "
            "axes")
 
-      .def("getValidFromDate", &Instrument::getValidFromDate,
+      .def("getValidFromDate", &Instrument::getValidFromDate, arg("self"),
            "Return the valid from date of the instrument")
 
-      .def("getValidToDate", &Instrument::getValidToDate,
+      .def("getValidToDate", &Instrument::getValidToDate, arg("self"),
            "Return the valid to date of the instrument")
 
-      .def("getBaseInstrument", &Instrument::baseInstrument,
+      .def("getBaseInstrument", &Instrument::baseInstrument, arg("self"),
            return_value_policy<RemoveConstSharedPtr>(),
            "Return reference to the base instrument");
-  ;
-
-  ;
 }
diff --git a/Framework/PythonInterface/mantid/geometry/src/Exports/MDFrame.cpp b/Framework/PythonInterface/mantid/geometry/src/Exports/MDFrame.cpp
index 3f6a3e2ed811775b0019107a4cce1f7a29f1114b..af5dad9763b679e40144822ef79e472624536e42 100644
--- a/Framework/PythonInterface/mantid/geometry/src/Exports/MDFrame.cpp
+++ b/Framework/PythonInterface/mantid/geometry/src/Exports/MDFrame.cpp
@@ -13,6 +13,6 @@ void export_MDFrame() {
   register_ptr_to_python<boost::shared_ptr<MDFrame>>();
 
   class_<MDFrame, boost::noncopyable>("MDFrame", no_init)
-      .def("getUnitLabel", &MDFrame::getUnitLabel)
-      .def("name", &MDFrame::name);
+      .def("getUnitLabel", &MDFrame::getUnitLabel, arg("self"))
+      .def("name", &MDFrame::name, arg("self"));
 }
diff --git a/Framework/PythonInterface/mantid/geometry/src/Exports/Object.cpp b/Framework/PythonInterface/mantid/geometry/src/Exports/Object.cpp
index 756ed9f2b7d8d8e1a0fed30067fb6c7ca722d43b..33acda45f4d304af7bba24863adb797455708765 100644
--- a/Framework/PythonInterface/mantid/geometry/src/Exports/Object.cpp
+++ b/Framework/PythonInterface/mantid/geometry/src/Exports/Object.cpp
@@ -13,9 +13,9 @@ void export_Object() {
   class_<Object, boost::noncopyable>("Object", no_init)
       .def("getBoundingBox",
            (const BoundingBox &(Object::*)() const) & Object::getBoundingBox,
-           return_value_policy<copy_const_reference>(),
+           arg("self"), return_value_policy<copy_const_reference>(),
            "Return the axis-aligned bounding box for this shape")
 
-      .def("getShapeXML", &Object::getShapeXML,
+      .def("getShapeXML", &Object::getShapeXML, arg("self"),
            "Returns the XML that was used to create this shape.");
 }
diff --git a/Framework/PythonInterface/mantid/geometry/src/Exports/OrientedLattice.cpp b/Framework/PythonInterface/mantid/geometry/src/Exports/OrientedLattice.cpp
index b392a312a8eefe784c93c74f828db9efda0e334e..14a995b5b9a8a47c38e10f7a23d34f4bd591f057 100644
--- a/Framework/PythonInterface/mantid/geometry/src/Exports/OrientedLattice.cpp
+++ b/Framework/PythonInterface/mantid/geometry/src/Exports/OrientedLattice.cpp
@@ -55,13 +55,17 @@ void export_OrientedLattice() {
           (arg("_a"), arg("_b"), arg("_c"), arg("_alpha"), arg("_beta"),
            arg("_gamma"), arg("Unit") = (int)(angDegrees))))
       .def(init<UnitCell>(arg("uc")))
-      .def("getuVector", (&OrientedLattice::getuVector))
-      .def("getvVector", (&OrientedLattice::getvVector))
-      .def("getU", &OrientedLattice::getU, return_readonly_numpy())
-      .def("setU", &setU)
-      .def("getUB", &OrientedLattice::getUB, return_readonly_numpy())
-      .def("setUB", &setUB)
-      .def("setUFromVectors", &setUFromVectors)
-      .def("qFromHKL", &qFromHKL, "Q vector from HKL vector")
-      .def("hklFromQ", &hklFromQ, "HKL value from Q vector");
+      .def("getuVector", (&OrientedLattice::getuVector), arg("self"))
+      .def("getvVector", (&OrientedLattice::getvVector), arg("self"))
+      .def("getU", &OrientedLattice::getU, arg("self"), return_readonly_numpy())
+      .def("setU", &setU, (arg("self"), arg("newU")))
+      .def("getUB", &OrientedLattice::getUB, arg("self"),
+           return_readonly_numpy())
+      .def("setUB", &setUB, (arg("self"), arg("newUB")))
+      .def("setUFromVectors", &setUFromVectors,
+           (arg("self"), arg("u"), arg("v")))
+      .def("qFromHKL", &qFromHKL, (arg("self"), arg("vec")),
+           "Q vector from HKL vector")
+      .def("hklFromQ", &hklFromQ, (arg("self"), arg("vec")),
+           "HKL value from Q vector");
 }
diff --git a/Framework/PythonInterface/mantid/geometry/src/Exports/PeakShape.cpp b/Framework/PythonInterface/mantid/geometry/src/Exports/PeakShape.cpp
index 420e07c0ea2a4b5fca085a0adb15ba02098b4166..7c8fbf8f63638225abb96f5704d43dbde5b9c84b 100644
--- a/Framework/PythonInterface/mantid/geometry/src/Exports/PeakShape.cpp
+++ b/Framework/PythonInterface/mantid/geometry/src/Exports/PeakShape.cpp
@@ -9,10 +9,12 @@ void export_PeakShape() {
   register_ptr_to_python<Mantid::Geometry::PeakShape_sptr>();
 
   class_<PeakShape, boost::noncopyable>("PeakShape", no_init)
-      .def("toJSON", &PeakShape::toJSON, "Serialize object to JSON")
-      .def("shapeName", &PeakShape::shapeName, "Shape name for type of shape")
-      .def("algorithmVersion", &PeakShape::algorithmVersion,
+      .def("toJSON", &PeakShape::toJSON, arg("self"),
+           "Serialize object to JSON")
+      .def("shapeName", &PeakShape::shapeName, arg("self"),
+           "Shape name for type of shape")
+      .def("algorithmVersion", &PeakShape::algorithmVersion, arg("self"),
            "Number of source integration algorithm version")
-      .def("algorithmName", &PeakShape::algorithmName,
+      .def("algorithmName", &PeakShape::algorithmName, arg("self"),
            "Name of source integration algorithm");
 }
diff --git a/Framework/PythonInterface/mantid/geometry/src/Exports/PointGroup.cpp b/Framework/PythonInterface/mantid/geometry/src/Exports/PointGroup.cpp
index 31d222c1a7f857eb4064efe43111e3034283bbdb..612397d3524a54e1a4bfbd7bcdccc5540e14b3d4 100644
--- a/Framework/PythonInterface/mantid/geometry/src/Exports/PointGroup.cpp
+++ b/Framework/PythonInterface/mantid/geometry/src/Exports/PointGroup.cpp
@@ -55,14 +55,16 @@ void export_PointGroup() {
       .value("Cubic", PointGroup::Cubic);
 
   class_<PointGroup, boost::noncopyable, bases<Group>>("PointGroup", no_init)
-      .def("getName", &PointGroup::getName)
-      .def("getHMSymbol", &PointGroup::getSymbol)
-      .def("getCrystalSystem", &PointGroup::crystalSystem)
+      .def("getName", &PointGroup::getName, arg("self"))
+      .def("getHMSymbol", &PointGroup::getSymbol, arg("self"))
+      .def("getCrystalSystem", &PointGroup::crystalSystem, arg("self"))
       .def("isEquivalent", &isEquivalent,
+           (arg("self"), arg("hkl1"), arg("hkl2")),
            "Check whether the two HKLs are symmetrically equivalent.")
-      .def("getEquivalents", &getEquivalents, "Returns an array with all "
-                                              "symmetry equivalents of the "
-                                              "supplied HKL.")
+      .def("getEquivalents", &getEquivalents, (arg("self"), arg("hkl")),
+           "Returns an array with all symmetry equivalents of the supplied "
+           "HKL.")
       .def("getReflectionFamily", &getReflectionFamily,
+           (arg("self"), arg("hkl")),
            "Returns the same HKL for all symmetry equivalents.");
 }
diff --git a/Framework/PythonInterface/mantid/geometry/src/Exports/PointGroupFactory.cpp b/Framework/PythonInterface/mantid/geometry/src/Exports/PointGroupFactory.cpp
index 0ec8f5c51de65da80f1ffe5e224800ae214dc0e9..07ef88cf35da0139bc8344b68d2b0ca4761a4906 100644
--- a/Framework/PythonInterface/mantid/geometry/src/Exports/PointGroupFactory.cpp
+++ b/Framework/PythonInterface/mantid/geometry/src/Exports/PointGroupFactory.cpp
@@ -25,19 +25,23 @@ void export_PointGroupFactory() {
   class_<PointGroupFactoryImpl, boost::noncopyable>("PointGroupFactoryImpl",
                                                     no_init)
       .def("isSubscribed", &PointGroupFactoryImpl::isSubscribed,
+           (arg("self"), arg("hmSymbol")),
            "Returns true of the point group with the given symbol is "
            "subscribed.")
       .def("createPointGroup", &PointGroupFactoryImpl::createPointGroup,
+           (arg("self"), arg("hmSymbol")),
            "Creates a point group if registered.")
       .def("createPointGroupFromSpaceGroup", &getPointGroupFromSpaceGroup,
+           (arg("self"), arg("group")),
            "Creates the point group that corresponds to the given space group.")
       .def("createPointGroupFromSpaceGroupSymbol",
-           &getPointGroupFromSpaceGroupSymbol,
+           &getPointGroupFromSpaceGroupSymbol, (arg("self"), arg("group")),
            "Creates a point group directly from the space group symbol.")
       .def("getAllPointGroupSymbols",
-           &PointGroupFactoryImpl::getAllPointGroupSymbols,
+           &PointGroupFactoryImpl::getAllPointGroupSymbols, arg("self"),
            "Returns all registered point group symbols.")
       .def("getPointGroupSymbols", &PointGroupFactoryImpl::getPointGroupSymbols,
+           (arg("self"), arg("crystalsystem")),
            "Returns all point groups registered for the given crystal system.")
       .def("Instance", &PointGroupFactory::Instance,
            return_value_policy<reference_existing_object>(),
diff --git a/Framework/PythonInterface/mantid/geometry/src/Exports/RectangularDetector.cpp b/Framework/PythonInterface/mantid/geometry/src/Exports/RectangularDetector.cpp
index 01cf57f0361b3758262a8f13e8461379ec964353..8738dd36438adefb21edaf65818cf8196e0c93b4 100644
--- a/Framework/PythonInterface/mantid/geometry/src/Exports/RectangularDetector.cpp
+++ b/Framework/PythonInterface/mantid/geometry/src/Exports/RectangularDetector.cpp
@@ -16,31 +16,33 @@ void export_RectangularDetector() {
 
   class_<RectangularDetector, bases<CompAssembly, IObjComponent>,
          boost::noncopyable>("RectangularDetector", no_init)
-      .def("xpixels", &RectangularDetector::xpixels,
+      .def("xpixels", &RectangularDetector::xpixels, arg("self"),
            "Returns the number of pixels in the X direction")
-      .def("ypixels", &RectangularDetector::ypixels,
+      .def("ypixels", &RectangularDetector::ypixels, arg("self"),
            "Returns the number of pixels in the Y direction")
-      .def("xstep", &RectangularDetector::xstep,
+      .def("xstep", &RectangularDetector::xstep, arg("self"),
            "Returns the step size in the X direction")
-      .def("ystep", &RectangularDetector::ystep,
+      .def("ystep", &RectangularDetector::ystep, arg("self"),
            "Returns the step size in the Y direction")
-      .def("xsize", &RectangularDetector::xsize,
+      .def("xsize", &RectangularDetector::xsize, arg("self"),
            "Returns the size in the X direction")
-      .def("ysize", &RectangularDetector::ysize,
+      .def("ysize", &RectangularDetector::ysize, arg("self"),
            "Returns the size in the Y direction")
-      .def("xstart", &RectangularDetector::xstart,
+      .def("xstart", &RectangularDetector::xstart, arg("self"),
            "Returns the start position in the X direction")
-      .def("ystart", &RectangularDetector::ystart,
+      .def("ystart", &RectangularDetector::ystart, arg("self"),
            "Returns the start position in the Y direction")
-      .def("idstart", &RectangularDetector::idstart, "Returns the idstart")
+      .def("idstart", &RectangularDetector::idstart, arg("self"),
+           "Returns the idstart")
       .def("idfillbyfirst_y", &RectangularDetector::idfillbyfirst_y,
-           "Returns the idfillbyfirst_y")
-      .def("idstepbyrow", &RectangularDetector::idstepbyrow,
+           arg("self"), "Returns the idfillbyfirst_y")
+      .def("idstepbyrow", &RectangularDetector::idstepbyrow, arg("self"),
            "Returns the idstepbyrow")
-      .def("idstep", &RectangularDetector::idstep, "Returns the idstep")
-      .def("minDetectorID", &RectangularDetector::minDetectorID,
+      .def("idstep", &RectangularDetector::idstep, arg("self"),
+           "Returns the idstep")
+      .def("minDetectorID", &RectangularDetector::minDetectorID, arg("self"),
            "Returns the minimum detector id")
-      .def("maxDetectorID", &RectangularDetector::maxDetectorID,
+      .def("maxDetectorID", &RectangularDetector::maxDetectorID, arg("self"),
            "Returns the maximum detector id");
 }
 
diff --git a/Framework/PythonInterface/mantid/geometry/src/Exports/ReferenceFrame.cpp b/Framework/PythonInterface/mantid/geometry/src/Exports/ReferenceFrame.cpp
index be19d8047e4e04829fe7773e7f6ec54823f0f4ab..c8a79ddbbc76e80bf9bf83a2eb08ba863c6b6c7f 100644
--- a/Framework/PythonInterface/mantid/geometry/src/Exports/ReferenceFrame.cpp
+++ b/Framework/PythonInterface/mantid/geometry/src/Exports/ReferenceFrame.cpp
@@ -21,13 +21,14 @@ void export_ReferenceFrame() {
       .export_values();
 
   class_<ReferenceFrame, boost::noncopyable>("ReferenceFrame", no_init)
-      .def("pointingAlongBeam", &ReferenceFrame::pointingAlongBeam)
-      .def("pointingUp", &ReferenceFrame::pointingUp)
-      .def("vecPointingUp", &ReferenceFrame::vecPointingUp)
-      .def("vecPointingAlongBeam", &ReferenceFrame::vecPointingAlongBeam)
-      .def("pointingAlongBeamAxis", &ReferenceFrame::pointingAlongBeamAxis)
-      .def("pointingUpAxis", &ReferenceFrame::pointingUpAxis)
-      .def("pointingHorizontalAxis", &ReferenceFrame::pointingHorizontalAxis)
-
-      ;
+      .def("pointingAlongBeam", &ReferenceFrame::pointingAlongBeam, arg("self"))
+      .def("pointingUp", &ReferenceFrame::pointingUp, arg("self"))
+      .def("vecPointingUp", &ReferenceFrame::vecPointingUp, arg("self"))
+      .def("vecPointingAlongBeam", &ReferenceFrame::vecPointingAlongBeam,
+           arg("self"))
+      .def("pointingAlongBeamAxis", &ReferenceFrame::pointingAlongBeamAxis,
+           arg("self"))
+      .def("pointingUpAxis", &ReferenceFrame::pointingUpAxis, arg("self"))
+      .def("pointingHorizontalAxis", &ReferenceFrame::pointingHorizontalAxis,
+           arg("self"));
 }
diff --git a/Framework/PythonInterface/mantid/geometry/src/Exports/SpaceGroup.cpp b/Framework/PythonInterface/mantid/geometry/src/Exports/SpaceGroup.cpp
index 9b83cabe216135b66e9d7a04c8aa141c5c0c5282..919d784341e24fcb868e2eff89e92e5523843112 100644
--- a/Framework/PythonInterface/mantid/geometry/src/Exports/SpaceGroup.cpp
+++ b/Framework/PythonInterface/mantid/geometry/src/Exports/SpaceGroup.cpp
@@ -53,16 +53,19 @@ void export_SpaceGroup() {
   register_ptr_to_python<boost::shared_ptr<SpaceGroup>>();
 
   class_<SpaceGroup, boost::noncopyable, bases<Group>>("SpaceGroup", no_init)
-      .def("getNumber", &SpaceGroup::number)
-      .def("getHMSymbol", &SpaceGroup::hmSymbol)
+      .def("getNumber", &SpaceGroup::number, arg("self"))
+      .def("getHMSymbol", &SpaceGroup::hmSymbol, arg("self"))
       .def("getEquivalentPositions", &getEquivalentPositions,
+           (arg("self"), arg("point")),
            "Returns an array with all symmetry equivalents of the supplied "
            "HKL.")
       .def("isAllowedReflection", &isAllowedReflection,
+           (arg("self"), arg("hkl")),
            "Returns True if the supplied reflection is allowed with respect to "
            "space group symmetry operations.")
-      .def("getPointGroup", &SpaceGroup::getPointGroup,
+      .def("getPointGroup", &SpaceGroup::getPointGroup, arg("self"),
            "Returns the point group of the space group.")
       .def("getSiteSymmetryGroup", &getSiteSymmetryGroup,
+           (arg("self"), arg("position")),
            "Returns the site symmetry group for supplied point coordinates.");
 }
diff --git a/Framework/PythonInterface/mantid/geometry/src/Exports/SpaceGroupFactory.cpp b/Framework/PythonInterface/mantid/geometry/src/Exports/SpaceGroupFactory.cpp
index 365d6e02a78ba2b35863b83effebb5d24cca5fe1..2b0a5b54e8302334ba9785e5c532f2d6dd51c2b8 100644
--- a/Framework/PythonInterface/mantid/geometry/src/Exports/SpaceGroupFactory.cpp
+++ b/Framework/PythonInterface/mantid/geometry/src/Exports/SpaceGroupFactory.cpp
@@ -45,19 +45,24 @@ void export_SpaceGroupFactory() {
   class_<SpaceGroupFactoryImpl, boost::noncopyable>("SpaceGroupFactoryImpl",
                                                     no_init)
       .def("isSubscribedSymbol", &isSubscribedSymbol,
+           (arg("self"), arg("symbol")),
            "Returns true if the space group the supplied symbol is subscribed.")
       .def("isSubscribedNumber", &isSubscribedNumber,
+           (arg("self"), arg("number")),
            "Returns true if a space group with the given number is subscribed.")
-      .def("createSpaceGroup", &createSpaceGroup, "Creates a space group.")
-      .def("getAllSpaceGroupSymbols", &allSpaceGroupSymbols,
+      .def("createSpaceGroup", &createSpaceGroup, (arg("self"), arg("symbol")),
+           "Creates a space group.")
+      .def("getAllSpaceGroupSymbols", &allSpaceGroupSymbols, arg("self"),
            "Returns all subscribed space group symbols.")
       .def("getAllSpaceGroupNumbers",
-           &SpaceGroupFactoryImpl::subscribedSpaceGroupNumbers,
+           &SpaceGroupFactoryImpl::subscribedSpaceGroupNumbers, arg("self"),
            "Returns all subscribed space group numbers.")
       .def("subscribedSpaceGroupSymbols", &spaceGroupSymbolsForNumber,
+           (arg("self"), arg("number")),
            "Returns all space group symbols that are registered under the "
            "given number.")
-      .def("getSpaceGroupsForPointGroup", &spaceGroupSymbolsForPointGroup)
+      .def("getSpaceGroupsForPointGroup", &spaceGroupSymbolsForPointGroup,
+           (arg("self"), arg("pointGroup")))
       .def("Instance", &SpaceGroupFactory::Instance,
            return_value_policy<reference_existing_object>(),
            "Returns a reference to the SpaceGroupFactory singleton")
diff --git a/Framework/PythonInterface/mantid/geometry/src/Exports/SymmetryElement.cpp b/Framework/PythonInterface/mantid/geometry/src/Exports/SymmetryElement.cpp
index be79196c0fee3a15bbded1fa0030b42437bef456..f520a92edac03e3880ecc318023e2736efbe506f 100644
--- a/Framework/PythonInterface/mantid/geometry/src/Exports/SymmetryElement.cpp
+++ b/Framework/PythonInterface/mantid/geometry/src/Exports/SymmetryElement.cpp
@@ -42,12 +42,12 @@ void export_SymmetryElement() {
       .value("None", SymmetryElementRotation::None);
 
   class_<SymmetryElement, boost::noncopyable>("SymmetryElement", no_init)
-      .def("getHMSymbol", &SymmetryElement::hmSymbol,
+      .def("getHMSymbol", &SymmetryElement::hmSymbol, arg("self"),
            "Returns the Hermann-Mauguin symbol for the element.")
-      .def("getAxis", &getAxis, "Returns the symmetry axis or [0,0,0] for "
-                                "identiy, inversion and translations.")
-      .def("getRotationSense", &getRotationSense,
-           "Returns the rotation sense"
-           "of a rotation axis or None"
+      .def("getAxis", &getAxis, arg("self"),
+           "Returns the symmetry axis or [0,0,0] for "
+           "identiy, inversion and translations.")
+      .def("getRotationSense", &getRotationSense, arg("self"),
+           "Returns the rotation sense of a rotation axis or None"
            "if the element is not a rotation.");
 }
diff --git a/Framework/PythonInterface/mantid/geometry/src/Exports/SymmetryElementFactory.cpp b/Framework/PythonInterface/mantid/geometry/src/Exports/SymmetryElementFactory.cpp
index 59db23c9a35c62af611787e2ac2dc1b17e056fde..5804ab01d36d8075314e745c262736fbfa215372 100644
--- a/Framework/PythonInterface/mantid/geometry/src/Exports/SymmetryElementFactory.cpp
+++ b/Framework/PythonInterface/mantid/geometry/src/Exports/SymmetryElementFactory.cpp
@@ -9,6 +9,7 @@ void export_SymmetryElementFactory() {
   class_<SymmetryElementFactoryImpl, boost::noncopyable>(
       "SymmetryElementFactoryImpl", no_init)
       .def("createSymElement", &SymmetryElementFactoryImpl::createSymElement,
+           (arg("self"), arg("operation")),
            "Creates the symmetry element that corresponds to the supplied "
            "symmetry operation.")
       .def("Instance", &SymmetryElementFactory::Instance,
diff --git a/Framework/PythonInterface/mantid/geometry/src/Exports/SymmetryOperation.cpp b/Framework/PythonInterface/mantid/geometry/src/Exports/SymmetryOperation.cpp
index 180a9153aa917276f8037cf9c0e0d1d8943dd0d7..d20617ea9576b16d6affdb008c4cb89aeb5beb1b 100644
--- a/Framework/PythonInterface/mantid/geometry/src/Exports/SymmetryOperation.cpp
+++ b/Framework/PythonInterface/mantid/geometry/src/Exports/SymmetryOperation.cpp
@@ -34,19 +34,21 @@ void export_SymmetryOperation() {
   register_ptr_to_python<boost::shared_ptr<SymmetryOperation>>();
 
   class_<SymmetryOperation>("SymmetryOperation")
-      .def("getOrder", &SymmetryOperation::order,
+      .def("getOrder", &SymmetryOperation::order, arg("self"),
            "Returns the order of the symmetry operation, which indicates how "
            "often the operation needs to be applied to a point to arrive at "
            "identity.")
-      .def("getIdentifier", &SymmetryOperation::identifier,
+      .def("getIdentifier", &SymmetryOperation::identifier, arg("self"),
            "The identifier of the operation in x,y,z-notation.")
       .def("transformCoordinates", &applyToCoordinates,
+           (arg("self"), arg("coordinates")),
            "Returns transformed coordinates. For transforming HKLs, use "
            "transformHKL.")
-      .def("transformHKL", &applyToVector, "Returns transformed HKLs. For "
-                                           "transformation of coordinates use "
-                                           "transformCoordinates.")
-      .def("apply", &applyToVector, "An alias for transformHKL.");
+      .def("transformHKL", &applyToVector, (arg("self"), arg("hkl")),
+           "Returns transformed HKLs. For transformation of coordinates use "
+           "transformCoordinates.")
+      .def("apply", &applyToVector, (arg("self"), arg("hkl")),
+           "An alias for transformHKL.");
 
   std_vector_exporter<Mantid::Geometry::SymmetryOperation>::wrap(
       "std_vector_symmetryoperation");
diff --git a/Framework/PythonInterface/mantid/geometry/src/Exports/SymmetryOperationFactory.cpp b/Framework/PythonInterface/mantid/geometry/src/Exports/SymmetryOperationFactory.cpp
index dc78c2bcd5d569943f0c08956a9802974591fb1d..147ff1e85375cdc32b7c96902b8a1d4fb9ab5104 100644
--- a/Framework/PythonInterface/mantid/geometry/src/Exports/SymmetryOperationFactory.cpp
+++ b/Framework/PythonInterface/mantid/geometry/src/Exports/SymmetryOperationFactory.cpp
@@ -25,14 +25,16 @@ void export_SymmetryOperationFactory() {
   class_<SymmetryOperationFactoryImpl, boost::noncopyable>(
       "SymmetryOperationFactoryImpl", no_init)
       .def("exists", &SymmetryOperationFactoryImpl::isSubscribed,
+           (arg("self"), arg("identifier")),
            "Returns true if the symmetry operation is supplied.")
       .def("createSymOp", &SymmetryOperationFactoryImpl::createSymOp,
+           (arg("self"), arg("identifier")),
            "Creates the symmetry operation from the supplied x,y,z-identifier.")
-      .def("createSymOps", &createSymOps,
+      .def("createSymOps", &createSymOps, (arg("self"), arg("identifier")),
            "Creates a vector of SymmetryOperation objects from a semi-colon "
            "separated list of x,y,z-identifiers.")
       .def("subscribedSymbols",
-           &SymmetryOperationFactoryImpl::subscribedSymbols,
+           &SymmetryOperationFactoryImpl::subscribedSymbols, arg("self"),
            "Return all subscribed symbols.")
       .def("Instance", &SymmetryOperationFactory::Instance,
            return_value_policy<reference_existing_object>(),
diff --git a/Framework/PythonInterface/mantid/geometry/src/Exports/UnitCell.cpp b/Framework/PythonInterface/mantid/geometry/src/Exports/UnitCell.cpp
index 9da36354a38d67012a65986d4586822ff4e7e1a9..326b247bb1c7a501a2711efd64b5728f94ec028a 100644
--- a/Framework/PythonInterface/mantid/geometry/src/Exports/UnitCell.cpp
+++ b/Framework/PythonInterface/mantid/geometry/src/Exports/UnitCell.cpp
@@ -38,103 +38,129 @@ void export_UnitCell() {
       return_readonly_numpy;
 
   class_<UnitCell>("UnitCell", init<>())
-      .def(init<UnitCell const &>(arg("other")))
-      .def(init<double, double, double>((arg("_a"), arg("_b"), arg("_c"))))
+      .def(init<UnitCell const &>((arg("self"), arg("other"))))
+      .def(init<double, double, double>(
+          (arg("self"), arg("_a"), arg("_b"), arg("_c"))))
       .def(init<double, double, double, double, double, double, optional<int>>(
-          (arg("_a"), arg("_b"), arg("_c"), arg("_alpha"), arg("_beta"),
-           arg("_gamma"), arg("Unit") = (int)(angDegrees))))
-      .def("a", (double (UnitCell::*)() const) & UnitCell::a)
-      .def("a1", (double (UnitCell::*)() const) & UnitCell::a1)
-      .def("a2", (double (UnitCell::*)() const) & UnitCell::a2)
-      .def("a3", (double (UnitCell::*)() const) & UnitCell::a3)
-      .def("alpha", (double (UnitCell::*)() const) & UnitCell::alpha)
-      .def("alpha1", (double (UnitCell::*)() const) & UnitCell::alpha1)
-      .def("alpha2", (double (UnitCell::*)() const) & UnitCell::alpha2)
-      .def("alpha3", (double (UnitCell::*)() const) & UnitCell::alpha3)
-      .def("alphastar", (double (UnitCell::*)() const) & UnitCell::alphastar)
-      .def("astar", (double (UnitCell::*)() const) & UnitCell::astar)
-      .def("b", (double (UnitCell::*)() const) & UnitCell::b)
-      .def("b1", (double (UnitCell::*)() const) & UnitCell::b1)
-      .def("b2", (double (UnitCell::*)() const) & UnitCell::b2)
-      .def("b3", (double (UnitCell::*)() const) & UnitCell::b3)
-      .def("beta", (double (UnitCell::*)() const) & UnitCell::beta)
-      .def("beta1", (double (UnitCell::*)() const) & UnitCell::beta1)
-      .def("beta2", (double (UnitCell::*)() const) & UnitCell::beta2)
-      .def("beta3", (double (UnitCell::*)() const) & UnitCell::beta3)
-      .def("betastar", (double (UnitCell::*)() const) & UnitCell::betastar)
-      .def("bstar", (double (UnitCell::*)() const) & UnitCell::bstar)
-      .def("c", (double (UnitCell::*)() const) & UnitCell::c)
-      .def("cstar", (double (UnitCell::*)() const) & UnitCell::cstar)
+          (arg("self"), arg("_a"), arg("_b"), arg("_c"), arg("_alpha"),
+           arg("_beta"), arg("_gamma"), arg("Unit") = (int)(angDegrees))))
+      .def("a", (double (UnitCell::*)() const) & UnitCell::a, arg("self"))
+      .def("a1", (double (UnitCell::*)() const) & UnitCell::a1, arg("self"))
+      .def("a2", (double (UnitCell::*)() const) & UnitCell::a2, arg("self"))
+      .def("a3", (double (UnitCell::*)() const) & UnitCell::a3, arg("self"))
+      .def("alpha", (double (UnitCell::*)() const) & UnitCell::alpha,
+           arg("self"))
+      .def("alpha1", (double (UnitCell::*)() const) & UnitCell::alpha1,
+           arg("self"))
+      .def("alpha2", (double (UnitCell::*)() const) & UnitCell::alpha2,
+           arg("self"))
+      .def("alpha3", (double (UnitCell::*)() const) & UnitCell::alpha3,
+           arg("self"))
+      .def("alphastar", (double (UnitCell::*)() const) & UnitCell::alphastar,
+           arg("self"))
+      .def("astar", (double (UnitCell::*)() const) & UnitCell::astar,
+           arg("self"))
+      .def("b", (double (UnitCell::*)() const) & UnitCell::b, arg("self"))
+      .def("b1", (double (UnitCell::*)() const) & UnitCell::b1, arg("self"))
+      .def("b2", (double (UnitCell::*)() const) & UnitCell::b2, arg("self"))
+      .def("b3", (double (UnitCell::*)() const) & UnitCell::b3, arg("self"))
+      .def("beta", (double (UnitCell::*)() const) & UnitCell::beta, arg("self"))
+      .def("beta1", (double (UnitCell::*)() const) & UnitCell::beta1,
+           arg("self"))
+      .def("beta2", (double (UnitCell::*)() const) & UnitCell::beta2,
+           arg("self"))
+      .def("beta3", (double (UnitCell::*)() const) & UnitCell::beta3,
+           arg("self"))
+      .def("betastar", (double (UnitCell::*)() const) & UnitCell::betastar,
+           arg("self"))
+      .def("bstar", (double (UnitCell::*)() const) & UnitCell::bstar,
+           arg("self"))
+      .def("c", (double (UnitCell::*)() const) & UnitCell::c, arg("self"))
+      .def("cstar", (double (UnitCell::*)() const) & UnitCell::cstar,
+           arg("self"))
       .def("d",
            (double (UnitCell::*)(double, double, double) const) & UnitCell::d,
-           (arg("h"), arg("k"), arg("l")))
+           (arg("self"), arg("h"), arg("k"), arg("l")))
       .def("d", (double (UnitCell::*)(const V3D &) const) & UnitCell::d,
-           (arg("hkl")))
+           (arg("self"), arg("hkl")))
       .def("dstar", (double (UnitCell::*)(double, double, double) const) &
                         UnitCell::dstar,
-           (arg("h"), arg("k"), arg("l")))
-      .def("errora", (double (UnitCell::*)() const) & UnitCell::errora)
-      .def("errorb", (double (UnitCell::*)() const) & UnitCell::errorb)
-      .def("errorc", (double (UnitCell::*)() const) & UnitCell::errorc)
+           (arg("self"), arg("h"), arg("k"), arg("l")))
+      .def("errora", (double (UnitCell::*)() const) & UnitCell::errora,
+           arg("self"))
+      .def("errorb", (double (UnitCell::*)() const) & UnitCell::errorb,
+           arg("self"))
+      .def("errorc", (double (UnitCell::*)() const) & UnitCell::errorc,
+           arg("self"))
       .def("erroralpha",
            (double (UnitCell::*)(int const) const) & UnitCell::erroralpha,
-           (arg("Unit") = (int)(angDegrees)))
+           (arg("self"), arg("Unit") = (int)(angDegrees)))
       .def("errorbeta",
            (double (UnitCell::*)(int const) const) & UnitCell::errorbeta,
-           (arg("Unit") = (int)(angDegrees)))
+           (arg("self"), arg("Unit") = (int)(angDegrees)))
       .def("errorgamma",
            (double (UnitCell::*)(int const) const) & UnitCell::errorgamma,
-           (arg("Unit") = (int)(angDegrees)))
-      .def("gamma", (double (UnitCell::*)() const) & UnitCell::gamma)
-      .def("gammastar", (double (UnitCell::*)() const) & UnitCell::gammastar)
+           (arg("self"), arg("Unit") = (int)(angDegrees)))
+      .def("gamma", (double (UnitCell::*)() const) & UnitCell::gamma,
+           arg("self"))
+      .def("gammastar", (double (UnitCell::*)() const) & UnitCell::gammastar,
+           arg("self"))
       .def("recAngle", (double (UnitCell::*)(double, double, double, double,
                                              double, double, int const) const) &
                            UnitCell::recAngle,
-           (arg("h1"), arg("k1"), arg("l1"), arg("h2"), arg("k2"), arg("l2"),
-            arg("Unit") = (int)(angDegrees)))
-      .def("recVolume", (double (UnitCell::*)() const) & UnitCell::recVolume)
+           (arg("self"), arg("h1"), arg("k1"), arg("l1"), arg("h2"), arg("k2"),
+            arg("l2"), arg("Unit") = (int)(angDegrees)))
+      .def("recVolume", (double (UnitCell::*)() const) & UnitCell::recVolume,
+           arg("self"))
       .def("set", (void (UnitCell::*)(double, double, double, double, double,
                                       double, int const)) &
                       UnitCell::set,
-           (arg("_a"), arg("_b"), arg("_c"), arg("_alpha"), arg("_beta"),
-            arg("_gamma"), arg("Unit") = (int)(angDegrees)))
-      .def("seta", (void (UnitCell::*)(double))(&UnitCell::seta), (arg("_a")))
+           (arg("self"), arg("_a"), arg("_b"), arg("_c"), arg("_alpha"),
+            arg("_beta"), arg("_gamma"), arg("Unit") = (int)(angDegrees)))
+      .def("seta", (void (UnitCell::*)(double))(&UnitCell::seta),
+           (arg("self"), arg("_a")))
       .def("setalpha",
            (void (UnitCell::*)(double, int const))(&UnitCell::setalpha),
-           (arg("_alpha"), arg("Unit") = (int)(angDegrees)))
-      .def("setb", (void (UnitCell::*)(double))(&UnitCell::setb), (arg("_b")))
+           (arg("self"), arg("_alpha"), arg("Unit") = (int)(angDegrees)))
+      .def("setb", (void (UnitCell::*)(double))(&UnitCell::setb),
+           (arg("self"), arg("_b")))
       .def("setbeta",
            (void (UnitCell::*)(double, int const))(&UnitCell::setbeta),
-           (arg("_beta"), arg("Unit") = (int)(angDegrees)))
-      .def("setc", (void (UnitCell::*)(double))(&UnitCell::setc), (arg("_c")))
+           (arg("self"), arg("_beta"), arg("Unit") = (int)(angDegrees)))
+      .def("setc", (void (UnitCell::*)(double))(&UnitCell::setc),
+           (arg("self"), arg("_c")))
       .def("setgamma",
            (void (UnitCell::*)(double, int const))(&UnitCell::setgamma),
-           (arg("_gamma"), arg("Unit") = (int)(angDegrees)))
+           (arg("self"), arg("_gamma"), arg("Unit") = (int)(angDegrees)))
       .def("setError", (void (UnitCell::*)(double, double, double, double,
                                            double, double, int const)) &
                            UnitCell::setError,
-           (arg("_aerr"), arg("_berr"), arg("_cerr"), arg("_alphaerr"),
-            arg("_betaerr"), arg("_gammaerr"), arg("Unit") = (int)(angDegrees)))
+           (arg("self"), arg("_aerr"), arg("_berr"), arg("_cerr"),
+            arg("_alphaerr"), arg("_betaerr"), arg("_gammaerr"),
+            arg("Unit") = (int)(angDegrees)))
       .def("setErrora", (void (UnitCell::*)(double))(&UnitCell::setErrora),
-           (arg("_aerr")))
+           (arg("self"), arg("_aerr")))
       .def("setErroralpha",
            (void (UnitCell::*)(double, int const))(&UnitCell::setErroralpha),
-           (arg("_alphaerr"), arg("Unit") = (int)(angDegrees)))
+           (arg("self"), arg("_alphaerr"), arg("Unit") = (int)(angDegrees)))
       .def("setErrorb", (void (UnitCell::*)(double))(&UnitCell::setErrorb),
-           (arg("_berr")))
+           (arg("self"), arg("_berr")))
       .def("setErrorbeta",
            (void (UnitCell::*)(double, int const))(&UnitCell::setErrorbeta),
-           (arg("_betaerr"), arg("Unit") = (int)(angDegrees)))
+           (arg("self"), arg("_betaerr"), arg("Unit") = (int)(angDegrees)))
       .def("setErrorc", (void (UnitCell::*)(double))(&UnitCell::setErrorc),
-           (arg("_cerr")))
+           (arg("self"), arg("_cerr")))
       .def("setErrorgamma",
            (void (UnitCell::*)(double, int const))(&UnitCell::setErrorgamma),
-           (arg("_gammaerr"), arg("Unit") = (int)(angDegrees)))
-      .def("volume", (double (UnitCell::*)() const) & UnitCell::volume)
-      .def("getG", &UnitCell::getG, return_readonly_numpy())
-      .def("getGstar", &UnitCell::getGstar, return_readonly_numpy())
-      .def("getB", &UnitCell::getB, return_readonly_numpy())
-      .def("recalculateFromGstar", &recalculateFromGstar);
+           (arg("self"), arg("_gammaerr"), arg("Unit") = (int)(angDegrees)))
+      .def("volume", (double (UnitCell::*)() const) & UnitCell::volume,
+           arg("self"))
+      .def("getG", &UnitCell::getG, arg("self"), return_readonly_numpy())
+      .def("getGstar", &UnitCell::getGstar, arg("self"),
+           return_readonly_numpy())
+      .def("getB", &UnitCell::getB, arg("self"), return_readonly_numpy())
+      .def("recalculateFromGstar", &recalculateFromGstar,
+           (arg("self"), arg("NewGstar")));
 
   scope().attr("deg2rad") = Mantid::Geometry::deg2rad;
   scope().attr("rad2deg") = Mantid::Geometry::rad2deg;
diff --git a/Framework/PythonInterface/mantid/kernel/src/Exports/ConfigService.cpp b/Framework/PythonInterface/mantid/kernel/src/Exports/ConfigService.cpp
index 61163771c9d2d3e88a73a25de32ab62e32c6cecb..22a6c099010b426e969319b0d978d85180b45722 100644
--- a/Framework/PythonInterface/mantid/kernel/src/Exports/ConfigService.cpp
+++ b/Framework/PythonInterface/mantid/kernel/src/Exports/ConfigService.cpp
@@ -28,11 +28,20 @@ std::string getStringUsingCache(ConfigServiceImpl &self,
   return self.getString(key, true);
 }
 
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunknown-pragmas"
+#pragma clang diagnostic ignored "-Wunused-local-typedef"
+#endif
+
 /// Overload generator for getInstrument
 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(getInstrument_Overload, getInstrument, 0,
                                        1)
 /// Overload generator for getString
 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(getString_Overload, getString, 1, 2)
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
 }
 
 void export_ConfigService() {
diff --git a/Framework/PythonInterface/mantid/kernel/src/Exports/Statistics.cpp b/Framework/PythonInterface/mantid/kernel/src/Exports/Statistics.cpp
index 3cfaf72e9ec1d44d7e3816714d8a8d30c5f98de4..d2f9494ae0059a2f4839abd506fcf8da627f4c0c 100644
--- a/Framework/PythonInterface/mantid/kernel/src/Exports/Statistics.cpp
+++ b/Framework/PythonInterface/mantid/kernel/src/Exports/Statistics.cpp
@@ -93,10 +93,18 @@ Statistics getStatisticsNumpy(const numeric::array &data,
     throw UnknownDataType();
   }
 }
+
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunknown-pragmas"
+#pragma clang diagnostic ignored "-Wunused-local-typedef"
+#endif
 // Define an overload to handle the default argument
 BOOST_PYTHON_FUNCTION_OVERLOADS(getStatisticsOverloads, getStatisticsNumpy, 1,
                                 2)
-
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
 //============================ Z score
 //============================================
 
@@ -145,9 +153,17 @@ std::vector<double> getModifiedZscoreNumpy(const numeric::array &data,
   }
 }
 
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunknown-pragmas"
+#pragma clang diagnostic ignored "-Wunused-local-typedef"
+#endif
 // Define an overload to handle the default argument
 BOOST_PYTHON_FUNCTION_OVERLOADS(getModifiedZscoreOverloads,
                                 getModifiedZscoreNumpy, 1, 2)
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
 
 //============================ getMoments
 //============================================
@@ -198,10 +214,17 @@ std::vector<double> getMomentsAboutOriginNumpy(const numeric::array &indep,
   return getMomentsNumpyImpl(&getMomentsAboutOrigin, indep, depend, maxMoment);
 }
 
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunknown-pragmas"
+#pragma clang diagnostic ignored "-Wunused-local-typedef"
+#endif
 // Define an overload to handle the default argument
 BOOST_PYTHON_FUNCTION_OVERLOADS(getMomentsAboutOriginOverloads,
                                 getMomentsAboutOriginNumpy, 2, 3)
-
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
 /**
  * Proxy for @see Mantid::Kernel::getMomentsAboutMean so that it can accept
  * numpy arrays
@@ -213,9 +236,18 @@ std::vector<double> getMomentsAboutMeanNumpy(const numeric::array &indep,
   return getMomentsNumpyImpl(&getMomentsAboutMean, indep, depend, maxMoment);
 }
 
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunknown-pragmas"
+#pragma clang diagnostic ignored "-Wunused-local-typedef"
+#endif
 // Define an overload to handle the default argument
 BOOST_PYTHON_FUNCTION_OVERLOADS(getMomentsAboutMeanOverloads,
                                 getMomentsAboutMeanNumpy, 2, 3)
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
 ///@endcond
 }
 
diff --git a/Framework/PythonInterface/plugins/algorithms/LoadVesuvio.py b/Framework/PythonInterface/plugins/algorithms/LoadVesuvio.py
index e587a1bfdef0c883ffd6d29d8e7955c34d6b0dfe..477cf69705777a9ce74bfb877129a6023557327e 100644
--- a/Framework/PythonInterface/plugins/algorithms/LoadVesuvio.py
+++ b/Framework/PythonInterface/plugins/algorithms/LoadVesuvio.py
@@ -132,6 +132,20 @@ class LoadVesuvio(LoadEmptyVesuvio):
         else:
             self._exec_single_foil_state_mode()
 
+#----------------------------------------------------------------------------------------
+
+    def validateInputs(self):
+        issues = {}
+
+        # Validtae run number ranges
+        run_str = self.getProperty(RUN_PROP).value
+        if "-" in run_str:
+            lower, upper = run_str.split("-")
+            if upper < lower:
+                issues[RUN_PROP] = "Range must be in format lower-upper"
+
+        return issues
+
 #----------------------------------------------------------------------------------------
 
     def _exec_difference_mode(self):
@@ -346,24 +360,42 @@ class LoadVesuvio(LoadEmptyVesuvio):
             if index == 0:
                 out_name, out_mon = SUMMED_WS, SUMMED_MON
             else:
-                out_name, out_mon = SUMMED_WS+'tmp', SUMMED_MON + 'tmp'
+                out_name, out_mon = SUMMED_WS + 'tmp', SUMMED_MON + 'tmp'
+
             # Load data
-            ms.LoadRaw(Filename=run, SpectrumList=spectra,
-                       OutputWorkspace=out_name, LoadMonitors='Exclude',EnableLogging=_LOGGING_)
-            ms.LoadRaw(Filename=run,SpectrumList=self._mon_spectra,
-                       OutputWorkspace=out_mon,EnableLogging=_LOGGING_)
-            if index > 0: # sum
-                ms.Plus(LHSWorkspace=SUMMED_WS, RHSWorkspace=out_name,
-                        OutputWorkspace=SUMMED_WS,EnableLogging=_LOGGING_)
-                ms.Plus(LHSWorkspace=SUMMED_MON, RHSWorkspace=out_mon,
-                        OutputWorkspace=SUMMED_MON,EnableLogging=_LOGGING_)
-                ms.DeleteWorkspace(out_name,EnableLogging=_LOGGING_)
-                ms.DeleteWorkspace(out_mon,EnableLogging=_LOGGING_)
-
-        ms.CropWorkspace(Inputworkspace= SUMMED_WS, OutputWorkspace= SUMMED_WS,
-                         XMax=self._tof_max,EnableLogging=_LOGGING_)
-        ms.CropWorkspace(Inputworkspace= SUMMED_MON, OutputWorkspace= SUMMED_MON,
-                         XMax=self._mon_tof_max, EnableLogging=_LOGGING_)
+            ms.LoadRaw(Filename=run,
+                       SpectrumList=spectra,
+                       OutputWorkspace=out_name,
+                       LoadMonitors='Exclude',
+                       EnableLogging=_LOGGING_)
+            ms.LoadRaw(Filename=run,
+                       SpectrumList=self._mon_spectra,
+                       OutputWorkspace=out_mon,
+                       EnableLogging=_LOGGING_)
+
+            # Sum
+            if index > 0:
+                ms.Plus(LHSWorkspace=SUMMED_WS,
+                        RHSWorkspace=out_name,
+                        OutputWorkspace=SUMMED_WS,
+                        EnableLogging=_LOGGING_)
+                ms.Plus(LHSWorkspace=SUMMED_MON,
+                        RHSWorkspace=out_mon,
+                        OutputWorkspace=SUMMED_MON,
+                        EnableLogging=_LOGGING_)
+
+                ms.DeleteWorkspace(out_name, EnableLogging=_LOGGING_)
+                ms.DeleteWorkspace(out_mon, EnableLogging=_LOGGING_)
+
+        ms.CropWorkspace(Inputworkspace= SUMMED_WS,
+                         OutputWorkspace=SUMMED_WS,
+                         XMax=self._tof_max,
+                         EnableLogging=_LOGGING_)
+        ms.CropWorkspace(Inputworkspace= SUMMED_MON,
+                         OutputWorkspace=SUMMED_MON,
+                         XMax=self._mon_tof_max,
+                         EnableLogging=_LOGGING_)
+
         return mtd[SUMMED_WS], mtd[SUMMED_MON]
 
 #----------------------------------------------------------------------------------------
@@ -375,9 +407,9 @@ class LoadVesuvio(LoadEmptyVesuvio):
         run_str = self.getProperty(RUN_PROP).value
         # Load is not doing the right thing when summing. The numbers don't look correct
         if "-" in run_str:
-            lower,upper =  run_str.split("-")
+            lower, upper = run_str.split("-")
             # Range goes lower to up-1 but we want to include the last number
-            runs = range(int(lower),int(upper)+1)
+            runs = range(int(lower), int(upper)+1)
 
         elif "," in run_str:
             runs =  run_str.split(",")
diff --git a/Framework/PythonInterface/plugins/algorithms/PDToPDFgetN.py b/Framework/PythonInterface/plugins/algorithms/PDToPDFgetN.py
new file mode 100644
index 0000000000000000000000000000000000000000..db6819bf1d05cb23dc7ed144a29799ca64e6b257
--- /dev/null
+++ b/Framework/PythonInterface/plugins/algorithms/PDToPDFgetN.py
@@ -0,0 +1,143 @@
+#pylint: disable=no-init
+from mantid.simpleapi import *
+from mantid.api import *
+from mantid.kernel import Direction, FloatArrayProperty
+import mantid
+
+COMPRESS_TOL_TOF = .01
+
+
+class PDToPDFgetN(DataProcessorAlgorithm):
+    _focusPos = {}
+    _iparmFile = None
+
+    def category(self):
+        return "Workflow\\Diffraction;PythonAlgorithms"
+
+    def name(self):
+        return "PDToPDFgetN"
+
+    def summary(self):
+        return "The algorithm used converting raw data to pdfgetn input files"
+
+    def PyInit(self):
+        group = "Input"
+        self.declareProperty(FileProperty(name="Filename",
+                                          defaultValue="", action=FileAction.Load,
+                                          extensions=["_event.nxs", ".nxs.h5"]),
+                             "Event file")
+        self.declareProperty("MaxChunkSize", 0.0,
+                             "Specify maximum Gbytes of file to read in one chunk.  Default is whole file.")
+        self.declareProperty("FilterBadPulses", 95.,
+                             doc="Filter out events measured while proton " +
+                             "charge is more than 5% below average")
+
+        self.declareProperty(MatrixWorkspaceProperty("InputWorkspace", "",
+                                                     direction=Direction.Input,
+                                                     optional=PropertyMode.Optional),
+                             doc="Handle to reduced workspace")
+        self.setPropertyGroup("Filename", group)
+        self.setPropertyGroup("MaxChunkSize", group)
+        self.setPropertyGroup("FilterBadPulses", group)
+        self.setPropertyGroup("InputWorkspace", group)
+
+        group = "Output"
+        self.declareProperty(MatrixWorkspaceProperty("OutputWorkspace", "",
+                                                     direction=Direction.Output),
+                             doc="Handle to reduced workspace")
+        self.declareProperty(FileProperty(name="PDFgetNFile", defaultValue="", action=FileAction.Save,
+                                          extensions=[".getn"]), "Output filename")
+        self.setPropertyGroup("OutputWorkspace", group)
+        self.setPropertyGroup("PDFgetNFile", group)
+
+        self.declareProperty(FileProperty(name="CalibrationFile",
+                                          defaultValue="", action=FileAction.OptionalLoad,
+                                          extensions=[".h5", ".hd5", ".hdf", ".cal"]))
+        self.declareProperty(FileProperty(name="CharacterizationRunsFile", defaultValue="",
+                                          action=FileAction.OptionalLoad,
+                                          extensions=["txt"]),
+                             "File with characterization runs denoted")
+
+        self.declareProperty("RemovePromptPulseWidth", 0.0,
+                             "Width of events (in microseconds) near the prompt pulse to remove. 0 disables")
+        self.declareProperty("CropWavelengthMin", 0.,
+                             "Crop the data at this minimum wavelength.")
+        self.declareProperty("CropWavelengthMax", 0.,
+                             "Crop the data at this maximum wavelength.")
+
+        self.declareProperty(FloatArrayProperty("Binning", values=[0., 0., 0.],
+                             direction=Direction.Input), "Positive is linear bins, negative is logorithmic")
+        self.declareProperty("ResampleX", 0,
+                             "Number of bins in x-axis. Non-zero value overrides \"Params\" property. " +
+                             "Negative value means logorithmic binning.")
+
+    def _loadCharacterizations(self):
+        self._focusPos = {}
+        self._iparmFile = None
+
+        charFilename = self.getProperty("CharacterizationRunsFile").value
+
+        if charFilename is None or len(charFilename) <= 0:
+            return
+
+        results = PDLoadCharacterizations(Filename=charFilename,
+                                          OutputWorkspace="characterizations")
+        self._iparmFile = results[1]
+        self._focusPos['PrimaryFlightPath'] = results[2]
+        self._focusPos['SpectrumIDs'] = results[3]
+        self._focusPos['L2'] = results[4]
+        self._focusPos['Polar'] = results[5]
+        self._focusPos['Azimuthal'] = results[6]
+
+    def PyExec(self):
+        self._loadCharacterizations()
+
+        wksp = self.getProperty("InputWorkspace").value
+        if wksp is None:
+            wksp = LoadEventAndCompress(Filename=self.getProperty("Filename").value,
+                                        OutputWorkspace=self.getPropertyValue("OutputWorkspace"),
+                                        MaxChunkSize=self.getProperty("MaxChunkSize").value,
+                                        FilterBadPulses=self.getProperty("FilterBadPulses").value,
+                                        CompressTOFTolerance=COMPRESS_TOL_TOF)
+        else:
+            self.log().information("Using input workspace. Ignoring properties 'Filename', " +
+                                   "'OutputWorkspace', 'MaxChunkSize', and 'FilterBadPulses'")
+
+        charac = ""
+        if mtd.doesExist("characterizations"):
+            charac = "characterizations"
+
+        # get the correct row of the table
+        PDDetermineCharacterizations(InputWorkspace=wksp,
+                                     Characterizations=charac,
+                                     ReductionProperties="__snspowderreduction")
+
+        wksp = AlignAndFocusPowder(InputWorkspace=wksp, OutputWorkspace=wksp,
+                                   CalFileName=self.getProperty("CalibrationFile").value,
+                                   Params=self.getProperty("Binning").value,
+                                   ResampleX=self.getProperty("ResampleX").value, Dspacing=True,
+                                   PreserveEvents=False,
+                                   RemovePromptPulseWidth=self.getProperty("RemovePromptPulseWidth").value,
+                                   CompressTolerance=COMPRESS_TOL_TOF,
+                                   CropWavelengthMin=self.getProperty("CropWavelengthMin").value,
+                                   CropWavelengthMax=self.getProperty("CropWavelengthMax").value,
+                                   ReductionProperties="__snspowderreduction",
+                                   **(self._focusPos))
+        wksp = NormaliseByCurrent(InputWorkspace=wksp, OutputWorkspace=wksp)
+        wksp.getRun()['gsas_monitor'] = 1
+        if self._iparmFile is not None:
+            wksp.getRun()['iparm_file'] = self._iparmFile
+
+        wksp = SetUncertainties(InputWorkspace=wksp, OutputWorkspace=wksp,
+                                SetError="sqrt")
+        SaveGSS(InputWorkspace=wksp,
+                Filename=self.getProperty("PDFgetNFile").value,
+                SplitFiles=False, Append=False,
+                MultiplyByBinWidth=False,
+                Bank=mantid.pmds["__snspowderreduction"]["bank"].value,
+                Format="SLOG", ExtendedHeader=True)
+
+        self.setProperty("OutputWorkspace", wksp)
+
+# Register algorithm with Mantid.
+AlgorithmFactory.subscribe(PDToPDFgetN)
diff --git a/Framework/PythonInterface/plugins/algorithms/SavePlot1DAsJson.py b/Framework/PythonInterface/plugins/algorithms/SavePlot1DAsJson.py
index f52fad8cdc115c57000329048628b138798af648..7bc6cc433707c03185ec1ec1402151f124a6de45 100644
--- a/Framework/PythonInterface/plugins/algorithms/SavePlot1DAsJson.py
+++ b/Framework/PythonInterface/plugins/algorithms/SavePlot1DAsJson.py
@@ -1,4 +1,4 @@
-#pylint: disable=no-init,unused-variable
+#pylint: disable=no-init,unused-variable,invalid-name,bare-except
 from mantid.api import *
 from mantid.kernel import *
 
@@ -76,30 +76,47 @@ class SavePlot1DAsJson(PythonAlgorithm):
         return
 
     def _serialize(self, workspace, plotname):
-        wname = plotname or workspace.getName()
+        pname = plotname or workspace.getName()
         # init dictionary
         ishist = workspace.isHistogramData()
         plottype = "histogram" if ishist else "point"
-        serialized = {"type": plottype}
-        # helper
-        label = lambda axis: "%s (%s)" % (
-            axis.getUnit().caption(),
-            axis.getUnit().symbol() or 1,
+        serialized = dict(
+            type = plottype,
+            data = dict(),
             )
         # loop over spectra
         for i in range(workspace.getNumberHistograms()):
-            k = "%s%s" % (wname, i)
-            value = dict(
-                x=list(workspace.readX(i)),
-                y=list(workspace.readY(i)),
-                e=list(workspace.readE(i)),
-                xlabel=label(workspace.getAxis(0)),
-                ylabel=label(workspace.getAxis(1)),
-                title="long title of %s" % k,
-                )
-            serialized[k] = value
+            spectrum_no = workspace.getSpectrum(i).getSpectrumNo()
+            # Why do we need label?
+            # label = "%s_spectrum_%d" % (pname, spectrum_no)
+            # labels.append(label)
+            # or title?
+            # title = "%s - spectrum %d" % (workspace.getTitle(), spectrum_no)
+            arr = [
+                list(workspace.readX(i)),
+                list(workspace.readY(i)),
+                list(workspace.readE(i)),
+                ]
+            serialized['data'][spectrum_no] = arr
             continue
-        return serialized
+        # axes
+        # .. helper
+        label = lambda axis: axis.getUnit().caption()
+        def unit(axis):
+            s = axis.getUnit().symbol()
+            try:
+                return s.latex()
+            except:
+                return '%s' % s
+        axes = dict(
+            xlabel=label(workspace.getAxis(0)),
+            ylabel=label(workspace.getAxis(1)),
+            xunit = unit(workspace.getAxis(0)),
+            # yunit = unit(workspace.getAxis(1)),
+            yunit = workspace.YUnitLabel(),
+            )
+        serialized['axes'] = axes
+        return {pname: serialized}
 
 
 # Register algorithm with Mantid
diff --git a/Framework/PythonInterface/plugins/algorithms/TOFTOFCropWorkspace.py b/Framework/PythonInterface/plugins/algorithms/TOFTOFCropWorkspace.py
new file mode 100644
index 0000000000000000000000000000000000000000..c7c6f387adb444ff9c0b0ded8ac87c33c0f3bd99
--- /dev/null
+++ b/Framework/PythonInterface/plugins/algorithms/TOFTOFCropWorkspace.py
@@ -0,0 +1,70 @@
+from mantid.api import PythonAlgorithm, AlgorithmFactory, WorkspaceProperty    # , WorkspaceUnitValidator
+from mantid.kernel import Direction
+import mantid.simpleapi as api
+
+
+class TOFTOFCropWorkspace(PythonAlgorithm):
+    """ Crop empty time channels
+    """
+    def __init__(self):
+        PythonAlgorithm.__init__(self)
+
+    def category(self):
+        """ Return category
+        """
+        return "PythonAlgorithms\\MLZ\\TOFTOF;Utility"
+
+    def name(self):
+        """ Return summary
+        """
+        return "TOFTOFCropWorkspace"
+
+    def summary(self):
+        return "Crop empty time channels."
+
+    def PyInit(self):
+        """ Declare properties
+        """
+        # better would be to use the validator, but it fails if WorkspaceGroup is given as an input
+        # self.declareProperty(WorkspaceProperty("InputWorkspace", "", direction=Direction.Input,
+        #                                       validator=WorkspaceUnitValidator('TOF')),
+        #                     doc="Input workspace.")
+        self.declareProperty(WorkspaceProperty("InputWorkspace", "", direction=Direction.Input),
+                             doc="Input workspace.")
+        self.declareProperty(WorkspaceProperty("OutputWorkspace", "", direction=Direction.Output),
+                             doc="Name of the workspace that will contain the results")
+        return
+
+    def validateInputs(self):
+        issues = dict()
+        input_workspace = self.getProperty("InputWorkspace").value
+
+        xunit = input_workspace.getAxis(0).getUnit().unitID()
+        if xunit != 'TOF':
+            issues['InputWorkspace'] = "X axis units must be TOF. "
+
+        # check for required properties
+        run = input_workspace.getRun()
+        if not run.hasProperty('channel_width'):
+            issues['InputWorkspace'] = "Input workpsace must have sample log channel_width."
+        if not run.hasProperty('full_channels'):
+            issues['InputWorkspace'] = "Input workpsace must have sample log full_channels."
+
+        return issues
+
+    def PyExec(self):
+        """ Main execution body
+        """
+        inputws = self.getProperty("InputWorkspace").value
+        outputws = self.getProperty("OutputWorkspace").value
+
+        run = inputws.getRun()
+        channel_width = float(run.getLogData('channel_width').value)
+        full_channels = float(run.getLogData('full_channels').value)
+
+        outputws = api.CropWorkspace(inputws, XMin=0., XMax=full_channels*channel_width, OutputWorkspace=outputws)
+        self.setProperty("OutputWorkspace", outputws)
+
+
+# Register algorithm with Mantid.
+AlgorithmFactory.subscribe(TOFTOFCropWorkspace)
diff --git a/Framework/PythonInterface/plugins/algorithms/TOFTOFMergeRuns.py b/Framework/PythonInterface/plugins/algorithms/TOFTOFMergeRuns.py
new file mode 100644
index 0000000000000000000000000000000000000000..443a8249b46b60ca036b0bec1e6482e55d983c88
--- /dev/null
+++ b/Framework/PythonInterface/plugins/algorithms/TOFTOFMergeRuns.py
@@ -0,0 +1,191 @@
+from mantid.kernel import Direction, StringArrayProperty, StringArrayLengthValidator
+from mantid.api import PythonAlgorithm, AlgorithmFactory, WorkspaceProperty, WorkspaceGroup
+import mantid.simpleapi as api
+import numpy as np
+from dateutil.parser import parse
+import mlzutils
+
+
+class TOFTOFMergeRuns(PythonAlgorithm):
+    """ Clean the Sample Logs of workspace after merging for TOFTOF instrument
+    """
+
+    mandatory_properties = ['channel_width', 'chopper_ratio', 'chopper_speed', 'Ei', 'wavelength', 'full_channels', 'EPP']
+    optional_properties = ['temperature', 'run_title']
+    properties_to_merge = ['temperature', 'monitor_counts', 'duration', 'run_number', 'run_start', 'run_end']
+    must_have_properties = ['monitor_counts', 'duration', 'run_number', 'run_start', 'run_end']
+
+    def __init__(self):
+        """
+        Init
+        """
+        PythonAlgorithm.__init__(self)
+
+    def category(self):
+        """ Return category
+        """
+        return "PythonAlgorithms\\MLZ\\TOFTOF;Utility"
+
+    def name(self):
+        """ Return summary
+        """
+        return "TOFTOFMergeRuns"
+
+    def summary(self):
+        return "Merge runs and the sample logs."
+
+    def PyInit(self):
+        """ Declare properties
+        """
+        validator = StringArrayLengthValidator()
+        validator.setLengthMin(1)
+        self.declareProperty(StringArrayProperty(name="InputWorkspaces", direction=Direction.Input, validator=validator),
+                             doc="Comma separated list of workspaces or groups of workspaces.")
+        self.declareProperty(WorkspaceProperty("OutputWorkspace", "", direction=Direction.Output),
+                             doc="Name of the workspace that will contain the merged workspaces.")
+        return
+
+    def _validate_input(self):
+        """
+        Checks for the valid input:
+            all given workspaces and/or groups must exist
+            gets names of the grouped workspaces
+        """
+        workspaces = self.getProperty("InputWorkspaces").value
+        mlzutils.ws_exist(workspaces, self.log())
+        input_workspaces = []
+        if len(workspaces) < 1:
+            message = "List of workspaces is empty. Nothing to merge."
+            self.log().error(message)
+            raise RuntimeError(message)
+        for wsname in workspaces:
+            wks = api.AnalysisDataService.retrieve(wsname)
+            if isinstance(wks, WorkspaceGroup):
+                input_workspaces.extend(wks.getNames())
+            else:
+                input_workspaces.append(wsname)
+        return input_workspaces
+
+    def _can_merge(self, wsnames):
+        """
+        Checks whether given workspaces can be merged
+        """
+        # mandatory properties must be identical
+        mlzutils.compare_mandatory(wsnames, self.mandatory_properties, self.log())
+
+        # timing (x-axis binning) must match
+        # is it possible to use WorkspaceHelpers::matchingBins from python?
+        self.timingsMatch(wsnames)
+
+        # Check sample logs for must have properties
+        for wsname in wsnames:
+            wks = api.AnalysisDataService.retrieve(wsname)
+            run = wks.getRun()
+            for prop in self.must_have_properties:
+                if not run.hasProperty(prop):
+                    message = "Error: Workspace " + wsname + " does not have property " + prop +\
+                        ". Cannot merge."
+                    self.log().error(message)
+                    raise RuntimeError(message)
+
+        # warnig if optional properties are not identical must be given
+        ws1 = api.AnalysisDataService.retrieve(wsnames[0])
+        run1 = ws1.getRun()
+        for wsname in wsnames[1:]:
+            wks = api.AnalysisDataService.retrieve(wsname)
+            run = wks.getRun()
+            mlzutils.compare_properties(run1, run, self.optional_properties, self.log(), tolerance=0.01)
+        return True
+
+    def PyExec(self):
+        """ Main execution body
+        """
+        # get list of input workspaces
+        input_workspace_list = self._validate_input()
+        workspaceCount = len(input_workspace_list)
+        self.log().information("Workspaces to merge " + str(workspaceCount))
+        wsOutput = self.getPropertyValue("OutputWorkspace")
+
+        if workspaceCount < 2:
+            api.CloneWorkspace(InputWorkspace=self.wsNames[0], OutputWorkspace=wsOutput)
+            self.log().warning("Cannot merge one workspace. Clone is produced.")
+            return
+
+        # check whether given workspaces can be merged
+        self._can_merge(input_workspace_list)
+
+        # delete output workspace if it exists
+        if api.mtd.doesExist(wsOutput):
+            api.DeleteWorkspace(Workspace=wsOutput)
+
+        #  Merge runs
+        api.MergeRuns(InputWorkspaces=input_workspace_list, OutputWorkspace=wsOutput)
+
+        # Merge logs
+        # MergeRuns by default copies all logs from the first workspace
+        pdict = {}
+        for prop in self.properties_to_merge:
+            pdict[prop] = []
+
+        for wsname in input_workspace_list:
+            wks = api.AnalysisDataService.retrieve(wsname)
+            run = wks.getRun()
+            for prop in self.properties_to_merge:
+                if run.hasProperty(prop):
+                    pdict[prop].append(run.getProperty(prop).value)
+
+        # take average for temperatures
+        nentries = len(pdict['temperature'])
+        if nentries > 0:
+            temps = [float(temp) for temp in pdict['temperature']]
+            tmean = sum(temps)/nentries
+            api.AddSampleLog(Workspace=wsOutput, LogName='temperature', LogText=str(tmean),
+                             LogType='Number', LogUnit='K')
+        # sum monitor counts
+        mcounts = [int(mco) for mco in pdict['monitor_counts']]
+        # check for zero monitor counts
+        zeros = np.where(np.array(mcounts) == 0)[0]
+        if len(zeros) > 0:
+            for index in zeros:
+                self.log().warning("Workspace " + self.wsNames[index] + " has zero monitor counts.")
+        # create sample log
+        api.AddSampleLog(Workspace=wsOutput, LogName='monitor_counts', LogText=str(sum(mcounts)),
+                         LogType='Number')
+        # sum durations
+        durations = [int(dur) for dur in pdict['duration']]
+        api.AddSampleLog(Workspace=wsOutput, LogName='duration', LogText=str(sum(durations)),
+                         LogType='Number', LogUnit='s')
+        # get minimal run_start
+        fmt = "%Y-%m-%dT%H:%M:%S%z"
+        run_start = [parse(entry) for entry in pdict['run_start']]
+        api.AddSampleLog(Workspace=wsOutput, LogName='run_start',
+                         LogText=min(run_start).strftime(fmt), LogType='String')
+        # get maximal run_end
+        run_end = [parse(entry) for entry in pdict['run_end']]
+        api.AddSampleLog(Workspace=wsOutput, LogName='run_end',
+                         LogText=max(run_end).strftime(fmt), LogType='String')
+        # list of run_numbers
+        api.AddSampleLog(Workspace=wsOutput, LogName='run_number',
+                         LogText=str(pdict['run_number']), LogType='String')
+
+        self.setProperty("OutputWorkspace", wsOutput)
+
+    def timingsMatch(self, wsNames):
+        """
+        :param wsNames:
+        :return:
+        """
+        for i in range(len(wsNames)):
+            leftWorkspace = wsNames[i]
+            rightWorkspace = wsNames[i+1]
+            leftXData = api.mtd[leftWorkspace].dataX(0)
+            rightXData = api.mtd[rightWorkspace].dataX(0)
+            leftDeltaX = leftXData[0] - leftXData[1]
+            rightDeltaX = rightXData[0] - rightXData[1]
+            if abs(leftDeltaX - rightDeltaX) >= 1e-4 or abs(rightXData[0] - leftXData[0]) >= 1e-4:
+                raise RuntimeError("Timings don't match")
+            else:
+                return True
+
+# Register algorithm with Mantid.
+AlgorithmFactory.subscribe(TOFTOFMergeRuns)
diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/EVSDiffractionReduction.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/EVSDiffractionReduction.py
new file mode 100644
index 0000000000000000000000000000000000000000..7fc7669b87706f09e5faec5f0b8e607dcb950867
--- /dev/null
+++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/EVSDiffractionReduction.py
@@ -0,0 +1,208 @@
+from mantid.simpleapi import *
+from mantid.api import *
+from mantid.kernel import *
+from mantid import config
+
+import os
+
+class EVSDiffractionReduction(DataProcessorAlgorithm):
+
+    _workspace_names = None
+    _chopped_data = None
+    _output_ws = None
+    _data_files = None
+    _instrument_name = None
+    _mode = None
+    _par_filename = None
+    _spectra_range = None
+    _grouping_method = None
+    _rebin_string = None
+    _ipf_filename = None
+    _sum_files = None
+
+
+    def category(self):
+        return 'Diffraction;PythonAlgorithms'
+
+
+    def summary(self):
+        return 'Performs diffraction reduction for VESUVIO'
+
+
+    def PyInit(self):
+        self.declareProperty(StringArrayProperty('InputFiles'),
+                             doc='Comma separated list of input files.')
+
+        self.declareProperty(FileProperty('InstrumentParFile', '',
+                                          action=FileAction.Load,
+                                          extensions=['.dat', '.par']),
+                             doc='PAR file containing instrument definition.')
+
+        self.declareProperty(name='SumFiles', defaultValue=False,
+                             doc='Enabled to sum spectra from each input file.')
+
+        self.declareProperty(IntArrayProperty('SpectraRange', [3, 198]),
+                             doc='Range of spectra to use.')
+
+        self.declareProperty(name='RebinParam', defaultValue='',
+                             doc='Rebin parameters.')
+
+        self.declareProperty(name='GroupingPolicy', defaultValue='All',
+                             validator=StringListValidator(['All', 'Individual', 'IPF']),
+                             doc='Selects the type of detector grouping to be used.')
+
+        self.declareProperty(WorkspaceGroupProperty('OutputWorkspace', '',
+                             direction=Direction.Output),
+                             doc='Group name for the result workspaces.')
+
+
+    def validateInputs(self):
+        """
+        Checks for issues with user input.
+        """
+        issues = dict()
+
+        # Validate input files
+        input_files = self.getProperty('InputFiles').value
+        if len(input_files) == 0:
+            issues['InputFiles'] = 'InputFiles must contain at least one filename'
+
+        # Validate detector range
+        detector_range = self.getProperty('SpectraRange').value
+        if len(detector_range) != 2:
+            issues['SpectraRange'] = 'SpectraRange must be an array of 2 values only'
+        else:
+            if detector_range[0] > detector_range[1]:
+                issues['SpectraRange'] = 'SpectraRange must be in format [lower_index,upper_index]'
+
+        return issues
+
+
+    def PyExec(self):
+        from IndirectReductionCommon import (load_files,
+                                             get_multi_frame_rebin,
+                                             identify_bad_detectors,
+                                             unwrap_monitor,
+                                             process_monitor_efficiency,
+                                             scale_monitor,
+                                             scale_detectors,
+                                             rebin_reduction,
+                                             group_spectra,
+                                             fold_chopped,
+                                             rename_reduction)
+
+        self._setup()
+
+        load_opts = dict()
+        load_opts['Mode'] = 'FoilOut'
+        load_opts['InstrumentParFile'] = self._par_filename
+
+        self._workspace_names, self._chopped_data = load_files(self._data_files,
+                                                               ipf_filename=self._ipf_filename,
+                                                               spec_min=self._spectra_range[0],
+                                                               spec_max=self._spectra_range[1],
+                                                               sum_files=self._sum_files,
+                                                               load_opts=load_opts)
+
+        for c_ws_name in self._workspace_names:
+            is_multi_frame = isinstance(mtd[c_ws_name], WorkspaceGroup)
+
+            # Get list of workspaces
+            if is_multi_frame:
+                workspaces = mtd[c_ws_name].getNames()
+            else:
+                workspaces = [c_ws_name]
+
+            # Process rebinning for framed data
+            rebin_string_2, num_bins = get_multi_frame_rebin(c_ws_name,
+                                                             self._rebin_string)
+
+            masked_detectors = identify_bad_detectors(workspaces[0])
+
+            # Process workspaces
+            for ws_name in workspaces:
+                monitor_ws_name = ws_name + '_mon'
+
+                # Process monitor
+                if not unwrap_monitor(ws_name):
+                    ConvertUnits(InputWorkspace=monitor_ws_name,
+                                 OutputWorkspace=monitor_ws_name,
+                                 Target='Wavelength',
+                                 EMode='Elastic')
+
+                process_monitor_efficiency(ws_name)
+                scale_monitor(ws_name)
+
+                # Scale detector data by monitor intensities
+                scale_detectors(ws_name, 'Elastic')
+
+                # Remove the no longer needed monitor workspace
+                DeleteWorkspace(monitor_ws_name)
+
+                # Convert to dSpacing
+                ConvertUnits(InputWorkspace=ws_name,
+                             OutputWorkspace=ws_name,
+                             Target='dSpacing',
+                             EMode='Elastic')
+
+                # Handle rebinning
+                rebin_reduction(ws_name,
+                                self._rebin_string,
+                                rebin_string_2,
+                                num_bins)
+
+                # Group spectra
+                group_spectra(ws_name,
+                              masked_detectors,
+                              self._grouping_method)
+
+            if is_multi_frame:
+                fold_chopped(c_ws_name)
+
+        # Rename output workspaces
+        output_workspace_names = [rename_reduction(ws_name, self._sum_files) for ws_name in self._workspace_names]
+
+        # Group result workspaces
+        GroupWorkspaces(InputWorkspaces=output_workspace_names,
+                        OutputWorkspace=self._output_ws)
+
+        self.setProperty('OutputWorkspace', self._output_ws)
+
+
+    def _setup(self):
+        """
+        Gets algorithm properties.
+        """
+        self._instrument_name = 'VESUVIO'
+        self._mode = 'diffspec'
+
+        self._output_ws = self.getPropertyValue('OutputWorkspace')
+        self._data_files = self.getProperty('InputFiles').value
+        self._par_filename = self.getPropertyValue('InstrumentParFile')
+        self._spectra_range = self.getProperty('SpectraRange').value
+        self._rebin_string = self.getPropertyValue('RebinParam')
+        self._grouping_method = self.getPropertyValue('GroupingPolicy')
+
+        if self._rebin_string == '':
+            self._rebin_string = None
+
+        # Get the IPF filename
+        self._ipf_filename = self._instrument_name + '_diffraction_' + self._mode + '_Parameters.xml'
+        if not os.path.exists(self._ipf_filename):
+            self._ipf_filename = os.path.join(config['instrumentDefinition.directory'], self._ipf_filename)
+        logger.information('IPF filename is: %s' % (self._ipf_filename))
+
+        # Only enable sum files if we actually have more than one file
+        sum_files = self.getProperty('SumFiles').value
+        self._sum_files = False
+
+        if sum_files:
+            num_raw_files = len(self._data_files)
+            if num_raw_files > 1:
+                self._sum_files = True
+                logger.information('Summing files enabled (have %d files)' % num_raw_files)
+            else:
+                logger.information('SumFiles options is ignored when only one file is provided')
+
+
+AlgorithmFactory.subscribe(EVSDiffractionReduction)
diff --git a/Framework/PythonInterface/plugins/algorithms/mlzutils.py b/Framework/PythonInterface/plugins/algorithms/mlzutils.py
index 11929ab069adf73a25a143413a867ff4127985b6..3b69302522b7ef2cd6d2eba41c946e3e548d5673 100644
--- a/Framework/PythonInterface/plugins/algorithms/mlzutils.py
+++ b/Framework/PythonInterface/plugins/algorithms/mlzutils.py
@@ -55,7 +55,7 @@ def ws_exist(wslist, logger):
     return True
 
 
-def compare_properties(lhs_run, rhs_run, plist, logger):
+def compare_properties(lhs_run, rhs_run, plist, logger, tolerance=5e-3):
     """
     checks whether properties match in the given runs, produces warnings
         @param lhs_run Left-hand-side run
@@ -65,11 +65,16 @@ def compare_properties(lhs_run, rhs_run, plist, logger):
     """
     lhs_title = ""
     rhs_title = ""
-    if lhs_run.hasProperty('run_title'):
+    if lhs_run.hasProperty('run_title') and rhs_run.hasProperty('run_title'):
         lhs_title = lhs_run.getProperty('run_title').value
-    if rhs_run.hasProperty('run_title'):
         rhs_title = rhs_run.getProperty('run_title').value
 
+    # for TOFTOF run_titles can be identical
+    if lhs_title == rhs_title:
+        if lhs_run.hasProperty('run_number') and rhs_run.hasProperty('run_number'):
+            lhs_title = str(lhs_run.getProperty('run_number').value)
+            rhs_title = str(rhs_run.getProperty('run_number').value)
+
     for property_name in plist:
         if lhs_run.hasProperty(property_name) and rhs_run.hasProperty(property_name):
             lhs_property = lhs_run.getProperty(property_name)
@@ -81,8 +86,8 @@ def compare_properties(lhs_run, rhs_run, plist, logger):
                             lhs_title + ": " + lhs_property.value + ", but " + \
                             rhs_title + ": " + rhs_property.value
                         logger.warning(message)
-                if lhs_property.type == 'number':
-                    if abs(lhs_property.value - rhs_property.value) > 5e-3:
+                elif lhs_property.type == 'number':
+                    if abs(lhs_property.value - rhs_property.value) > tolerance:
                         message = "Property " + property_name + " does not match! " + \
                             lhs_title + ": " + str(lhs_property.value) + ", but " + \
                             rhs_title + ": " + str(rhs_property.value)
@@ -98,3 +103,54 @@ def compare_properties(lhs_run, rhs_run, plist, logger):
                 lhs_title + " or " + rhs_title + " - skipping comparison."
             logger.warning(message)
     return
+
+
+def compare_mandatory(wslist, plist, logger, tolerance=0.01):
+    """
+    Compares properties which are required to be the same.
+    Produces error message and throws exception if difference is observed
+    or if one of the sample logs is not found.
+    Important: exits after the first difference is observed. No further check is performed.
+        @param wslist  List of workspaces
+        @param plist   List of properties to compare
+        @param logger  Logger self.log()
+        @param tolerance  Tolerance for comparison of the double values.
+    """
+    # retrieve the workspaces, form dictionary {wsname: run}
+    runs = {}
+    for wsname in wslist:
+        wks = api.AnalysisDataService.retrieve(wsname)
+        runs[wsname] = wks.getRun()
+
+    for prop in plist:
+        properties = []
+        for wsname in wslist:
+            run = runs[wsname]
+            if not run.hasProperty(prop):
+                message = "Workspace " + wsname + " does not have sample log " + prop
+                logger.error(message)
+                raise RuntimeError(message)
+
+            curprop = run.getProperty(prop)
+            if curprop.type == 'string':
+                properties.append(curprop.value)
+            elif curprop.type == 'number':
+                properties.append(int(curprop.value/tolerance))
+            else:
+                message = "Unknown type " + str(curprop.type) + " for the sample log " +\
+                    prop + " in the workspace " + wsname
+                logger.error(message)
+                raise RuntimeError(message)
+        # this should never happen, but lets check
+        nprop = len(properties)
+        if nprop != len(wslist):
+            message = "Error. Number of properties " + str(nprop) + " for property " + prop +\
+                " is not equal to number of workspaces " + str(len(wslist))
+            logger.error(message)
+            raise RuntimeError(message)
+        pvalue = properties[0]
+        if properties.count(pvalue) != nprop:
+            message = "Sample log " + prop + " is not identical in the given list of workspaces. \n" +\
+                "Workspaces: " + ", ".join(wslist) + "\n Values: " + str(properties)
+            logger.error(message)
+            raise RuntimeError(message)
diff --git a/Framework/PythonInterface/test/python/plugins/algorithms/CMakeLists.txt b/Framework/PythonInterface/test/python/plugins/algorithms/CMakeLists.txt
index bb68b040a2e73b551095e18bf876be0abb92e83b..06aefc104046e72c2151ed57d7933b8230e6daec 100644
--- a/Framework/PythonInterface/test/python/plugins/algorithms/CMakeLists.txt
+++ b/Framework/PythonInterface/test/python/plugins/algorithms/CMakeLists.txt
@@ -26,6 +26,7 @@ set ( TEST_PY_FILES
   EnggFitPeaksTest.py
   EnggFocusTest.py
   EnggVanadiumCorrectionsTest.py
+  EVSDiffractionReductionTest.py
   FilterLogByTimeTest.py
   FindReflectometryLinesTest.py
   FlatPlatePaalmanPingsCorrectionTest.py
@@ -75,6 +76,8 @@ set ( TEST_PY_FILES
   UpdatePeakParameterTableValueTest.py
   SANSSubtractTest.py
   TimeSliceTest.py
+  TOFTOFCropWorkspaceTest.py
+  TOFTOFMergeRunsTest.py
   TOSCABankCorrectionTest.py
   TransformToIqtTest.py
   ExportSampleLogsToCSVFileTest.py
diff --git a/Framework/PythonInterface/test/python/plugins/algorithms/EVSDiffractionReductionTest.py b/Framework/PythonInterface/test/python/plugins/algorithms/EVSDiffractionReductionTest.py
new file mode 100644
index 0000000000000000000000000000000000000000..9ec89cdaf4051d9055296ecb9f3c04d0239c79d3
--- /dev/null
+++ b/Framework/PythonInterface/test/python/plugins/algorithms/EVSDiffractionReductionTest.py
@@ -0,0 +1,45 @@
+#pylint: disable=too-many-public-methods,invalid-name
+
+import unittest
+from mantid.simpleapi import *
+from mantid.api import *
+
+
+class EVDDiffractionReductionTest(unittest.TestCase):
+
+    def test_basic_reduction_completes(self):
+        """
+        Sanity test to ensure the most basic reduction actually completes.
+        """
+
+        wks = EVSDiffractionReduction(InputFiles=['EVS15289.raw'],
+                                      InstrumentParFIle='IP0005.dat')
+
+        self.assertTrue(isinstance(wks, WorkspaceGroup), 'Result workspace should be a workspace group.')
+        self.assertEqual(len(wks), 1)
+        self.assertEqual(wks.getNames()[0], 'EVS15289_diffspec_red')
+
+        red_ws = wks[0]
+        self.assertEqual(red_ws.getAxis(0).getUnit().unitID(), 'dSpacing')
+        self.assertEqual(red_ws.getNumberHistograms(), 1)
+
+
+    def test_grouping_individual(self):
+        """
+        Test setting individual grouping, one spectrum per detector.
+        """
+
+        wks = EVSDiffractionReduction(InputFiles=['EVS15289.raw'],
+                                      GroupingPolicy='Individual',
+                                      InstrumentParFIle='IP0005.dat')
+
+        self.assertTrue(isinstance(wks, WorkspaceGroup), 'Result workspace should be a workspace group.')
+        self.assertEqual(len(wks), 1)
+
+        red_ws = wks[0]
+        self.assertEqual(red_ws.getAxis(0).getUnit().unitID(), 'dSpacing')
+        self.assertEqual(red_ws.getNumberHistograms(), 196)
+
+
+if __name__ == '__main__':
+    unittest.main()
diff --git a/Framework/PythonInterface/test/python/plugins/algorithms/SavePlot1DAsJsonTest.py b/Framework/PythonInterface/test/python/plugins/algorithms/SavePlot1DAsJsonTest.py
index 6e8c6100e3f2d764c4aa5a8b6c5bdb8961b02cbc..62f8c938fa13402e41580886bc0c61f632ad58d6 100644
--- a/Framework/PythonInterface/test/python/plugins/algorithms/SavePlot1DAsJsonTest.py
+++ b/Framework/PythonInterface/test/python/plugins/algorithms/SavePlot1DAsJsonTest.py
@@ -1,4 +1,4 @@
-#pylint: disable=invalid-name,too-many-public-methods
+#pylint: disable=invalid-name,too-many-public-methods,too-many-arguments
 import unittest
 import numpy as np
 import mantid.simpleapi as api
@@ -9,13 +9,13 @@ from mantid.api import AnalysisDataService
 
 import os, json
 
-class SaveVulcanGSSTest(unittest.TestCase):
+class SavePlot1DAsJsonTest(unittest.TestCase):
 
     def test_save_one_curve(self):
         """ Test to Save one curve
         """
-        datawsname = "TestOneCurve"
-        E, I, err = self._createOneCurve(datawsname)
+        datawsname = "constant energy cut"
+        E, I, err = self._createOneQCurve(datawsname)
 
         # Execute
         out_path = "tempout_curve.json"
@@ -26,11 +26,9 @@ class SaveVulcanGSSTest(unittest.TestCase):
         # executed?
         self.assertTrue(alg_test.isExecuted())
         # Verify ....
-        d = json.load(open(out_path))
-        d0 = d[datawsname+'0'] # plots are numbered
-        np.testing.assert_array_equal(d0['x'], E)
-        np.testing.assert_array_equal(d0['y'], I)
-        np.testing.assert_array_equal(d0['e'], err)
+        d = json.load(open(out_path))[datawsname]
+        self.assertEqual(d['type'], 'point')
+        self._checkData(d, E, I, err)
         # Delete the output file
         os.remove(out_path)
         return
@@ -51,11 +49,8 @@ class SaveVulcanGSSTest(unittest.TestCase):
         # Executed?
         self.assertTrue(alg_test.isExecuted())
         # Verify ....
-        d = json.load(open(out_path))
-        d0 = d[datawsname+'0'] # plots are numbered
-        np.testing.assert_array_equal(d0['x'], E)
-        np.testing.assert_array_equal(d0['y'], I)
-        np.testing.assert_array_equal(d0['e'], err)
+        d = json.load(open(out_path))[datawsname]
+        self._checkData(d, E, I, err)
         # test overwrite
         alg_test = run_algorithm(
             "SavePlot1DAsJson",
@@ -80,14 +75,9 @@ class SaveVulcanGSSTest(unittest.TestCase):
         # executed?
         self.assertTrue(alg_test.isExecuted())
         # Verify ....
-        d = json.load(open(out_path))
-        d0 = d[datawsname+'0'] # plots are numbered
-        np.testing.assert_array_equal(d0['x'], E)
-        np.testing.assert_array_equal(d0['y'], I)
-        np.testing.assert_array_equal(d0['e'], err)
-        d1 = d[datawsname+'1'] #
-        np.testing.assert_array_equal(d1['y'], I2)
-        np.testing.assert_array_equal(d1['e'], err2)
+        d = json.load(open(out_path))[datawsname]
+        self._checkData(d, E, I, err)
+        self._checkData(d, E, I2, err2, ID="2")
         # Delete the output file
         os.remove(out_path)
         return
@@ -97,6 +87,7 @@ class SaveVulcanGSSTest(unittest.TestCase):
         """ Test to Save one curve with a name specified by client
         """
         datawsname = "TestOneCurve"
+        plotname = "myplot"
         E, I, err = self._createOneCurve(datawsname)
         # Execute
         out_path = "tempout_curve_withname.json"
@@ -104,36 +95,55 @@ class SaveVulcanGSSTest(unittest.TestCase):
             "SavePlot1DAsJson",
             InputWorkspace = datawsname,
             JsonFilename = out_path,
-            PlotName = "myplot")
+            PlotName = plotname)
         # executed?
         self.assertTrue(alg_test.isExecuted())
         # Verify ....
-        d = json.load(open(out_path))
-        plotname = "myplot"
-        d0 = d[plotname+'0'] # plots are numbered
-        np.testing.assert_array_equal(d0['x'], E)
-        np.testing.assert_array_equal(d0['y'], I)
-        np.testing.assert_array_equal(d0['e'], err)
+        d = json.load(open(out_path))[plotname]
+        self._checkData(d, E, I, err)
         # Delete the output file
         os.remove(out_path)
         return
 
 
+    def _checkData(self, s, E, I, err, ID="1"):
+        d0 = s["data"][ID]
+        np.testing.assert_array_equal(d0[0], E)
+        np.testing.assert_array_equal(d0[1], I)
+        np.testing.assert_array_equal(d0[2], err)
+        return
+
+
     def _createOneCurve(self, datawsname):
         """ Create data workspace
         """
-        E = np.arange(-50, 50, 1.0)
+        E = np.arange(-50, 50, 10.0)
         I = 1000 * np.exp(-E**2/10**2)
         err = I ** .5
         # create workspace
         dataws = api.CreateWorkspace(
             DataX = E, DataY = I, DataE = err, NSpec = 1,
-            UnitX = "Energy(meV)")
+            UnitX = "Energy")
         # Add to data service
         AnalysisDataService.addOrReplace(datawsname, dataws)
         return E, I, err
 
 
+    def _createOneQCurve(self, datawsname):
+        """ Create data workspace
+        """
+        Q = np.arange(0, 13, 1.0)
+        I = 1000 * np.exp(-Q**2/10**2)
+        err = I ** .5
+        # create workspace
+        dataws = api.CreateWorkspace(
+            DataX = Q, DataY = I, DataE = err, NSpec = 1,
+            UnitX = "Momentum")
+        # Add to data service
+        AnalysisDataService.addOrReplace(datawsname, dataws)
+        return Q, I, err
+
+
     def _createOneHistogram(self, datawsname):
         """ Create data workspace
         """
diff --git a/Framework/PythonInterface/test/python/plugins/algorithms/TOFTOFCropWorkspaceTest.py b/Framework/PythonInterface/test/python/plugins/algorithms/TOFTOFCropWorkspaceTest.py
new file mode 100644
index 0000000000000000000000000000000000000000..14651813e297fe91d44d8e8006bfc41db7655bbb
--- /dev/null
+++ b/Framework/PythonInterface/test/python/plugins/algorithms/TOFTOFCropWorkspaceTest.py
@@ -0,0 +1,59 @@
+import unittest
+from mantid.simpleapi import Load, DeleteWorkspace, GroupWorkspaces, TOFTOFCropWorkspace
+from testhelpers import run_algorithm
+from mantid.api import AnalysisDataService
+
+
+class TOFTOFCropWorkspaceTest(unittest.TestCase):
+
+    _input_ws = None
+    _cropped_ws = None
+
+    def setUp(self):
+        input_ws = Load(Filename="TOFTOFTestdata.nxs")
+        self._input_ws = input_ws
+
+    def test_basicrun(self):
+        OutputWorkspaceName = "cropped_ws"
+        alg_test = run_algorithm("TOFTOFCropWorkspace",
+                                 InputWorkspace=self._input_ws,
+                                 OutputWorkspace=OutputWorkspaceName)
+        self.assertTrue(alg_test.isExecuted())
+        self._cropped_ws = AnalysisDataService.retrieve(OutputWorkspaceName)
+
+        run = self._cropped_ws.getRun()
+        # check existence of required entries in logs
+        self.assertTrue('full_channels' in run.keys())
+        self.assertTrue('channel_width' in run.keys())
+        # check their values
+        full_channels = float(run.getLogData('full_channels').value)
+        channel_width = float(run.getLogData('channel_width').value)
+        self.assertTrue(full_channels > 0.)
+        self.assertTrue(channel_width > 0.)
+        # check unit horizontal axis
+        self.assertEqual(self._cropped_ws.getAxis(0).getUnit().unitID(), 'TOF')
+        # check length of cropped ws
+        self.assertEqual(len(self._cropped_ws.readX(0)), int(full_channels))
+
+    def test_inputgroup(self):
+        group = GroupWorkspaces([self._input_ws])
+        OutputWorkspaceName = "cropped_ws"
+        alg_test = run_algorithm("TOFTOFCropWorkspace",
+                                 InputWorkspace=group,
+                                 OutputWorkspace=OutputWorkspaceName)
+        self.assertTrue(alg_test.isExecuted())
+
+    def test_invalid_xunits(self):
+        self._input_ws.getAxis(0).setUnit('Wavelength')
+        OutputWorkspaceName = "cropped_ws"
+        self.assertRaises(RuntimeError, TOFTOFCropWorkspace, InputWorkspace=self._input_ws,
+                          OutputWorkspace=OutputWorkspaceName)
+
+    def cleanUp(self):
+        if AnalysisDataService.doesExist(self._input_ws):
+            DeleteWorkspace(self._input_ws)
+        if AnalysisDataService.doesExist(self._cropped_ws):
+            DeleteWorkspace(self._cropped_ws)
+
+if __name__ == "__main__":
+    unittest.main()
diff --git a/Framework/PythonInterface/test/python/plugins/algorithms/TOFTOFMergeRunsTest.py b/Framework/PythonInterface/test/python/plugins/algorithms/TOFTOFMergeRunsTest.py
new file mode 100644
index 0000000000000000000000000000000000000000..3e0b4dac93aa19f9044bba5ab938da751a5f231c
--- /dev/null
+++ b/Framework/PythonInterface/test/python/plugins/algorithms/TOFTOFMergeRunsTest.py
@@ -0,0 +1,93 @@
+import unittest
+from mantid.simpleapi import Load, DeleteWorkspace, AddSampleLogMultiple, \
+    DeleteLog
+from testhelpers import run_algorithm
+from mantid.api import AnalysisDataService
+
+
+class TOFTOFMergeRunsTest(unittest.TestCase):
+
+    def setUp(self):
+        input_ws = Load(Filename="TOFTOFTestdata.nxs")
+        self._input_ws_base = input_ws
+        self._input_good = input_ws
+        AddSampleLogMultiple(Workspace=self._input_good, LogNames=['run_number'], LogValues=[001])
+
+        self._input_bad_entry = input_ws+0
+        # remove a compulsory entry in Logs
+        DeleteLog(self._input_bad_entry, 'duration')
+
+        self._input_bad_value = input_ws+0
+        AddSampleLogMultiple(Workspace=self._input_bad_value, LogNames=['wavelength'], LogValues=[0.])
+
+    def test_success(self):
+        OutputWorkspaceName = "output_ws"
+        Inputws = "%s, %s" % (self._input_ws_base.name(), self._input_good.name())
+
+        alg_test = run_algorithm("TOFTOFMergeRuns",
+                                 InputWorkspaces=Inputws,
+                                 OutputWorkspace=OutputWorkspaceName)
+        self.assertTrue(alg_test.isExecuted())
+
+        wsoutput = AnalysisDataService.retrieve(OutputWorkspaceName)
+
+        run_out = wsoutput.getRun()
+        run_in = self._input_ws_base.getRun()
+        self.assertEqual(run_out.getLogData('wavelength').value, run_in.getLogData('wavelength').value)
+        self.assertEqual(run_out.getLogData('chopper_speed').value, run_in.getLogData('chopper_speed').value)
+        self.assertEqual(run_out.getLogData('chopper_ratio').value, run_in.getLogData('chopper_ratio').value)
+        self.assertEqual(run_out.getLogData('channel_width').value, run_in.getLogData('channel_width').value)
+        self.assertEqual(run_out.getLogData('Ei').value, run_in.getLogData('Ei').value)
+        self.assertEqual(run_out.getLogData('EPP').value, run_in.getLogData('EPP').value)
+        self.assertEqual(run_out.getLogData('proposal_number').value, run_in.getLogData('proposal_number').value)
+        self.assertEqual(run_out.getLogData('proposal_title').value, run_in.getLogData('proposal_title').value)
+        self.assertEqual(run_out.getLogData('mode').value, run_in.getLogData('mode').value)
+        self.assertEqual(run_out.getLogData('experiment_team').value, run_in.getLogData('experiment_team').value)
+
+        run_in_good = self._input_good.getRun()
+        self.assertEqual(run_out.getLogData('run_number').value,
+                         str([run_in.getLogData('run_number').value, run_in_good.getLogData('run_number').value]))
+
+        self.assertEqual(run_out.getLogData('temperature').value, float(run_in.getLogData('temperature').value))
+        self.assertEqual(run_out.getLogData('duration').value,
+                         float(run_in.getLogData('duration').value) + float(run_in_good.getLogData('duration').value))
+        self.assertEqual(run_out.getLogData('run_start').value, run_in.getLogData('run_start').value)
+        self.assertEqual(run_out.getLogData('run_end').value, run_in.getLogData('run_end').value)
+        self.assertEqual(run_out.getLogData('full_channels').value, run_in.getLogData('full_channels').value)
+        self.assertEqual(run_out.getLogData('monitor_counts').value, 2*int(run_in.getLogData('monitor_counts').value))
+        # Dimension output workspace
+        self.assertEqual(wsoutput.getNumberHistograms(), self._input_ws_base.getNumberHistograms())
+        self.assertEqual(wsoutput.blocksize(), self._input_ws_base.blocksize())
+        # check instrument
+        self.assertEqual(wsoutput.getInstrument().getName(), "TOFTOF")
+
+        AnalysisDataService.remove("output_ws")
+
+    def test_failed(self):
+        """
+        Failed tests because of missing keys or different values
+        """
+        OutputWorkspaceName = "output_ws"
+        Inputws_badvalue = "%s, %s" % (self._input_ws_base.name(), self._input_bad_value.name())
+        self.assertRaises(RuntimeError,
+                          run_algorithm, 'TOFTOFMergeRuns',
+                          InputWorkspaces=Inputws_badvalue,
+                          OutputWorkspace=OutputWorkspaceName,
+                          rethrow=True)
+
+        Inputws_badentry = "%s, %s" % (self._input_ws_base.name(), self._input_bad_entry.name())
+        self.assertRaises(RuntimeError,
+                          run_algorithm, 'TOFTOFMergeRuns',
+                          InputWorkspaces=Inputws_badentry,
+                          OutputWorkspace=OutputWorkspaceName,
+                          rethrow=True)
+
+        if "output_ws" is not None:
+            AnalysisDataService.remove("output_ws")
+
+    def cleanUp(self):
+        if self._input_ws_base is not None:
+            DeleteWorkspace(self._input_ws_base)
+
+if __name__ == "__main__":
+    unittest.main()
diff --git a/Framework/PythonInterface/test/testhelpers/WorkspaceCreationHelperModule.cpp b/Framework/PythonInterface/test/testhelpers/WorkspaceCreationHelperModule.cpp
index 810d3fe4179fdd9af9c2c3ebafebafcc9e919589..9e6e57799eb3bf45edf789edfa54b8de0d873698 100644
--- a/Framework/PythonInterface/test/testhelpers/WorkspaceCreationHelperModule.cpp
+++ b/Framework/PythonInterface/test/testhelpers/WorkspaceCreationHelperModule.cpp
@@ -21,6 +21,11 @@ using namespace Mantid::DataObjects::MDEventsTestHelper;
 using namespace Mantid::PythonInterface::Policies;
 using namespace WorkspaceCreationHelper;
 
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunknown-pragmas"
+#pragma clang diagnostic ignored "-Wunused-local-typedef"
+#endif
 BOOST_PYTHON_FUNCTION_OVERLOADS(create2DWorkspaceWithFullInstrument_overloads,
                                 create2DWorkspaceWithFullInstrument, 2, 4)
 
@@ -31,6 +36,10 @@ BOOST_PYTHON_FUNCTION_OVERLOADS(
     create2DWorkspaceWithRectangularInstrument_overloads,
     create2DWorkspaceWithRectangularInstrument, 3, 3)
 
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
 BOOST_PYTHON_MODULE(WorkspaceCreationHelper) {
   using namespace boost::python;
 
diff --git a/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks2D.h b/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks2D.h
index 973c128b27ba685ec33b4abfe7b79f178da2f9a5..1a7c1005d68692eb07359cc90d0ad0731cadf8ed 100644
--- a/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks2D.h
+++ b/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks2D.h
@@ -6,6 +6,7 @@
 #include "MantidAPI/Algorithm.h"
 #include "MantidAPI/IFunction.h"
 #include "MantidAPI/IPeakFunction.h"
+#include "MantidGeometry/Crystal/PointGroup.h"
 
 #include "MantidKernel/Matrix.h"
 
@@ -104,6 +105,9 @@ protected:
   getFunctionPawley(std::string profileFunctionName,
                     const PoldiPeakCollection_sptr &peakCollection);
 
+  std::string getCrystalSystemFromPointGroup(
+      const Geometry::PointGroup_sptr &pointGroup) const;
+
   std::string
   getRefinedStartingCell(const std::string &initialCell,
                          const std::string &crystalSystem,
diff --git a/Framework/SINQ/src/LoadFlexiNexus.cpp b/Framework/SINQ/src/LoadFlexiNexus.cpp
index 2bb6ca7cd7c68e2f318925b7e6852205c334abd5..d589ce89c86d6df3055e64532ff7ba7071916091 100644
--- a/Framework/SINQ/src/LoadFlexiNexus.cpp
+++ b/Framework/SINQ/src/LoadFlexiNexus.cpp
@@ -5,7 +5,6 @@
 #include "MantidGeometry/MDGeometry/MDTypes.h"
 #include "MantidDataObjects/MDHistoWorkspace.h"
 #include "MantidKernel/Utils.h"
-#include <iostream>
 #include <fstream>
 #include <sstream>
 #include <boost/algorithm/string.hpp>
diff --git a/Framework/SINQ/src/MDHistoToWorkspace2D.cpp b/Framework/SINQ/src/MDHistoToWorkspace2D.cpp
index 25153f13116175287ce20080935335240801e021..2433e266d31d3c8c4e2320b3d07579760c6d05f0 100644
--- a/Framework/SINQ/src/MDHistoToWorkspace2D.cpp
+++ b/Framework/SINQ/src/MDHistoToWorkspace2D.cpp
@@ -13,7 +13,6 @@
 
 #include "MantidAPI/IMDHistoWorkspace.h"
 #include <cmath>
-#include <iostream>
 
 // Register the algorithm into the AlgorithmFactory
 DECLARE_ALGORITHM(MDHistoToWorkspace2D)
diff --git a/Framework/SINQ/src/PoldiFitPeaks2D.cpp b/Framework/SINQ/src/PoldiFitPeaks2D.cpp
index 5ace6536c53526aaddd76b1e7faec2a84e5e7b44..dc9755d28fbc0efb9ba8f4463e93b03d0c66e3dc 100644
--- a/Framework/SINQ/src/PoldiFitPeaks2D.cpp
+++ b/Framework/SINQ/src/PoldiFitPeaks2D.cpp
@@ -546,8 +546,7 @@ Poldi2DFunction_sptr PoldiFitPeaks2D::getFunctionPawley(
                                 "peaks do not have point group.");
   }
 
-  std::string crystalSystem =
-      getCrystalSystemAsString(pointGroup->crystalSystem());
+  std::string crystalSystem = getCrystalSystemFromPointGroup(pointGroup);
   pawleyFunction->setCrystalSystem(crystalSystem);
 
   UnitCell cell = peakCollection->unitCell();
@@ -575,6 +574,35 @@ Poldi2DFunction_sptr PoldiFitPeaks2D::getFunctionPawley(
   return mdFunction;
 }
 
+/**
+ * Returns the crystal system for the specified point group
+ *
+ * This function simply uses Geometry::getCrystalSystemAsString(), except when
+ * the crystal system is trigonal but the point group uses hexagonal axes. In
+ * that case this function returns the string for PointGroup::Hexagonal.
+ *
+ * @param pointGroup :: The point group for which to find the crystal system
+ * @return The crystal system for the point group
+ */
+std::string PoldiFitPeaks2D::getCrystalSystemFromPointGroup(
+    const PointGroup_sptr &pointGroup) const {
+  if (!pointGroup) {
+    throw std::invalid_argument(
+        "Cannot return crystal system for null PointGroup.");
+  }
+
+  PointGroup::CrystalSystem crystalSystem = pointGroup->crystalSystem();
+
+  if (crystalSystem == PointGroup::Trigonal) {
+    if (pointGroup->getCoordinateSystem() ==
+        Group::CoordinateSystem::Hexagonal) {
+      return getCrystalSystemAsString(PointGroup::Hexagonal);
+    }
+  }
+
+  return getCrystalSystemAsString(crystalSystem);
+}
+
 /**
  * Tries to refine the initial cell using the supplied peaks
  *
diff --git a/Framework/SINQ/src/PoldiUtilities/PoldiAutoCorrelationCore.cpp b/Framework/SINQ/src/PoldiUtilities/PoldiAutoCorrelationCore.cpp
index 4a3ec4167a2bcbb4b2ea8d71ff9529c35d134574..48b5317b0eacdd7fdf4cc32a6cb5af86b2223ca7 100644
--- a/Framework/SINQ/src/PoldiUtilities/PoldiAutoCorrelationCore.cpp
+++ b/Framework/SINQ/src/PoldiUtilities/PoldiAutoCorrelationCore.cpp
@@ -385,6 +385,18 @@ UncertainValue PoldiAutoCorrelationCore::getCMessAndCSigma(
   case 2: {
     int middleIndex = cleanIndex((locator.icmin + 1), m_timeBinCount);
 
+    if (middleIndex < 0) {
+      m_logger.warning() << "Inconsistency foun while calculating correlation "
+                            "intensity and error for d-value: "
+                         << boost::lexical_cast<std::string>(dValue)
+                         << ", with detector index: "
+                         << boost::lexical_cast<std::string>(index)
+                         << ", got middle index: "
+                         << boost::lexical_cast<std::string>(middleIndex)
+                         << ", ignoring it." << std::endl;
+      break;
+    }
+
     double counts = getCounts(locator.detectorElement, middleIndex);
     double normCounts = getNormCounts(locator.detectorElement, middleIndex);
 
diff --git a/Framework/SINQ/src/PoldiUtilities/PoldiResidualCorrelationCore.cpp b/Framework/SINQ/src/PoldiUtilities/PoldiResidualCorrelationCore.cpp
index 02f23178125755897c583659e66ec70e8ca6ed16..665b2f1eefa67af58661bb36d0e4c8d86b5c6904 100644
--- a/Framework/SINQ/src/PoldiUtilities/PoldiResidualCorrelationCore.cpp
+++ b/Framework/SINQ/src/PoldiUtilities/PoldiResidualCorrelationCore.cpp
@@ -99,6 +99,15 @@ void PoldiResidualCorrelationCore::distributeCorrelationCounts(
         case 2: {
           int middleIndex = cleanIndex((locator.icmin + 1), m_timeBinCount);
 
+          if (middleIndex < 0) {
+            m_logger.warning()
+                << "Inconsistency foun while calculating distribute "
+                   "correlation counts for d-value with index "
+                << boost::lexical_cast<std::string>(k) << ", got middle index: "
+                << boost::lexical_cast<std::string>(middleIndex)
+                << ", ignoring it." << std::endl;
+            break;
+          }
           addToCountData(locator.detectorElement, middleIndex, deltaForD);
         }
         case 1: {
diff --git a/Framework/SINQ/src/SINQHMListener.cpp b/Framework/SINQ/src/SINQHMListener.cpp
index d8434b56b5cb7b3ab127f952316e51dfee9aeab3..fd449cb9648dd54cadb67cea330d91aa46ed5fcd 100644
--- a/Framework/SINQ/src/SINQHMListener.cpp
+++ b/Framework/SINQ/src/SINQHMListener.cpp
@@ -4,7 +4,6 @@
  *  Created on: Nov 14, 2012
  *      Author: mark.koennecke@psi.ch
  */
-#include <iostream>
 #include <sstream>
 
 #include "MantidAPI/LiveListenerFactory.h"
diff --git a/Framework/SINQ/test/PoldiFitPeaks1D2Test.h b/Framework/SINQ/test/PoldiFitPeaks1D2Test.h
index 4ced3e46bad5c158d1d9ef7f047fa179be817d44..35fbec1cc249f38f5f47758afc1a36845b5b3002 100644
--- a/Framework/SINQ/test/PoldiFitPeaks1D2Test.h
+++ b/Framework/SINQ/test/PoldiFitPeaks1D2Test.h
@@ -9,8 +9,7 @@
 #include "MantidAPI/CompositeFunction.h"
 #include "MantidAPI/IPeakFunction.h"
 
-#include "MantidCurveFitting/Gaussian.h"
-#include "MantidCurveFitting/FlatBackground.h"
+#include "MantidCurveFitting/Functions/FlatBackground.h"
 
 #include "MantidSINQ/PoldiUtilities/PoldiPeak.h"
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
@@ -21,6 +20,7 @@ using Mantid::Poldi::PoldiFitPeaks1D2;
 using namespace Mantid::Poldi;
 using namespace Mantid::API;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Functions;
 using namespace Mantid::Kernel;
 using namespace Mantid::DataObjects;
 
diff --git a/Framework/SINQ/test/PoldiFitPeaks1DTest.h b/Framework/SINQ/test/PoldiFitPeaks1DTest.h
index a2158802104fad5391ed961eec6a2eced22c43b3..452d6472c3987e074ea2ba878042f6b2cca616c4 100644
--- a/Framework/SINQ/test/PoldiFitPeaks1DTest.h
+++ b/Framework/SINQ/test/PoldiFitPeaks1DTest.h
@@ -9,8 +9,7 @@
 #include "MantidAPI/CompositeFunction.h"
 #include "MantidAPI/IPeakFunction.h"
 
-#include "MantidCurveFitting/Gaussian.h"
-#include "MantidCurveFitting/FlatBackground.h"
+#include "MantidCurveFitting/Functions/FlatBackground.h"
 
 #include "MantidSINQ/PoldiUtilities/PoldiPeak.h"
 
@@ -18,6 +17,7 @@ using Mantid::Poldi::PoldiFitPeaks1D;
 using namespace Mantid::Poldi;
 using namespace Mantid::API;
 using namespace Mantid::CurveFitting;
+using namespace Mantid::CurveFitting::Functions;
 using namespace Mantid::Kernel;
 
 class TestablePoldiFitPeaks1D : public Mantid::Poldi::PoldiFitPeaks1D {
diff --git a/Framework/SINQ/test/PoldiFitPeaks2DTest.h b/Framework/SINQ/test/PoldiFitPeaks2DTest.h
index da95dd9141476a4b1fdef8b7604b044ff0b0f45a..a9f11eb2d9af4e130098bdbf47729f9625cfc4e6 100644
--- a/Framework/SINQ/test/PoldiFitPeaks2DTest.h
+++ b/Framework/SINQ/test/PoldiFitPeaks2DTest.h
@@ -433,6 +433,40 @@ public:
     TS_ASSERT_EQUALS(refinedCell, "5 5 5 90 90 90");
   }
 
+  void testGetCrystalSystemFromPointGroup() {
+    TestablePoldiFitPeaks2D alg;
+
+    auto pgCubic = PointGroupFactory::Instance().createPointGroup("m-3m");
+    TS_ASSERT_EQUALS(alg.getCrystalSystemFromPointGroup(pgCubic), "Cubic");
+
+    auto pgTetra = PointGroupFactory::Instance().createPointGroup("4/mmm");
+    TS_ASSERT_EQUALS(alg.getCrystalSystemFromPointGroup(pgTetra), "Tetragonal");
+
+    auto pgOrtho = PointGroupFactory::Instance().createPointGroup("mmm");
+    TS_ASSERT_EQUALS(alg.getCrystalSystemFromPointGroup(pgOrtho),
+                     "Orthorhombic");
+
+    auto pgMono = PointGroupFactory::Instance().createPointGroup("2/m");
+    TS_ASSERT_EQUALS(alg.getCrystalSystemFromPointGroup(pgMono), "Monoclinic");
+
+    auto pgTric = PointGroupFactory::Instance().createPointGroup("-1");
+    TS_ASSERT_EQUALS(alg.getCrystalSystemFromPointGroup(pgTric), "Triclinic");
+
+    auto pgHex = PointGroupFactory::Instance().createPointGroup("6/mmm");
+    TS_ASSERT_EQUALS(alg.getCrystalSystemFromPointGroup(pgHex), "Hexagonal");
+
+    auto pgTrigRh = PointGroupFactory::Instance().createPointGroup("-3m r");
+    TS_ASSERT_EQUALS(alg.getCrystalSystemFromPointGroup(pgTrigRh), "Trigonal");
+
+    auto pgTrigHex = PointGroupFactory::Instance().createPointGroup("-3m");
+    TS_ASSERT_EQUALS(alg.getCrystalSystemFromPointGroup(pgTrigHex),
+                     "Hexagonal");
+
+    PointGroup_sptr invalid;
+    TS_ASSERT_THROWS(alg.getCrystalSystemFromPointGroup(invalid),
+                     std::invalid_argument);
+  }
+
 private:
   PoldiInstrumentAdapter_sptr m_instrument;
   PoldiTimeTransformer_sptr m_timeTransformer;
diff --git a/Framework/SINQ/test/PoldiSpectrumDomainFunctionTest.h b/Framework/SINQ/test/PoldiSpectrumDomainFunctionTest.h
index f9eb10908965fcbc41cb3fb4ab9d8c382c5a8382..492393f6b0a8a8122190cbd8da275650fb1d74fe 100644
--- a/Framework/SINQ/test/PoldiSpectrumDomainFunctionTest.h
+++ b/Framework/SINQ/test/PoldiSpectrumDomainFunctionTest.h
@@ -12,7 +12,6 @@
 #include "MantidAPI/FunctionValues.h"
 #include "MantidAPI/FunctionFactory.h"
 #include "MantidAPI/MultiDomainFunction.h"
-#include "MantidCurveFitting/Gaussian.h"
 #include "MantidCurveFitting/FitMW.h"
 #include "MantidCurveFitting/Jacobian.h"
 
diff --git a/Framework/TestHelpers/inc/MantidTestHelpers/FakeObjects.h b/Framework/TestHelpers/inc/MantidTestHelpers/FakeObjects.h
index d114a1ee434bb7a670fe77d3f9a9a90af498da6d..b9c906a2804d32c3049699391f332ba19d3fa9c3 100644
--- a/Framework/TestHelpers/inc/MantidTestHelpers/FakeObjects.h
+++ b/Framework/TestHelpers/inc/MantidTestHelpers/FakeObjects.h
@@ -18,19 +18,19 @@
  *      Author: Janik Zikovsky
  */
 
+#include <fstream>
+#include <map>
+#include <string>
+
 #include "MantidAPI/ISpectrum.h"
 #include "MantidAPI/ITableWorkspace.h"
 #include "MantidAPI/MatrixWorkspace.h"
-#include "MantidKernel/cow_ptr.h"
 #include "MantidAPI/RefAxis.h"
 #include "MantidAPI/SpectraAxis.h"
 #include "MantidGeometry/Instrument.h"
 #include "MantidGeometry/Instrument/DetectorGroup.h"
 #include "MantidGeometry/Instrument/INearestNeighbours.h"
-#include <iostream>
-#include <fstream>
-#include <map>
-#include <string>
+#include "MantidKernel/cow_ptr.h"
 
 using namespace Mantid::API;
 using namespace Mantid::Kernel;
diff --git a/Framework/TestHelpers/inc/MantidTestHelpers/ScopedFileHelper.h b/Framework/TestHelpers/inc/MantidTestHelpers/ScopedFileHelper.h
index e1701b8e755d30b6d97e22cd57d4cddecd5cec98..430cba7905b24eff879ea925528431386c272253 100644
--- a/Framework/TestHelpers/inc/MantidTestHelpers/ScopedFileHelper.h
+++ b/Framework/TestHelpers/inc/MantidTestHelpers/ScopedFileHelper.h
@@ -1,12 +1,13 @@
 //------------------------------------------------------------------------------
 // Includes
 //------------------------------------------------------------------------------
-#include <string>
-#include <iostream>
 #include <fstream>
-#include <Poco/Path.h>
+#include <string>
+
 #include "MantidKernel/ConfigService.h"
 
+#include <Poco/Path.h>
+
 namespace ScopedFileHelper {
 /** File object type. Provides exception save file creation/destruction.
 
diff --git a/Framework/TestHelpers/src/LoggingCleaner.cpp b/Framework/TestHelpers/src/LoggingCleaner.cpp
index 7e6bcdaef45e5d3d25e7872759a2e4ce215c06e8..81b7cead7dcce200d1711df3f7a0846dfd5c4231 100644
--- a/Framework/TestHelpers/src/LoggingCleaner.cpp
+++ b/Framework/TestHelpers/src/LoggingCleaner.cpp
@@ -1,5 +1,4 @@
 #include "MantidKernel/Logger.h"
-#include <iostream>
 
 class LoggingCleaner {
 public:
diff --git a/Framework/WorkflowAlgorithms/src/RefReduction.cpp b/Framework/WorkflowAlgorithms/src/RefReduction.cpp
index 4ece40c1ee5a6b08b584bceb6cc4eb34b8aee91b..c65be0ce528d4931c1d315a5a70e4ce20c321a22 100644
--- a/Framework/WorkflowAlgorithms/src/RefReduction.cpp
+++ b/Framework/WorkflowAlgorithms/src/RefReduction.cpp
@@ -629,6 +629,8 @@ double RefReduction::calculateAngleREFM(MatrixWorkspace_sptr workspace) {
   Mantid::Kernel::Property *prop = workspace->run().getProperty("SampleDetDis");
   Mantid::Kernel::TimeSeriesProperty<double> *dp =
       dynamic_cast<Mantid::Kernel::TimeSeriesProperty<double> *>(prop);
+  if (!dp)
+    throw std::runtime_error("SampleDetDis was not a TimeSeriesProperty");
   const double det_distance = dp->getStatistics().mean / 1000.0;
 
   double direct_beam_pix = getProperty("DirectPixel");
diff --git a/MantidPlot/pymantidplot/__init__.py b/MantidPlot/pymantidplot/__init__.py
index f77ce7c983d7da2f2fb6446947c212e40fcbedd5..3ea6a0189f54e0505309f7f71b712aba68fe14c9 100644
--- a/MantidPlot/pymantidplot/__init__.py
+++ b/MantidPlot/pymantidplot/__init__.py
@@ -300,7 +300,9 @@ def plotMD(source, plot_axis=-2, normalization=DEFAULT_MD_NORMALIZATION, error_b
     Args:
         source: Workspace(s) to plot
         plot_axis: Index of the plot axis (defaults to auto-select)
-        normalization: Type of normalization required (defaults to volume)
+        normalization: Type of normalization required (defaults to volume, options available:
+                       MDNormalization.NoNormalization, MDNormalization.NumEventsNormalization, and
+                       MDNormalization.VolumeNormalization).
         error_bars: Flag for error bar plotting.
         window: window used for plotting. If None a new one will be created
         clearWindow: if is True, the window specified will be cleared before adding new curve
diff --git a/MantidPlot/src/ApplicationWindow.cpp b/MantidPlot/src/ApplicationWindow.cpp
index d9455438c81ff03c2f0516cc79f00b0934b5c201..3fa69dd633f1932060d53fc279973fe2ed4731c0 100644
--- a/MantidPlot/src/ApplicationWindow.cpp
+++ b/MantidPlot/src/ApplicationWindow.cpp
@@ -10153,6 +10153,7 @@ void ApplicationWindow::showGraphContextMenu() {
   QMenu axes(this);
   QMenu colour(this);
   QMenu normalization(this);
+  QMenu normMD(this);
   QMenu exports(this);
   QMenu copy(this);
   QMenu prints(this);
@@ -10218,6 +10219,27 @@ void ApplicationWindow::showGraphContextMenu() {
     noNorm->setChecked(!ag->isDistribution());
     binNorm->setChecked(ag->isDistribution());
     cm.insertItem(tr("&Normalization"), &normalization);
+  } else if (ag->normalizableMD()) {
+    QAction *noNormMD = new QAction(tr("N&one"), &normMD);
+    noNormMD->setCheckable(true);
+    connect(noNormMD, SIGNAL(activated()), ag, SLOT(noNormalizationMD()));
+    normMD.addAction(noNormMD);
+
+    QAction *volNormMD = new QAction(tr("&Volume"), &normMD);
+    volNormMD->setCheckable(true);
+    connect(volNormMD, SIGNAL(activated()), ag, SLOT(volumeNormalizationMD()));
+    normMD.addAction(volNormMD);
+
+    QAction *eventsNormMD = new QAction(tr("&Events"), &normMD);
+    eventsNormMD->setCheckable(true);
+    connect(eventsNormMD, SIGNAL(activated()), ag, SLOT(numEventsNormalizationMD()));
+    normMD.addAction(eventsNormMD);
+
+    int normalization = ag->normalizationMD();
+    noNormMD->setChecked(0 == normalization);
+    volNormMD->setChecked(1 == normalization);
+    eventsNormMD->setChecked(2 == normalization);
+    cm.insertItem("MD &Normalization", &normMD);
   }
 
   QMenu plotType(this);
diff --git a/MantidPlot/src/CanvasPicker.cpp b/MantidPlot/src/CanvasPicker.cpp
index 2e918d8e064e3c9ad54900ec84662cafb6205846..96b5f6f4f3269e6226602ab49465c56be6f1709e 100644
--- a/MantidPlot/src/CanvasPicker.cpp
+++ b/MantidPlot/src/CanvasPicker.cpp
@@ -39,7 +39,6 @@
 #include <QVector>
 #include <qwt_text_label.h>
 #include <qwt_plot_canvas.h>
-//#include <iostream>
 
 CanvasPicker::CanvasPicker(Graph *graph):
 	QObject(graph)
diff --git a/MantidPlot/src/ConfigDialog.cpp b/MantidPlot/src/ConfigDialog.cpp
index 6344d67d31cb6107058a72196d4b9b7feec1ac5a..87e74e4ea83cab6eb72537345019aeadb92dc4f3 100644
--- a/MantidPlot/src/ConfigDialog.cpp
+++ b/MantidPlot/src/ConfigDialog.cpp
@@ -2341,8 +2341,11 @@ void ConfigDialog::apply()
   QList<MdiSubWindow*> windows = app->windowsList();
   foreach(MdiSubWindow *w, windows){
     if (w->isA("MultiLayer")){
-      (dynamic_cast<MultiLayer*>(w))->setScaleLayersOnPrint(boxScaleLayersOnPrint->isChecked());
-      (dynamic_cast<MultiLayer*>(w))->printCropmarks(boxPrintCropmarks->isChecked());
+      MultiLayer* multiLayer = dynamic_cast<MultiLayer*>(w);
+      if (multiLayer) {
+        multiLayer->setScaleLayersOnPrint(boxScaleLayersOnPrint->isChecked());
+        multiLayer->printCropmarks(boxPrintCropmarks->isChecked());
+      }
     }
   }
   // general page: application tab
diff --git a/MantidPlot/src/ContourLinesEditor.cpp b/MantidPlot/src/ContourLinesEditor.cpp
index 19ff48b3bf2c9a39d2da9d592d99f953a1315e9b..144b2c7f245cd9c0bbb736cbee787ba77a733413 100644
--- a/MantidPlot/src/ContourLinesEditor.cpp
+++ b/MantidPlot/src/ContourLinesEditor.cpp
@@ -108,10 +108,14 @@ void ContourLinesEditor::updateContourLevels()
 
 	int rows = table->rowCount();
 	QwtValueList levels;
-	for (int i = 0; i < rows; i++)
-		levels << dynamic_cast<DoubleSpinBox*>(table->cellWidget(i, 0))->value();
+  for (int i = 0; i < rows; i++) {
+    DoubleSpinBox *spinBox =
+        dynamic_cast<DoubleSpinBox *>(table->cellWidget(i, 0));
+    if (spinBox)
+      levels << spinBox->value();
+  }
 
-	d_spectrogram->setContourLevels(levels);
+  d_spectrogram->setContourLevels(levels);
 }
 
 void ContourLinesEditor::updateContourPens()
diff --git a/MantidPlot/src/CustomActionDialog.cpp b/MantidPlot/src/CustomActionDialog.cpp
index 0ffe792247682d974fbf3c6af8338c200fa32c61..8b779deb8ec2a2fb4978b0b5a1439b5d8ba7b504 100644
--- a/MantidPlot/src/CustomActionDialog.cpp
+++ b/MantidPlot/src/CustomActionDialog.cpp
@@ -514,7 +514,10 @@ void CustomActionDialog::chooseFolder()
 QAction * CustomActionDialog::actionAt(int row)
 {
 	ApplicationWindow *app = dynamic_cast<ApplicationWindow *>(parent());
-	QList<QAction *>actions = app->customActionsList();
+  if (!app)
+    throw std::runtime_error(
+        "The parent of this dialog was not the Application Window");
+  QList<QAction *>actions = app->customActionsList();
 	if (actions.isEmpty() || row < 0 || row >= actions.count())
         return 0;
 
diff --git a/MantidPlot/src/Graph.cpp b/MantidPlot/src/Graph.cpp
index 4896dda0ac8f5465a4115391ded20133c46cac61..b90d59c0c2ba39d003eb0589957f4663b3ab805e 100644
--- a/MantidPlot/src/Graph.cpp
+++ b/MantidPlot/src/Graph.cpp
@@ -60,6 +60,7 @@
 
 #include "MantidAPI/AnalysisDataService.h"
 #include "Mantid/MantidMatrixCurve.h"
+#include "Mantid/MantidMDCurve.h"
 #include "MantidQtAPI/PlotAxis.h"
 #include "MantidQtAPI/QwtRasterDataMD.h"
 #include "MantidQtAPI/QwtWorkspaceSpectrumData.h"
@@ -107,7 +108,6 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <stddef.h>
-#include <iostream>
 
 // We can safely ignore warnings about assuming signed overflow does not occur from qvector.h
 // (They really should have implemented it with unsigned types!
@@ -210,6 +210,9 @@ Graph::Graph(int x, int y, int width, int height, QWidget* parent, Qt::WFlags f)
 
   m_isDistribution = false;
   m_normalizable = false;
+
+  m_normalizableMD = false;
+  m_normalizationMD = 0;
 }
 
 void Graph::notifyChanges()
@@ -1437,7 +1440,8 @@ void Graph::setAxisScale(int axis, double start, double end, int type, double st
           QwtScaleWidget *rightAxis = d_plot->axisWidget(QwtPlot::yRight);
           if(rightAxis)
           {
-            if (type == ScaleTransformation::Log10 && (start <= 0 || start == DBL_MAX))
+            //if (type == ScaleTransformation::Log10 && (start <= 0 || start == DBL_MAX))
+            if (type == GraphOptions::Log10 && (start <= 0 || start == DBL_MAX))
             {
               start = sp->getMinPositiveValue();
             }
@@ -3412,12 +3416,15 @@ QString Graph::yAxisTitleFromFirstCurve()
     using namespace Mantid::API;
     QString wsName = firstCurve->workspaceName();
     auto ws = AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>(wsName.toStdString());
-    return MantidQt::API::PlotAxis(m_isDistribution, *ws).title();
-  }
-  else
-  {
-    return axisTitle(0);
+    if (ws)
+      return MantidQt::API::PlotAxis(m_isDistribution, *ws).title();
+  } else if (auto *firstCurve = dynamic_cast<MantidMDCurve*>(curve(0))) {
+    MantidQwtIMDWorkspaceData* data = firstCurve->mantidData();
+    if (data)
+      return data->getYAxisLabel();
   }
+
+  return axisTitle(0);
 }
 
 void Graph::contextMenuEvent(QContextMenuEvent *e)
@@ -5520,9 +5527,9 @@ void Graph::noNormalization()
   if(!m_isDistribution) return; // Nothing to do
 
   m_isDistribution = false;
-  updateDataCurves();
-  d_plot->updateAxes();
-  setYAxisTitle(yAxisTitleFromFirstCurve());
+
+  updateCurvesAndAxes();
+
   notifyChanges();
 }
 
@@ -5534,11 +5541,65 @@ void Graph::binWidthNormalization()
   if(m_isDistribution) return; // Nothing to do
 
   m_isDistribution = true;
+
+  updateCurvesAndAxes();
+
+  notifyChanges();
+}
+
+/**
+ * Set 'None' normalization for MD plots
+ */
+void Graph::noNormalizationMD()
+{
+  if (!normalizableMD())
+    return;
+
+  setNormalizationMD(0);
+
+  updateCurvesAndAxes();
+
+  notifyChanges();
+}
+
+/**
+ * Set volume normalization for MD plots
+ */
+void Graph::volumeNormalizationMD()
+{
+  if (!normalizableMD())
+    return;
+
+  setNormalizationMD(1);
+
+  updateCurvesAndAxes();
+
+  notifyChanges();
+}
+
+/**
+ * Set number of events normalization for MD plots
+ */
+void Graph::numEventsNormalizationMD()
+{
+  if (!normalizableMD())
+    return;
+
+  setNormalizationMD(2);
+
+  updateCurvesAndAxes();
+
+  notifyChanges();
+}
+
+/**
+ * Convenience method to use when updating the normalization types
+ * (whether Matrix or MD data normalizatio).
+ */
+void Graph::updateCurvesAndAxes() {
   updateDataCurves();
   d_plot->updateAxes();
   setYAxisTitle(yAxisTitleFromFirstCurve());
-
-  notifyChanges();
 }
 
 void Graph::setWaterfallXOffset(int offset)
@@ -5654,6 +5715,15 @@ void Graph::updateDataCurves()
       mc->invalidateBoundingRect();
       mc->loadData();
     }
+    else if (MantidMDCurve *mdc = dynamic_cast<MantidMDCurve*>(pc))
+    {
+      //mdc->setDrawAsDistribution(m_isDistribution);
+      // yes, using int in Graph and ApplicationWindow instead of the proper enum, just so that
+      // IMDWorkspace.h does not need to be included in more places in MantidPlot
+      mdc->mantidData()->setNormalization(static_cast<Mantid::API::MDNormalization>(m_normalizationMD));
+      mdc->invalidateBoundingRect();
+    }
+
   }
   QApplication::restoreOverrideCursor();
 }
diff --git a/MantidPlot/src/Graph.h b/MantidPlot/src/Graph.h
index 9512139404943318a36ffc5dc9fa343d9fc82d7d..34ae08f03ca7eacf89224cf0b37a0bffcc81b19d 100644
--- a/MantidPlot/src/Graph.h
+++ b/MantidPlot/src/Graph.h
@@ -209,6 +209,20 @@ public slots:
   bool isDistribution() const { return m_isDistribution; }
   void setDistribution(const bool on) { m_isDistribution = on; }
 
+  void noNormalizationMD();
+  void numEventsNormalizationMD();
+  void volumeNormalizationMD();
+
+  /// normalizable in the MD sense, don't confuse with (bin width) normalizable(),
+  /// True if this is a plot MD
+  bool normalizableMD() const { return m_normalizableMD; }
+  void setNormalizableMD(const bool on) { m_normalizableMD = on; }
+
+  /// when using MD curves (true == normalizbleMD()), what type of normalization
+  int normalizationMD() const { return m_normalizationMD; }
+  void setNormalizationMD(const int normalization) { m_normalizationMD = normalization; }
+
+
 
   //! Accessor method for #d_plot.
   Plot* plotWidget(){return d_plot;};
@@ -813,6 +827,8 @@ private:
 
   QString yAxisTitleFromFirstCurve();
   
+  void updateCurvesAndAxes();
+
   Plot *d_plot;
   QwtPlotZoomer *d_zoomer[2];
   TitlePicker *titlePicker;
@@ -877,6 +893,12 @@ private:
   bool m_isDistribution;
   // True, if the graph can be plotted as distribution
   bool m_normalizable;
+
+  // True if the graph is an MD plot and can be normalized (none, volume, events)
+  bool m_normalizableMD;
+  /// type of normalization for MD curves
+  int m_normalizationMD;
+
   // x and y units of MantidCurves
   boost::shared_ptr<Mantid::Kernel::Unit> m_xUnits;
   boost::shared_ptr<Mantid::Kernel::Unit> m_yUnits;
diff --git a/MantidPlot/src/ImportASCIIDialog.cpp b/MantidPlot/src/ImportASCIIDialog.cpp
index c93828a254594e8a1b6f68ab3d0b7fd17e373427..075910ef35fb89d929af75626a20ae8a6845b781 100644
--- a/MantidPlot/src/ImportASCIIDialog.cpp
+++ b/MantidPlot/src/ImportASCIIDialog.cpp
@@ -46,7 +46,6 @@
 #include <QHeaderView>
 
 #include <gsl/gsl_math.h>
-#include<iostream>
 
 ImportASCIIDialog::ImportASCIIDialog(bool new_windows_only, QWidget * parent, bool extended, Qt::WFlags flags )
 : ExtensibleFileDialog(parent, extended, flags )
@@ -451,62 +450,67 @@ void ImportASCIIDialog::preview()
 
 void ImportASCIIDialog::previewTable()
 {
-	if (!d_preview_table)
-		return;
+  if (!d_preview_table)
+    return;
 
-	if (!d_preview_table->isVisible())
-		d_preview_table->show();
+  if (!d_preview_table->isVisible())
+    d_preview_table->show();
 
-	if (d_current_path.trimmed().isEmpty()){
-		d_preview_table->clear();
-		d_preview_table->resetHeader();
-        return;
-    }
+  if (d_current_path.trimmed().isEmpty()){
+    d_preview_table->clear();
+    d_preview_table->resetHeader();
+    return;
+  }
 
-	int importMode = d_import_mode->currentIndex();
-	if (importMode == NewTables)
-		importMode = Table::Overwrite;
-	else
-		importMode -= 2;
-
-	d_preview_table->resetHeader();
-	d_preview_table->importASCII(d_current_path, columnSeparator(), d_ignored_lines->value(),
-							d_rename_columns->isChecked(), d_strip_spaces->isChecked(),
-							d_simplify_spaces->isChecked(), d_import_comments->isChecked(),
-                            d_comment_string->text(), (Table::ImportMode)importMode, 
-                            boxEndLine->currentIndex(), d_preview_lines_box->value());
-
-	if (d_import_dec_separators->isChecked())
-		d_preview_table->updateDecimalSeparators(decimalSeparators());
-    if (!d_preview_table->isVisible())
-        d_preview_table->show();
+  int importMode = d_import_mode->currentIndex();
+  if (importMode == NewTables) {
+    importMode = (ImportASCIIDialog::ImportMode)Table::Overwrite;
+  } else {
+    importMode -= 2;
+  }
+
+  d_preview_table->resetHeader();
+  d_preview_table->importASCII(d_current_path, columnSeparator(), d_ignored_lines->value(),
+                               d_rename_columns->isChecked(), d_strip_spaces->isChecked(),
+                               d_simplify_spaces->isChecked(), d_import_comments->isChecked(),
+                               d_comment_string->text(), (Table::ImportMode)importMode,
+                               boxEndLine->currentIndex(), d_preview_lines_box->value());
+
+  if (d_import_dec_separators->isChecked())
+    d_preview_table->updateDecimalSeparators(decimalSeparators());
+
+  if (!d_preview_table->isVisible())
+    d_preview_table->show();
 }
 
-void ImportASCIIDialog::previewMatrix()
-{
-	if (!d_preview_matrix)
-		return;
+void ImportASCIIDialog::previewMatrix() {
+  if (!d_preview_matrix)
+    return;
 
-	if (d_current_path.trimmed().isEmpty()){
-		d_preview_matrix->clear();
-        return;
-    }
+  if (d_current_path.trimmed().isEmpty()) {
+    d_preview_matrix->clear();
+    return;
+  }
 
-	int importMode = d_import_mode->currentIndex();
-	if (importMode == NewMatrices)
-		importMode = Matrix::Overwrite;
-	else
-		importMode -= 2;
+  int importMode = d_import_mode->currentIndex();
+  if (importMode == NewMatrices) {
+    importMode = (ImportASCIIDialog::ImportMode)Matrix::Overwrite;
+  } else {
+    // Overwrite-2 => NewColumns (in both Matrix::importMode and
+    // ImportASCIIDialog::importMode)
+    importMode -= 2;
+  }
 
-	QLocale locale = d_preview_matrix->locale();
-	if(d_import_dec_separators->isChecked())
-		locale = decimalSeparators();
+  QLocale locale = d_preview_matrix->locale();
+  if (d_import_dec_separators->isChecked())
+    locale = decimalSeparators();
 
-	d_preview_matrix->importASCII(d_current_path, columnSeparator(), d_ignored_lines->value(),
-							d_strip_spaces->isChecked(), d_simplify_spaces->isChecked(),
-                            d_comment_string->text(), importMode, locale,
-                            boxEndLine->currentIndex(), d_preview_lines_box->value());
-	d_preview_matrix->resizeColumnsToContents();
+  d_preview_matrix->importASCII(
+      d_current_path, columnSeparator(), d_ignored_lines->value(),
+      d_strip_spaces->isChecked(), d_simplify_spaces->isChecked(),
+      d_comment_string->text(), importMode, locale, boxEndLine->currentIndex(),
+      d_preview_lines_box->value());
+  d_preview_matrix->resizeColumnsToContents();
 }
 
 void ImportASCIIDialog::changePreviewFile(const QString& path)
@@ -543,8 +547,8 @@ void ImportASCIIDialog::setNewWindowsOnly(bool on)
     if (on){
         d_import_mode->clear();
         d_import_mode->addItem(tr("New Table"));
-        d_import_mode->addItem(tr("New Matrice"));
-		d_import_mode->addItem(tr("New Workspace"));
+        d_import_mode->addItem(tr("New Matrix"));
+        d_import_mode->addItem(tr("New Workspace"));
     }
 
     d_preview_button->setChecked(false);
diff --git a/MantidPlot/src/LegendWidget.cpp b/MantidPlot/src/LegendWidget.cpp
index d17de38685353e8b345e06f214dc8afb5d20038f..b11a10f70fd5790cb42c0ce7bb97b793f9203562 100644
--- a/MantidPlot/src/LegendWidget.cpp
+++ b/MantidPlot/src/LegendWidget.cpp
@@ -45,7 +45,6 @@
 #include <qwt_layout_metrics.h>
 #include <qwt_symbol.h>
 
-#include <iostream>
 
 LegendWidget::LegendWidget(Plot *plot):QWidget(plot),
 	d_plot(plot),
diff --git a/MantidPlot/src/Mantid/AlgorithmHistoryWindow.cpp b/MantidPlot/src/Mantid/AlgorithmHistoryWindow.cpp
index 3a3b77c8fd9c788f9f46b7b025966ebbf9909c42..54bd5afaec5e3c1f91ef237834b4d8d3626b8308 100644
--- a/MantidPlot/src/Mantid/AlgorithmHistoryWindow.cpp
+++ b/MantidPlot/src/Mantid/AlgorithmHistoryWindow.cpp
@@ -19,7 +19,6 @@
 #include <QDir>
 
 #include <numeric>
-#include <iostream>
 #include <fstream>
 #include <stdio.h>
 
diff --git a/MantidPlot/src/Mantid/AlgorithmMonitor.cpp b/MantidPlot/src/Mantid/AlgorithmMonitor.cpp
index 04364ef9d714cf1906b8061f77ce398dfc9a1111..5b4ffee3981e6414ebcc919bc80ebb93873f75e8 100644
--- a/MantidPlot/src/Mantid/AlgorithmMonitor.cpp
+++ b/MantidPlot/src/Mantid/AlgorithmMonitor.cpp
@@ -8,7 +8,6 @@
 #include <QtGui>
 #include <QThread>
 
-#include <iostream>
 #include <algorithm>
 
 using namespace std;
diff --git a/MantidPlot/src/Mantid/FitParameterTie.cpp b/MantidPlot/src/Mantid/FitParameterTie.cpp
index 928315ab13ef0ca142b535fe3e2db67c1a74e247..28bdb2c7bc4fbed6c23d4ed7e02c32d6ef078c71 100644
--- a/MantidPlot/src/Mantid/FitParameterTie.cpp
+++ b/MantidPlot/src/Mantid/FitParameterTie.cpp
@@ -2,7 +2,6 @@
 #include "MantidAPI/CompositeFunction.h"
 #include <QRegExp>
 #include <stdexcept>
-#include <iostream>
 
 /// Constructor
 FitParameterTie::FitParameterTie(boost::shared_ptr<Mantid::API::CompositeFunction> cf)
diff --git a/MantidPlot/src/Mantid/InputHistory.cpp b/MantidPlot/src/Mantid/InputHistory.cpp
index 9487afac9e6d080a582f193d7bd9795e4ec12187..3b0da1e014ed39f61c1bd199d0ffe0890727a769 100644
--- a/MantidPlot/src/Mantid/InputHistory.cpp
+++ b/MantidPlot/src/Mantid/InputHistory.cpp
@@ -3,7 +3,6 @@
 
 #include <QSettings>
 #include <vector>
-#include <iostream>
 
 using namespace Mantid::API;
 using namespace Mantid::Kernel;
diff --git a/MantidPlot/src/Mantid/InstrumentWidget/CollapsiblePanel.cpp b/MantidPlot/src/Mantid/InstrumentWidget/CollapsiblePanel.cpp
index 1aa71735f6e784ad9d982caf55f25155722ca9bd..6876cced0e8ccadf8e4d76c0dae2bc8f0c23eb87 100644
--- a/MantidPlot/src/Mantid/InstrumentWidget/CollapsiblePanel.cpp
+++ b/MantidPlot/src/Mantid/InstrumentWidget/CollapsiblePanel.cpp
@@ -6,7 +6,6 @@
 #include <QPolygon>
 
 #include <stdexcept>
-#include <iostream>
 
 CaptionLabel::CaptionLabel(const QString& caption,QWidget* parent):QLabel(caption,parent),m_collapsed(false)
 {
diff --git a/MantidPlot/src/Mantid/InstrumentWidget/GLActorCollection.cpp b/MantidPlot/src/Mantid/InstrumentWidget/GLActorCollection.cpp
index ad3abc03981b6faef83220de41f85f927b4fa08c..b023799998cf149676534041c557d4df7a28ebd6 100644
--- a/MantidPlot/src/Mantid/InstrumentWidget/GLActorCollection.cpp
+++ b/MantidPlot/src/Mantid/InstrumentWidget/GLActorCollection.cpp
@@ -5,7 +5,6 @@
 #include "MantidKernel/Exception.h"
 
 #include <stdexcept>
-#include <iostream>
 #include <functional>
 #include <algorithm>
 #include <float.h>
diff --git a/MantidPlot/src/Mantid/InstrumentWidget/GLColor.cpp b/MantidPlot/src/Mantid/InstrumentWidget/GLColor.cpp
index a7fe4c671ca1e83893816939532eab28202aa57b..2c232127ba143b343e6320f33c974a4382d256ff 100644
--- a/MantidPlot/src/Mantid/InstrumentWidget/GLColor.cpp
+++ b/MantidPlot/src/Mantid/InstrumentWidget/GLColor.cpp
@@ -4,6 +4,8 @@
 #include "GLColor.h"
 #include "MantidGeometry/Rendering/OpenGL_Headers.h"
 
+#include <iostream>
+
 /**
  * Default Constructor
  * @param red :: The red component of the RGB colour
diff --git a/MantidPlot/src/Mantid/InstrumentWidget/GLColor.h b/MantidPlot/src/Mantid/InstrumentWidget/GLColor.h
index 612efad0ba01a26a05abe6e403185a5dcca7832b..8bbe5681766eaff40f8c4bc03c7065535481cc13 100644
--- a/MantidPlot/src/Mantid/InstrumentWidget/GLColor.h
+++ b/MantidPlot/src/Mantid/InstrumentWidget/GLColor.h
@@ -1,7 +1,7 @@
 #ifndef GLCOLOR_H_
 #define GLCOLOR_H_
 
-#include <iostream>
+#include <iosfwd>
 
 /**
   \class  GLColor
diff --git a/MantidPlot/src/Mantid/InstrumentWidget/GLObject.cpp b/MantidPlot/src/Mantid/InstrumentWidget/GLObject.cpp
index 87815c5cf413272d650f3aab450c0300440354cf..f93d0d9e942e48c16b2795256bcaf30f9bdee588 100644
--- a/MantidPlot/src/Mantid/InstrumentWidget/GLObject.cpp
+++ b/MantidPlot/src/Mantid/InstrumentWidget/GLObject.cpp
@@ -5,7 +5,6 @@
 #include "ObjCompAssemblyActor.h"
 #include "MantidKernel/Exception.h"
 #include "MantidKernel/System.h"
-#include <iostream>
 
 int icount;
 GLObject::GLObject(bool withDisplayList,const std::string& name):mName(name), mChanged(true)
diff --git a/MantidPlot/src/Mantid/InstrumentWidget/InstrumentTreeWidget.cpp b/MantidPlot/src/Mantid/InstrumentWidget/InstrumentTreeWidget.cpp
index d725f60827949f724eee0152ddc0578c5e16a4cd..1b9cd0ce1eafb79f97f334cfaca7f75eb6c78fe1 100644
--- a/MantidPlot/src/Mantid/InstrumentWidget/InstrumentTreeWidget.cpp
+++ b/MantidPlot/src/Mantid/InstrumentWidget/InstrumentTreeWidget.cpp
@@ -12,7 +12,6 @@
 #include <QMessageBox>
 #include <QString>
 #include <cfloat>
-#include <iostream>
 
 InstrumentTreeWidget::InstrumentTreeWidget(QWidget *w):QTreeView(w), m_instrActor(NULL), m_treeModel(NULL)
 {
diff --git a/MantidPlot/src/Mantid/InstrumentWidget/MantidGLWidget.cpp b/MantidPlot/src/Mantid/InstrumentWidget/MantidGLWidget.cpp
index 9fea8e14de806cabe6faeb579156b03f33cb1dd3..dcd5dfc856a00b5b23900a0b88fea4af1e773d19 100644
--- a/MantidPlot/src/Mantid/InstrumentWidget/MantidGLWidget.cpp
+++ b/MantidPlot/src/Mantid/InstrumentWidget/MantidGLWidget.cpp
@@ -15,7 +15,6 @@
 
 #include <map>
 #include <string>
-#include <iostream>
 #include <cfloat>
 #include <typeinfo>
 
diff --git a/MantidPlot/src/Mantid/InstrumentWidget/OneCurvePlot.cpp b/MantidPlot/src/Mantid/InstrumentWidget/OneCurvePlot.cpp
index ea8e944da9099156c470d2fd8454272e96f7891b..090cde16df102ee36381f572326b508b332454e3 100644
--- a/MantidPlot/src/Mantid/InstrumentWidget/OneCurvePlot.cpp
+++ b/MantidPlot/src/Mantid/InstrumentWidget/OneCurvePlot.cpp
@@ -16,7 +16,6 @@
 #include <QPainter>
 #include <QFont>
 
-#include <iostream>
 #include <cmath>
 
 OneCurvePlot::OneCurvePlot(QWidget* parent):
diff --git a/MantidPlot/src/Mantid/InstrumentWidget/OpenGLError.cpp b/MantidPlot/src/Mantid/InstrumentWidget/OpenGLError.cpp
index e8cea2ea006df06912600df2cb708f998ce0f88f..afa7126f7499db695f9a5f731a0b5a23eb26f4bc 100644
--- a/MantidPlot/src/Mantid/InstrumentWidget/OpenGLError.cpp
+++ b/MantidPlot/src/Mantid/InstrumentWidget/OpenGLError.cpp
@@ -1,5 +1,4 @@
 #include "OpenGLError.h"
-#include <iostream>
 #include <sstream>
 #include "MantidKernel/Logger.h"
 #include "MantidGeometry/Rendering/OpenGL_Headers.h"
@@ -34,3 +33,8 @@ std::ostream& OpenGLError::log()
 {
   return g_log.error();
 }
+
+std::ostream& OpenGLError::logDebug()
+{
+  return g_log.debug();
+}
diff --git a/MantidPlot/src/Mantid/InstrumentWidget/OpenGLError.h b/MantidPlot/src/Mantid/InstrumentWidget/OpenGLError.h
index cdeb10d98f2ca333a20654e82d640597988998f8..c5e63188a828b6325d5725d70a9a11ba5006b648 100644
--- a/MantidPlot/src/Mantid/InstrumentWidget/OpenGLError.h
+++ b/MantidPlot/src/Mantid/InstrumentWidget/OpenGLError.h
@@ -16,6 +16,8 @@ public:
   static bool check(const std::string& funName);
   static bool hasError(const std::string& funName){return check(funName);}
   static std::ostream& log();
+  static std::ostream& logDebug();
+
 private:
   std::string m_msg;
 };
diff --git a/MantidPlot/src/Mantid/InstrumentWidget/PeakMarker2D.cpp b/MantidPlot/src/Mantid/InstrumentWidget/PeakMarker2D.cpp
index e7c5915aea5925c316a306b4db337360b1a3d0b2..99135d6c0b948016cac8b2109721c52eb4cb27f6 100644
--- a/MantidPlot/src/Mantid/InstrumentWidget/PeakMarker2D.cpp
+++ b/MantidPlot/src/Mantid/InstrumentWidget/PeakMarker2D.cpp
@@ -7,7 +7,6 @@
 #include <QMouseEvent>
 #include <QWheelEvent>
 
-#include <iostream>
 #include <algorithm>
 #include <stdexcept>
 #include <cmath>
diff --git a/MantidPlot/src/Mantid/InstrumentWidget/Projection3D.cpp b/MantidPlot/src/Mantid/InstrumentWidget/Projection3D.cpp
index d02948d9a19c79fe9251eef460285871c14a0e53..688652c8c9e7cdaba8bafa19adc2f8fbd9e9632a 100644
--- a/MantidPlot/src/Mantid/InstrumentWidget/Projection3D.cpp
+++ b/MantidPlot/src/Mantid/InstrumentWidget/Projection3D.cpp
@@ -23,7 +23,6 @@
 
 #include <map>
 #include <string>
-#include <iostream>
 #include <cfloat>
 #include <algorithm>
 
diff --git a/MantidPlot/src/Mantid/InstrumentWidget/ProjectionSurface.cpp b/MantidPlot/src/Mantid/InstrumentWidget/ProjectionSurface.cpp
index 1c6a0052da5fb529510990d2b153790c8ae3dee3..37a85ee1cfdd7f02149a70bff5c8a43c632989ad 100644
--- a/MantidPlot/src/Mantid/InstrumentWidget/ProjectionSurface.cpp
+++ b/MantidPlot/src/Mantid/InstrumentWidget/ProjectionSurface.cpp
@@ -220,7 +220,8 @@ void ProjectionSurface::draw(MantidGLWidget *widget,bool picking)const
     getController()->onPaint( painter );
     painter.end();
     // Discard any error generated here
-    glGetError();
+    GLuint ecode = glGetError();
+    OpenGLError::logDebug() << "Discarding OpenGL error: " << gluErrorString(ecode);
   }
 
 }
diff --git a/MantidPlot/src/Mantid/InstrumentWidget/Shape2D.cpp b/MantidPlot/src/Mantid/InstrumentWidget/Shape2D.cpp
index 0a40a6ff188c653ab6e139072d4222438edba486..bb5d301443a4fe282d1975a18a132873a43e21df 100644
--- a/MantidPlot/src/Mantid/InstrumentWidget/Shape2D.cpp
+++ b/MantidPlot/src/Mantid/InstrumentWidget/Shape2D.cpp
@@ -8,7 +8,6 @@
 #include <QLine>
 #include <QMap>
 
-#include <iostream>
 #include <algorithm>
 #include <stdexcept>
 #include <cmath>
diff --git a/MantidPlot/src/Mantid/InstrumentWidget/Shape2DCollection.cpp b/MantidPlot/src/Mantid/InstrumentWidget/Shape2DCollection.cpp
index dcbb04b15d4e764292ac601c3cffcda4c42b11ae..f2c380116003a2f527969cd3420e481512cbdc5b 100644
--- a/MantidPlot/src/Mantid/InstrumentWidget/Shape2DCollection.cpp
+++ b/MantidPlot/src/Mantid/InstrumentWidget/Shape2DCollection.cpp
@@ -7,7 +7,6 @@
 #include <QApplication>
 #include <QStringList>
 
-#include <iostream>
 #include <stdexcept>
 #include <cmath>
 
diff --git a/MantidPlot/src/Mantid/InstrumentWidget/UnwrappedSurface.cpp b/MantidPlot/src/Mantid/InstrumentWidget/UnwrappedSurface.cpp
index d83662b41b3b486ee0e4da6bce7f7fb13c2a5f1c..77766f8eff2801fa872fa1d9c612ba5122370e61 100644
--- a/MantidPlot/src/Mantid/InstrumentWidget/UnwrappedSurface.cpp
+++ b/MantidPlot/src/Mantid/InstrumentWidget/UnwrappedSurface.cpp
@@ -581,8 +581,8 @@ void UnwrappedSurface::drawSimpleToImage(QImage* image,bool picking)const
     if ( iw < 4 ) iw = 4;
     if ( ih < 4 ) ih = 4;
     
-    double w = (iw == 0)?  dw : udet.width/2;
-    double h = (ih == 0)?  dh : udet.height/2;
+    double w = udet.width/2;
+    double h = udet.height/2;
 
     if (!(m_viewRect.contains(udet.u-w, udet.v-h) || m_viewRect.contains(udet.u+w, udet.v+h))) continue;
 
diff --git a/MantidPlot/src/Mantid/InstrumentWidget/Viewport.cpp b/MantidPlot/src/Mantid/InstrumentWidget/Viewport.cpp
index fe0de8deb055bc5721ab9bbc5df3eec66ff61e4d..1c1c1cce8e769f9a132a535867b0ca279c79a35f 100644
--- a/MantidPlot/src/Mantid/InstrumentWidget/Viewport.cpp
+++ b/MantidPlot/src/Mantid/InstrumentWidget/Viewport.cpp
@@ -1,6 +1,5 @@
 #include "Viewport.h"
 #include <math.h>
-#include <iostream>
 #include "MantidGeometry/Rendering/OpenGL_Headers.h"
 #include "MantidKernel/V3D.h"
 #include "OpenGLError.h"
diff --git a/MantidPlot/src/Mantid/MantidApplication.cpp b/MantidPlot/src/Mantid/MantidApplication.cpp
index 67a264b7b77f1f1be7793be6bf5c16e7a5c5d138..00d38187960f9b55ee9851b0e879cbad491d2a97 100644
--- a/MantidPlot/src/Mantid/MantidApplication.cpp
+++ b/MantidPlot/src/Mantid/MantidApplication.cpp
@@ -8,6 +8,7 @@
 
 #include <QMessageBox>
 #include <QPushButton>
+
 #include <iostream>
 
 namespace
diff --git a/MantidPlot/src/Mantid/MantidMatrix.cpp b/MantidPlot/src/Mantid/MantidMatrix.cpp
index 1bfeabebe8f9a032becd58732e730038e2dfc296..0702315186ac550a91dc62e1b6df5826e94ac62c 100644
--- a/MantidPlot/src/Mantid/MantidMatrix.cpp
+++ b/MantidPlot/src/Mantid/MantidMatrix.cpp
@@ -49,7 +49,6 @@
 #include <QTabWidget>
 
 #include <stdlib.h>
-#include <iostream>
 #include <algorithm>
 #include <limits>
 
diff --git a/MantidPlot/src/Mantid/MantidMatrix.h b/MantidPlot/src/Mantid/MantidMatrix.h
index a26a55d01a9f14ce20ce8f56b5a0280f7c04d9d1..84aed7cef4775f634683751b6ad72c058c4e60f5 100644
--- a/MantidPlot/src/Mantid/MantidMatrix.h
+++ b/MantidPlot/src/Mantid/MantidMatrix.h
@@ -1,6 +1,26 @@
 #ifndef MANTIDMATRIX_H
 #define MANTIDMATRIX_H
 
+#include <map>
+#include <math.h>
+#include <string>
+
+#include "MantidMatrixExtensionRequest.h"
+#include "MantidMatrixModel.h"
+#include "MantidMatrixTabExtension.h"
+
+#include "Mantid/IProjectSerialisable.h"
+#include "MantidAPI/AnalysisDataService.h"
+#include "MantidAPI/FrameworkManager.h"
+#include "MantidAPI/MatrixWorkspace_fwd.h"
+#include "MantidQtAPI/WorkspaceObserver.h"
+#include "../ContourLinesEditor.h"
+#include "../Graph.h"
+#include "../MdiSubWindow.h"
+#include "../UserFunction.h"
+
+#include <Poco/NObserver.h>
+
 #include <QHeaderView>
 #include <QTableView>
 #include <QPrinter>
@@ -11,32 +31,9 @@
 #include <QMap>
 #include <QPointer>
 
-#include <Poco/NObserver.h>
-
-#include "MantidAPI/MatrixWorkspace_fwd.h"
-#include "MantidAPI/AnalysisDataService.h"
-#include "../UserFunction.h"
-#include "../MdiSubWindow.h"
-#include "../Graph.h"
-#include "MantidQtAPI/WorkspaceObserver.h"
-#include "Mantid/IProjectSerialisable.h"
-
 #include <qwt_double_rect.h>
 #include <qwt_color_map.h>
 
-#include <math.h>
-#include <string>
-#include <iostream>
-#include <map>
-
-#include "MantidAPI/FrameworkManager.h"
-#include "../ContourLinesEditor.h"
-
-#include "MantidMatrixExtensionRequest.h"
-#include "MantidMatrixModel.h"
-#include "MantidMatrixTabExtension.h"
-
-
 class QLabel;
 class QStackedWidget;
 class QShortcut;
diff --git a/MantidPlot/src/Mantid/MantidSampleLogDialog.cpp b/MantidPlot/src/Mantid/MantidSampleLogDialog.cpp
index 75d103842c8439fd2fbb44d37adcfa4b29c259b0..7e5969971fe53fce5369bf8ad52f4b959d085be1 100644
--- a/MantidPlot/src/Mantid/MantidSampleLogDialog.cpp
+++ b/MantidPlot/src/Mantid/MantidSampleLogDialog.cpp
@@ -20,7 +20,6 @@
 #include <QRadioButton>
 #include <QFileInfo>
 #include <QMessageBox>
-#include <iostream>
 #include <sstream>
 #include "MantidAPI/ExperimentInfo.h"
 #include "MantidAPI/MultipleExperimentInfos.h"
diff --git a/MantidPlot/src/Mantid/MantidTable.cpp b/MantidPlot/src/Mantid/MantidTable.cpp
index de0d7ddf84284a23f0317a2f6706c59727fff950..722da9ddc3519154666b378b65b8d86c072d0549 100644
--- a/MantidPlot/src/Mantid/MantidTable.cpp
+++ b/MantidPlot/src/Mantid/MantidTable.cpp
@@ -10,7 +10,6 @@
 #include <QMessageBox>
 #include <QHash>
 
-#include <iostream>
 #include <qfontmetrics.h>
 
 using namespace MantidQt::API;
diff --git a/MantidPlot/src/Mantid/MantidUI.cpp b/MantidPlot/src/Mantid/MantidUI.cpp
index 57ff719e17bc3fd07f193f9f5c3b20f7e6bfee5c..f6ddf9efda70d0a46db18176e62f79426ebffe43 100644
--- a/MantidPlot/src/Mantid/MantidUI.cpp
+++ b/MantidPlot/src/Mantid/MantidUI.cpp
@@ -68,7 +68,6 @@
 #include <locale>
 #include <set>
 #include <fstream>
-#include <iostream>
 #include <sstream>
 
 #include <boost/tokenizer.hpp>
@@ -618,6 +617,9 @@ MultiLayer* MantidUI::plotMDList(const QStringList& wsNames, const int plotAxis,
       data->setPlotAxisChoice(plotAxis);
       data->setNormalization(normalization);
 
+      g->setNormalizableMD(true);
+      g->setNormalizationMD(normalization);
+
       // Using information from the first graph
       if( i == 0 && isGraphNew )
         g->setAutoScale();
diff --git a/MantidPlot/src/Mantid/PeakPickerTool.cpp b/MantidPlot/src/Mantid/PeakPickerTool.cpp
index 2b5f31ed2bc51a2af4b37429a6176a008c24d6e4..0e071aa584dd73b7adaa756478eaabb70c859273 100644
--- a/MantidPlot/src/Mantid/PeakPickerTool.cpp
+++ b/MantidPlot/src/Mantid/PeakPickerTool.cpp
@@ -22,7 +22,6 @@
 #include <QInputDialog>
 #include <QMessageBox>
 
-#include <iostream>
 
 namespace
 {
diff --git a/MantidPlot/src/Mantid/UserFitFunctionDialog.cpp b/MantidPlot/src/Mantid/UserFitFunctionDialog.cpp
index eee79fa5b3a03980875658b2bc2ab34e142fa100..0814da59551452e138cd5f902fd2f43905eb3a33 100644
--- a/MantidPlot/src/Mantid/UserFitFunctionDialog.cpp
+++ b/MantidPlot/src/Mantid/UserFitFunctionDialog.cpp
@@ -7,7 +7,6 @@
 #include <qcheckbox.h>
 #include <qmessagebox.h>
 #include <qheaderview.h>
-#include <iostream>
 
 //---------------------------------------
 // Public member functions
diff --git a/MantidPlot/src/PythonScript.cpp b/MantidPlot/src/PythonScript.cpp
index 23717ada1dba6da691120c87e945f34295fce876..a83c5a096e4263f5e624afbbbed2ba2f5645a962 100644
--- a/MantidPlot/src/PythonScript.cpp
+++ b/MantidPlot/src/PythonScript.cpp
@@ -39,7 +39,6 @@
 #include <QVariant>
 #include <QMessageBox>
 
-#include <iostream>
 #include <stdexcept>
 
 
diff --git a/MantidPlot/src/ScaleDetails.cpp b/MantidPlot/src/ScaleDetails.cpp
index 71190376094ff0093f8972b303d2eba67214edcd..e6ef88b10316eb1eaf83abc126038653d8a710d5 100644
--- a/MantidPlot/src/ScaleDetails.cpp
+++ b/MantidPlot/src/ScaleDetails.cpp
@@ -272,6 +272,10 @@ void ScaleDetails::initWidgets()
     if (type == ScaleDraw::Date)
     {
       ScaleDraw *sclDraw = dynamic_cast<ScaleDraw *>(d_plot->axisScaleDraw(m_mappedaxis));
+      if (!sclDraw) {
+        throw std::runtime_error("Could not convert the axis Scale Draw object "
+                                 "to a ScaleDraw object");
+      }
       QDateTime origin = sclDraw->dateTimeOrigin();
 
       m_dspnStart->hide();
diff --git a/MantidPlot/src/Spectrogram.cpp b/MantidPlot/src/Spectrogram.cpp
index ece80d7b100332f706b13ad4a60a7d516e7de05b..db3ab2aaa13618f36329caf4fa1f9918c9e69fad 100644
--- a/MantidPlot/src/Spectrogram.cpp
+++ b/MantidPlot/src/Spectrogram.cpp
@@ -46,7 +46,6 @@
 
 #include "TSVSerialiser.h"
 
-#include <iostream>
 #include <numeric>
 
 Spectrogram::Spectrogram():
diff --git a/MantidPlot/src/importOPJ.cpp b/MantidPlot/src/importOPJ.cpp
index f5d393e96b4239a28a8c3f23f98e9eabfeca5a7d..458e67fe47debd7431cdd9268e58cb0edb4594b5 100644
--- a/MantidPlot/src/importOPJ.cpp
+++ b/MantidPlot/src/importOPJ.cpp
@@ -702,6 +702,8 @@ bool ImportOPJ::importGraphs(const OPJFile& opj)
 					break;
 				case 'F':
 					s=opj.functionIndex(data.right(data.length()-2).toStdString().c_str());
+                                        if (s<0)
+                                          break;
 					int type;
 					if(opj.functionType(s)==1)//Polar
 					{
diff --git a/MantidPlot/src/origin/OPJFile.cpp b/MantidPlot/src/origin/OPJFile.cpp
index 4a37431010cf8227260a305495d68edbddf115b8..73c397f65f2b0677228b8845a3ee1219b7708505 100644
--- a/MantidPlot/src/origin/OPJFile.cpp
+++ b/MantidPlot/src/origin/OPJFile.cpp
@@ -51,8 +51,8 @@
 #endif
 
 #include <stdio.h>
-#include <iostream>
 #include <stdlib.h>
+#include <limits.h>
 #include <math.h>
 #include <cstring>
 #include <algorithm> //required for std::swap
@@ -1328,6 +1328,12 @@ void OPJFile::readSpreadInfo(FILE *f, FILE *debug)
       fread(&sec_size,4,1,f);
       if(IsBigEndian()) SwapBytes(sec_size);
 
+      if (INT_MAX == sec_size) {
+        // this would end in an overflow and it's obviously wrong
+        fprintf(debug, "Error: while reading spread info, found section size: %d\n", sec_size);
+        fflush(debug);
+      }
+
     //section_body_1
       LAYER+=0x5;
       fseek(f,LAYER,SEEK_SET);
@@ -1336,6 +1342,9 @@ void OPJFile::readSpreadInfo(FILE *f, FILE *debug)
       if(col_index!=-1)
       {
         char *stmp=new char[sec_size+1];
+        if (!stmp)
+          break;
+
         stmp[sec_size]='\0';
         fread(stmp,sec_size,1,f);
         SPREADSHEET[spread].column[col_index].command=stmp;
@@ -1553,6 +1562,12 @@ void OPJFile::readExcelInfo(FILE *f, FILE *debug)
       fread(&sec_size,4,1,f);
       if(IsBigEndian()) SwapBytes(sec_size);
 
+      if (INT_MAX == sec_size) {
+        // this would end in an overflow for new[] below and it's obviously wrong
+        fprintf(debug, "Error: while reading Excel info, found section size: %d\n", sec_size);
+        fflush(debug);
+      }
+
     //section_body_1
       LAYER+=0x5;
       fseek(f,LAYER,SEEK_SET);
@@ -1803,6 +1818,12 @@ void OPJFile::readMatrixInfo(FILE *f, FILE *debug)
     fread(&sec_size,4,1,f);
     if(IsBigEndian()) SwapBytes(sec_size);
 
+    if (INT_MAX == sec_size) {
+      // this would end in an overflow for new[] below and it's obviously wrong
+      fprintf(debug, "Error: while reading matrix info, found section size: %d\n", sec_size);
+      fflush(debug);
+    }
+
   //section_body_1
     LAYER+=0x5;
     //check if it is a formula
@@ -2934,11 +2955,17 @@ void OPJFile::readProjectTreeFolder(FILE *f, FILE *debug, tree<projectNode>::ite
   fread(&namesize,4,1,f);
   if(IsBigEndian()) SwapBytes(namesize);
 
-  POS+=5;
+  if (INT_MAX == namesize) {
+    // this would cause an overflow and it's anyway obviously wrong
+    fprintf(debug, "Error: while reading project tree folder, found project/folder name size: %d\n", namesize);
+    fflush(debug);
+  }
 
   // read folder name
   char* name=new char[namesize+1];
   name[namesize]='\0';
+
+  POS+=5;
   fseek(f,POS,SEEK_SET);
   fread(name,namesize,1,f);
   tree<projectNode>::iterator current_folder=projectTree.append_child(parent, projectNode(name, 1, creation_date, modification_date));
diff --git a/MantidPlot/src/pixmaps.cpp b/MantidPlot/src/pixmaps.cpp
index ddb37192d961e4258e27d187fe1fc5ef72ea7aa6..75faddbc7aebf93d8e47a4779b26f8ffe73fb07c 100644
--- a/MantidPlot/src/pixmaps.cpp
+++ b/MantidPlot/src/pixmaps.cpp
@@ -6,7 +6,6 @@
  */
 
 #include "pixmaps.h"
-#include <iostream>
 #include <sstream>
 #include <stdexcept>
 
diff --git a/MantidPlot/src/zlib123/minigzip.c b/MantidPlot/src/zlib123/minigzip.c
index 6f12762c8ecedb7a71ddf33c3f7f848178ba3075..5263508908db17952ab8df54cbd0d1bfc0575657 100644
--- a/MantidPlot/src/zlib123/minigzip.c
+++ b/MantidPlot/src/zlib123/minigzip.c
@@ -209,8 +209,9 @@ void file_compress(file, mode)
     FILE  *in;
     gzFile out;
 
-    strcpy(outfile, file);
-    strcat(outfile, GZ_SUFFIX);
+    strncpy(outfile, file, MAX_NAME_LEN-1);
+    outfile[MAX_NAME_LEN-1] = '\0';
+    strncat(outfile, GZ_SUFFIX, MAX_NAME_LEN - strlen(outfile) - 1);
 
     in = fopen(file, "rb");
     if (in == NULL) {
diff --git a/MantidQt/API/inc/MantidQtAPI/Message.h b/MantidQt/API/inc/MantidQtAPI/Message.h
index c14f3a1fd7adab22e8c8ca8bcb1d494179fc9b99..6ce90fd89149090e3aed2b73247b6cba9d538d10 100644
--- a/MantidQt/API/inc/MantidQtAPI/Message.h
+++ b/MantidQt/API/inc/MantidQtAPI/Message.h
@@ -12,8 +12,6 @@
 #include <QObject>
 #include <QString>
 
-#include <iostream>
-
 //----------------------------------------------------------
 // Forward declarations
 //----------------------------------------------------------
diff --git a/MantidQt/API/src/UserSubWindow.cpp b/MantidQt/API/src/UserSubWindow.cpp
index 4c9354d8f67228ad51da3ea29e94ed5b04c76b43..6dace365d7f4fcdb8535a853873e8c3ac22c9547 100644
--- a/MantidQt/API/src/UserSubWindow.cpp
+++ b/MantidQt/API/src/UserSubWindow.cpp
@@ -12,8 +12,6 @@
 #include <QTemporaryFile>
 #include <QTextStream>
 
-#include <iostream>
-
 using namespace MantidQt::API;
 
 //------------------------------------------------------
diff --git a/MantidQt/API/test/MantidColorMapTest.h b/MantidQt/API/test/MantidColorMapTest.h
index 0c2af82d2111505cc7474e1ccc8ac09b3345be67..21cacf06e872d7fdd7a4146732f25df254882f63 100644
--- a/MantidQt/API/test/MantidColorMapTest.h
+++ b/MantidQt/API/test/MantidColorMapTest.h
@@ -2,8 +2,6 @@
 #define MANTIDQT_API_MANTIDCOLORMAPTEST_H_
 
 #include <cxxtest/TestSuite.h>
-#include <iostream>
-#include <iomanip>
 #include "MantidQtAPI/MantidColorMap.h"
 #include <limits>
 #include <QRgb>
diff --git a/MantidQt/API/test/QwtWorkspaceSpectrumDataTest.h b/MantidQt/API/test/QwtWorkspaceSpectrumDataTest.h
index d86d2e172bf10fde39a8de066bf272ec40d65018..a0a0dd32aefbbafb4fbab1362a033b5e3c0e99bc 100644
--- a/MantidQt/API/test/QwtWorkspaceSpectrumDataTest.h
+++ b/MantidQt/API/test/QwtWorkspaceSpectrumDataTest.h
@@ -2,8 +2,6 @@
 #define MANTIDQT_API_MANTIDQWTWORKSPACESPECTRUMDATA_H_
 
 #include <cxxtest/TestSuite.h>
-#include <iostream>
-#include <iomanip>
 #include <limits>
 #include <QRgb>
 #include "MantidAPI/MatrixWorkspace.h"
diff --git a/MantidQt/CustomDialogs/inc/MantidQtCustomDialogs/GetNegMuMuonicXRDDialog.h b/MantidQt/CustomDialogs/inc/MantidQtCustomDialogs/GetNegMuMuonicXRDDialog.h
index 85fa109a4511bb3ef96de179827dc54d33baab32..4d375e8cdc124c9d04bf0274f849ee4f597b7a13 100644
--- a/MantidQt/CustomDialogs/inc/MantidQtCustomDialogs/GetNegMuMuonicXRDDialog.h
+++ b/MantidQt/CustomDialogs/inc/MantidQtCustomDialogs/GetNegMuMuonicXRDDialog.h
@@ -36,19 +36,20 @@ namespace CustomDialogs {
 class GetNegMuMuonicXRDDialog : public API::AlgorithmDialog {
   Q_OBJECT
 
-  public:
+public:
   /// Constructor
   GetNegMuMuonicXRDDialog(QWidget *parent = 0);
 
-  private:
+private:
   /// Periodic Table widget used for selection of elements property
-  PeriodicTableWidget *periodicTable;
+  PeriodicTableWidget *m_periodicTable;
   /// QLineEdit used for input of y-position property
-  QLineEdit *yPosition;
+  QLineEdit *m_yPosition;
   /// QLineEdit used for input of GroupWorkspaceSpace
-  QLineEdit *groupWorkspaceNameInput;
-  //Check box for showing or hiding the Legend for PeriodicTableWidget
-  QCheckBox *showLegendCheck;
+  QLineEdit *m_groupWorkspaceNameInput;
+  // Check box for showing or hiding the Legend for PeriodicTableWidget
+  QCheckBox *m_showLegendCheck;
+
   /// Validate that the input is not empty before running algorithm
   bool validateDialogInput(QString input);
   /** Enables a the buttons corresponding to the elements
@@ -56,15 +57,15 @@ class GetNegMuMuonicXRDDialog : public API::AlgorithmDialog {
   */
   void enableElementsForGetNegMuMuonicXRD();
 
-  private slots:
+private slots:
   /// When the "Run" button is clicked, the algorithm is executed with inputs
   void runClicked();
   void showLegend();
 
-  protected:
+protected:
   // create the initial layout
   void initLayout();
-  signals:
+signals:
   /// signal emitted when validateDialogInput passes
   void validInput();
 };
diff --git a/MantidQt/CustomDialogs/src/GetNegMuMuonicXRDDialog.cpp b/MantidQt/CustomDialogs/src/GetNegMuMuonicXRDDialog.cpp
index 963da0325e8764e67562bd8801154cbca51c2648..463fae15e31cc0b36834b70bb1dfbef1ecd0c5a8 100644
--- a/MantidQt/CustomDialogs/src/GetNegMuMuonicXRDDialog.cpp
+++ b/MantidQt/CustomDialogs/src/GetNegMuMuonicXRDDialog.cpp
@@ -7,7 +7,6 @@
 #include <QValidator>
 #include <QFormLayout>
 
-
 namespace MantidQt {
 namespace CustomDialogs {
 DECLARE_DIALOG(GetNegMuMuonicXRDDialog)
@@ -18,7 +17,8 @@ DECLARE_DIALOG(GetNegMuMuonicXRDDialog)
  */
 
 GetNegMuMuonicXRDDialog::GetNegMuMuonicXRDDialog(QWidget *parent)
-    : API::AlgorithmDialog(parent) {}
+    : API::AlgorithmDialog(parent), m_periodicTable(NULL), m_yPosition(NULL),
+      m_groupWorkspaceNameInput(NULL), m_showLegendCheck(NULL) {}
 
 /// Initialise the layout
 void GetNegMuMuonicXRDDialog::initLayout() {
@@ -26,18 +26,18 @@ void GetNegMuMuonicXRDDialog::initLayout() {
   this->setMaximumHeight(400);
   this->setMaximumWidth(675);
   // assign periodicTable member to a new periodicTable
-  periodicTable = new PeriodicTableWidget();
+  m_periodicTable = new PeriodicTableWidget();
 
-  // assign yPosition member to a new QLineEdit
-  yPosition = new QLineEdit();
-  //assign GroupWorkspaceName member to a new QLineEdit
-  groupWorkspaceNameInput = new QLineEdit();
+  // assign m_yPosition member to a new QLineEdit
+  m_yPosition = new QLineEdit();
+  // assign GroupWorkspaceName member to a new QLineEdit
+  m_groupWorkspaceNameInput = new QLineEdit();
   auto *groupWsInputLabel = new QLabel("OutputWorkspace");
-  groupWorkspaceNameInput->setMaximumWidth(250);
+  m_groupWorkspaceNameInput->setMaximumWidth(250);
   // Disable all buttons on the periodicTable
   // as we only have a select few that need to be
   // enabled.
-  periodicTable->disableAllElementButtons();
+  m_periodicTable->disableAllElementButtons();
 
   /*Elements Enabled Correspond to those for which we
   * have data for in the dictionary found in
@@ -51,44 +51,44 @@ void GetNegMuMuonicXRDDialog::initLayout() {
   // run button for executing the algorithm
   auto *runButton = new QPushButton("Run");
 
-  // label for the QLineEdit for yPosition property
-  auto *yPositionLabel = new QLabel("Y Position");
+  // label for the QLineEdit for m_yPosition property
+  auto *m_yPositionLabel = new QLabel("Y Position");
 
-  /*validator allows only numeric input for yPosition
+  /*validator allows only numeric input for m_yPosition
    *this helps with validating the input.
    *Does not detect empty string as invalid input.
    */
-  auto yPositionNumericValidator = new QDoubleValidator();
+  auto m_yPositionNumericValidator = new QDoubleValidator();
 
   // YPosition LineEdit Attributes
-  yPosition->setMaximumWidth(250);
-  yPosition->setPlaceholderText("-0.01");
-  yPosition->setValidator(yPositionNumericValidator);
+  m_yPosition->setMaximumWidth(250);
+  m_yPosition->setPlaceholderText("-0.01");
+  m_yPosition->setValidator(m_yPositionNumericValidator);
 
   // Run Button Attributes and signal/slot assignment
   runButton->setMaximumWidth(100);
   connect(runButton, SIGNAL(clicked()), this, SLOT(runClicked()));
   connect(this, SIGNAL(validInput()), this, SLOT(accept()));
 
-  //Show Legend button attributes and signal/slot asssignment
-  showLegendCheck = new QCheckBox("Show Legend");
-  connect(showLegendCheck, SIGNAL(clicked()), this, SLOT(showLegend()));
+  // Show Legend button attributes and signal/slot asssignment
+  m_showLegendCheck = new QCheckBox("Show Legend");
+  connect(m_showLegendCheck, SIGNAL(clicked()), this, SLOT(showLegend()));
   // Adding Widgets to Layout
-  main_layout->addWidget(periodicTable);
-  main_layout->addWidget(showLegendCheck);
-  main_layout->addWidget(yPositionLabel);
-  main_layout->addWidget(yPosition);
+  main_layout->addWidget(m_periodicTable);
+  main_layout->addWidget(m_showLegendCheck);
+  main_layout->addWidget(m_yPositionLabel);
+  main_layout->addWidget(m_yPosition);
   main_layout->addWidget(groupWsInputLabel);
-  main_layout->addWidget(groupWorkspaceNameInput);
+  main_layout->addWidget(m_groupWorkspaceNameInput);
   main_layout->addWidget(runButton);
 }
 
 /**
  *
  */
-void GetNegMuMuonicXRDDialog::showLegend(){
-    bool checked = showLegendCheck->isChecked();
-    periodicTable->showGroupLegend(checked);
+void GetNegMuMuonicXRDDialog::showLegend() {
+  bool checked = m_showLegendCheck->isChecked();
+  m_periodicTable->showGroupLegend(checked);
 }
 
 /**
@@ -102,13 +102,13 @@ void GetNegMuMuonicXRDDialog::enableElementsForGetNegMuMuonicXRD() {
    * for the algorithm, and the button for that element can be enabled
    * the same as the elements are below.
    */
-  periodicTable->enableButtonByName("Au");
-  periodicTable->enableButtonByName("Ag");
-  periodicTable->enableButtonByName("Cu");
-  periodicTable->enableButtonByName("Zn");
-  periodicTable->enableButtonByName("Pb");
-  periodicTable->enableButtonByName("As");
-  periodicTable->enableButtonByName("Sn");
+  m_periodicTable->enableButtonByName("Au");
+  m_periodicTable->enableButtonByName("Ag");
+  m_periodicTable->enableButtonByName("Cu");
+  m_periodicTable->enableButtonByName("Zn");
+  m_periodicTable->enableButtonByName("Pb");
+  m_periodicTable->enableButtonByName("As");
+  m_periodicTable->enableButtonByName("Sn");
 }
 
 /**
@@ -128,7 +128,7 @@ bool GetNegMuMuonicXRDDialog::validateDialogInput(QString input) {
 */
 void GetNegMuMuonicXRDDialog::runClicked() {
   // getting a list of strings of elements selected from periodicTableWidget
-  QString elementsSelectedStr = periodicTable->getAllCheckedElementsStr();
+  QString elementsSelectedStr = m_periodicTable->getAllCheckedElementsStr();
   // if no elements are selected from the PeriodicTableWidget, a pop-up appears
   // to the user.
   if (!validateDialogInput(elementsSelectedStr)) {
@@ -141,15 +141,16 @@ void GetNegMuMuonicXRDDialog::runClicked() {
   // signal.
   if (validateDialogInput(elementsSelectedStr)) {
     storePropertyValue("Elements", elementsSelectedStr);
-    if (validateDialogInput(yPosition->text())) {
-      storePropertyValue("YAxisPosition", yPosition->text());
+    if (validateDialogInput(m_yPosition->text())) {
+      storePropertyValue("YAxisPosition", m_yPosition->text());
     } else {
-      // used as default value for yPosition property if the user does not input
+      // used as default value for m_yPosition property if the user does not
+      // input
       // one.
-      storePropertyValue("YAxisPosition", yPosition->placeholderText());
+      storePropertyValue("YAxisPosition", m_yPosition->placeholderText());
     }
-    if (validateDialogInput(groupWorkspaceNameInput->text())){
-        storePropertyValue("OutputWorkspace", groupWorkspaceNameInput->text());
+    if (validateDialogInput(m_groupWorkspaceNameInput->text())) {
+      storePropertyValue("OutputWorkspace", m_groupWorkspaceNameInput->text());
     }
     emit validInput();
   }
diff --git a/MantidQt/CustomInterfaces/CMakeLists.txt b/MantidQt/CustomInterfaces/CMakeLists.txt
index ada8021d700646e914d4bbe412a8e155037d3058..be571e64c996a33e8e2b1b6535783bbb32c3a6e6 100644
--- a/MantidQt/CustomInterfaces/CMakeLists.txt
+++ b/MantidQt/CustomInterfaces/CMakeLists.txt
@@ -90,7 +90,11 @@ set ( SRC_FILES
   src/SANSPlotSpecial.cpp
   src/SANSRunWindow.cpp
   src/StepScan.cpp
+  src/Tomography/ImageROIPresenter.cpp
+  src/Tomography/ImageROIViewQtWidget.cpp
+  src/Tomography/ImageStackPreParams.cpp
   src/Tomography/SavuConfigDialog.cpp
+  src/Tomography/StackOfImagesDirs.cpp
   src/Tomography/TomographyIfaceModel.cpp
   src/Tomography/TomographyIfacePresenter.cpp
   src/Tomography/TomographyIfaceViewQtGUI.cpp
@@ -205,8 +209,14 @@ set ( INC_FILES
   inc/MantidQtCustomInterfaces/SANSPlotSpecial.h
   inc/MantidQtCustomInterfaces/SANSRunWindow.h
   inc/MantidQtCustomInterfaces/StepScan.h
+  inc/MantidQtCustomInterfaces/Tomography/IImageROIPresenter.h
+  inc/MantidQtCustomInterfaces/Tomography/IImageROIView.h
+  inc/MantidQtCustomInterfaces/Tomography/ImageROIPresenter.h
+  inc/MantidQtCustomInterfaces/Tomography/ImageROIViewQtWidget.h
+  inc/MantidQtCustomInterfaces/Tomography/ImageStackPreParams.h
   inc/MantidQtCustomInterfaces/Tomography/ITomographyIfacePresenter.h
   inc/MantidQtCustomInterfaces/Tomography/ITomographyIfaceView.h
+  inc/MantidQtCustomInterfaces/Tomography/StackOfImagesDirs.h
   inc/MantidQtCustomInterfaces/Tomography/TomographyIfacePresenter.h
   inc/MantidQtCustomInterfaces/Tomography/TomographyIfaceViewQtGUI.h
   inc/MantidQtCustomInterfaces/Tomography/TomographyIfaceModel.h
@@ -308,6 +318,7 @@ set ( MOC_FILES inc/MantidQtCustomInterfaces/Background.h
                 inc/MantidQtCustomInterfaces/SANSEventSlicing.h
                 inc/MantidQtCustomInterfaces/SANSDiagnostics.h
                 inc/MantidQtCustomInterfaces/StepScan.h
+                inc/MantidQtCustomInterfaces/Tomography/ImageROIViewQtWidget.h
                 inc/MantidQtCustomInterfaces/Tomography/TomographyIfacePresenter.h
                 inc/MantidQtCustomInterfaces/Tomography/TomographyIfaceViewQtGUI.h
                 inc/MantidQtCustomInterfaces/Tomography/TomoToolConfigDialog.h
@@ -370,6 +381,7 @@ set ( UI_FILES inc/MantidQtCustomInterfaces/DataComparison.ui
                inc/MantidQtCustomInterfaces/SANSRunWindow.ui
                inc/MantidQtCustomInterfaces/SANSEventSlicing.ui
                inc/MantidQtCustomInterfaces/StepScan.ui
+               inc/MantidQtCustomInterfaces/Tomography/ImageSelectCoRAndRegions.ui
                inc/MantidQtCustomInterfaces/Tomography/TomographyIfaceQtGUI.ui
                inc/MantidQtCustomInterfaces/Tomography/TomographyIfaceQtTabSetup.ui
                inc/MantidQtCustomInterfaces/Tomography/TomographyIfaceQtTabRun.ui
@@ -386,12 +398,14 @@ set ( TEST_FILES
   ALCPeakFittingModelTest.h
   ALCPeakFittingPresenterTest.h
   EnggDiffractionPresenterTest.h
+  ImageROIPresenterTest.h
   IO_MuonGroupingTest.h
   MuonAnalysisHelperTest.h
   ParseKeyValueStringTest.h
   ReflGenerateNotebookTest.h
   ReflLegacyTransferStrategyTest.h
   ReflMainViewPresenterTest.h
+  StackOfImagesDirsTest.h
   TomographyIfacePresenterTest.h
   UserInputValidatorTest.h
 )
diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/EnggDiffractionPresenter.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/EnggDiffractionPresenter.h
index ab2cb4672c86bae2b479c406c6ba8a9076e5fe9b..fd4858acdea1345941737d7cd22f19f74c739ba8 100644
--- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/EnggDiffractionPresenter.h
+++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/EnggDiffractionPresenter.h
@@ -176,6 +176,8 @@ private:
                               Mantid::API::ITableWorkspace_sptr &vanIntegWS,
                               Mantid::API::MatrixWorkspace_sptr &vanCurvesWS);
 
+  void plotFocusedWorkspace(std::string outWSName);
+
   /// string to use for ENGINX file names (as a prefix, etc.)
   const static std::string g_enginxStr;
 
diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/EnggDiffractionQtTabFocus.ui b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/EnggDiffractionQtTabFocus.ui
index da4954af8627faf0c93a9d1c3268b22d655fb790..76e0aa9e04571d14f1c1e5c9d4dc3fbe68065fd5 100644
--- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/EnggDiffractionQtTabFocus.ui
+++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/EnggDiffractionQtTabFocus.ui
@@ -7,30 +7,123 @@
     <x>0</x>
     <y>0</y>
     <width>614</width>
-    <height>533</height>
+    <height>545</height>
    </rect>
   </property>
   <property name="windowTitle">
    <string>Form</string>
   </property>
-  <layout class="QGridLayout" name="gridLayout_3">
-   <item row="6" column="0">
-    <widget class="QGroupBox" name="groupBox_focus_2">
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <widget class="QGroupBox" name="groupBox_focus">
      <property name="title">
-      <string>Output</string>
+      <string>Focus run</string>
      </property>
-     <layout class="QGridLayout" name="gridLayout_2">
+     <layout class="QGridLayout" name="gridLayout">
+      <item row="2" column="0">
+       <layout class="QHBoxLayout" name="horizontalLayout_3">
+        <item>
+         <spacer name="horizontalSpacer_3">
+          <property name="orientation">
+           <enum>Qt::Horizontal</enum>
+          </property>
+          <property name="sizeHint" stdset="0">
+           <size>
+            <width>238</width>
+            <height>20</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+        <item>
+         <widget class="QPushButton" name="pushButton_focus">
+          <property name="text">
+           <string>Focus</string>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+      <item row="1" column="0">
+       <layout class="QHBoxLayout" name="horizontalLayout_5">
+        <item>
+         <layout class="QVBoxLayout" name="verticalLayout_3">
+          <item>
+           <layout class="QHBoxLayout" name="horizontalLayout_4">
+            <item>
+             <widget class="QLabel" name="label_banks_sel">
+              <property name="text">
+               <string>Banks:</string>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <spacer name="horizontalSpacer_5">
+              <property name="orientation">
+               <enum>Qt::Horizontal</enum>
+              </property>
+              <property name="sizeHint" stdset="0">
+               <size>
+                <width>298</width>
+                <height>20</height>
+               </size>
+              </property>
+             </spacer>
+            </item>
+           </layout>
+          </item>
+          <item>
+           <spacer name="verticalSpacer_2">
+            <property name="orientation">
+             <enum>Qt::Vertical</enum>
+            </property>
+            <property name="sizeHint" stdset="0">
+             <size>
+              <width>20</width>
+              <height>18</height>
+             </size>
+            </property>
+           </spacer>
+          </item>
+         </layout>
+        </item>
+        <item>
+         <layout class="QVBoxLayout" name="verticalLayout_4">
+          <item>
+           <widget class="QCheckBox" name="checkBox_focus_bank1">
+            <property name="text">
+             <string>1</string>
+            </property>
+            <property name="checked">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QCheckBox" name="checkBox_focus_bank2">
+            <property name="text">
+             <string>2</string>
+            </property>
+            <property name="checked">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </item>
+       </layout>
+      </item>
       <item row="0" column="0">
-       <layout class="QHBoxLayout" name="horizontalLayout_6">
+       <layout class="QHBoxLayout" name="horizontalLayout">
         <item>
-         <widget class="QCheckBox" name="checkBox_FocusedWS">
+         <widget class="QLabel" name="label_run_num">
           <property name="text">
-           <string>Plot Focused Workspace</string>
+           <string>Run #:</string>
           </property>
          </widget>
         </item>
         <item>
-         <spacer name="horizontalSpacer_4">
+         <spacer name="horizontalSpacer">
           <property name="orientation">
            <enum>Qt::Horizontal</enum>
           </property>
@@ -42,12 +135,22 @@
           </property>
          </spacer>
         </item>
+        <item>
+         <widget class="QLineEdit" name="lineEdit_run_num">
+          <property name="text">
+           <string/>
+          </property>
+          <property name="readOnly">
+           <bool>false</bool>
+          </property>
+         </widget>
+        </item>
        </layout>
       </item>
      </layout>
     </widget>
    </item>
-   <item row="2" column="0">
+   <item>
     <widget class="QGroupBox" name="groupBox">
      <property name="title">
       <string>Focus Cropped</string>
@@ -148,147 +251,96 @@
      </layout>
     </widget>
    </item>
-   <item row="4" column="0">
-    <spacer name="verticalSpacer">
-     <property name="orientation">
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeHint" stdset="0">
-      <size>
-       <width>20</width>
-       <height>388</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
-   <item row="0" column="0">
-    <widget class="QGroupBox" name="groupBox_focus">
+   <item>
+    <widget class="QGroupBox" name="groupBox_2">
      <property name="title">
-      <string>Focus run</string>
+      <string>Focus Texture</string>
      </property>
-     <layout class="QGridLayout" name="gridLayout">
-      <item row="2" column="0">
-       <layout class="QHBoxLayout" name="horizontalLayout_3">
+     <layout class="QGridLayout" name="gridLayout_4">
+      <item row="0" column="0">
+       <layout class="QHBoxLayout" name="horizontalLayout_7">
         <item>
-         <spacer name="horizontalSpacer_3">
+         <widget class="QLabel" name="label_texture_run_num">
+          <property name="text">
+           <string>Run #:</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <spacer name="horizontalSpacer_6">
           <property name="orientation">
            <enum>Qt::Horizontal</enum>
           </property>
           <property name="sizeHint" stdset="0">
            <size>
-            <width>238</width>
+            <width>98</width>
             <height>20</height>
            </size>
           </property>
          </spacer>
         </item>
         <item>
-         <widget class="QPushButton" name="pushButton_focus">
+         <widget class="QLineEdit" name="lineEdit_texture_run_num">
           <property name="text">
-           <string>Focus</string>
+           <string/>
+          </property>
+          <property name="readOnly">
+           <bool>false</bool>
           </property>
          </widget>
         </item>
        </layout>
       </item>
       <item row="1" column="0">
-       <layout class="QHBoxLayout" name="horizontalLayout_5">
+       <layout class="QHBoxLayout" name="horizontalLayout_8">
         <item>
-         <layout class="QVBoxLayout" name="verticalLayout_3">
-          <item>
-           <layout class="QHBoxLayout" name="horizontalLayout_4">
-            <item>
-             <widget class="QLabel" name="label_banks_sel">
-              <property name="text">
-               <string>Banks:</string>
-              </property>
-             </widget>
-            </item>
-            <item>
-             <spacer name="horizontalSpacer_5">
-              <property name="orientation">
-               <enum>Qt::Horizontal</enum>
-              </property>
-              <property name="sizeHint" stdset="0">
-               <size>
-                <width>298</width>
-                <height>20</height>
-               </size>
-              </property>
-             </spacer>
-            </item>
-           </layout>
-          </item>
-          <item>
-           <spacer name="verticalSpacer_2">
-            <property name="orientation">
-             <enum>Qt::Vertical</enum>
-            </property>
-            <property name="sizeHint" stdset="0">
-             <size>
-              <width>20</width>
-              <height>18</height>
-             </size>
-            </property>
-           </spacer>
-          </item>
-         </layout>
+         <widget class="QLabel" name="label_2">
+          <property name="text">
+           <string>Detector Grouping File:</string>
+          </property>
+         </widget>
         </item>
         <item>
-         <layout class="QVBoxLayout" name="verticalLayout_4">
-          <item>
-           <widget class="QCheckBox" name="checkBox_focus_bank1">
-            <property name="text">
-             <string>1</string>
-            </property>
-            <property name="checked">
-             <bool>true</bool>
-            </property>
-           </widget>
-          </item>
-          <item>
-           <widget class="QCheckBox" name="checkBox_focus_bank2">
-            <property name="text">
-             <string>2</string>
-            </property>
-            <property name="checked">
-             <bool>true</bool>
-            </property>
-           </widget>
-          </item>
-         </layout>
+         <widget class="QLineEdit" name="lineEdit_texture_grouping_file">
+          <property name="sizePolicy">
+           <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+            <horstretch>1</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
+          <property name="readOnly">
+           <bool>true</bool>
+          </property>
+         </widget>
         </item>
-       </layout>
-      </item>
-      <item row="0" column="0">
-       <layout class="QHBoxLayout" name="horizontalLayout">
         <item>
-         <widget class="QLabel" name="label_run_num">
+         <widget class="QPushButton" name="pushButton_texture_browse_grouping_file">
           <property name="text">
-           <string>Run #:</string>
+           <string>Browse</string>
           </property>
          </widget>
         </item>
+       </layout>
+      </item>
+      <item row="2" column="0">
+       <layout class="QHBoxLayout" name="horizontalLayout_11">
         <item>
-         <spacer name="horizontalSpacer">
+         <spacer name="horizontalSpacer_9">
           <property name="orientation">
            <enum>Qt::Horizontal</enum>
           </property>
           <property name="sizeHint" stdset="0">
            <size>
-            <width>98</width>
+            <width>40</width>
             <height>20</height>
            </size>
           </property>
          </spacer>
         </item>
         <item>
-         <widget class="QLineEdit" name="lineEdit_run_num">
+         <widget class="QPushButton" name="pushButton_focus_texture">
           <property name="text">
-           <string/>
-          </property>
-          <property name="readOnly">
-           <bool>false</bool>
+           <string>Focus</string>
           </property>
          </widget>
         </item>
@@ -297,23 +349,42 @@
      </layout>
     </widget>
    </item>
-   <item row="3" column="0">
-    <widget class="QGroupBox" name="groupBox_2">
+   <item>
+    <spacer name="verticalSpacer_3">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>40</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item>
+    <widget class="QGroupBox" name="groupBox_focus_3">
+     <property name="minimumSize">
+      <size>
+       <width>596</width>
+       <height>111</height>
+      </size>
+     </property>
      <property name="title">
-      <string>Focus Texture</string>
+      <string>Output</string>
      </property>
-     <layout class="QGridLayout" name="gridLayout_4">
-      <item row="0" column="0">
-       <layout class="QHBoxLayout" name="horizontalLayout_7">
+     <layout class="QVBoxLayout" name="verticalLayout_6">
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout_20">
         <item>
-         <widget class="QLabel" name="label_texture_run_num">
+         <widget class="QCheckBox" name="checkBox_FocusedWS">
           <property name="text">
-           <string>Run #:</string>
+           <string>Plot Focused Workspace</string>
           </property>
          </widget>
         </item>
         <item>
-         <spacer name="horizontalSpacer_6">
+         <spacer name="horizontalSpacer_18">
           <property name="orientation">
            <enum>Qt::Horizontal</enum>
           </property>
@@ -325,77 +396,106 @@
           </property>
          </spacer>
         </item>
+       </layout>
+      </item>
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout_21">
         <item>
-         <widget class="QLineEdit" name="lineEdit_texture_run_num">
-          <property name="text">
-           <string/>
+         <spacer name="horizontalSpacer_19">
+          <property name="orientation">
+           <enum>Qt::Horizontal</enum>
           </property>
-          <property name="readOnly">
-           <bool>false</bool>
+          <property name="sizeHint" stdset="0">
+           <size>
+            <width>98</width>
+            <height>20</height>
+           </size>
           </property>
-         </widget>
+         </spacer>
         </item>
-       </layout>
-      </item>
-      <item row="1" column="0">
-       <layout class="QHBoxLayout" name="horizontalLayout_8">
         <item>
-         <widget class="QLabel" name="label_2">
+         <widget class="QLabel" name="label_4">
           <property name="text">
-           <string>Detector Grouping File:</string>
+           <string>Plot Data Representation:</string>
           </property>
          </widget>
         </item>
         <item>
-         <widget class="QLineEdit" name="lineEdit_texture_grouping_file">
+         <widget class="QComboBox" name="comboBox_PlotData">
           <property name="sizePolicy">
-           <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
-            <horstretch>1</horstretch>
+           <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+            <horstretch>0</horstretch>
             <verstretch>0</verstretch>
            </sizepolicy>
           </property>
-          <property name="readOnly">
-           <bool>true</bool>
+          <property name="minimumSize">
+           <size>
+            <width>175</width>
+            <height>10</height>
+           </size>
           </property>
+          <property name="sizeIncrement">
+           <size>
+            <width>0</width>
+            <height>0</height>
+           </size>
+          </property>
+          <property name="baseSize">
+           <size>
+            <width>0</width>
+            <height>0</height>
+           </size>
+          </property>
+          <property name="layoutDirection">
+           <enum>Qt::LeftToRight</enum>
+          </property>
+          <item>
+           <property name="text">
+            <string>One Window - Replacing Plots</string>
+           </property>
+          </item>
+          <item>
+           <property name="text">
+            <string>One Window - Waterfall</string>
+           </property>
+          </item>
+          <item>
+           <property name="text">
+            <string>Multiple Windows</string>
+           </property>
+          </item>
          </widget>
         </item>
+       </layout>
+      </item>
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout_22">
         <item>
-         <widget class="QPushButton" name="pushButton_texture_browse_grouping_file">
+         <widget class="QCheckBox" name="checkBox_OutputFiles_">
           <property name="text">
-           <string>Browse</string>
+           <string>Output Files</string>
           </property>
          </widget>
         </item>
-       </layout>
-      </item>
-      <item row="2" column="0">
-       <layout class="QHBoxLayout" name="horizontalLayout_11">
         <item>
-         <spacer name="horizontalSpacer_9">
+         <spacer name="horizontalSpacer_20">
           <property name="orientation">
            <enum>Qt::Horizontal</enum>
           </property>
           <property name="sizeHint" stdset="0">
            <size>
-            <width>40</width>
+            <width>98</width>
             <height>20</height>
            </size>
           </property>
          </spacer>
         </item>
-        <item>
-         <widget class="QPushButton" name="pushButton_focus_texture">
-          <property name="text">
-           <string>Focus</string>
-          </property>
-         </widget>
-        </item>
        </layout>
       </item>
      </layout>
     </widget>
    </item>
-   <item row="5" column="0">
+   <item>
     <layout class="QHBoxLayout" name="horizontalLayout_13">
      <item>
       <spacer name="horizontalSpacer_11">
diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/EnggDiffractionViewQtGUI.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/EnggDiffractionViewQtGUI.h
index baed981c8f15aa12f32c87aa18132004d4e24ec8..ef099e716254d88448ed06d78aa0e5945b4b9b9e 100644
--- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/EnggDiffractionViewQtGUI.h
+++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/EnggDiffractionViewQtGUI.h
@@ -121,6 +121,12 @@ public:
 
   virtual void plotFocusedSpectrum(const std::string &wsName);
 
+  virtual void plotWaterfallSpectrum(const std::string &wsName);
+
+  virtual void plotReplacingWindow(const std::string &wsName);
+
+  int currentPlotType() const { return m_currentType; }
+
 private slots:
   /// for buttons, do calibrate, focus and similar
   void loadCalibrationClicked();
@@ -145,6 +151,12 @@ private slots:
   // slots of the general part of the interface
   void instrumentChanged(int idx);
 
+  // slots of the focus part of the interface
+  void plotRepChanged(int idx);
+
+  // slots of plot spectrum check box status
+  void plotFocusStatus();
+
   // show the standard Mantid help window with this interface's help
   void openHelpWin();
 
@@ -183,6 +195,10 @@ private:
 
   /// instrument selected (ENGIN-X, etc.)
   std::string m_currentInst;
+
+  // plot data representation type selected
+  int m_currentType;
+
   /// current calibration produced in the 'Calibration' tab
   std::string m_currentCalibFilename;
   /// calibration settings - from/to the 'settings' tab
diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/IEnggDiffractionPresenter.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/IEnggDiffractionPresenter.h
index a2c0240d4cefb1d2befa48388c9bb25ab47bfc01..01fcbcaa76dce48d4ff93578b350e60faef98845 100644
--- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/IEnggDiffractionPresenter.h
+++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/IEnggDiffractionPresenter.h
@@ -38,16 +38,16 @@ public:
   /// These are user actions, triggered from the (passive) view, that need
   /// handling by the presenter
   enum Notification {
-    Start,                 ///< Start and setup interface
-    LoadExistingCalib,     ///< Load a calibration already availble on disk
-    CalcCalib,             ///< Calculate a (new) calibration
-    FocusRun,              ///< Focus one or more run files
-    FocusCropped,          ///< Focus one or more run files, cropped variant
-    FocusTexture,          ///< Focus one or more run files, texture variant
-    ResetFocus,            ///< Re-set / clear all focus inputs and options
-    LogMsg,                ///< need to send a message to the Mantid log system
-    InstrumentChange,      ///< Instrument selection updated
-    ShutDown               ///< closing the interface
+    Start,             ///< Start and setup interface
+    LoadExistingCalib, ///< Load a calibration already availble on disk
+    CalcCalib,         ///< Calculate a (new) calibration
+    FocusRun,          ///< Focus one or more run files
+    FocusCropped,      ///< Focus one or more run files, cropped variant
+    FocusTexture,      ///< Focus one or more run files, texture variant
+    ResetFocus,        ///< Re-set / clear all focus inputs and options
+    LogMsg,            ///< need to send a message to the Mantid log system
+    InstrumentChange,  ///< Instrument selection updated
+    ShutDown           ///< closing the interface
   };
 
   /**
diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/IEnggDiffractionView.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/IEnggDiffractionView.h
index e701764dac3f0d11fa716a65cde8b98fd4ea1e00..dda719b7a2caf327befc3207572a95b07500e5df 100644
--- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/IEnggDiffractionView.h
+++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/IEnggDiffractionView.h
@@ -269,6 +269,30 @@ public:
   * @param wsName name of the workspace to plot (must be in the ADS)
   */
   virtual void plotFocusedSpectrum(const std::string &wsName) = 0;
+
+  /**
+ * Produces a waterfall spectrum graph for focused output. Runs
+ * plotSpectrum function via python.
+ *
+ * @param wsName name of the workspace to plot (must be in the ADS)
+ */
+  virtual void plotWaterfallSpectrum(const std::string &wsName) = 0;
+
+  /**
+  * Produces a replaceable spectrum graph for focused output. Runs
+  * plotSpectrum function via python.
+  *
+  * @param wsName name of the workspace to plot (must be in the ADS)
+  */
+  virtual void plotReplacingWindow(const std::string &wsName) = 0;
+
+  /*
+ * Selected plot data representation will be applied, which will
+ * ran through python script
+ *
+ * @return which format should to applied for plotting data
+ */
+  virtual int currentPlotType() const = 0;
 };
 
 } // namespace CustomInterfaces
diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ISISEnergyTransfer.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ISISEnergyTransfer.h
index d164fa8aa6aae3a65e4c873d541e6d5527df0039..49090162ee653bd896774ab56d46edfcee8606f6 100644
--- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ISISEnergyTransfer.h
+++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ISISEnergyTransfer.h
@@ -6,68 +6,66 @@
 #include "MantidKernel/System.h"
 #include "MantidQtCustomInterfaces/Background.h"
 
-namespace MantidQt
-{
-namespace CustomInterfaces
-{
-  /** ISISEnergyTransfer
-    Handles an energy transfer reduction for ISIS instruments.
-
-    @author Dan Nixon
-    @date 23/07/2014
-
-    Copyright &copy; 2013 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge National Laboratory & European Spallation Source
-
-    This file is part of Mantid.
-
-    Mantid is free software; you can 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.
-
-    Mantid is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU 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/>.
-
-    File change history is stored at: <https://github.com/mantidproject/mantid>
-    Code Documentation is available at: <http://doxygen.mantidproject.org>
-  */
-  class DLLExport ISISEnergyTransfer : public IndirectDataReductionTab
-  {
-    Q_OBJECT
-
-  public:
-    ISISEnergyTransfer(IndirectDataReduction * idrUI, QWidget * parent = 0);
-    virtual ~ISISEnergyTransfer();
-
-    virtual void setup();
-    virtual void run();
-
-  public slots:
-    virtual bool validate();
-
-  private slots:
-    void algorithmComplete(bool error);
-    void setInstrumentDefault(); ///< Sets default parameters for current instrument
-    void mappingOptionSelected(const QString& groupType); ///< change ui to display appropriate options
-    void plotRaw(); ///< plot raw data from instrument
-    void pbRunEditing();  //< Called when a user starts to type / edit the runs to load.
-    void pbRunFinding();  //< Called when the FileFinder starts finding the files.
-    void pbRunFinished(); //< Called when the FileFinder has finished finding the files.
-    void plotRawComplete(bool error); //< Called when the Plot Raw algorithmm chain completes
-
-  private:
-    Ui::ISISEnergyTransfer m_uiForm;
-
-    QPair<QString, QString> createMapFile(const QString& groupType); ///< create the mapping file with which to group results
-    std::vector<std::string> getSaveFormats(); ///< get a vector of save formats
-
-  };
+namespace MantidQt {
+namespace CustomInterfaces {
+/** ISISEnergyTransfer
+  Handles an energy transfer reduction for ISIS instruments.
+
+  @author Dan Nixon
+  @date 23/07/2014
+
+  Copyright &copy; 2013 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge
+  National Laboratory & European Spallation Source
+
+  This file is part of Mantid.
+
+  Mantid is free software; you can 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.
+
+  Mantid is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU 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/>.
+
+  File change history is stored at: <https://github.com/mantidproject/mantid>
+  Code Documentation is available at: <http://doxygen.mantidproject.org>
+*/
+class DLLExport ISISEnergyTransfer : public IndirectDataReductionTab {
+  Q_OBJECT
+
+public:
+  ISISEnergyTransfer(IndirectDataReduction *idrUI, QWidget *parent = 0);
+  virtual ~ISISEnergyTransfer();
+
+  virtual void setup();
+  virtual void run();
+
+public slots:
+  virtual bool validate();
+
+private slots:
+  void algorithmComplete(bool error);
+  void
+  setInstrumentDefault(); ///< Sets default parameters for current instrument
+  void mappingOptionSelected(const QString &groupType); ///< change ui to display appropriate options
+  void plotRaw();       ///< plot raw data from instrument
+  void pbRunEditing();  //< Called when a user starts to type / edit the runs to load.
+  void pbRunFinding();  //< Called when the FileFinder starts finding the files.
+  void pbRunFinished(); //< Called when the FileFinder has finished finding the files.
+  void plotRawComplete(bool error); //< Called when the Plot Raw algorithmm chain completes
+
+private:
+  Ui::ISISEnergyTransfer m_uiForm;
+
+  QPair<QString, QString> createMapFile(const QString &groupType); ///< create the mapping file with which to group results
+  std::vector<std::string> getSaveFormats(); ///< get a vector of save formats
+};
 } // namespace CustomInterfaces
 } // namespace Mantid
 
-#endif //MANTIDQTCUSTOMINTERFACES_ISISENERGYTRANSFER_H_
+#endif // MANTIDQTCUSTOMINTERFACES_ISISENERGYTRANSFER_H_
diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCDataLoadingView.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCDataLoadingView.h
index d9329f7144829ae550b54e047e56440b3d27c514..d1a4d3042e628ec26e154f221037afcc1e25f6f9 100644
--- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCDataLoadingView.h
+++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCDataLoadingView.h
@@ -80,9 +80,9 @@ namespace CustomInterfaces
     void setAvailablePeriods(const std::vector<std::string> &periods);
     void setTimeLimits(double tMin, double tMax);
     void setTimeRange (double tMin, double tMax);
-    void setWaitingCursor();
-    void restoreCursor();
     void help();
+    void disableAll();
+    void enableAll();
 
     // -- End of IALCDataLoadingView interface -----------------------------------------------------
 
diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCDataLoadingView.ui b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCDataLoadingView.ui
index e42aeb104219368d0f519ce7ff6cef8d6a03773c..b99c1ebe7740a26e855601f7225a099e9c69852f 100644
--- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCDataLoadingView.ui
+++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCDataLoadingView.ui
@@ -383,7 +383,7 @@
                 </widget>
               </item>
               <item>
-                <widget class="QGroupBox" name="groupBox_2">
+                <widget class="QGroupBox" name="calculationGroup">
                   <property name="title">
                     <string>Calculation</string>
                   </property>
diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/IALCDataLoadingView.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/IALCDataLoadingView.h
index 3c0ac04337d569a3eb59e1d323853755edc1721a..43c9bf2e2182991fd9f416eb280fe0c1c657127f 100644
--- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/IALCDataLoadingView.h
+++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/IALCDataLoadingView.h
@@ -119,15 +119,15 @@ namespace CustomInterfaces
     /// @param tMax :: Maximum X value available
     virtual void setTimeRange(double tMin, double tMax) = 0;
 
-    /// Set waiting cursor for long operation
-    virtual void setWaitingCursor() = 0;
-
-    /// Restore the original cursor
-    virtual void restoreCursor() = 0;
-
     /// Opens the Mantid Wiki web page
     virtual void help() = 0;
 
+    /// Disables all the widgets
+    virtual void disableAll() = 0;
+
+    /// Enables all the widgets
+    virtual void enableAll() = 0;
+
   signals:
     /// Request to load data
     void loadRequested();
diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/QtReflMainView.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/QtReflMainView.h
index 5423d7311d73d879001d488f2bdcd02e9b6ef5dc..1306417ed5c84ffd9139390a259a08e08a250d6d 100644
--- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/QtReflMainView.h
+++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/QtReflMainView.h
@@ -62,6 +62,7 @@ namespace MantidQt
       virtual void giveUserWarning(std::string prompt, std::string title);
       virtual void giveUserCritical(std::string prompt, std::string title);
       virtual void showAlgorithmDialog(const std::string& algorithm);
+      virtual std::string requestNotebookPath();
 
       //Plotting
       virtual void plotWorkspaces(const std::set<std::string>& workspaces);
diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ReflMainView.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ReflMainView.h
index ba7cfe632c3682ec2472b1778fbfee8efb29998f..bfcca663b78dc95a9e99974146d2ec1d066007fb 100644
--- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ReflMainView.h
+++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ReflMainView.h
@@ -57,6 +57,7 @@ namespace MantidQt
       virtual void giveUserWarning(std::string prompt, std::string title) = 0;
       virtual void giveUserCritical(std::string prompt, std::string title) = 0;
       virtual void showAlgorithmDialog(const std::string& algorithm) = 0;
+      virtual std::string requestNotebookPath() = 0;
 
       //Plotting
       virtual void plotWorkspaces(const std::set<std::string>& workspaces) = 0;
diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/IImageROIPresenter.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/IImageROIPresenter.h
new file mode 100644
index 0000000000000000000000000000000000000000..581accf1509477c8aa554e2bd2d128822391906e
--- /dev/null
+++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/IImageROIPresenter.h
@@ -0,0 +1,77 @@
+#ifndef MANTIDQTCUSTOMINTERFACES_TOMOGRAPHY_IIMAGEROIPRESENTER_H_
+#define MANTIDQTCUSTOMINTERFACES_TOMOGRAPHY_IIMAGEROIPRESENTER_H_
+
+namespace MantidQt {
+namespace CustomInterfaces {
+
+/**
+Presenter for the widget that handles the selection of the center of
+rotation, region of interest, region for normalization, etc. from an
+image or stack of images. This is the abstract base class / interface
+for the presenter (in the sense of the MVP pattern).  The name
+ImageROI refers to the Center-of-Rotation, which is the most basic
+parameter that users can select via this widget. This class is
+QtGUI-free as it uses the interface of the view. The model is simply
+the ImageStackPreParams class which holds coordinates selected by the
+user.
+
+Copyright &copy; 2015 ISIS Rutherford Appleton Laboratory, NScD
+Oak Ridge National Laboratory & European Spallation Source
+
+This file is part of Mantid.
+
+Mantid is free software; you can 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.
+
+Mantid is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU 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/>.
+
+File change history is stored at: <https://github.com/mantidproject/mantid>
+Code Documentation is available at: <http://doxygen.mantidproject.org>
+*/
+class IImageROIPresenter {
+
+public:
+  IImageROIPresenter(){};
+  virtual ~IImageROIPresenter(){};
+
+  /// These are user actions, triggered from the (passive) view, that need
+  /// handling by the presenter
+  enum Notification {
+    Init,                 ///< interface is initing (set, defaults, etc.)
+    BrowseImgOrStack,     ///< User browses for an image file or stack
+    NewImgOrStack,        ///< A new image or stack needs to be loaded
+    UpdateImgIndex,       ///< Sliding/scrolling through the stack
+    SelectCoR,            ///< Start picking of the center of rotation
+    SelectROI,            ///< Start selection of the region of interest
+    SelectNormalization,  ///< Start selection of the normalization region
+    FinishedCoR,          ///< A CoR has been picked
+    FinishedROI,          ///< The ROI is selected
+    FinishedNormalization,///< The normalization region is selected
+    ResetCoR,             ///< Reset CoR to default/none/middle
+    ResetROI,             ///< Reset ROI to default/empty
+    ResetNormalization,   ///< Reet the normalization region to default/empty
+    ShutDown              ///< The widget is being closed/destroyed
+  };
+
+  /**
+   * Notifications sent through the presenter when something changes
+   * in the view. This plays the role of signals emitted by the view
+   * to this presenter.
+   *
+   * @param notif Type of notification to process.
+   */
+  virtual void notify(IImageROIPresenter::Notification notif) = 0;
+};
+
+} // namespace CustomInterfaces
+} // namespace MantidQt
+
+#endif // MANTIDQTCUSTOMINTERFACES_TOMOGRAPHY_IIMAGEROIPRESENTER_H_
diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/IImageROIView.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/IImageROIView.h
new file mode 100644
index 0000000000000000000000000000000000000000..592dc79a3a1d4e828bf35f1c7c6311257c7d4bb7
--- /dev/null
+++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/IImageROIView.h
@@ -0,0 +1,216 @@
+#ifndef MANTIDQTCUSTOMINTERFACES_TOMOGRAPHY_IIMAGEROIVIEW_H_
+#define MANTIDQTCUSTOMINTERFACES_TOMOGRAPHY_IIMAGEROIVIEW_H_
+
+#include "MantidAPI/WorkspaceGroup_fwd.h"
+#include "MantidQtCustomInterfaces/Tomography/ImageStackPreParams.h"
+
+namespace MantidQt {
+namespace CustomInterfaces {
+
+/**
+Widget to handle the selection of the center of rotation, region of
+interest, region for normalization, etc. from an image or stack of
+images. This is the abstract base class / interface for the view of
+this widget (in the sense of the MVP pattern).  The name ImageROI
+refers to the Center-of-Rotation, which is the most basic parameter
+that users can select via this widget. This class is Qt-free. Qt
+specific functionality and dependencies are added in a class derived
+from this.
+
+Copyright &copy; 2015 ISIS Rutherford Appleton Laboratory, NScD
+Oak Ridge National Laboratory & European Spallation Source
+
+This file is part of Mantid.
+
+Mantid is free software; you can 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.
+
+Mantid is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU 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/>.
+
+File change history is stored at: <https://github.com/mantidproject/mantid>
+Code Documentation is available at: <http://doxygen.mantidproject.org>
+*/
+class IImageROIView {
+
+public:
+  IImageROIView(){};
+  virtual ~IImageROIView(){};
+
+  // Selection states
+  enum SelectionState {
+    SelectNone,          ///< Init, or after any reset
+    SelectCoR,
+    SelectROIFirst,
+    SelectROISecond,
+    SelectNormAreaFirst,
+    SelectNormAreaSecond
+  };
+
+  /**
+   * Sets the user selection. This should guarantee that all widgets
+   * are updated (including spin boxes, image, slider through the
+   * image stack, etc.
+   *
+   * @param params all user-modifyable parameters (coordinates for the
+   * CoR, ROI and area for normalization).
+   *
+   */
+  virtual void setParams(ImageStackPreParams &params) = 0;
+
+  /**
+   * Provides the current user selection.
+   *
+   * @return parameters as set/edited by the user.
+   */
+  virtual ImageStackPreParams userSelection() const = 0;
+
+  /**
+   * The current selection state. For example: nothin/initialized,
+   * selecting CoR, selecting second corner of the normalization area,
+   * selecting first corner of the ROI.
+   *
+   * @return current state
+   */
+  virtual SelectionState selectionState() const = 0;
+
+  /**
+   * Update to a new state (for example select CoR).
+   *
+   * @param state new state we're transitioning into.
+   */
+  virtual void changeSelectionState(const SelectionState& state) = 0;
+
+  /**
+   * Display a special case of stack of images: individual image, from
+   * a path to a recognized directory structure (sample/dark/white) or
+   * image format. Here recognized format means something that is
+   * supported natively by the widgets library, in practice
+   * Qt. Normally you can expect that .tiff and .png images are
+   * supported.
+   *
+   * @param path path to the stack (directory) or individual image file.
+   */
+  virtual void showStack(const std::string &path) = 0;
+
+  /**
+   * Display a stack of images (or individual image as a particular
+   * case), from a workspace group containing matrix workspaces. It
+   * assumes that the workspace contains an image in the form in which
+   * LoadFITS loads FITS images (or spectrum per row, all of them with
+   * the same number of data points (columns)).
+   *
+   * @param ws Workspace group where every workspace is a FITS or
+   * similar image that has been loaded with LoadFITS or similar
+   * algorithm.
+   */
+  virtual void showStack(Mantid::API::WorkspaceGroup_sptr &ws) = 0;
+
+  /**
+   * Get the stack of images currently being displayed (it has been
+   * shown using showStack()), as a workspace group.
+   *
+   * @return workspace group containing the individual images, which
+   * can be empty if no stack has been loaded.
+   */
+  virtual const Mantid::API::WorkspaceGroup_sptr stack() const = 0;
+
+  /**
+   * Normally one image (projection for tomography stacks) will be
+   * shown on a 2D display. Show there a particular projection from a
+   * stack contained in a workspace group.
+   *
+   * @param wsg workspace holding a stack of images
+   *
+   * @param idx index (in the group) of the image to show
+   *
+   */
+  virtual void showProjection(const Mantid::API::WorkspaceGroup_sptr &wsg,
+                              size_t idx) = 0;
+
+  /**
+   * Display a warning to the user (for example as a pop-up window).
+   *
+   * @param warn warning title, should be short and would normally be
+   * shown as the title of the window or a big banner.
+   *
+   * @param description longer, free form description of the issue.
+   */
+  virtual void userWarning(const std::string &warn,
+                           const std::string &description) = 0;
+
+  /**
+   * Display an error message (for example as a pop-up window).
+   *
+   * @param err Error title, should be short and would normally be
+   * shown as the title of the window or a big banner.
+   *
+   * @param description longer, free form description of the issue.
+   */
+  virtual void userError(const std::string &err,
+                         const std::string &description) = 0;
+
+  /**
+   * The index of the image currently shown (from the current stack if there's
+   * any).
+   *
+   * @return index from 0 to the total number of images in the
+   * stack-1, as used for example when indexing workspaces in
+   * workspacegroups
+   */
+  virtual size_t currentImgIndex() const = 0;
+
+  /**
+   * Display now this image (idx) from the stack.
+   *
+   * @param idx index of the image to display.
+   */
+  virtual void updateImgWithIndex(size_t idx) = 0;
+
+  /**
+   * Get the path/location of a stack of images (or single image as a
+   * particular case) that the user is requesting to display.  The
+   * path would be expected to point to a recognized directory
+   * structure (sample/dark/white) or image file (as a particular
+   * case).
+   *
+   * @return location (can be a directory, file, etc.) that needs to
+   * be figured out elsewhere.
+   */
+  virtual std::string askImgOrStackPath() = 0;
+
+  /**
+   * Save settings (normally when closing this widget).
+   */
+  virtual void saveSettings() const = 0;
+
+  /**
+   * Forget the current center-of-rotation selection and set to
+   * default.
+   */
+  virtual void resetCoR() = 0;
+
+  /**
+   * Forget the current region-of-interest selection and set to
+   * default (all).
+   */
+  virtual void resetROI() = 0;
+
+  /**
+   * Forget the current selection of region-for-normalization and set
+   * to default (none).
+   */
+  virtual void resetNormArea() = 0;
+};
+
+} // namespace CustomInterfaces
+} // namespace MantidQt
+
+#endif // MANTIDQTCUSTOMINTERFACES_TOMOGRAPHY_IIMAGEROIVIEW_H_
diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ITomographyIfacePresenter.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ITomographyIfacePresenter.h
index 77f46747a077d353afc005a2a3bbe7461230e8e3..be9585bc25ee1d01ede65b98fdd416566c7aa4d4 100644
--- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ITomographyIfacePresenter.h
+++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ITomographyIfacePresenter.h
@@ -9,7 +9,7 @@ Interface for what the presenter of the tomography GUI needs to
 implement. Here the term presenter is used as in the MVP
 (Model-View-Presenter) pattern. The (passive) view will use this.
 
-Copyright &copy; 2014,205 ISIS Rutherford Appleton Laboratory, NScD
+Copyright &copy; 2014,2015 ISIS Rutherford Appleton Laboratory, NScD
 Oak Ridge National Laboratory & European Spallation Source
 
 This file is part of Mantid.
diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ITomographyIfaceView.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ITomographyIfaceView.h
index 3802a4b2b8cece79b1dc96f4b9dc12c18349e24c..0130f027370db9e29626b780bc78c2029c46b804 100644
--- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ITomographyIfaceView.h
+++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ITomographyIfaceView.h
@@ -15,7 +15,7 @@ Tomography GUI. Base class / interface for the view of the tomo GUI
 specific functionality/dependencies are added in a class derived from
 this.
 
-Copyright &copy; 2014,205 ISIS Rutherford Appleton Laboratory, NScD
+Copyright &copy; 2014,2015 ISIS Rutherford Appleton Laboratory, NScD
 Oak Ridge National Laboratory & European Spallation Source
 
 This file is part of Mantid.
diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ImageROIPresenter.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ImageROIPresenter.h
new file mode 100644
index 0000000000000000000000000000000000000000..7aaeac9147ec95b82725d83a6b0bef36ccac27ae
--- /dev/null
+++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ImageROIPresenter.h
@@ -0,0 +1,95 @@
+#ifndef MANTIDQTCUSTOMINTERFACES_TOMOGRAPHY_IMAGEROIPRESENTER_H_
+#define MANTIDQTCUSTOMINTERFACES_TOMOGRAPHY_IMAGEROIPRESENTER_H_
+
+#include "MantidAPI/WorkspaceGroup_fwd.h"
+#include "MantidQtCustomInterfaces/Tomography/IImageROIPresenter.h"
+#include "MantidQtCustomInterfaces/Tomography/IImageROIView.h"
+#include "MantidQtCustomInterfaces/Tomography/ImageStackPreParams.h"
+#include "MantidQtCustomInterfaces/Tomography/StackOfImagesDirs.h"
+
+#include <boost/scoped_ptr.hpp>
+
+namespace MantidQt {
+namespace CustomInterfaces {
+
+/**
+Presenter for the image center of rotation (and other parameters)
+selection widget. In principle, in a strict MVP setup, signals from
+the model should always be handled through this presenter and never go
+directly to the view, and viceversa.
+
+Copyright &copy; 2015 ISIS Rutherford Appleton Laboratory, NScD
+Oak Ridge National Laboratory & European Spallation Source
+
+This file is part of Mantid.
+
+Mantid is free software; you can 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.
+
+Mantid is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU 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/>.
+
+File change history is stored at: <https://github.com/mantidproject/mantid>
+Code Documentation is available at: <http://doxygen.mantidproject.org>
+*/
+class DLLExport ImageROIPresenter : public IImageROIPresenter {
+
+public:
+  /// Default constructor - normally used from the concrete view
+  ImageROIPresenter(IImageROIView *view);
+  virtual ~ImageROIPresenter();
+
+  void notify(IImageROIPresenter::Notification notif);
+
+protected:
+  void initialize();
+
+  /// clean shut down of model, view, etc.
+  void cleanup();
+
+  void processInit();
+  void processBrowseImg();
+  void processNewStack();
+  void processUpdateImgIndex();
+  void processSelectCoR();
+  void processSelectROI();
+  void processSelectNormalization();
+  void processFinishedCoR();
+  void processFinishedROI();
+  void processFinishedNormalization();
+  void processResetCoR();
+  void processResetROI();
+  void processResetNormalization();
+  void processShutDown();
+
+private:
+  StackOfImagesDirs checkInputStack(const std::string &path);
+
+  /// loads a list of images from a stack, from their individual paths
+  Mantid::API::WorkspaceGroup_sptr
+  loadFITSStack(const std::vector<std::string> &imgs);
+
+  void loadFITSImage(const std::string &path, const std::string &wsName);
+
+  /// path to the image stack being visualized
+  std::string m_stackPath;
+
+  /// Associated view for this presenter (MVP pattern)
+  IImageROIView *const m_view;
+
+  /// Associated model for this presenter (MVP pattern). This is just
+  /// a set of coordinates
+  const boost::scoped_ptr<ImageStackPreParams> m_model;
+};
+
+} // namespace CustomInterfaces
+} // namespace MantidQt
+
+#endif // MANTIDQTCUSTOMINTERFACES_TOMOGRAPHY_IMAGEROIPRESENTER_H_
diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ImageROIViewQtWidget.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ImageROIViewQtWidget.h
new file mode 100644
index 0000000000000000000000000000000000000000..739374aed282d5b19cf3fb1d097b4a95bc583d3e
--- /dev/null
+++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ImageROIViewQtWidget.h
@@ -0,0 +1,186 @@
+#ifndef MANTIDQTCUSTOMINTERFACES_TOMOGRAPHY_IMAGEROIVIEWQTWIDGET_H_
+#define MANTIDQTCUSTOMINTERFACES_TOMOGRAPHY_IMAGEROIVIEWQTWIDGET_H_
+
+#include "MantidAPI/WorkspaceGroup_fwd.h"
+#include "MantidKernel/System.h"
+#include "MantidQtCustomInterfaces/Tomography/IImageROIPresenter.h"
+#include "MantidQtCustomInterfaces/Tomography/IImageROIView.h"
+
+#include "ui_ImageSelectCoRAndRegions.h"
+
+#include <boost/scoped_ptr.hpp>
+
+// forward declarations for Qt
+class QWidget;
+class QPixmap;
+
+namespace MantidQt {
+namespace CustomInterfaces {
+
+/**
+Qt-based view of the widget to handle the selection of the center of
+rotation, region of interest, region for normalization, etc. from an
+image or stack of images. Provides a concrete view for the graphical
+interface for tomography functionality in Mantid. This view is
+Qt-based and it is probably the only one that will be implemented in a
+foreseeable horizon. The interface of this class is given by
+IImageROIView so that it fits in the MVP (Model-View-Presenter) design
+of the ImageROI widget.
+
+Copyright &copy; 2015 ISIS Rutherford Appleton Laboratory, NScD
+Oak Ridge National Laboratory & European Spallation Source
+
+This file is part of Mantid.
+
+Mantid is free software; you can 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.
+
+Mantid is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU 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/>.
+
+File change history is stored at: <https://github.com/mantidproject/mantid>
+Code Documentation is available at: <http://doxygen.mantidproject.org>
+*/
+class DLLExport ImageROIViewQtWidget : public QWidget, public IImageROIView {
+  Q_OBJECT
+
+public:
+  ImageROIViewQtWidget(QWidget *parent = 0);
+  virtual ~ImageROIViewQtWidget(){};
+
+  void setParams(ImageStackPreParams &params);
+
+  ImageStackPreParams userSelection() const;
+
+  SelectionState selectionState() const { return m_selectionState; }
+
+  void changeSelectionState(const SelectionState& state);
+
+  /// show a stack of images given the path to the files
+  void showStack(const std::string &path);
+
+  /// show a stack of images that have been loaded into a group of workspaces
+  void showStack(Mantid::API::WorkspaceGroup_sptr &ws);
+
+  const Mantid::API::WorkspaceGroup_sptr stack() const { return m_stack; }
+
+  void showProjection(const Mantid::API::WorkspaceGroup_sptr &wsg, size_t idx);
+
+  void userWarning(const std::string &warn, const std::string &description);
+
+  void userError(const std::string &err, const std::string &description);
+
+  size_t currentImgIndex() const;
+
+  void updateImgWithIndex(size_t idx);
+
+  std::string askImgOrStackPath();
+
+  void saveSettings() const;
+
+  void resetCoR();
+  void resetROI();
+  void resetNormArea();
+
+protected:
+  void initLayout();
+  void showImg();
+
+  /// update coordinates from mouse event
+  void mouseUpdateCoR(int x, int y);
+  void mouseUpdateROICorners12(int x, int y);
+  void mouseUpdateROICorner2(int x, int y);
+  void mouseFinishROI(int x, int y);
+  void mouseUpdateNormAreaCorners12(int x, int y);
+  void mouseUpdateNormAreaCorner2(int x, int y);
+  void mouseFinishNormArea(int x, int y);
+
+private slots:
+  void browseImgClicked();
+
+  void corClicked();
+  void corResetClicked();
+  void roiClicked();
+  void roiResetClicked();
+  void normAreaClicked();
+  void normAreaResetClicked();
+
+  void updateFromImagesSlider(int current);
+
+  void valueUpdatedCoR(int v);
+  void valueUpdatedROI(int v);
+  void valueUpdatedNormArea(int v);
+
+private:
+  void grabCoRFromWidgets();
+  void grabROIFromWidgets();
+  void grabNormAreaFromWidgets();
+
+  void grabCoRFromMousePoint(int x, int y);
+  void grabROICorner1FromMousePoint(int x, int y);
+  void grabROICorner2FromMousePoint(int x, int y);
+  void grabNormAreaCorner1FromMousePoint(int x, int y);
+  void grabNormAreaCorner2FromMousePoint(int x, int y);
+
+  void setupConnections();
+
+  void readSettings();
+
+  // widget closing
+  virtual void closeEvent(QCloseEvent *ev);
+
+  /// enable/disable the groups with spin boxes for the center and corners
+  void enableParamWidgets(bool enable);
+  /// initialize values to defaults and set max/min for the spin boxes
+  void initParamWidgets(size_t maxWidth, size_t maxHeight);
+
+  /// Set coordinates in the widgets from a params object
+  void setParamWidgets(ImageStackPreParams &params);
+
+  // shows the image in a widget
+  void showProjectionImage(const Mantid::API::WorkspaceGroup_sptr &wsg,
+                           size_t idx);
+
+  /// repaint the image with new positions of points and rectangles
+  void refreshROIetAl();
+  void refreshCoR();
+  void refreshROI();
+  void refreshNormArea();
+
+  bool eventFilter(QObject *obj, QEvent *event);
+
+  Ui::ImageSelectCoRAndRegions m_ui;
+
+  Mantid::API::WorkspaceGroup_sptr m_stack;
+
+  /// this holds the base image on top of which rectangles and other
+  /// objects are drawn
+  boost::scoped_ptr<QPixmap> m_basePixmap;
+
+  /// persistent settings
+  static const std::string m_settingsGroup;
+
+  /// parameters currently set by the user
+  ImageStackPreParams m_params;
+
+  /// max image size for the current stack
+  int m_imgWidth, m_imgHeight;
+
+  /// are we picking the CoR, or the first point of the ROI, etc.
+  SelectionState m_selectionState;
+
+  // presenter as in the model-view-presenter
+  boost::scoped_ptr<IImageROIPresenter> m_presenter;
+};
+
+} // namespace CustomInterfaces
+} // namespace MantidQt
+
+#endif // MANTIDQTCUSTOMINTERFACES_TOMOGRAPHY_IMAGEROIVIEWQTWIDGET_H_
diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ImageSelectCoRAndRegions.ui b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ImageSelectCoRAndRegions.ui
new file mode 100644
index 0000000000000000000000000000000000000000..c71dbfed6a89027b1f6ea39a849f4df738db4671
--- /dev/null
+++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ImageSelectCoRAndRegions.ui
@@ -0,0 +1,669 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ImageSelectCoRAndRegions</class>
+ <widget class="QWidget" name="ImageSelectCoRAndRegions">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>800</width>
+    <height>600</height>
+   </rect>
+  </property>
+  <property name="sizePolicy">
+   <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QGridLayout" name="gridLayout_8">
+   <item row="0" column="0">
+    <widget class="QSplitter" name="splitter_main_horiz">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+       <horstretch>1</horstretch>
+       <verstretch>1</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <widget class="QSplitter" name="splitter_img_vertical">
+      <property name="sizePolicy">
+       <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
+        <horstretch>2</horstretch>
+        <verstretch>0</verstretch>
+       </sizepolicy>
+      </property>
+      <property name="orientation">
+       <enum>Qt::Vertical</enum>
+      </property>
+      <widget class="QWidget" name="layoutWidget">
+       <layout class="QGridLayout" name="gridLayout_5">
+        <property name="sizeConstraint">
+         <enum>QLayout::SetMinimumSize</enum>
+        </property>
+        <item row="0" column="0">
+         <widget class="QLabel" name="label_img_seq">
+          <property name="sizePolicy">
+           <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
+          <property name="minimumSize">
+           <size>
+            <width>0</width>
+            <height>28</height>
+           </size>
+          </property>
+          <property name="maximumSize">
+           <size>
+            <width>16777215</width>
+            <height>28</height>
+           </size>
+          </property>
+          <property name="text">
+           <string>Image:</string>
+          </property>
+         </widget>
+        </item>
+        <item row="0" column="1">
+         <widget class="QLineEdit" name="lineEdit_img_seq">
+          <property name="sizePolicy">
+           <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
+          <property name="minimumSize">
+           <size>
+            <width>100</width>
+            <height>28</height>
+           </size>
+          </property>
+          <property name="maximumSize">
+           <size>
+            <width>100</width>
+            <height>28</height>
+           </size>
+          </property>
+          <property name="text">
+           <string>0/0</string>
+          </property>
+          <property name="alignment">
+           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+          </property>
+          <property name="readOnly">
+           <bool>true</bool>
+          </property>
+         </widget>
+        </item>
+        <item row="0" column="2">
+         <widget class="QLabel" name="label_img_name">
+          <property name="sizePolicy">
+           <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+            <horstretch>1</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
+          <property name="minimumSize">
+           <size>
+            <width>0</width>
+            <height>28</height>
+           </size>
+          </property>
+          <property name="maximumSize">
+           <size>
+            <width>16777215</width>
+            <height>28</height>
+           </size>
+          </property>
+          <property name="text">
+           <string>none</string>
+          </property>
+         </widget>
+        </item>
+        <item row="0" column="3">
+         <widget class="QPushButton" name="pushButton_browse_img">
+          <property name="sizePolicy">
+           <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
+          <property name="minimumSize">
+           <size>
+            <width>0</width>
+            <height>28</height>
+           </size>
+          </property>
+          <property name="maximumSize">
+           <size>
+            <width>16777215</width>
+            <height>28</height>
+           </size>
+          </property>
+          <property name="text">
+           <string>Browse</string>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="layoutWidget">
+       <layout class="QGridLayout" name="gridLayout_7" rowstretch="0,1">
+        <property name="sizeConstraint">
+         <enum>QLayout::SetMaximumSize</enum>
+        </property>
+        <property name="spacing">
+         <number>3</number>
+        </property>
+        <item row="0" column="0">
+         <widget class="QScrollArea" name="scrollArea">
+          <property name="sizePolicy">
+           <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+            <horstretch>2</horstretch>
+            <verstretch>2</verstretch>
+           </sizepolicy>
+          </property>
+          <property name="widgetResizable">
+           <bool>true</bool>
+          </property>
+          <widget class="QWidget" name="scrollAreaWidgetContents">
+           <property name="geometry">
+            <rect>
+             <x>0</x>
+             <y>0</y>
+             <width>510</width>
+             <height>402</height>
+            </rect>
+           </property>
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+             <horstretch>2</horstretch>
+             <verstretch>2</verstretch>
+            </sizepolicy>
+           </property>
+           <layout class="QGridLayout" name="gridLayout" rowstretch="0" columnstretch="0">
+            <property name="margin">
+             <number>0</number>
+            </property>
+            <property name="spacing">
+             <number>1</number>
+            </property>
+            <item row="0" column="0">
+             <widget class="QLabel" name="label_img">
+              <property name="sizePolicy">
+               <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+                <horstretch>2</horstretch>
+                <verstretch>2</verstretch>
+               </sizepolicy>
+              </property>
+              <property name="text">
+               <string/>
+              </property>
+             </widget>
+            </item>
+           </layout>
+          </widget>
+         </widget>
+        </item>
+        <item row="1" column="0">
+         <widget class="QScrollBar" name="horizontalScrollBar_img_stack">
+          <property name="sizePolicy">
+           <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+            <horstretch>2</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
+          <property name="orientation">
+           <enum>Qt::Horizontal</enum>
+          </property>
+          <property name="invertedControls">
+           <bool>true</bool>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </widget>
+     </widget>
+     <widget class="QWidget" name="layoutWidget_2">
+      <layout class="QGridLayout" name="gridLayout_6" columnminimumwidth="0">
+       <property name="sizeConstraint">
+        <enum>QLayout::SetDefaultConstraint</enum>
+       </property>
+       <property name="spacing">
+        <number>4</number>
+       </property>
+       <item row="0" column="0">
+        <widget class="QGroupBox" name="groupBox_cor">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="maximumSize">
+          <size>
+           <width>260</width>
+           <height>16777215</height>
+          </size>
+         </property>
+         <property name="title">
+          <string>Center of rotation</string>
+         </property>
+         <layout class="QGridLayout" name="gridLayout_2">
+          <property name="margin">
+           <number>3</number>
+          </property>
+          <property name="spacing">
+           <number>4</number>
+          </property>
+          <item row="1" column="0">
+           <layout class="QHBoxLayout" name="horizontalLayout">
+            <item>
+             <widget class="QLabel" name="label_3">
+              <property name="text">
+               <string>Column:</string>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QSpinBox" name="spinBox_cor_x">
+              <property name="maximum">
+               <number>9999</number>
+              </property>
+              <property name="value">
+               <number>9999</number>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QLabel" name="label_2">
+              <property name="text">
+               <string>Row:</string>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QSpinBox" name="spinBox_cor_y">
+              <property name="maximum">
+               <number>9999</number>
+              </property>
+              <property name="value">
+               <number>9999</number>
+              </property>
+             </widget>
+            </item>
+           </layout>
+          </item>
+          <item row="2" column="0">
+           <layout class="QHBoxLayout" name="horizontalLayout_2">
+            <item>
+             <widget class="QPushButton" name="pushButton_cor">
+              <property name="toolTip">
+               <string>After pushing this button, click on the image to select</string>
+              </property>
+              <property name="text">
+               <string>Select</string>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <spacer name="horizontalSpacer_3">
+              <property name="orientation">
+               <enum>Qt::Horizontal</enum>
+              </property>
+              <property name="sizeHint" stdset="0">
+               <size>
+                <width>108</width>
+                <height>20</height>
+               </size>
+              </property>
+             </spacer>
+            </item>
+            <item>
+             <widget class="QPushButton" name="pushButton_cor_reset">
+              <property name="text">
+               <string>Reset</string>
+              </property>
+             </widget>
+            </item>
+           </layout>
+          </item>
+          <item row="0" column="0">
+           <layout class="QHBoxLayout" name="horizontalLayout_5">
+            <item>
+             <spacer name="horizontalSpacer_4">
+              <property name="orientation">
+               <enum>Qt::Horizontal</enum>
+              </property>
+              <property name="sizeHint" stdset="0">
+               <size>
+                <width>78</width>
+                <height>20</height>
+               </size>
+              </property>
+             </spacer>
+            </item>
+            <item>
+             <widget class="QPushButton" name="pushButton">
+              <property name="enabled">
+               <bool>false</bool>
+              </property>
+              <property name="text">
+               <string>Auto-find</string>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QComboBox" name="comboBox">
+              <property name="enabled">
+               <bool>false</bool>
+              </property>
+              <item>
+               <property name="text">
+                <string>Method:</string>
+               </property>
+              </item>
+             </widget>
+            </item>
+           </layout>
+          </item>
+         </layout>
+        </widget>
+       </item>
+       <item row="1" column="0">
+        <spacer name="verticalSpacer_2">
+         <property name="orientation">
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeType">
+          <enum>QSizePolicy::Minimum</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>20</width>
+           <height>20</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item row="2" column="0">
+        <widget class="QGroupBox" name="groupBox_roi">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="maximumSize">
+          <size>
+           <width>260</width>
+           <height>16777215</height>
+          </size>
+         </property>
+         <property name="title">
+          <string>Region of interest:</string>
+         </property>
+         <layout class="QGridLayout" name="gridLayout_3">
+          <property name="margin">
+           <number>3</number>
+          </property>
+          <property name="spacing">
+           <number>2</number>
+          </property>
+          <item row="0" column="0">
+           <widget class="QLabel" name="label_4">
+            <property name="text">
+             <string>Corner 1</string>
+            </property>
+           </widget>
+          </item>
+          <item row="0" column="1">
+           <widget class="QSpinBox" name="spinBox_roi_top_x">
+            <property name="maximum">
+             <number>9999</number>
+            </property>
+            <property name="value">
+             <number>9999</number>
+            </property>
+           </widget>
+          </item>
+          <item row="0" column="2">
+           <widget class="QSpinBox" name="spinBox_roi_top_y">
+            <property name="maximum">
+             <number>9999</number>
+            </property>
+            <property name="value">
+             <number>9999</number>
+            </property>
+           </widget>
+          </item>
+          <item row="1" column="0">
+           <widget class="QLabel" name="label_5">
+            <property name="text">
+             <string>Corner 2</string>
+            </property>
+           </widget>
+          </item>
+          <item row="1" column="1">
+           <widget class="QSpinBox" name="spinBox_roi_bottom_x">
+            <property name="maximum">
+             <number>9999</number>
+            </property>
+            <property name="value">
+             <number>9999</number>
+            </property>
+           </widget>
+          </item>
+          <item row="1" column="2">
+           <widget class="QSpinBox" name="spinBox_roi_bottom_y">
+            <property name="maximum">
+             <number>9999</number>
+            </property>
+            <property name="value">
+             <number>9999</number>
+            </property>
+           </widget>
+          </item>
+          <item row="2" column="0" colspan="3">
+           <layout class="QHBoxLayout" name="horizontalLayout_3">
+            <item>
+             <widget class="QPushButton" name="pushButton_roi">
+              <property name="toolTip">
+               <string>After pushing this button, click and drag on the image to select</string>
+              </property>
+              <property name="text">
+               <string>Select</string>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <spacer name="horizontalSpacer_2">
+              <property name="orientation">
+               <enum>Qt::Horizontal</enum>
+              </property>
+              <property name="sizeHint" stdset="0">
+               <size>
+                <width>155</width>
+                <height>20</height>
+               </size>
+              </property>
+             </spacer>
+            </item>
+            <item>
+             <widget class="QPushButton" name="pushButton_roi_reset">
+              <property name="toolTip">
+               <string>Reset to the whole field of view</string>
+              </property>
+              <property name="text">
+               <string>Reset</string>
+              </property>
+             </widget>
+            </item>
+           </layout>
+          </item>
+         </layout>
+        </widget>
+       </item>
+       <item row="3" column="0">
+        <spacer name="verticalSpacer_3">
+         <property name="orientation">
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeType">
+          <enum>QSizePolicy::Minimum</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>20</width>
+           <height>20</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item row="4" column="0">
+        <widget class="QGroupBox" name="groupBox_norm">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="maximumSize">
+          <size>
+           <width>260</width>
+           <height>16777215</height>
+          </size>
+         </property>
+         <property name="title">
+          <string>Area for normalization:</string>
+         </property>
+         <layout class="QGridLayout" name="gridLayout_4">
+          <property name="margin">
+           <number>3</number>
+          </property>
+          <property name="spacing">
+           <number>2</number>
+          </property>
+          <item row="0" column="0">
+           <widget class="QLabel" name="label_6">
+            <property name="text">
+             <string>Corner 1</string>
+            </property>
+           </widget>
+          </item>
+          <item row="0" column="1">
+           <widget class="QSpinBox" name="spinBox_norm_top_x">
+            <property name="maximum">
+             <number>9999</number>
+            </property>
+            <property name="value">
+             <number>9999</number>
+            </property>
+           </widget>
+          </item>
+          <item row="0" column="2">
+           <widget class="QSpinBox" name="spinBox_norm_top_y">
+            <property name="maximum">
+             <number>9999</number>
+            </property>
+            <property name="value">
+             <number>9999</number>
+            </property>
+           </widget>
+          </item>
+          <item row="1" column="0">
+           <widget class="QLabel" name="label_7">
+            <property name="text">
+             <string>Corner 2</string>
+            </property>
+           </widget>
+          </item>
+          <item row="1" column="1">
+           <widget class="QSpinBox" name="spinBox_norm_bottom_x">
+            <property name="maximum">
+             <number>9999</number>
+            </property>
+            <property name="value">
+             <number>9999</number>
+            </property>
+           </widget>
+          </item>
+          <item row="1" column="2">
+           <widget class="QSpinBox" name="spinBox_norm_bottom_y">
+            <property name="maximum">
+             <number>9999</number>
+            </property>
+            <property name="value">
+             <number>9999</number>
+            </property>
+           </widget>
+          </item>
+          <item row="2" column="0" colspan="3">
+           <layout class="QHBoxLayout" name="horizontalLayout_8">
+            <item>
+             <widget class="QPushButton" name="pushButton_norm_area">
+              <property name="toolTip">
+               <string>After pushing this button, click and drag on the image to select</string>
+              </property>
+              <property name="text">
+               <string>Select</string>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <spacer name="horizontalSpacer">
+              <property name="orientation">
+               <enum>Qt::Horizontal</enum>
+              </property>
+              <property name="sizeHint" stdset="0">
+               <size>
+                <width>98</width>
+                <height>20</height>
+               </size>
+              </property>
+             </spacer>
+            </item>
+            <item>
+             <widget class="QPushButton" name="pushButton_norm_area_reset">
+              <property name="toolTip">
+               <string>Reset to empty/none</string>
+              </property>
+              <property name="text">
+               <string>Reset</string>
+              </property>
+             </widget>
+            </item>
+           </layout>
+          </item>
+         </layout>
+        </widget>
+       </item>
+       <item row="5" column="0">
+        <spacer name="verticalSpacer">
+         <property name="orientation">
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>20</width>
+           <height>68</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+      </layout>
+     </widget>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ImageStackPreParams.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ImageStackPreParams.h
new file mode 100644
index 0000000000000000000000000000000000000000..164a3a475f7229f2b91fe6e9a82e15f102cb7065
--- /dev/null
+++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ImageStackPreParams.h
@@ -0,0 +1,63 @@
+#ifndef MANTIDQTCUSTOMINTERFACES_TOMOGRAPHY_IMAGESTACKPREPARAMS_H_
+#define MANTIDQTCUSTOMINTERFACES_TOMOGRAPHY_IMAGESTACKPREPARAMS_H_
+
+#include "MantidKernel/System.h"
+#include "MantidKernel/V2D.h"
+
+#include <utility>
+
+namespace MantidQt {
+namespace CustomInterfaces {
+
+/**
+This holds parameters for pre-processing images or stacks of images
+for tomographic reconstruction. These parameters are used in different
+pre-processing steps in the tomographic reconstruction pipeline, and
+also for the reconstruction algorithms (iternative methods, FBP,
+etc.).
+
+The parameters include:
+- center of rotation
+- region of interest (clip from original or raw images)
+- region for normalization (where the beam is not blocked by any sample 
+  object throughout the stack of images) other parameters describing
+  the stack of images: 
+
+Copyright &copy; 2014,2015 ISIS Rutherford Appleton Laboratory, NScD
+Oak Ridge National Laboratory & European Spallation Source
+
+This file is part of Mantid.
+
+Mantid is free software; you can 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.
+
+Mantid is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU 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/>.
+
+File change history is stored at: <https://github.com/mantidproject/mantid>
+Code Documentation is available at: <http://doxygen.mantidproject.org>
+*/
+class ImageStackPreParams {
+public:
+
+  ImageStackPreParams();
+
+  typedef std::pair<Mantid::Kernel::V2D, Mantid::Kernel::V2D> Box2D;
+
+  Mantid::Kernel::V2D cor;
+  Box2D roi;
+  Box2D normalizationRegion;  //< also known as 'air' region
+  bool medianFilter;
+};
+
+} // namespace CustomInterfaces
+} // namespace MantidQt
+
+#endif // MANTIDQTCUSTOMINTERFACES_TOMOGRAPHY_IMAGESTACKPREPARAMS_H_
diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/StackOfImagesDirs.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/StackOfImagesDirs.h
new file mode 100644
index 0000000000000000000000000000000000000000..3ef122016ea93de03b22395c15ab647d62ea9324
--- /dev/null
+++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/StackOfImagesDirs.h
@@ -0,0 +1,86 @@
+#ifndef MANTIDQTCUSTOMINTERFACES_TOMOGRAPHY_STACKOFIMAGESDIR_H_
+#define MANTIDQTCUSTOMINTERFACES_TOMOGRAPHY_STACKOFIMAGESDIR_H_
+
+#include "MantidKernel/System.h"
+
+#include <string>
+#include <vector>
+
+namespace MantidQt {
+namespace CustomInterfaces {
+
+/**
+Represents the structure of directories where a stack of images is
+stored on disk: data/flat/dark + processed + pre_filtered, etc.
+
+Copyright &copy; 2015 ISIS Rutherford Appleton Laboratory, NScD
+Oak Ridge National Laboratory & European Spallation Source
+
+This file is part of Mantid.
+
+Mantid is free software; you can 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.
+
+Mantid is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU 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/>.
+
+File change history is stored at: <https://github.com/mantidproject/mantid>
+Code Documentation is available at: <http://doxygen.mantidproject.org>
+*/
+class DLLExport StackOfImagesDirs {
+public:
+  /// constructor from a path (to a directory)
+  StackOfImagesDirs(const std::string &path);
+
+  /// The current (simple) concept of valid is: there at least a
+  /// sample/data directory with at least one file in it.
+  bool isValid() const { return m_valid; }
+
+  // human readable description of the expected structure of directories
+  std::string description() const;
+
+  // string that describes the status/error message about this directory
+  std::string status() const;
+
+  std::string sampleImagesDir() const { return m_sampleDir; };
+  std::string flatImagesDir() const { return m_flatDir; };
+  std::string darkImagesDir() const { return m_darkDir; };
+
+  std::vector<std::string> sampleFiles() const;
+  std::vector<std::string> flatFiles() const;
+  std::vector<std::string> darkFiles() const;
+
+private:
+  /// tries to find the expected data_/dark_/flat_ directories
+  void findStackDirs(const std::string &path);
+  /// finds images in a directory
+  std::vector<std::string> findImgFiles(const std::string &path) const;
+
+  /// passes basic validity checks
+  bool m_valid;
+  /// string with informative messages specially when not valid
+  std::string m_statusDescStr;
+
+  std::string m_sampleDir;
+  std::string m_flatDir;
+  std::string m_darkDir;
+
+  static const std::string g_descr;
+  static const std::string g_sampleNamePrefix;
+  static const std::string g_flatNamePrefix;
+  static const std::string g_darkNamePrefix;
+  static const std::string g_processedNamePrefix;
+  static const std::string g_prefilteredNamePrefix;
+};
+
+} // namespace CustomInterfaces
+} // namespace MantidQt
+
+#endif // MANTIDQTCUSTOMINTERFACES_TOMOGRAPHY_STACKOFIMAGESDIR_H_
diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomoPathsConfig.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomoPathsConfig.h
index 92400342f4a0363d6d52588065ae557fc58994c3..ee3becb0206f8910ae585ab1f4cedae98c201d29 100644
--- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomoPathsConfig.h
+++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomoPathsConfig.h
@@ -18,7 +18,7 @@ that define where the data for a particular dataset can be found, and
 that are normally required to run reconstruction tools but also pre-
 and post- processing steps.
 
-Copyright &copy; 2014,205 ISIS Rutherford Appleton Laboratory, NScD
+Copyright &copy; 2014,2015 ISIS Rutherford Appleton Laboratory, NScD
 Oak Ridge National Laboratory & European Spallation Source
 
 This file is part of Mantid.
diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomoRecToolConfig.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomoRecToolConfig.h
index 1ff91bd3933bcec2ee31c120f04e8e814e78bc12..256518618dcb17ac301ae2871bf615424cfb1f02 100644
--- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomoRecToolConfig.h
+++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomoRecToolConfig.h
@@ -12,7 +12,7 @@ is under development, and as it is not necessarily related to custom
 interfaces this class and some derived ones might be moved out of
 here.
 
-Copyright &copy; 2014,205 ISIS Rutherford Appleton Laboratory, NScD
+Copyright &copy; 2014,2015 ISIS Rutherford Appleton Laboratory, NScD
 Oak Ridge National Laboratory & European Spallation Source
 
 This file is part of Mantid.
diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomoReconToolsUserSettings.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomoReconToolsUserSettings.h
index 25857af9e1a9827251c4b52c3453429c8837cb7a..a6047a19de1292643bf844af8fa30a6357b406a6 100644
--- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomoReconToolsUserSettings.h
+++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomoReconToolsUserSettings.h
@@ -13,7 +13,7 @@ namespace CustomInterfaces {
 /**
 Settings for a set of tomographic reconstruction tools supported.
 
-Copyright &copy; 2014,205 ISIS Rutherford Appleton Laboratory, NScD
+Copyright &copy; 2014,2015 ISIS Rutherford Appleton Laboratory, NScD
 Oak Ridge National Laboratory & European Spallation Source
 
 This file is part of Mantid.
diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomoToolConfigDialog.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomoToolConfigDialog.h
index 64cfc7a36aed82bdc7e6a1585e4b6895eb15ca0b..5196ca49bef979e5268b8dc9cbd68a5e1c20aca8 100644
--- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomoToolConfigDialog.h
+++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomoToolConfigDialog.h
@@ -15,7 +15,7 @@ namespace CustomInterfaces {
 Third party tool configuration dialog(s) for the tomographic reconstruction
 GUI.
 
-Copyright &copy; 2014,205 ISIS Rutherford Appleton Laboratory, NScD
+Copyright &copy; 2014,2015 ISIS Rutherford Appleton Laboratory, NScD
 Oak Ridge National Laboratory & European Spallation Source
 
 This file is part of Mantid.
diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomographyIfaceModel.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomographyIfaceModel.h
index a915f0c9ed1f7e54df8fa5b8249154eaef3410f8..4bd8001060f092397a3dec2d71d888c863d8f279 100644
--- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomographyIfaceModel.h
+++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomographyIfaceModel.h
@@ -20,7 +20,7 @@ Tomography GUI. Model for the interface (as in the MVP
 signals from this model should always be handled through the presenter
 and never go directly to the view.
 
-Copyright &copy; 2014,205 ISIS Rutherford Appleton Laboratory, NScD
+Copyright &copy; 2014,2015 ISIS Rutherford Appleton Laboratory, NScD
 Oak Ridge National Laboratory & European Spallation Source
 
 This file is part of Mantid.
diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomographyIfacePresenter.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomographyIfacePresenter.h
index f37b5569d582d5b09be32ecb775cd754c73d6b22..ec29c07091b112cb2ab2b5de01325dacdce081f0 100644
--- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomographyIfacePresenter.h
+++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomographyIfacePresenter.h
@@ -23,7 +23,7 @@ Tomography GUI. Presenter for the GUI (as in the MVP
 signals from the model should always be handled through this presenter
 and never go directly to the view, and viceversa.
 
-Copyright &copy; 2014,205 ISIS Rutherford Appleton Laboratory, NScD
+Copyright &copy; 2014,2015 ISIS Rutherford Appleton Laboratory, NScD
 Oak Ridge National Laboratory & European Spallation Source
 
 This file is part of Mantid.
diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomographyIfaceQtTabRun.ui b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomographyIfaceQtTabRun.ui
index ecfc5ff939ec2a361cae319847285f9d52c70162..ea670ee8a7158f0eb58a5f606461f3633d73f3a1 100644
--- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomographyIfaceQtTabRun.ui
+++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomographyIfaceQtTabRun.ui
@@ -9,8 +9,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>462</width>
-    <height>460</height>
+    <width>671</width>
+    <height>451</height>
    </rect>
   </property>
   <layout class="QGridLayout" name="gridLayout">
@@ -74,7 +74,7 @@
         <item row="1" column="0">
          <widget class="QFrame" name="frame_image">
           <property name="sizePolicy">
-           <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+           <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
             <horstretch>2</horstretch>
             <verstretch>2</verstretch>
            </sizepolicy>
@@ -105,10 +105,16 @@
                <rect>
                 <x>0</x>
                 <y>0</y>
-                <width>151</width>
-                <height>180</height>
+                <width>231</width>
+                <height>175</height>
                </rect>
               </property>
+              <property name="sizePolicy">
+               <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+                <horstretch>0</horstretch>
+                <verstretch>0</verstretch>
+               </sizepolicy>
+              </property>
               <layout class="QGridLayout" name="gridLayout_5">
                <property name="margin">
                 <number>0</number>
@@ -118,6 +124,12 @@
                </property>
                <item row="0" column="0">
                 <widget class="QLabel" name="label_image">
+                 <property name="sizePolicy">
+                  <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+                   <horstretch>0</horstretch>
+                   <verstretch>0</verstretch>
+                  </sizepolicy>
+                 </property>
                  <property name="text">
                   <string/>
                  </property>
diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomographyIfaceViewQtGUI.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomographyIfaceViewQtGUI.h
index 010abf23fbeaea0ce1a7fe1b47d4a7fe60bbecf7..3f78f8feafe18f03d52db0af5d4eab26556e76b1 100644
--- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomographyIfaceViewQtGUI.h
+++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/TomographyIfaceViewQtGUI.h
@@ -9,6 +9,8 @@
 #include "MantidQtCustomInterfaces/Tomography/ITomographyIfacePresenter.h"
 #include "MantidQtCustomInterfaces/Tomography/ITomographyIfaceView.h"
 #include "MantidQtCustomInterfaces/Tomography/TomoToolConfigDialog.h"
+
+#include "ui_ImageSelectCoRAndRegions.h"
 #include "ui_TomographyIfaceQtGUI.h"
 #include "ui_TomographyIfaceQtTabSetup.h"
 #include "ui_TomographyIfaceQtTabRun.h"
@@ -30,7 +32,7 @@ in a foreseeable horizon. The interface of this class is given by
 ITomographyIfaceView so that it fits in the MVP (Model-View-Presenter)
 design of the tomography GUI.
 
-Copyright &copy; 2014,205 ISIS Rutherford Appleton Laboratory, NScD
+Copyright &copy; 2014,2015 ISIS Rutherford Appleton Laboratory, NScD
 Oak Ridge National Laboratory & European Spallation Source
 
 This file is part of Mantid.
@@ -176,8 +178,9 @@ private:
   void processPathBrowseClick(QLineEdit *le, std::string &data);
 
   // Begin of Savu related functionality. This will grow and will need
-  // separation
-
+  // separation. They should find a better place to live.
+  ///@name Savu related methods
+  ///@{
   /// to load plugins (savu classification / API)
   void loadAvailablePlugins();
 
@@ -201,6 +204,7 @@ private:
                                       const std::string &name);
   std::string pluginParamValString(const Json::Value &jsonVal,
                                    const std::string &name);
+  ///@}
 
   static size_t g_nameSeqNo;
 
@@ -213,6 +217,7 @@ private:
   // but they could be separate dialogs, widgets, etc.
   Ui::TomographyIfaceQtTabSetup m_uiTabSetup;
   Ui::TomographyIfaceQtTabRun m_uiTabRun;
+  Ui::ImageSelectCoRAndRegions m_uiTabCoR;
 
   /// Tool specific setup dialogs
   Ui::TomoToolConfigAstra m_uiAstra;
diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ToolConfigAstraToolbox.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ToolConfigAstraToolbox.h
index 80d2b62a64138bcac14062a62289bb451a62e20e..8e4b19d2f7cdac14401455f43f7fbcf0e8c5bc86 100644
--- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ToolConfigAstraToolbox.h
+++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ToolConfigAstraToolbox.h
@@ -15,7 +15,7 @@ Configuration of a third party tomographic reconstruction tool
 specialized for the Astra Toolbox tomographic reconstruction tool
 (C++, CUDA): Astra Toolbox <http://sourceforge.net/p/astra-toolbox/wiki/Home/
 
-Copyright &copy; 2014,205 ISIS Rutherford Appleton Laboratory, NScD
+Copyright &copy; 2014,2015 ISIS Rutherford Appleton Laboratory, NScD
 Oak Ridge National Laboratory & European Spallation Source
 
 This file is part of Mantid.
@@ -38,7 +38,7 @@ Code Documentation is available at: <http://doxygen.mantidproject.org>
 */
 class DLLExport ToolConfigAstraToolbox : public TomoRecToolConfig {
 public:
-  ToolConfigAstraToolbox() { }
+  ToolConfigAstraToolbox();
 
   ToolConfigAstraToolbox(const std::string &runnable, double centerRot,
                          double angleMin, double angleMax,
@@ -47,7 +47,7 @@ public:
                          const std::string &pathOpen,
                          const std::string &pathSample);
 
-  ~ToolConfigAstraToolbox() { }
+  ~ToolConfigAstraToolbox() {}
 
 protected:
   virtual std::string makeCmdLineOptions() const;
diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ToolConfigCustom.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ToolConfigCustom.h
index fe02d914dc2a9d2db490682fa9daf8e9fdaa845d..98c947dc793a6e7fed3e9f3297e0fe1da67ea057 100644
--- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ToolConfigCustom.h
+++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ToolConfigCustom.h
@@ -18,7 +18,7 @@ custom interfaces might be moved out of here. Tools of other type
 might be added, and then this should not be a sublcass of
 TomoRecToolConfig but of a more general ToolConfig class.
 
-Copyright &copy; 2014,205 ISIS Rutherford Appleton Laboratory, NScD
+Copyright &copy; 2014,2015 ISIS Rutherford Appleton Laboratory, NScD
 Oak Ridge National Laboratory & European Spallation Source
 
 This file is part of Mantid.
diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ToolConfigTomoPy.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ToolConfigTomoPy.h
index 56eec90cbd50d02bc126f34a091192f029621a78..b3e9054938af5d0c8ecdf4a94751f6ab2628d65e 100644
--- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ToolConfigTomoPy.h
+++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Tomography/ToolConfigTomoPy.h
@@ -14,7 +14,7 @@ Third party tomographic reconstruction tool configuration class
 specialized for TomoPy (Python + C++):
 https://www1.aps.anl.gov/Science/Scientific-Software/TomoPy
 
-Copyright &copy; 2014,205 ISIS Rutherford Appleton Laboratory, NScD
+Copyright &copy; 2014,2015 ISIS Rutherford Appleton Laboratory, NScD
 Oak Ridge National Laboratory & European Spallation Source
 
 This file is part of Mantid.
@@ -37,14 +37,14 @@ Code Documentation is available at: <http://doxygen.mantidproject.org>
 */
 class DLLExport ToolConfigTomoPy : public TomoRecToolConfig {
 public:
-  ToolConfigTomoPy() { }
+  ToolConfigTomoPy();
 
   ToolConfigTomoPy(const std::string &runnable, const std::string &pathOut,
                    const std::string &pathDark, const std::string &pathOpen,
                    const std::string &pathSample, double centerRot,
                    double angleMin, double angleMax);
 
-  ~ToolConfigTomoPy() { }
+  ~ToolConfigTomoPy() {}
 
 protected:
   virtual std::string makeCmdLineOptions() const;
diff --git a/MantidQt/CustomInterfaces/src/EnggDiffraction/EnggDiffractionPresenter.cpp b/MantidQt/CustomInterfaces/src/EnggDiffraction/EnggDiffractionPresenter.cpp
index 0b0be67c9f4055f395f0eedcd8b963851a9b1b64..3eaf4ab45a93f469e62a7e1283be0559c0822a36 100644
--- a/MantidQt/CustomInterfaces/src/EnggDiffraction/EnggDiffractionPresenter.cpp
+++ b/MantidQt/CustomInterfaces/src/EnggDiffraction/EnggDiffractionPresenter.cpp
@@ -57,7 +57,8 @@ void EnggDiffractionPresenter::cleanup() {
   if (m_workerThread) {
     if (m_workerThread->isRunning()) {
       g_log.notice() << "A calibration process is currently running, shutting "
-                        "it down immediately..." << std::endl;
+                        "it down immediately..."
+                     << std::endl;
       m_workerThread->wait(10);
     }
     delete m_workerThread;
@@ -146,7 +147,8 @@ void EnggDiffractionPresenter::processCalcCalib() {
     return;
   }
   g_log.notice() << "EnggDiffraction GUI: starting new calibration. This may "
-                    "take a few seconds... " << std::endl;
+                    "take a few seconds... "
+                 << std::endl;
 
   const std::string outFilename = outputCalibFilename(vanNo, ceriaNo);
 
@@ -414,10 +416,9 @@ void EnggDiffractionPresenter::parseCalibrateFilename(const std::string &path,
  * @param vanNo vanadium run number
  * @param ceriaNo ceria run number
  */
-void
-EnggDiffractionPresenter::startAsyncCalibWorker(const std::string &outFilename,
-                                                const std::string &vanNo,
-                                                const std::string &ceriaNo) {
+void EnggDiffractionPresenter::startAsyncCalibWorker(
+    const std::string &outFilename, const std::string &vanNo,
+    const std::string &ceriaNo) {
   delete m_workerThread;
   m_workerThread = new QThread(this);
   EnggDiffWorker *worker =
@@ -466,11 +467,13 @@ void EnggDiffractionPresenter::doNewCalibration(const std::string &outFilename,
   } catch (std::runtime_error &) {
     g_log.error() << "The calibration calculations failed. One of the "
                      "algorithms did not execute correctly. See log messages "
-                     "for details. " << std::endl;
+                     "for details. "
+                  << std::endl;
   } catch (std::invalid_argument &) {
     g_log.error()
         << "The calibration calculations failed. Some input properties "
-           "were not valid. See log messages for details. " << std::endl;
+           "were not valid. See log messages for details. "
+        << std::endl;
   }
   // restore normal data search paths
   conf.setDataSearchDirs(tmpDirs);
@@ -710,8 +713,8 @@ void EnggDiffractionPresenter::inputChecksBeforeFocusTexture(
   inputChecksBeforeFocus();
 }
 
-void
-EnggDiffractionPresenter::inputChecksBanks(const std::vector<bool> &banks) {
+void EnggDiffractionPresenter::inputChecksBanks(
+    const std::vector<bool> &banks) {
   if (0 == banks.size()) {
     const std::string msg =
         "Error in specification of banks found when starting the "
@@ -848,7 +851,8 @@ void EnggDiffractionPresenter::doFocusRun(
     const std::string &specNos, const std::string &dgFile) {
 
   g_log.notice() << "Generating new focusing workspace(s) and file(s) into "
-                    "this directory: " << dir << std::endl;
+                    "this directory: "
+                 << dir << std::endl;
 
   // TODO: this is almost 100% common with doNewCalibrate() - refactor
   EnggDiffCalibSettings cs = m_view->currentCalibSettings();
@@ -887,7 +891,8 @@ void EnggDiffractionPresenter::doFocusRun(
         loadDetectorGroupingCSV(dgFile, bankIDs, specs);
       } catch (std::runtime_error &re) {
         g_log.error() << "Error loading detector grouping file: " + dgFile +
-                             ". Detailed error: " + re.what() << std::endl;
+                             ". Detailed error: " + re.what()
+                      << std::endl;
         bankIDs.clear();
         specs.clear();
       }
@@ -903,8 +908,8 @@ void EnggDiffractionPresenter::doFocusRun(
         fpath.append(effectiveFilenames[idx]).toString();
     g_log.notice() << "Generating new focused file (bank " +
                           boost::lexical_cast<std::string>(bankIDs[idx]) +
-                          ") for run " + runNo +
-                          " into: " << effectiveFilenames[idx] << std::endl;
+                          ") for run " + runNo + " into: "
+                   << effectiveFilenames[idx] << std::endl;
     try {
       doFocusing(cs, fullFilename, runNo, bankIDs[idx], specs[idx], dgFile);
       m_focusFinishedOK = true;
@@ -916,7 +921,8 @@ void EnggDiffractionPresenter::doFocusRun(
     } catch (std::invalid_argument &ia) {
       g_log.error()
           << "The focusing failed. Some input properties were not valid. "
-             "See log messages for details. Error: " << ia.what() << std::endl;
+             "See log messages for details. Error: "
+          << ia.what() << std::endl;
     }
   }
 
@@ -1082,12 +1088,8 @@ void EnggDiffractionPresenter::doFocusing(const EnggDiffCalibSettings &cs,
     // TODO: use detector positions (from calibrate full) when available
     // alg->setProperty(DetectorPositions, TableWorkspace)
     alg->execute();
-
-    const bool plotFocusedWS = m_view->focusedOutWorkspace();
-    if (plotFocusedWS == true) {
-      m_view->plotFocusedSpectrum(outWSName);
-    }
-
+	// plot Focused workspace according to the data type selected
+	plotFocusedWorkspace(outWSName);
   } catch (std::runtime_error &re) {
     g_log.error() << "Error in calibration. ",
         "Could not run the algorithm EnggCalibrate succesfully for bank " +
@@ -1160,7 +1162,8 @@ void EnggDiffractionPresenter::loadOrCalcVanadiumWorkspaces(
                        "This is possibly because some of the settings are not "
                        "consistent. Please check the log messages for "
                        "details. Details: " +
-                           std::string(ia.what()) << std::endl;
+                           std::string(ia.what())
+                    << std::endl;
       throw;
     } catch (std::runtime_error &re) {
       g_log.error() << "Failed to calculate Vanadium corrections. "
@@ -1169,7 +1172,8 @@ void EnggDiffractionPresenter::loadOrCalcVanadiumWorkspaces(
                        "There was no obvious error in the input properties "
                        "but the algorithm failed. Please check the log "
                        "messages for details." +
-                           std::string(re.what()) << std::endl;
+                           std::string(re.what())
+                    << std::endl;
       throw;
     }
   } else {
@@ -1325,5 +1329,29 @@ void EnggDiffractionPresenter::calcVanadiumWorkspaces(
   vanCurvesWS = ADS.retrieveWS<MatrixWorkspace>(curvesName);
 }
 
+/**
+ * Checks the plot type selected and applies the appropriate
+ * python function to apply during first bank and second bank
+ *
+ * @param outWSName; title of the focused workspace
+ */
+void EnggDiffractionPresenter::plotFocusedWorkspace(std::string outWSName) {
+  const bool plotFocusedWS = m_view->focusedOutWorkspace();
+  int plotType = m_view->currentPlotType();
+  if (plotFocusedWS == true && 0 == plotType) {
+    if (outWSName == "engggui_focusing_output_ws_bank_1")
+      m_view->plotFocusedSpectrum(outWSName);
+    if (outWSName == "engggui_focusing_output_ws_bank_2")
+      m_view->plotReplacingWindow(outWSName);
+  } else if (plotFocusedWS == true && 1 == plotType) {
+    if (outWSName == "engggui_focusing_output_ws_bank_1")
+      m_view->plotFocusedSpectrum(outWSName);
+    if (outWSName == "engggui_focusing_output_ws_bank_2")
+      m_view->plotWaterfallSpectrum(outWSName);
+  } else if (plotFocusedWS == true && 2 == plotType) {
+    m_view->plotFocusedSpectrum(outWSName);
+  }
+}
+
 } // namespace CustomInterfaces
 } // namespace MantidQt
diff --git a/MantidQt/CustomInterfaces/src/EnggDiffraction/EnggDiffractionViewQtGUI.cpp b/MantidQt/CustomInterfaces/src/EnggDiffraction/EnggDiffractionViewQtGUI.cpp
index c594b5b2732fcbf545042214fcd30a80cc6dc117..281afa85eaff3569539a0a803ace7e433a59b7a4 100644
--- a/MantidQt/CustomInterfaces/src/EnggDiffraction/EnggDiffractionViewQtGUI.cpp
+++ b/MantidQt/CustomInterfaces/src/EnggDiffraction/EnggDiffractionViewQtGUI.cpp
@@ -149,6 +149,7 @@ void EnggDiffractionViewQtGUI::doSetupTabSettings() {
 }
 
 void EnggDiffractionViewQtGUI::doSetupTabFocus() {
+
   connect(m_uiTabFocus.pushButton_focus, SIGNAL(released()), this,
           SLOT(focusClicked()));
 
@@ -163,6 +164,12 @@ void EnggDiffractionViewQtGUI::doSetupTabFocus() {
 
   connect(m_uiTabFocus.pushButton_reset, SIGNAL(released()), this,
           SLOT(focusResetClicked()));
+
+  connect(m_uiTabFocus.comboBox_PlotData, SIGNAL(currentIndexChanged(int)),
+          this, SLOT(plotRepChanged(int)));
+
+  connect(m_uiTabFocus.checkBox_FocusedWS, SIGNAL(clicked()), this,
+          SLOT(plotFocusStatus()));
 }
 
 void EnggDiffractionViewQtGUI::doSetupGeneralWidgets() {
@@ -209,9 +216,11 @@ void EnggDiffractionViewQtGUI::readSettings() {
 
   qs.beginReadArray("user-params-focus-bank_i");
   qs.setArrayIndex(0);
-  m_uiTabFocus.checkBox_focus_bank1->setChecked(qs.value("value", true).toBool());
+  m_uiTabFocus.checkBox_focus_bank1->setChecked(
+      qs.value("value", true).toBool());
   qs.setArrayIndex(1);
-  m_uiTabFocus.checkBox_focus_bank2->setChecked(qs.value("value", true).toBool());
+  m_uiTabFocus.checkBox_focus_bank2->setChecked(
+      qs.value("value", true).toBool());
   qs.endArray();
 
   m_uiTabFocus.lineEdit_cropped_run_num->setText(
@@ -230,6 +239,8 @@ void EnggDiffractionViewQtGUI::readSettings() {
   m_uiTabFocus.checkBox_FocusedWS->setChecked(
       qs.value("user-params-focus-plot-ws", true).toBool());
 
+  m_uiTabFocus.comboBox_PlotData->setCurrentIndex(0);
+
   QString lastPath =
       MantidQt::API::AlgorithmInputHistory::Instance().getPreviousDirectory();
   // TODO: this should become << >> operators on
@@ -421,8 +432,20 @@ void EnggDiffractionViewQtGUI::enableCalibrateAndFocusActions(bool enable) {
 }
 
 void EnggDiffractionViewQtGUI::plotFocusedSpectrum(const std::string &wsName) {
-  std::string pyCode = "plotSpectrum('" + wsName + "', 0)";
+  std::string pyCode = "win = plotSpectrum('" + wsName + "', 0)";
+
+  std::string status =
+      runPythonCode(QString::fromStdString(pyCode), false).toStdString();
+  m_logMsgs.push_back("Plotted output focused data, with status string " +
+                      status);
+  m_presenter->notify(IEnggDiffractionPresenter::LogMsg);
+}
 
+void EnggDiffractionViewQtGUI::plotWaterfallSpectrum(
+    const std::string &wsName) {
+  // parameter of list ?
+  std::string pyCode =
+      "plotSpectrum('" + wsName + "', 0, waterfall = True, window = win)";
   std::string status =
       runPythonCode(QString::fromStdString(pyCode), false).toStdString();
   m_logMsgs.push_back("Plotted output focused data, with status string " +
@@ -430,6 +453,17 @@ void EnggDiffractionViewQtGUI::plotFocusedSpectrum(const std::string &wsName) {
   m_presenter->notify(IEnggDiffractionPresenter::LogMsg);
 }
 
+void EnggDiffractionViewQtGUI::plotReplacingWindow(const std::string &wsName) {
+  std::string pyCode =
+      "plotSpectrum('" + wsName + "', 0, window = win, clearWindow = True)";
+  std::string status =
+      runPythonCode(QString::fromStdString(pyCode), false).toStdString();
+
+  m_logMsgs.push_back("Plotted output focused data, with status string " +
+                      status);
+  m_presenter->notify(IEnggDiffractionPresenter::LogMsg);
+}
+
 void EnggDiffractionViewQtGUI::resetFocus() {
   m_uiTabFocus.lineEdit_run_num->setText("");
   m_uiTabFocus.checkBox_focus_bank1->setChecked(true);
@@ -442,10 +476,9 @@ void EnggDiffractionViewQtGUI::resetFocus() {
   m_uiTabFocus.lineEdit_texture_grouping_file->setText("");
 }
 
-void
-EnggDiffractionViewQtGUI::writeOutCalibFile(const std::string &outFilename,
-                                            const std::vector<double> &difc,
-                                            const std::vector<double> &tzero) {
+void EnggDiffractionViewQtGUI::writeOutCalibFile(
+    const std::string &outFilename, const std::vector<double> &difc,
+    const std::vector<double> &tzero) {
   // TODO: this is horrible and should not last much here.
   // Avoid running Python code
   // Update this as soon as we have a more stable way of generating IPARM
@@ -677,6 +710,21 @@ bool EnggDiffractionViewQtGUI::focusedOutWorkspace() const {
   return m_uiTabFocus.checkBox_FocusedWS->checkState();
 }
 
+void EnggDiffractionViewQtGUI::plotFocusStatus() {
+  if (focusedOutWorkspace()) {
+    m_uiTabFocus.comboBox_PlotData->setEnabled(true);
+  } else {
+    m_uiTabFocus.comboBox_PlotData->setEnabled(false);
+  }
+}
+
+void EnggDiffractionViewQtGUI::plotRepChanged(int /*idx*/) {
+  QComboBox *inst = m_uiTabFocus.comboBox_PlotData;
+  if (!inst)
+    return;
+  m_currentType = inst->currentIndex();
+}
+
 void EnggDiffractionViewQtGUI::instrumentChanged(int /*idx*/) {
   QComboBox *inst = m_ui.comboBox_instrument;
   if (!inst)
diff --git a/MantidQt/CustomInterfaces/src/Indirect/ApplyPaalmanPings.cpp b/MantidQt/CustomInterfaces/src/Indirect/ApplyPaalmanPings.cpp
index 42270faab779a63de3226cd5b3b3cc4ebd2c2de6..e4e9d4484706608f74596258ca4846cf1bc906b7 100644
--- a/MantidQt/CustomInterfaces/src/Indirect/ApplyPaalmanPings.cpp
+++ b/MantidQt/CustomInterfaces/src/Indirect/ApplyPaalmanPings.cpp
@@ -145,6 +145,7 @@ void ApplyPaalmanPings::run() {
         switch (result) {
         case QMessageBox::YesToAll:
           interpolateAll = true;
+          //fall through
         case QMessageBox::Yes:
           addInterpolationStep(factorWs, absCorProps["SampleWorkspace"]);
           break;
@@ -175,9 +176,18 @@ void ApplyPaalmanPings::run() {
     correctionType = "cyl";
     break;
   }
-  const QString outputWsName =
+  QString outputWsName =
       sampleWsName.left(nameCutIndex) + +"_" + correctionType + "_Corrected";
 
+  if (useCan) {
+    auto containerWsName = m_uiForm.dsContainer->getCurrentDataName();
+    int cutIndex = containerWsName.indexOf("_");
+    if (cutIndex == -1) {
+      cutIndex = containerWsName.length();
+    }
+	outputWsName += "_Subtract_" + containerWsName.left(cutIndex);
+  }
+
   applyCorrAlg->setProperty("OutputWorkspace", outputWsName.toStdString());
 
   // Add corrections algorithm to queue
diff --git a/MantidQt/CustomInterfaces/src/Indirect/CalculatePaalmanPings.cpp b/MantidQt/CustomInterfaces/src/Indirect/CalculatePaalmanPings.cpp
index 81277fad6d9919ec6d2057026a52be6716bff9c2..49584757883539d7ef1a4332893875067f9017e1 100644
--- a/MantidQt/CustomInterfaces/src/Indirect/CalculatePaalmanPings.cpp
+++ b/MantidQt/CustomInterfaces/src/Indirect/CalculatePaalmanPings.cpp
@@ -122,8 +122,17 @@ void CalculatePaalmanPings::run() {
     break;
   }
 
-  const QString outputWsName =
+  QString outputWsName =
       sampleWsName.left(nameCutIndex) + "_" + correctionType + "_abs";
+  if (useCan) {
+    auto containerWsName = m_uiForm.dsContainer->getCurrentDataName();
+    int cutIndex = containerWsName.indexOf("_");
+    if (cutIndex == -1) {
+      cutIndex = containerWsName.length();
+    }
+    outputWsName += "_Subtract_" + containerWsName.left(cutIndex);
+  }
+
   absCorAlgo->setProperty("OutputWorkspace", outputWsName.toStdString());
 
   // Add corrections algorithm to queue
diff --git a/MantidQt/CustomInterfaces/src/Indirect/ConvFit.cpp b/MantidQt/CustomInterfaces/src/Indirect/ConvFit.cpp
index c4e727187fc8084c0e25ba20eab0bc8384a87a9a..8af4d002b29daed1fbcea4c0495aa2a709a07156 100644
--- a/MantidQt/CustomInterfaces/src/Indirect/ConvFit.cpp
+++ b/MantidQt/CustomInterfaces/src/Indirect/ConvFit.cpp
@@ -993,8 +993,14 @@ void ConvFit::updatePlot() {
       return;
     MatrixWorkspace_sptr ws = boost::dynamic_pointer_cast<MatrixWorkspace>(
         outputGroup->getItem(specNo));
-    if (ws)
+    if (ws) {
       m_uiForm.ppPlot->addSpectrum("Fit", ws, 1, Qt::red);
+      m_uiForm.ppPlot->addSpectrum("Diff", ws, 2, Qt::blue);
+	  if(m_uiForm.ckPlotGuess->isChecked()){
+		  m_uiForm.ppPlot->removeSpectrum("Guess");
+		  m_uiForm.ckPlotGuess->setChecked(false);
+	  }
+    }
   }
 }
 
diff --git a/MantidQt/CustomInterfaces/src/Indirect/ISISEnergyTransfer.cpp b/MantidQt/CustomInterfaces/src/Indirect/ISISEnergyTransfer.cpp
index ae32ddc36c2e30d07b9ff6dd2d5de8769a48a24a..684a600758ee1da57dd55c4810ab16df27c780fe 100644
--- a/MantidQt/CustomInterfaces/src/Indirect/ISISEnergyTransfer.cpp
+++ b/MantidQt/CustomInterfaces/src/Indirect/ISISEnergyTransfer.cpp
@@ -69,19 +69,19 @@ bool ISISEnergyTransfer::validate() {
   UserInputValidator uiv;
 
   // Run files input
-  if (!m_uiForm.dsRunFiles->isValid()){
+  if (!m_uiForm.dsRunFiles->isValid()) {
     uiv.addErrorMessage("Run file range is invalid.");
   }
 
   // Calibration file input
   if (m_uiForm.ckUseCalib->isChecked() &&
-      !m_uiForm.dsCalibrationFile->isValid()){
+      !m_uiForm.dsCalibrationFile->isValid()) {
     uiv.addErrorMessage("Calibration file/workspace is invalid.");
   }
 
   // Mapping file
   if ((m_uiForm.cbGroupingOptions->currentText() == "File") &&
-      (!m_uiForm.dsMapFile->isValid())){
+      (!m_uiForm.dsMapFile->isValid())) {
     uiv.addErrorMessage("Mapping file is invalid.");
   }
 
@@ -115,17 +115,63 @@ bool ISISEnergyTransfer::validate() {
   // Spectra Number check
   const int specMin = m_uiForm.spSpectraMin->value();
   const int specMax = m_uiForm.spSpectraMax->value();
-  if(specMin > specMax){
-	uiv.addErrorMessage("Spectra Min must be less than Spectra Max");
+  if (specMin > specMax) {
+    uiv.addErrorMessage("Spectra Min must be less than Spectra Max");
   }
 
   // Background Removal (TOF)
-  if(m_uiForm.ckBackgroundRemoval->isChecked()){
-	  const int start = m_uiForm.spBackgroundStart->value();
-	  const int end = m_uiForm.spBackgroundEnd->value();
-	  if(start > end){
-		  uiv.addErrorMessage("Background Start must be less than Background End");
-	  }
+  if (m_uiForm.ckBackgroundRemoval->isChecked()) {
+    const int start = m_uiForm.spBackgroundStart->value();
+    const int end = m_uiForm.spBackgroundEnd->value();
+    if (start > end) {
+      uiv.addErrorMessage("Background Start must be less than Background End");
+    }
+  }
+
+  if (m_uiForm.dsRunFiles->isValid()) {
+    int detectorMin = m_uiForm.spPlotTimeSpecMin->value();
+    int detectorMax = m_uiForm.spPlotTimeSpecMax->value();
+
+    QString rawFile = m_uiForm.dsRunFiles->getFirstFilename();
+    auto pos = rawFile.lastIndexOf(".");
+    auto extension = rawFile.right(rawFile.length() - pos);
+    QFileInfo rawFileInfo(rawFile);
+    std::string name = rawFileInfo.baseName().toStdString();
+
+    IAlgorithm_sptr loadAlg = AlgorithmManager::Instance().create("Load");
+    loadAlg->initialize();
+    loadAlg->setProperty("Filename", rawFile.toStdString());
+    loadAlg->setProperty("OutputWorkspace", name);
+    if (extension.compare(".nxs") == 0) {
+      int64_t detectorMin =
+          static_cast<int64_t>(m_uiForm.spPlotTimeSpecMin->value());
+      int64_t detectorMax =
+          static_cast<int64_t>(m_uiForm.spPlotTimeSpecMax->value());
+      loadAlg->setProperty("SpectrumMin", detectorMin);
+      loadAlg->setProperty("SpectrumMax", detectorMax);
+    } else {
+      loadAlg->setProperty("SpectrumMin", detectorMin);
+      loadAlg->setProperty("SpectrumMax", detectorMax);
+    }
+
+    loadAlg->execute();
+
+    if (m_uiForm.ckBackgroundRemoval->isChecked()) {
+      MatrixWorkspace_sptr tempWs =
+          AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>(name);
+      const double minBack = tempWs->readX(0)[0];
+      const double maxBack = tempWs->readX(0)[tempWs->blocksize()];
+
+      if (m_uiForm.spBackgroundStart->value() < minBack) {
+        uiv.addErrorMessage("The Start of Background Removal is less than the "
+                            "minimum of the data range");
+      }
+
+      if (m_uiForm.spBackgroundEnd->value() > maxBack) {
+        uiv.addErrorMessage("The End of Background Removal is more than the "
+                            "maximum of the data range");
+      }
+    }
   }
 
   QString error = uiv.generateErrorMessage();
@@ -446,6 +492,15 @@ void ISISEnergyTransfer::plotRaw() {
         "Minimum spectra must be less than or equal to maximum spectra.");
     return;
   }
+  const int startBack = m_uiForm.spBackgroundStart->value();
+  const int endBack = m_uiForm.spBackgroundEnd->value();
+
+  if (m_uiForm.ckBackgroundRemoval->isChecked() == true) {
+    if (startBack > endBack) {
+      emit showMessageBox("Background Start must be less than Background End");
+      return;
+    }
+  }
 
   QString rawFile = m_uiForm.dsRunFiles->getFirstFilename();
   auto pos = rawFile.lastIndexOf(".");
@@ -453,7 +508,7 @@ void ISISEnergyTransfer::plotRaw() {
   QFileInfo rawFileInfo(rawFile);
   std::string name = rawFileInfo.baseName().toStdString();
 
-   IAlgorithm_sptr loadAlg = AlgorithmManager::Instance().create("Load");
+  IAlgorithm_sptr loadAlg = AlgorithmManager::Instance().create("Load");
   loadAlg->initialize();
   loadAlg->setProperty("Filename", rawFile.toStdString());
   loadAlg->setProperty("OutputWorkspace", name);
@@ -468,7 +523,27 @@ void ISISEnergyTransfer::plotRaw() {
     loadAlg->setProperty("SpectrumMin", detectorMin);
     loadAlg->setProperty("SpectrumMax", detectorMax);
   }
-  m_batchAlgoRunner->addAlgorithm(loadAlg);
+
+  loadAlg->execute();
+
+  if (m_uiForm.ckBackgroundRemoval->isChecked()) {
+    MatrixWorkspace_sptr tempWs =
+        AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>(name);
+    const double minBack = tempWs->readX(0)[0];
+    const double maxBack = tempWs->readX(0)[tempWs->blocksize()];
+
+    if (startBack < minBack) {
+      emit showMessageBox("The Start of Background Removal is less than the "
+                          "minimum of the data range");
+      return;
+    }
+
+    if (endBack > maxBack) {
+      emit showMessageBox("The End of Background Removal is more than the "
+                          "maximum of the data range");
+      return;
+    }
+  }
 
   // Rebin the workspace to its self to ensure constant binning
   BatchAlgorithmRunner::AlgorithmRuntimeProps inputToRebin;
diff --git a/MantidQt/CustomInterfaces/src/Muon/ALCDataLoadingPresenter.cpp b/MantidQt/CustomInterfaces/src/Muon/ALCDataLoadingPresenter.cpp
index 8f56ec1b0f6dda9ee3a374c3f34150efedfbb044..fd6b1326b51c74c93e0bb75c553d573bc568abfd 100644
--- a/MantidQt/CustomInterfaces/src/Muon/ALCDataLoadingPresenter.cpp
+++ b/MantidQt/CustomInterfaces/src/Muon/ALCDataLoadingPresenter.cpp
@@ -36,7 +36,7 @@ namespace CustomInterfaces
 
   void ALCDataLoadingPresenter::load()
   {
-    m_view->setWaitingCursor();
+    m_view->disableAll();
 
     try
     {
@@ -116,7 +116,7 @@ namespace CustomInterfaces
       m_view->displayError(e.what());
     }
 
-    m_view->restoreCursor();
+    m_view->enableAll();
   }
 
   void ALCDataLoadingPresenter::updateAvailableInfo()
diff --git a/MantidQt/CustomInterfaces/src/Muon/ALCDataLoadingView.cpp b/MantidQt/CustomInterfaces/src/Muon/ALCDataLoadingView.cpp
index f2e6c9712f4cc86af3f1eea2f66670ae8ed47cac..7f1d5b578649dac18e4272bd25866676717e0341 100644
--- a/MantidQt/CustomInterfaces/src/Muon/ALCDataLoadingView.cpp
+++ b/MantidQt/CustomInterfaces/src/Muon/ALCDataLoadingView.cpp
@@ -40,6 +40,18 @@ namespace CustomInterfaces
     m_dataCurve->setSymbol(QwtSymbol(QwtSymbol::Ellipse, QBrush(), QPen(), QSize(7,7)));
     m_dataCurve->setRenderHint(QwtPlotItem::RenderAntialiased, true);
     m_dataCurve->attach(m_ui.dataPlot);
+
+    // The following lines disable the groups' titles when the
+    // group is disabled
+    QPalette palette;
+    palette.setColor(QPalette::Disabled, QPalette::WindowText,
+                     QApplication::palette().color(QPalette::Disabled,
+                                                   QPalette::WindowText));
+    m_ui.dataGroup->setPalette(palette);
+    m_ui.deadTimeGroup->setPalette(palette);
+    m_ui.detectorGroupingGroup->setPalette(palette);
+    m_ui.periodsGroup->setPalette(palette);
+    m_ui.calculationGroup->setPalette(palette);
   }
 
   std::string ALCDataLoadingView::firstRun() const
@@ -221,14 +233,28 @@ namespace CustomInterfaces
     MantidQt::API::HelpWindow::showCustomInterface(NULL, QString("Muon_ALC"));
   }
 
-  void ALCDataLoadingView::setWaitingCursor()
-  {
-    QApplication::setOverrideCursor(Qt::WaitCursor);
+  void ALCDataLoadingView::disableAll() {
+
+    // Disable all the widgets in the view
+    m_ui.dataGroup->setEnabled(false);
+    m_ui.deadTimeGroup->setEnabled(false);
+    m_ui.detectorGroupingGroup->setEnabled(false);
+    m_ui.periodsGroup->setEnabled(false);
+    m_ui.calculationGroup->setEnabled(false);
+    m_ui.load->setEnabled(false);
+
   }
 
-  void ALCDataLoadingView::restoreCursor()
-  {
-    QApplication::restoreOverrideCursor();
+  void ALCDataLoadingView::enableAll() {
+
+    // Enable all the widgets in the view
+    m_ui.deadTimeGroup->setEnabled(true);
+    m_ui.dataGroup->setEnabled(true);
+    m_ui.detectorGroupingGroup->setEnabled(true);
+    m_ui.periodsGroup->setEnabled(true);
+    m_ui.calculationGroup->setEnabled(true);
+    m_ui.load->setEnabled(true);
+
   }
 
 } // namespace CustomInterfaces
diff --git a/MantidQt/CustomInterfaces/src/Muon/ALCInterface.cpp b/MantidQt/CustomInterfaces/src/Muon/ALCInterface.cpp
index a52e8a9ea46656ce5503523ea3af0e8a01bf2846..f70fe204e98fc0c6d7dd30b80c2caff417715d33 100644
--- a/MantidQt/CustomInterfaces/src/Muon/ALCInterface.cpp
+++ b/MantidQt/CustomInterfaces/src/Muon/ALCInterface.cpp
@@ -31,6 +31,7 @@ namespace CustomInterfaces
 
   ALCInterface::ALCInterface(QWidget* parent)
     : UserSubWindow(parent), m_ui(),
+      m_baselineModellingView(NULL), m_peakFittingView(NULL),
       m_dataLoading(NULL), m_baselineModelling(NULL), m_peakFitting(NULL),
       m_baselineModellingModel(new ALCBaselineModellingModel()),
       m_peakFittingModel(new ALCPeakFittingModel())
diff --git a/MantidQt/CustomInterfaces/src/QtReflMainView.cpp b/MantidQt/CustomInterfaces/src/QtReflMainView.cpp
index a2c94562df9b0f759051ea6d4a835b49f4ab67b0..6f599771e4f4ffc5b63452900b01485518c834b5 100644
--- a/MantidQt/CustomInterfaces/src/QtReflMainView.cpp
+++ b/MantidQt/CustomInterfaces/src/QtReflMainView.cpp
@@ -434,6 +434,17 @@ namespace MantidQt
       runPythonCode(QString::fromStdString(pythonSrc.str()));
     }
 
+    /**
+    Show the user file dialog to choose save location of notebook
+    */
+    std::string QtReflMainView::requestNotebookPath()
+    {
+      QString qfilename = QFileDialog::getSaveFileName(0, "Save notebook file", QDir::currentPath(),
+                                                       "IPython Notebook files (*.ipynb);;All files (*.*)",
+                                                       new QString("IPython Notebook files (*.ipynb)"));
+      return qfilename.toStdString();
+    }
+
     /**
     Plot a workspace
     */
diff --git a/MantidQt/CustomInterfaces/src/ReflMainViewPresenter.cpp b/MantidQt/CustomInterfaces/src/ReflMainViewPresenter.cpp
index 8b813d6392f361ddceaef1748a5cf1a5cec4e2eb..2aedd280cf80054880642b336291837ffc642aa8 100644
--- a/MantidQt/CustomInterfaces/src/ReflMainViewPresenter.cpp
+++ b/MantidQt/CustomInterfaces/src/ReflMainViewPresenter.cpp
@@ -295,16 +295,15 @@ namespace MantidQt
     */
     void ReflMainViewPresenter::saveNotebook(std::map<int,std::set<int>> groups, std::set<int> rows)
     {
-      std::unique_ptr<ReflGenerateNotebook> notebook(new ReflGenerateNotebook(
-        m_wsName, m_model, m_view->getProcessInstrument(), COL_RUNS, COL_TRANSMISSION, COL_OPTIONS, COL_ANGLE,
-        COL_QMIN, COL_QMAX, COL_DQQ, COL_SCALE, COL_GROUP));
-      QString qfilename = QFileDialog::getSaveFileName(0, "Save notebook file", QDir::currentPath(),
-                                                       "IPython Notebook files (*.ipynb);;All files (*.*)",
-                                                       new QString("IPython Notebook files (*.ipynb)"));
-      std::string filename = qfilename.toStdString();
+
+      std::string filename = m_view->requestNotebookPath();
       if (filename == "") {
         return;
       }
+
+      std::unique_ptr<ReflGenerateNotebook> notebook(new ReflGenerateNotebook(
+        m_wsName, m_model, m_view->getProcessInstrument(), COL_RUNS, COL_TRANSMISSION, COL_OPTIONS, COL_ANGLE,
+        COL_QMIN, COL_QMAX, COL_DQQ, COL_SCALE, COL_GROUP));
       std::string generatedNotebook = notebook->generateNotebook(groups, rows);
 
       std::ofstream file(filename.c_str(), std::ofstream::trunc);
diff --git a/MantidQt/CustomInterfaces/src/Tomography/ImageROIPresenter.cpp b/MantidQt/CustomInterfaces/src/Tomography/ImageROIPresenter.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..5f411515c231575349bb8e05fc40899892918a63
--- /dev/null
+++ b/MantidQt/CustomInterfaces/src/Tomography/ImageROIPresenter.cpp
@@ -0,0 +1,305 @@
+#include "MantidAPI/AlgorithmManager.h"
+#include "MantidAPI/AnalysisDataService.h"
+#include "MantidAPI/MatrixWorkspace.h"
+#include "MantidAPI/WorkspaceGroup.h"
+#include "MantidQtCustomInterfaces/Tomography/ImageStackPreParams.h"
+#include "MantidQtCustomInterfaces/Tomography/ImageROIPresenter.h"
+#include "MantidQtCustomInterfaces/Tomography/IImageROIView.h"
+
+using namespace MantidQt::CustomInterfaces;
+
+namespace MantidQt {
+namespace CustomInterfaces {
+
+ImageROIPresenter::ImageROIPresenter(IImageROIView *view)
+    : m_view(view), m_model(new ImageStackPreParams()) {
+  if (!m_view) {
+    throw std::runtime_error("Severe inconsistency found. Presenter created "
+                             "with an empty/null view (tomography interface). "
+                             "Cannot continue.");
+  }
+}
+
+ImageROIPresenter::~ImageROIPresenter() { cleanup(); }
+
+void ImageROIPresenter::cleanup() {}
+
+void ImageROIPresenter::notify(Notification notif) {
+
+  switch (notif) {
+
+  case IImageROIPresenter::Init:
+    processInit();
+    break;
+
+  case IImageROIPresenter::BrowseImgOrStack:
+    processBrowseImg();
+    break;
+
+  case IImageROIPresenter::NewImgOrStack:
+    processNewStack();
+    break;
+
+  case IImageROIPresenter::UpdateImgIndex:
+    processUpdateImgIndex();
+    break;
+
+  case IImageROIPresenter::SelectCoR:
+    processSelectCoR();
+    break;
+
+  case IImageROIPresenter::SelectROI:
+    processSelectROI();
+    break;
+
+  case IImageROIPresenter::SelectNormalization:
+    processSelectNormalization();
+    break;
+
+  case IImageROIPresenter::FinishedCoR:
+    processFinishedCoR();
+    break;
+
+  case IImageROIPresenter::FinishedROI:
+    processFinishedROI();
+    break;
+
+  case IImageROIPresenter::FinishedNormalization:
+    processFinishedNormalization();
+    break;
+
+  case IImageROIPresenter::ResetCoR:
+    processResetCoR();
+    break;
+
+  case IImageROIPresenter::ResetROI:
+    processResetROI();
+    break;
+
+  case IImageROIPresenter::ResetNormalization:
+    processResetNormalization();
+    break;
+
+  case IImageROIPresenter::ShutDown:
+    processShutDown();
+    break;
+  }
+}
+
+void ImageROIPresenter::processInit() {
+  ImageStackPreParams p;
+  m_view->setParams(p);
+}
+
+void ImageROIPresenter::processBrowseImg() {
+  const std::string path = m_view->askImgOrStackPath();
+
+  if (path.empty())
+    return;
+
+  m_stackPath = path;
+  processNewStack();
+}
+
+/**
+ * Validates the input stack of images (directories and files), and
+ * shows warning/error messages as needed. The outocome of the
+ * validation can be checkec via isValid() on the returned stack of
+ * images object.
+ *
+ * @param path user provided path to the stack of images
+ *
+ * @return a stack of images built from the path passed, not
+ * necessarily correct (check with isValid())
+ */
+StackOfImagesDirs ImageROIPresenter::checkInputStack(const std::string &path) {
+  StackOfImagesDirs soid(path);
+
+  const std::string soiPath = soid.sampleImagesDir();
+  if (soiPath.empty()) {
+    m_view->userWarning("Error trying to find a stack of images",
+                        "Could not find the sample images directory. The stack "
+                        "of images is expected as: \n\n" +
+                            soid.description());
+  } else if (!soid.isValid()) {
+    m_view->userWarning("Error while checking/validating the stack of images",
+                        "The stack of images could not be loaded correctly. " +
+                            soid.status());
+  }
+
+  return soid;
+}
+
+void ImageROIPresenter::processNewStack() {
+
+  StackOfImagesDirs soid("");
+  try {
+    soid = checkInputStack(m_stackPath);
+  } catch (std::exception &e) {
+    // Poco::FileNotFoundException: this should never happen, unless
+    // the open dir dialog misbehaves unexpectedly, or in tests
+    m_view->userWarning("Error trying to open directories/files",
+                        "The path selected via the dialog cannot be openend or "
+                        "there was a problem while trying to access it. This "
+                        "is an unexpected inconsistency. Error details: " +
+                            std::string(e.what()));
+  }
+
+  if (!soid.isValid())
+    return;
+
+  std::vector<std::string> imgs = soid.sampleFiles();
+  if (0 >= imgs.size()) {
+    m_view->userWarning(
+        "Error trying to find image/projection files in the stack directories",
+        "Could not find any image file in the samples subdirectory: " +
+            soid.sampleImagesDir());
+    return;
+  }
+
+  Mantid::API::WorkspaceGroup_sptr wsg = loadFITSStack(imgs);
+  if (!wsg)
+    return;
+
+  size_t imgCount = wsg->size();
+  if (0 == imgCount) {
+    m_view->userWarning(
+        "Failed to load any FITS images - directory structure issue",
+        "Even though a directory apparently holding a stack of images was "
+        "found, "
+        "it was not possible to load any image file correctly from: " +
+            m_stackPath);
+    return;
+  }
+
+  m_view->showStack(wsg);
+
+  // clean-up container group workspace? Not for now
+  if (false && wsg)
+    Mantid::API::AnalysisDataService::Instance().remove(wsg->getName());
+}
+
+void ImageROIPresenter::processUpdateImgIndex() {
+  m_view->updateImgWithIndex(m_view->currentImgIndex());
+}
+
+void ImageROIPresenter::processSelectCoR() {
+  m_view->changeSelectionState(IImageROIView::SelectCoR);
+}
+
+void ImageROIPresenter::processSelectROI() {
+  m_view->changeSelectionState(IImageROIView::SelectROIFirst);
+}
+
+void ImageROIPresenter::processSelectNormalization() {
+  m_view->changeSelectionState(IImageROIView::SelectNormAreaFirst);
+}
+
+void ImageROIPresenter::processFinishedCoR() {
+  m_view->changeSelectionState(IImageROIView::SelectNone);
+}
+
+void ImageROIPresenter::processFinishedROI() {
+  m_view->changeSelectionState(IImageROIView::SelectNone);
+}
+
+void ImageROIPresenter::processFinishedNormalization() {
+  m_view->changeSelectionState(IImageROIView::SelectNone);
+}
+
+void ImageROIPresenter::processResetCoR() {
+  m_view->resetCoR();
+  m_view->changeSelectionState(IImageROIView::SelectNone);
+}
+
+void ImageROIPresenter::processResetROI() {
+  m_view->resetROI();
+  m_view->changeSelectionState(IImageROIView::SelectNone);
+}
+
+void ImageROIPresenter::processResetNormalization() {
+  m_view->resetNormArea();
+  m_view->changeSelectionState(IImageROIView::SelectNone);
+}
+
+void ImageROIPresenter::processShutDown() { m_view->saveSettings(); }
+
+Mantid::API::WorkspaceGroup_sptr
+ImageROIPresenter::loadFITSStack(const std::vector<std::string> &imgs) {
+  const std::string wsName = "__stack_fits_viewer_tomography_gui";
+  auto &ads = Mantid::API::AnalysisDataService::Instance();
+  if (ads.doesExist(wsName)) {
+    ads.remove(wsName);
+  }
+  for (size_t i = 0; i < imgs.size(); ++i) {
+    loadFITSImage(imgs[i], wsName);
+  }
+
+  Mantid::API::WorkspaceGroup_sptr wsg;
+  try {
+    wsg = ads.retrieveWS<Mantid::API::WorkspaceGroup>(wsName);
+  } catch (std::exception &e) {
+    throw std::runtime_error(
+        "Could not produce a workspace group for the stack images. Cannot "
+        "display it. Error details: " +
+        std::string(e.what()));
+  }
+
+  if (wsg &&
+      Mantid::API::AnalysisDataService::Instance().doesExist(wsg->name()) &&
+      imgs.size() == wsg->size()) {
+    return wsg;
+  } else {
+    return Mantid::API::WorkspaceGroup_sptr();
+  }
+}
+
+void ImageROIPresenter::loadFITSImage(const std::string &path,
+                                      const std::string &wsName) {
+  // get fits file into workspace and retrieve it from the ADS
+  auto alg = Mantid::API::AlgorithmManager::Instance().create("LoadFITS");
+  try {
+    alg->initialize();
+    alg->setPropertyValue("Filename", path);
+    alg->setProperty("OutputWorkspace", wsName);
+    // this is way faster when loading into a MatrixWorkspace
+    alg->setProperty("LoadAsRectImg", true);
+  } catch (std::exception &e) {
+    throw std::runtime_error("Failed to initialize the mantid algorithm to "
+                             "load images. Error description: " +
+                             std::string(e.what()));
+  }
+
+  try {
+    alg->execute();
+  } catch (std::exception &e) {
+    throw std::runtime_error(
+        "Failed to load image. Could not load this file as a "
+        "FITS image: " +
+        std::string(e.what()));
+  }
+
+  if (!alg->isExecuted()) {
+    throw std::runtime_error(
+        "Failed to load image correctly. Note that even though "
+        "the image file has been loaded it seems to contain errors.");
+  }
+
+  try {
+    Mantid::API::WorkspaceGroup_sptr wsg;
+    Mantid::API::MatrixWorkspace_sptr ws;
+    const auto &ads = Mantid::API::AnalysisDataService::Instance();
+    wsg = ads.retrieveWS<Mantid::API::WorkspaceGroup>(wsName);
+    ws = ads.retrieveWS<Mantid::API::MatrixWorkspace>(wsg->getNames()[0]);
+  } catch (std::exception &e) {
+    throw std::runtime_error(
+        "Could not load image contents for file '" + path +
+        "'. An unrecoverable error "
+        "happened when trying to load the image contents. Cannot "
+        "display it. Error details: " +
+        std::string(e.what()));
+  }
+}
+
+} // namespace CustomInterfaces
+} // namespace MantidQt
diff --git a/MantidQt/CustomInterfaces/src/Tomography/ImageROIViewQtWidget.cpp b/MantidQt/CustomInterfaces/src/Tomography/ImageROIViewQtWidget.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..51d23189b5cc869314dadd5affa48158f7b373b0
--- /dev/null
+++ b/MantidQt/CustomInterfaces/src/Tomography/ImageROIViewQtWidget.cpp
@@ -0,0 +1,830 @@
+#include "MantidAPI/MatrixWorkspace.h"
+#include "MantidAPI/WorkspaceGroup.h"
+#include "MantidQtAPI/AlgorithmInputHistory.h"
+#include "MantidQtAPI/AlgorithmRunner.h"
+
+#include "MantidQtCustomInterfaces/Tomography/ImageROIViewQtWidget.h"
+#include "MantidQtCustomInterfaces/Tomography/ImageROIPresenter.h"
+
+using namespace Mantid::API;
+using namespace MantidQt::CustomInterfaces;
+
+#include <QCloseEvent>
+#include <QFileDialog>
+#include <QMessageBox>
+#include <QPainter>
+#include <QSettings>
+
+namespace MantidQt {
+namespace CustomInterfaces {
+
+// this would be more like a CustomWidget if it's eventually moved there
+const std::string ImageROIViewQtWidget::m_settingsGroup =
+    "CustomInterfaces/ImageROIView";
+
+ImageROIViewQtWidget::ImageROIViewQtWidget(QWidget *parent)
+    : QWidget(parent), IImageROIView(), m_imgWidth(0), m_imgHeight(0),
+      m_selectionState(SelectNone), m_presenter(NULL) {
+  initLayout();
+
+  // using an event filter. might be worth refactoring into a specific
+  // QLabel + selection of ROI+NormArea+CoR class
+  // not using Qwt Pickers to avoid Qwt version issues..
+  m_ui.label_img->installEventFilter(this);
+}
+
+void ImageROIViewQtWidget::setParams(ImageStackPreParams &params) {
+  m_params = params;
+  setParamWidgets(m_params);
+}
+
+ImageStackPreParams ImageROIViewQtWidget::userSelection() const {
+  return m_params;
+}
+
+void ImageROIViewQtWidget::changeSelectionState(
+    const IImageROIView::SelectionState &state) {
+  m_selectionState = state;
+}
+
+void ImageROIViewQtWidget::showStack(const std::string & /*path*/) {
+  // TODO:
+  // a) load as proper stack of images workspace - this can only be done when
+  //    we have a firt working version of the "lean MD workspace". This method
+  //    would then load into one workspace of such type.
+  // b) load as workspace group - this is done in the overloaded method below
+
+  // enableParamWidgets(true);
+}
+
+void ImageROIViewQtWidget::showStack(Mantid::API::WorkspaceGroup_sptr &wsg) {
+  if (0 == wsg->size())
+    return;
+
+  m_stack = wsg;
+
+  m_ui.horizontalScrollBar_img_stack->setEnabled(true);
+  m_ui.horizontalScrollBar_img_stack->setMinimum(0);
+  m_ui.horizontalScrollBar_img_stack->setMaximum(
+      static_cast<int>(m_stack->size() - 1));
+
+  size_t width = 0, height = 0;
+  try {
+    MatrixWorkspace_sptr ws =
+        boost::dynamic_pointer_cast<MatrixWorkspace>(wsg->getItem(0));
+    if (!ws)
+      return;
+    width = ws->blocksize();
+    height = ws->getNumberHistograms();
+  } catch (std::exception &e) {
+    QMessageBox::warning(this, "Cannot load image information",
+                         "There was a problem while "
+                         " trying to find the size of the image: " +
+                             QString::fromStdString(e.what()));
+  }
+
+  showProjection(m_stack, 0);
+  initParamWidgets(width, height);
+  refreshROIetAl();
+  enableParamWidgets(true);
+}
+
+void ImageROIViewQtWidget::showProjection(
+    const Mantid::API::WorkspaceGroup_sptr &wsg, size_t idx) {
+
+  showProjectionImage(wsg, idx);
+  refreshROIetAl();
+
+  // give name, set up scroll/slider
+  std::string name;
+  try {
+    MatrixWorkspace_sptr ws =
+        boost::dynamic_pointer_cast<MatrixWorkspace>(wsg->getItem(idx));
+    if (!ws)
+      return;
+    name = ws->run().getLogData("run_title")->value();
+  } catch (std::exception &e) {
+    QMessageBox::warning(this, "Cannot load image information",
+                         "There was a problem while "
+                         " trying to find the name of the image: " +
+                             QString::fromStdString(e.what()));
+  }
+  m_ui.label_img_name->setText(QString::fromStdString(name));
+
+  const size_t numPics = wsg->size();
+  m_ui.lineEdit_img_seq->setText(
+      QString::fromStdString("1/" + boost::lexical_cast<std::string>(numPics)));
+  m_ui.horizontalScrollBar_img_stack->setValue(static_cast<int>(idx));
+}
+
+void ImageROIViewQtWidget::userWarning(const std::string &err,
+                                       const std::string &description) {
+  QMessageBox::warning(this, QString::fromStdString(err),
+                       QString::fromStdString(description), QMessageBox::Ok,
+                       QMessageBox::Ok);
+}
+
+void ImageROIViewQtWidget::userError(const std::string &err,
+                                     const std::string &description) {
+  QMessageBox::critical(this, QString::fromStdString(err),
+                        QString::fromStdString(description), QMessageBox::Ok,
+                        QMessageBox::Ok);
+}
+
+std::string ImageROIViewQtWidget::askImgOrStackPath() {
+  // get path
+  QString fitsStr = QString("Supported formats: FITS, TIFF and PNG "
+                            "(*.fits *.fit *.tiff *.tif *.png);;"
+                            "FITS, Flexible Image Transport System images "
+                            "(*.fits *.fit);;"
+                            "TIFF, Tagged Image File Format "
+                            "(*.tif *.tiff);;"
+                            "PNG, Portable Network Graphics "
+                            "(*.png);;"
+                            "Other extensions/all files (*.*)");
+  QString prevPath =
+      MantidQt::API::AlgorithmInputHistory::Instance().getPreviousDirectory();
+  QString path(QFileDialog::getExistingDirectory(
+      this, tr("Open stack of images"), prevPath, QFileDialog::ShowDirsOnly));
+  if (!path.isEmpty()) {
+    MantidQt::API::AlgorithmInputHistory::Instance().setPreviousDirectory(path);
+  }
+
+  return path.toStdString();
+}
+
+void ImageROIViewQtWidget::saveSettings() const {
+  QSettings qs;
+  qs.beginGroup(QString::fromStdString(m_settingsGroup));
+
+  qs.setValue("interface-win-geometry", saveGeometry());
+  qs.endGroup();
+}
+
+void ImageROIViewQtWidget::resetCoR() {
+  int midx =
+      (m_ui.spinBox_cor_x->minimum() + m_ui.spinBox_cor_x->maximum()) / 2;
+  m_ui.spinBox_cor_x->setValue(midx);
+  int midy =
+      (m_ui.spinBox_cor_y->minimum() + m_ui.spinBox_cor_y->maximum()) / 2;
+  m_ui.spinBox_cor_y->setValue(midy);
+}
+
+void ImageROIViewQtWidget::resetROI() {
+  m_ui.spinBox_roi_top_x->setValue(0);
+  m_ui.spinBox_roi_top_y->setValue(0);
+  m_ui.spinBox_roi_bottom_x->setValue(m_ui.spinBox_roi_bottom_x->maximum());
+  m_ui.spinBox_roi_bottom_y->setValue(m_ui.spinBox_roi_bottom_y->maximum());
+}
+
+void ImageROIViewQtWidget::resetNormArea() {
+  m_ui.spinBox_norm_top_x->setValue(0);
+  m_ui.spinBox_norm_top_y->setValue(0);
+  m_ui.spinBox_norm_bottom_x->setValue(0);
+  m_ui.spinBox_norm_bottom_y->setValue(0);
+}
+
+void ImageROIViewQtWidget::initLayout() {
+  // setup container ui
+  m_ui.setupUi(this);
+
+  QList<int> sizes;
+  sizes.push_back(1000);
+  sizes.push_back(100);
+  m_ui.splitter_main_horiz->setSizes(sizes);
+
+  sizes.clear();
+  sizes.push_back(10);
+  sizes.push_back(1000);
+  m_ui.splitter_img_vertical->setSizes(sizes);
+  m_ui.horizontalScrollBar_img_stack->setEnabled(false);
+  m_ui.lineEdit_img_seq->setText("---");
+
+  enableParamWidgets(false);
+
+  setupConnections();
+
+  initParamWidgets(1, 1);
+  grabCoRFromWidgets();
+  grabROIFromWidgets();
+  grabNormAreaFromWidgets();
+
+  // presenter that knows how to handle a IImageROIView should take care
+  // of all the logic. Note the view needs to now the concrete presenter here
+  m_presenter.reset(new ImageROIPresenter(this));
+
+  // it will know what compute resources and tools we have available:
+  // This view doesn't even know the names of compute resources, etc.
+  m_presenter->notify(ImageROIPresenter::Init);
+}
+
+void ImageROIViewQtWidget::setupConnections() {
+
+  // 'browse' buttons
+  connect(m_ui.pushButton_browse_img, SIGNAL(released()), this,
+          SLOT(browseImgClicked()));
+
+  connect(m_ui.pushButton_cor, SIGNAL(released()), this, SLOT(corClicked()));
+  connect(m_ui.pushButton_cor_reset, SIGNAL(released()), this,
+          SLOT(corResetClicked()));
+
+  connect(m_ui.pushButton_roi, SIGNAL(released()), this, SLOT(roiClicked()));
+  connect(m_ui.pushButton_roi_reset, SIGNAL(released()), this,
+          SLOT(roiResetClicked()));
+
+  connect(m_ui.pushButton_norm_area, SIGNAL(released()), this,
+          SLOT(normAreaClicked()));
+  connect(m_ui.pushButton_norm_area_reset, SIGNAL(released()), this,
+          SLOT(normAreaResetClicked()));
+
+  // image sequence scroll/slide:
+  connect(m_ui.horizontalScrollBar_img_stack, SIGNAL(valueChanged(int)), this,
+          SLOT(updateFromImagesSlider(int)));
+
+  // parameter (points) widgets
+  connect(m_ui.spinBox_cor_x, SIGNAL(valueChanged(int)), this,
+          SLOT(valueUpdatedCoR(int)));
+  connect(m_ui.spinBox_cor_y, SIGNAL(valueChanged(int)), this,
+          SLOT(valueUpdatedCoR(int)));
+
+  connect(m_ui.spinBox_roi_top_x, SIGNAL(valueChanged(int)), this,
+          SLOT(valueUpdatedROI(int)));
+  connect(m_ui.spinBox_roi_top_y, SIGNAL(valueChanged(int)), this,
+          SLOT(valueUpdatedROI(int)));
+  connect(m_ui.spinBox_roi_bottom_x, SIGNAL(valueChanged(int)), this,
+          SLOT(valueUpdatedROI(int)));
+  connect(m_ui.spinBox_roi_bottom_y, SIGNAL(valueChanged(int)), this,
+          SLOT(valueUpdatedROI(int)));
+
+  connect(m_ui.spinBox_norm_top_x, SIGNAL(valueChanged(int)), this,
+          SLOT(valueUpdatedNormArea(int)));
+  connect(m_ui.spinBox_norm_top_y, SIGNAL(valueChanged(int)), this,
+          SLOT(valueUpdatedNormArea(int)));
+  connect(m_ui.spinBox_norm_bottom_x, SIGNAL(valueChanged(int)), this,
+          SLOT(valueUpdatedNormArea(int)));
+  connect(m_ui.spinBox_norm_bottom_y, SIGNAL(valueChanged(int)), this,
+          SLOT(valueUpdatedNormArea(int)));
+}
+
+void ImageROIViewQtWidget::valueUpdatedCoR(int) {
+  grabCoRFromWidgets();
+  refreshROIetAl();
+}
+
+void ImageROIViewQtWidget::valueUpdatedROI(int) {
+  grabROIFromWidgets();
+  refreshROIetAl();
+}
+
+void ImageROIViewQtWidget::valueUpdatedNormArea(int) {
+  grabNormAreaFromWidgets();
+  refreshROIetAl();
+}
+
+/**
+ * Parameter values from spin box widgets => coordinate parameters
+ * data member
+ */
+void ImageROIViewQtWidget::grabCoRFromWidgets() {
+  m_params.cor = Mantid::Kernel::V2D(m_ui.spinBox_cor_x->value(),
+                                     m_ui.spinBox_cor_y->value());
+}
+
+void ImageROIViewQtWidget::grabROIFromWidgets() {
+  m_params.roi =
+      std::make_pair(Mantid::Kernel::V2D(m_ui.spinBox_roi_top_x->value(),
+                                         m_ui.spinBox_roi_top_y->value()),
+                     Mantid::Kernel::V2D(m_ui.spinBox_roi_bottom_x->value(),
+                                         m_ui.spinBox_roi_bottom_y->value()));
+}
+
+void ImageROIViewQtWidget::grabNormAreaFromWidgets() {
+  m_params.normalizationRegion =
+      std::make_pair(Mantid::Kernel::V2D(m_ui.spinBox_norm_top_x->value(),
+                                         m_ui.spinBox_norm_top_y->value()),
+                     Mantid::Kernel::V2D(m_ui.spinBox_norm_bottom_x->value(),
+                                         m_ui.spinBox_norm_bottom_y->value()));
+}
+
+/**
+ * Updates the image view with the current image index and selection
+ * of parameters (ROI, normalization area, CoR). This needs to be used
+ * for every event that modifies the current image and/or selection of
+ * parameters.
+ */
+void ImageROIViewQtWidget::refreshROIetAl() {
+
+  const QPixmap *pp = m_ui.label_img->pixmap();
+  if (!pp)
+    return;
+
+  QPixmap toDisplay(*m_basePixmap.get());
+  QPainter painter(&toDisplay);
+
+  // TODO: display settings / nicer symbol?
+
+  QPen penCoR(Qt::red);
+  painter.setPen(penCoR);
+  painter.drawLine(static_cast<int>(m_params.cor.X() - 5),
+                   static_cast<int>(m_params.cor.Y()),
+                   static_cast<int>(m_params.cor.X() + 5),
+                   static_cast<int>(m_params.cor.Y()));
+  painter.drawLine(static_cast<int>(m_params.cor.X()),
+                   static_cast<int>(m_params.cor.Y() - 5),
+                   static_cast<int>(m_params.cor.X()),
+                   static_cast<int>(m_params.cor.Y() + 5));
+
+  QPen penROI(Qt::green);
+  painter.setPen(penROI);
+  painter.drawRect(
+      static_cast<int>(m_params.roi.first.X()),
+      static_cast<int>(m_params.roi.first.Y()),
+      static_cast<int>(m_params.roi.second.X() - m_params.roi.first.X()),
+      static_cast<int>(m_params.roi.second.Y() - m_params.roi.first.Y()));
+
+  QPen penNA(Qt::yellow);
+  painter.setPen(penNA);
+  painter.drawRect(static_cast<int>(m_params.normalizationRegion.first.X()),
+                   static_cast<int>(m_params.normalizationRegion.first.Y()),
+                   static_cast<int>(m_params.normalizationRegion.second.X() -
+                                    m_params.normalizationRegion.first.X()),
+                   static_cast<int>(m_params.normalizationRegion.second.Y() -
+                                    m_params.normalizationRegion.first.Y()));
+
+  m_ui.label_img->setPixmap(toDisplay);
+}
+
+void ImageROIViewQtWidget::refreshCoR() {
+  const QPixmap *pp = m_ui.label_img->pixmap();
+  if (!pp)
+    return;
+
+  grabCoRFromWidgets();
+
+  QPixmap toDisplay(*m_basePixmap.get());
+  QPainter painter(&toDisplay);
+  QPen pen(Qt::red);
+  painter.setPen(pen);
+  painter.drawLine(static_cast<int>(m_params.cor.X() - 5),
+                   static_cast<int>(m_params.cor.Y()),
+                   static_cast<int>(m_params.cor.X() + 5),
+                   static_cast<int>(m_params.cor.Y()));
+  painter.drawLine(static_cast<int>(m_params.cor.X()),
+                   static_cast<int>(m_params.cor.Y() - 5),
+                   static_cast<int>(m_params.cor.X()),
+                   static_cast<int>(m_params.cor.Y() + 5));
+  m_ui.label_img->setPixmap(toDisplay);
+}
+
+void ImageROIViewQtWidget::refreshROI() {
+  const QPixmap *pp = m_ui.label_img->pixmap();
+  if (!pp)
+    return;
+
+  grabROIFromWidgets();
+  // TODO: display proper symbol
+
+  // QPixmap const *pm = m_ui.label_img->pixmap();
+  QPixmap toDisplay(*m_basePixmap.get());
+  QPainter painter(&toDisplay);
+  QPen pen(Qt::green);
+  painter.setPen(pen);
+  painter.drawRect(
+      static_cast<int>(m_params.roi.first.X()),
+      static_cast<int>(m_params.roi.first.Y()),
+      static_cast<int>(m_params.roi.second.X() - m_params.roi.first.X()),
+      static_cast<int>(m_params.roi.second.Y() - m_params.roi.first.Y()));
+  m_ui.label_img->setPixmap(toDisplay);
+}
+
+void ImageROIViewQtWidget::refreshNormArea() {
+  // TODO: display proper symbol
+  const QPixmap *pp = m_ui.label_img->pixmap();
+  if (!pp)
+    return;
+
+  grabNormAreaFromWidgets();
+
+  // QPixmap const *pm = m_ui.label_img->pixmap();
+  QPixmap toDisplay(*m_basePixmap.get());
+  QPainter painter(&toDisplay);
+  QPen pen(Qt::yellow);
+  painter.setPen(pen);
+  painter.drawRect(static_cast<int>(m_params.normalizationRegion.first.X()),
+                   static_cast<int>(m_params.normalizationRegion.first.Y()),
+                   static_cast<int>(m_params.normalizationRegion.second.X() -
+                                    m_params.normalizationRegion.first.X()),
+                   static_cast<int>(m_params.normalizationRegion.second.Y() -
+                                    m_params.normalizationRegion.first.Y()));
+  m_ui.label_img->setPixmap(toDisplay);
+}
+
+void ImageROIViewQtWidget::enableParamWidgets(bool enable) {
+  m_ui.groupBox_cor->setEnabled(enable);
+  m_ui.groupBox_roi->setEnabled(enable);
+  m_ui.groupBox_norm->setEnabled(enable);
+}
+
+void ImageROIViewQtWidget::initParamWidgets(size_t maxWidth, size_t maxHeight) {
+  m_imgWidth = static_cast<int>(maxWidth);
+  m_imgHeight = static_cast<int>(maxHeight);
+
+  m_ui.spinBox_cor_x->setMinimum(0);
+  m_ui.spinBox_cor_x->setMaximum(m_imgWidth - 1);
+  m_ui.spinBox_cor_y->setMinimum(0);
+  m_ui.spinBox_cor_y->setMaximum(m_imgHeight - 1);
+  resetCoR();
+
+  m_ui.spinBox_roi_top_x->setMinimum(0);
+  m_ui.spinBox_roi_top_x->setMaximum(m_imgWidth - 1);
+  m_ui.spinBox_roi_top_y->setMinimum(0);
+  m_ui.spinBox_roi_top_y->setMaximum(m_imgHeight - 1);
+
+  m_ui.spinBox_roi_bottom_x->setMinimum(0);
+  m_ui.spinBox_roi_bottom_x->setMaximum(m_imgWidth - 1);
+  m_ui.spinBox_roi_bottom_y->setMinimum(0);
+  m_ui.spinBox_roi_bottom_y->setMaximum(m_imgHeight - 1);
+
+  resetROI();
+
+  m_ui.spinBox_norm_top_x->setMinimum(0);
+  m_ui.spinBox_norm_top_x->setMaximum(m_imgWidth - 1);
+  m_ui.spinBox_norm_top_y->setMinimum(0);
+  m_ui.spinBox_norm_top_y->setMaximum(m_imgHeight - 1);
+
+  m_ui.spinBox_norm_bottom_x->setMinimum(0);
+  m_ui.spinBox_norm_bottom_x->setMaximum(m_imgWidth - 1);
+  m_ui.spinBox_norm_bottom_y->setMinimum(0);
+  m_ui.spinBox_norm_bottom_y->setMaximum(m_imgHeight - 1);
+
+  resetNormArea();
+}
+
+void ImageROIViewQtWidget::setParamWidgets(ImageStackPreParams &params) {
+  m_ui.spinBox_cor_x->setValue(static_cast<int>(params.cor.X()));
+  m_ui.spinBox_cor_y->setValue(static_cast<int>(params.cor.Y()));
+
+  m_ui.spinBox_roi_top_x->setValue(static_cast<int>(params.roi.first.X()));
+  m_ui.spinBox_roi_top_y->setValue(static_cast<int>(params.roi.first.Y()));
+
+  m_ui.spinBox_roi_bottom_x->setValue(static_cast<int>(params.roi.second.X()));
+  m_ui.spinBox_roi_bottom_y->setValue(static_cast<int>(params.roi.second.Y()));
+
+  m_ui.spinBox_norm_top_x->setValue(
+      static_cast<int>(params.normalizationRegion.first.X()));
+  m_ui.spinBox_norm_top_y->setValue(
+      static_cast<int>(params.normalizationRegion.first.Y()));
+
+  m_ui.spinBox_norm_bottom_x->setValue(
+      static_cast<int>(params.normalizationRegion.second.X()));
+  m_ui.spinBox_norm_bottom_y->setValue(
+      static_cast<int>(params.normalizationRegion.second.Y()));
+}
+
+void ImageROIViewQtWidget::corClicked() {
+  m_presenter->notify(IImageROIPresenter::SelectCoR);
+}
+
+void ImageROIViewQtWidget::corResetClicked() {
+  m_presenter->notify(IImageROIPresenter::ResetCoR);
+  refreshROIetAl();
+}
+
+void ImageROIViewQtWidget::roiClicked() {
+  m_presenter->notify(IImageROIPresenter::SelectROI);
+}
+
+void ImageROIViewQtWidget::roiResetClicked() {
+  m_presenter->notify(IImageROIPresenter::ResetROI);
+  refreshROIetAl();
+}
+
+void ImageROIViewQtWidget::normAreaClicked() {
+  m_presenter->notify(IImageROIPresenter::SelectNormalization);
+}
+
+void ImageROIViewQtWidget::normAreaResetClicked() {
+  m_presenter->notify(IImageROIPresenter::ResetNormalization);
+  refreshROIetAl();
+}
+
+void ImageROIViewQtWidget::browseImgClicked() {
+  m_presenter->notify(IImageROIPresenter::BrowseImgOrStack);
+}
+
+void ImageROIViewQtWidget::updateFromImagesSlider(int /* current */) {
+  m_presenter->notify(IImageROIPresenter::UpdateImgIndex);
+}
+
+size_t ImageROIViewQtWidget::currentImgIndex() const {
+  return m_ui.horizontalScrollBar_img_stack->value();
+}
+
+void ImageROIViewQtWidget::updateImgWithIndex(size_t idx) {
+  int max = m_ui.horizontalScrollBar_img_stack->maximum();
+  int current = m_ui.horizontalScrollBar_img_stack->value();
+
+  showProjection(m_stack, idx);
+  m_ui.lineEdit_img_seq->setText(
+      QString::fromStdString(boost::lexical_cast<std::string>(current + 1) +
+                             "/" + boost::lexical_cast<std::string>(max + 1)));
+}
+
+void ImageROIViewQtWidget::showProjectionImage(
+    const Mantid::API::WorkspaceGroup_sptr &wsg, size_t idx) {
+
+  MatrixWorkspace_sptr ws;
+  try {
+    ws = boost::dynamic_pointer_cast<MatrixWorkspace>(wsg->getItem(idx));
+    if (!ws)
+      return;
+  } catch (std::exception &e) {
+    QMessageBox::warning(
+        this, "Cannot load image",
+        "There was a problem while trying to find the image data: " +
+            QString::fromStdString(e.what()));
+  }
+
+  const size_t MAXDIM = 2048 * 16;
+  size_t width;
+  try {
+    width = boost::lexical_cast<size_t>(ws->run().getLogData("Axis1")->value());
+    // TODO: add a settings option for this (like max mem allocation for
+    // images)?
+    if (width >= MAXDIM)
+      width = MAXDIM;
+  } catch (std::exception &e) {
+    QMessageBox::critical(this, "Cannot load image",
+                          "There was a problem while trying to "
+                          "find the width of the image: " +
+                              QString::fromStdString(e.what()));
+    return;
+  }
+
+  size_t height;
+  try {
+    height =
+        boost::lexical_cast<size_t>(ws->run().getLogData("Axis2")->value());
+    if (height >= MAXDIM)
+      height = MAXDIM;
+  } catch (std::exception &e) {
+    QMessageBox::critical(this, "Cannot load image",
+                          "There was a problem while trying to "
+                          "find the height of the image: " +
+                              QString::fromStdString(e.what()));
+    return;
+  }
+
+  // images are loaded as 1 histogram == 1 pixel (1 bin per histogram):
+  if (height != ws->getNumberHistograms() || width != ws->blocksize()) {
+    QMessageBox::critical(
+        this, "Image dimensions do not match in the input image workspace",
+        "Could not load the expected "
+        "number of rows and columns.");
+    return;
+  }
+  // find min and max to scale pixel values
+  double min = std::numeric_limits<double>::max(),
+         max = std::numeric_limits<double>::min();
+  for (size_t i = 0; i < ws->getNumberHistograms(); ++i) {
+    for (size_t j = 0; j < ws->blocksize(); ++j) {
+      const double &v = ws->readY(i)[j];
+      if (v < min)
+        min = v;
+      if (v > max)
+        max = v;
+    }
+  }
+  if (min >= max) {
+    QMessageBox::warning(
+        this, "Empty image!",
+        "The image could be loaded but it contains "
+        "effectively no information, all pixels have the same value.");
+    // black picture
+    QPixmap pix(static_cast<int>(width), static_cast<int>(height));
+    pix.fill(QColor(0, 0, 0));
+    m_ui.label_img->setPixmap(pix);
+    m_ui.label_img->show();
+    m_basePixmap.reset(new QPixmap(pix));
+    return;
+  }
+
+  // load / transfer image into a QImage
+  QImage rawImg(QSize(static_cast<int>(width), static_cast<int>(height)),
+                QImage::Format_RGB32);
+  const double max_min = max - min;
+  const double scaleFactor = 255.0 / max_min;
+  for (size_t yi = 0; yi < width; ++yi) {
+    for (size_t xi = 0; xi < width; ++xi) {
+      const double &v = ws->readY(yi)[xi];
+      // color the range min-max in gray scale. To apply different color
+      // maps you'd need to use rawImg.setColorTable() or similar.
+      const int scaled = static_cast<int>(scaleFactor * (v - min));
+      QRgb vRgb = qRgb(scaled, scaled, scaled);
+      rawImg.setPixel(static_cast<int>(xi), static_cast<int>(yi), vRgb);
+    }
+  }
+
+  // paint and show image
+  // direct from image
+  QPixmap pix = QPixmap::fromImage(rawImg);
+  m_ui.label_img->setPixmap(pix);
+  m_ui.label_img->show();
+  m_basePixmap.reset(new QPixmap(pix));
+  // Alternative, drawing with a painter:
+  // QPixmap pix(static_cast<int>(width), static_cast<int>(height));
+  // QPainter painter;
+  // painter.begin(&pix);
+  // painter.drawImage(0, 0, rawImg);
+  // painter.end();
+  // m_ui.label_img->setPixmap(pix);
+  // m_ui.label_img->show();
+  // m_basePixmap.reset(new QPixmap(pix));
+}
+
+/**
+ * Qt events filter for the mouse click and click&drag events that are
+ * used to select points and rectangles. Part of the logic of the
+ * selection is handled here. The test on the presenter can only test
+ * the begin and end of the selection. For full testability (including
+ * the mouse interaction), this method should be implemented fully in
+ * terms of notifications to the presenter. This would require a bunch
+ * of new notifications in IImageROIPresenter, and making at least all
+ * the mouseUpdateCoR, mouseUpdateROICorners12, mouseXXX methods
+ * public in this view interface. This can be considered at a later
+ * stage.
+ *
+ * @param obj object concerned by the event
+ * @param event event received (mouse click, release, move, etc.)
+ **/
+bool ImageROIViewQtWidget::eventFilter(QObject *obj, QEvent *event) {
+  // quick ignore
+  if (IImageROIView::SelectNone == m_selectionState)
+    return false;
+
+  if (m_ui.label_img == obj) {
+
+    QPoint p = m_ui.label_img->mapFromGlobal(QCursor::pos());
+    int x = p.x();
+    int y = p.y();
+    // ignore potential clicks outside of the image
+    if (x >= m_imgWidth || y >= m_imgHeight || x < 0 || y < 0)
+      return false;
+
+    auto type = event->type();
+    if (type == QEvent::MouseButtonPress) {
+
+      if (IImageROIView::SelectCoR == m_selectionState) {
+        mouseUpdateCoR(x, y);
+      } else if (IImageROIView::SelectROIFirst == m_selectionState) {
+        mouseUpdateROICorners12(x, y);
+      } else if (IImageROIView::SelectNormAreaFirst == m_selectionState) {
+        mouseUpdateNormAreaCorners12(x, y);
+      }
+    } else if (type == QEvent::MouseMove) {
+
+      if (IImageROIView::SelectROISecond == m_selectionState) {
+        mouseUpdateROICorner2(x, y);
+      } else if (IImageROIView::SelectNormAreaSecond == m_selectionState) {
+        mouseUpdateNormAreaCorner2(x, y);
+      }
+    } else if (type == QEvent::MouseButtonRelease) {
+
+      if (IImageROIView::SelectROISecond == m_selectionState) {
+        mouseFinishROI(x, y);
+      } else if (IImageROIView::SelectNormAreaSecond == m_selectionState) {
+        mouseFinishNormArea(x, y);
+      }
+    }
+  }
+  // pass on the event up to the parent class
+  return false;
+}
+
+/**
+ * Parameter values from mouse position (at a relevant event like
+ * first click, or last release) => spin box widgets, AND coordinate
+ * parameters data member. This grabs the Center of Rotation (CoR)
+ *
+ * @param x position on x axis (local to the image)
+ * @param y position on y axis (local to the image)
+ */
+void ImageROIViewQtWidget::grabCoRFromMousePoint(int x, int y) {
+  m_params.cor = Mantid::Kernel::V2D(x, y);
+  m_ui.spinBox_cor_x->setValue(x);
+  m_ui.spinBox_cor_y->setValue(y);
+}
+
+void ImageROIViewQtWidget::grabROICorner1FromMousePoint(int x, int y) {
+  m_params.roi.first = Mantid::Kernel::V2D(x, y);
+  m_ui.spinBox_roi_top_x->setValue(x);
+  m_ui.spinBox_roi_top_y->setValue(y);
+}
+
+void ImageROIViewQtWidget::grabROICorner2FromMousePoint(int x, int y) {
+  m_params.roi.second = Mantid::Kernel::V2D(x, y);
+  m_ui.spinBox_roi_bottom_x->setValue(x);
+  m_ui.spinBox_roi_bottom_y->setValue(y);
+}
+
+void ImageROIViewQtWidget::grabNormAreaCorner1FromMousePoint(int x, int y) {
+  m_params.normalizationRegion.first = Mantid::Kernel::V2D(x, y);
+  m_ui.spinBox_norm_top_x->setValue(x);
+  m_ui.spinBox_norm_top_y->setValue(y);
+}
+
+void ImageROIViewQtWidget::grabNormAreaCorner2FromMousePoint(int x, int y) {
+  m_params.normalizationRegion.second = Mantid::Kernel::V2D(x, y);
+  m_ui.spinBox_norm_bottom_x->setValue(x);
+  m_ui.spinBox_norm_bottom_y->setValue(y);
+}
+
+/**
+ * This is an update and implicity a finish, as there's only one
+ * update for the CoR (single point-click). The coordinates count as
+ * usual in Qt widgets. Top-left is (0,0).
+ *
+ * @param x position on x axis (local to the image)
+ * @param y position on y axis (local to the image)
+ */
+void ImageROIViewQtWidget::mouseUpdateCoR(int x, int y) {
+  grabCoRFromMousePoint(x, y);
+  refreshROIetAl();
+
+  m_presenter->notify(IImageROIPresenter::FinishedCoR);
+}
+
+/**
+ * Start of ROI selection (or first click after pushing "select
+ * ROI". The rectangle starts as a point from the mouse click.
+ *
+ * @param x position on x axis (local to the image)
+ * @param y position on y axis (local to the image)
+ */
+void ImageROIViewQtWidget::mouseUpdateROICorners12(int x, int y) {
+  grabROICorner1FromMousePoint(x, y);
+  grabROICorner2FromMousePoint(x, y);
+  refreshROIetAl();
+  m_selectionState = IImageROIView::SelectROISecond;
+}
+
+/**
+ * Change the rectangle while pressing the mouse button. The first
+ * corner stays at the first click, now only the second corner changes
+ * to the new mouse position. On release of the mouse button we'll get
+ * to mouseFinishROICorner2() and end the selection of the ROI.
+ *
+ * @param x position on x axis (local to the image)
+ * @param y position on y axis (local to the image)
+ */
+void ImageROIViewQtWidget::mouseUpdateROICorner2(int x, int y) {
+  grabROICorner2FromMousePoint(x, y);
+  refreshROIetAl();
+}
+
+/**
+ * End of ROI selection (or mouse button release after clicking once
+ * and move, all after pushing "select ROI". The second corner of the
+ * rectangle is set at the current position.
+ *
+ * @param x position on x axis (local to the image)
+ * @param y position on y axis (local to the image)
+ */
+void ImageROIViewQtWidget::mouseFinishROI(int x, int y) {
+  grabROICorner2FromMousePoint(x, y);
+  refreshROIetAl();
+  m_presenter->notify(IImageROIPresenter::FinishedROI);
+}
+
+void ImageROIViewQtWidget::mouseUpdateNormAreaCorners12(int x, int y) {
+  grabNormAreaCorner1FromMousePoint(x, y);
+  grabNormAreaCorner2FromMousePoint(x, y);
+  refreshROIetAl();
+  m_selectionState = IImageROIView::SelectNormAreaSecond;
+}
+
+void ImageROIViewQtWidget::mouseUpdateNormAreaCorner2(int x, int y) {
+  grabNormAreaCorner2FromMousePoint(x, y);
+  refreshROIetAl();
+}
+
+void ImageROIViewQtWidget::mouseFinishNormArea(int x, int y) {
+  grabNormAreaCorner2FromMousePoint(x, y);
+  refreshROIetAl();
+  m_presenter->notify(IImageROIPresenter::FinishedNormalization);
+}
+
+void ImageROIViewQtWidget::readSettings() {
+  QSettings qs;
+  qs.beginGroup(QString::fromStdString(m_settingsGroup));
+  restoreGeometry(qs.value("interface-win-geometry").toByteArray());
+  qs.endGroup();
+}
+
+void ImageROIViewQtWidget::closeEvent(QCloseEvent *event) {
+  m_presenter->notify(IImageROIPresenter::ShutDown);
+  event->accept();
+}
+
+} // namespace CustomInterfaces
+} // namespace MantidQt
diff --git a/MantidQt/CustomInterfaces/src/Tomography/ImageStackPreParams.cpp b/MantidQt/CustomInterfaces/src/Tomography/ImageStackPreParams.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..b343d7c20876fa95bda014ff49ed75407ab2daaf
--- /dev/null
+++ b/MantidQt/CustomInterfaces/src/Tomography/ImageStackPreParams.cpp
@@ -0,0 +1,11 @@
+#include "MantidQtCustomInterfaces/Tomography/ImageStackPreParams.h"
+
+using namespace MantidQt::CustomInterfaces;
+
+namespace MantidQt {
+namespace CustomInterfaces {
+
+ImageStackPreParams::ImageStackPreParams() : medianFilter(false) {}
+
+} // namespace CustomInterfaces
+} // namespace MantidQt
diff --git a/MantidQt/CustomInterfaces/src/Tomography/StackOfImagesDirs.cpp b/MantidQt/CustomInterfaces/src/Tomography/StackOfImagesDirs.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..d8be84c4a5db207fb1285d9888532c6e30c86fe3
--- /dev/null
+++ b/MantidQt/CustomInterfaces/src/Tomography/StackOfImagesDirs.cpp
@@ -0,0 +1,129 @@
+#include "MantidQtCustomInterfaces/Tomography/StackOfImagesDirs.h"
+
+#include <boost/algorithm/string.hpp>
+
+#include <Poco/DirectoryIterator.h>
+#include <Poco/Path.h>
+
+namespace MantidQt {
+namespace CustomInterfaces {
+
+const std::string StackOfImagesDirs::g_descr =
+    "A directory (folder) that contains subdirectories with names "
+    "starting with:\n- 'Data' (for sample images),\n- 'Flat' (for white "
+    "bean images),\n- 'Dark' (for dark images)\nThe first one is "
+    "mandatory whereas the other two are optional.";
+
+const std::string StackOfImagesDirs::g_sampleNamePrefix = "data";
+const std::string StackOfImagesDirs::g_flatNamePrefix = "flat";
+const std::string StackOfImagesDirs::g_darkNamePrefix = "dark";
+const std::string StackOfImagesDirs::g_processedNamePrefix = "processed";
+const std::string StackOfImagesDirs::g_prefilteredNamePrefix = "pre_filtered";
+
+StackOfImagesDirs::StackOfImagesDirs(const std::string &path)
+    : m_valid(false), m_statusDescStr("Constructed, no checks done yet.") {
+  findStackDirs(path);
+}
+
+std::string StackOfImagesDirs::description() const { return g_descr; }
+
+std::string StackOfImagesDirs::status() const {
+  if (m_valid)
+    return "Stack of images is correct";
+  else
+    return "There are errors in the directories and/or files. " +
+           m_statusDescStr;
+}
+
+std::vector<std::string> StackOfImagesDirs::sampleFiles() const {
+  return findImgFiles(m_sampleDir);
+}
+std::vector<std::string> StackOfImagesDirs::flatFiles() const {
+  return findImgFiles(m_flatDir);
+}
+std::vector<std::string> StackOfImagesDirs::darkFiles() const {
+  return findImgFiles(m_darkDir);
+}
+
+void StackOfImagesDirs::findStackDirs(const std::string &path) {
+  if (path.empty())
+    return;
+
+  Poco::File dir(path);
+  if (!dir.isDirectory() || !dir.exists())
+    return;
+
+  Poco::DirectoryIterator end;
+  for (Poco::DirectoryIterator it(dir); it != end; ++it) {
+    if (!it->isDirectory()) {
+      continue;
+    }
+
+    const std::string name = it.name();
+
+    // case insensitive comparison against expected pattersn: data_*, flat_*,
+    // dark_*, etc.
+    if (boost::iequals(name.substr(0, g_sampleNamePrefix.length()),
+                       g_sampleNamePrefix)) {
+      m_sampleDir = it.path().toString();
+    } else if (boost::iequals(name.substr(0, g_flatNamePrefix.length()),
+                              g_flatNamePrefix)) {
+      m_flatDir = name;
+    } else if (boost::iequals(name.substr(0, g_darkNamePrefix.length()),
+                              g_darkNamePrefix)) {
+      m_darkDir = name;
+    }
+  }
+
+  if (m_sampleDir.empty()) {
+    m_statusDescStr = "The the sample images directory (" + g_sampleNamePrefix +
+                      "...) has not been found.";
+    return;
+  }
+
+  // can be valid only if we get here. There must be at least one entry that is
+  // a file
+  Poco::Path samplesPath(m_sampleDir);
+  for (Poco::DirectoryIterator it(samplesPath); it != end; ++it) {
+    if (it->isFile()) {
+      m_valid = true;
+      break;
+    }
+  }
+
+  if (m_valid) {
+    m_statusDescStr = "all checks passed";
+  } else {
+    m_statusDescStr = "No files were found in the sample images directory (" +
+                      g_sampleNamePrefix + "...).";
+  }
+}
+
+std::vector<std::string>
+StackOfImagesDirs::findImgFiles(const std::string &path) const {
+  std::vector<std::string> fnames;
+  Poco::File dir(path);
+  if (!dir.isDirectory() || !dir.exists())
+    return fnames;
+
+  // as an alternative could also use Poco::Glob to find the files
+  Poco::DirectoryIterator it(dir);
+  Poco::DirectoryIterator end;
+  while (it != end) {
+    // TODO: filter names by extension?
+    // const std::string name = it.name();
+    if (it->isFile()) {
+      fnames.push_back(it.path().toString());
+    }
+
+    ++it;
+  }
+
+  // this assumes the usual sorting of images of a stack (directory): a prefix,
+  // and a sequence number (with a fixed number of digits).
+  std::sort(fnames.begin(), fnames.end());
+  return fnames;
+}
+
+} // namespace CustomInterfaces
+} // namespace MantidQt
diff --git a/MantidQt/CustomInterfaces/src/Tomography/TomographyIfaceModel.cpp b/MantidQt/CustomInterfaces/src/Tomography/TomographyIfaceModel.cpp
index 15c9f4550e6d57228cd464e6c3cb350e47c23449..5aaaaccde66a10647182a685e42fefe0ca5570aa 100644
--- a/MantidQt/CustomInterfaces/src/Tomography/TomographyIfaceModel.cpp
+++ b/MantidQt/CustomInterfaces/src/Tomography/TomographyIfaceModel.cpp
@@ -582,7 +582,6 @@ TomographyIfaceModel::loadFITSImage(const std::string &path) {
         "Failed to load image. Could not load this file as a "
         "FITS image: " +
         std::string(e.what()));
-    return WorkspaceGroup_sptr();
   }
   if (!alg->isExecuted()) {
     throw std::runtime_error(
diff --git a/MantidQt/CustomInterfaces/src/Tomography/TomographyIfacePresenter.cpp b/MantidQt/CustomInterfaces/src/Tomography/TomographyIfacePresenter.cpp
index 59ae96f3caed1ffa8f76c7fbb143fcdb94a95c34..ef2cad5f09bddc06fd38dd9c798e60f91e150e41 100644
--- a/MantidQt/CustomInterfaces/src/Tomography/TomographyIfacePresenter.cpp
+++ b/MantidQt/CustomInterfaces/src/Tomography/TomographyIfacePresenter.cpp
@@ -310,7 +310,6 @@ void TomographyIfacePresenter::processLogMsg() {
   std::vector<std::string> msgs = m_view->logMsgs();
   for (size_t i = 0; i < msgs.size(); i++) {
     m_model->logMsg(msgs[i]);
-    break;
   }
 }
 
diff --git a/MantidQt/CustomInterfaces/src/Tomography/TomographyIfaceViewQtGUI.cpp b/MantidQt/CustomInterfaces/src/Tomography/TomographyIfaceViewQtGUI.cpp
index c280ce58fce36a8d851ee1ad68804b38bf4fdd47..48fef5a235172ab657810b05bc0b1f4314753bc7 100644
--- a/MantidQt/CustomInterfaces/src/Tomography/TomographyIfaceViewQtGUI.cpp
+++ b/MantidQt/CustomInterfaces/src/Tomography/TomographyIfaceViewQtGUI.cpp
@@ -3,6 +3,7 @@
 #include "MantidQtAPI/AlgorithmInputHistory.h"
 #include "MantidQtAPI/AlgorithmRunner.h"
 #include "MantidQtAPI/HelpWindow.h"
+#include "MantidQtCustomInterfaces/Tomography/ImageROIViewQtWidget.h"
 #include "MantidQtCustomInterfaces/Tomography/TomographyIfaceViewQtGUI.h"
 #include "MantidQtCustomInterfaces/Tomography/TomographyIfacePresenter.h"
 #include "MantidQtCustomInterfaces/Tomography/ToolConfigAstraToolbox.h"
@@ -65,12 +66,27 @@ void TomographyIfaceViewQtGUI::initLayout() {
   // setup container ui
   m_ui.setupUi(this);
   // add tab contents and set up their ui's
-  QWidget *tab1w = new QWidget(m_ui.tabMain);
-  m_uiTabRun.setupUi(tab1w);
-  m_ui.tabMain->addTab(tab1w, QString("Run"));
-  QWidget *tab2w = new QWidget(m_ui.tabMain);
-  m_uiTabSetup.setupUi(tab2w);
-  m_ui.tabMain->addTab(tab2w, QString("Setup"));
+  QWidget *tabRunW = new QWidget(m_ui.tabMain);
+  m_uiTabRun.setupUi(tabRunW);
+  m_ui.tabMain->addTab(tabRunW, QString("Run"));
+  QWidget *tabSetupW = new QWidget(m_ui.tabMain);
+  m_uiTabSetup.setupUi(tabSetupW);
+  m_ui.tabMain->addTab(tabSetupW, QString("Setup"));
+
+  ImageROIViewQtWidget *tabROIW = new ImageROIViewQtWidget(m_ui.tabMain);
+  m_ui.tabMain->addTab(tabROIW, QString("ROI etc."));
+
+  QWidget *tabFiltersW = new QWidget();
+  m_ui.tabMain->addTab(tabFiltersW, QString("Filters"));
+
+  QWidget *tabVizW = new QWidget();
+  m_ui.tabMain->addTab(tabVizW, QString("Visualize"));
+
+  QWidget *tabConvertW = new QWidget();
+  m_ui.tabMain->addTab(tabConvertW, QString("Convert"));
+
+  QWidget *tabEBandsW = new QWidget();
+  m_ui.tabMain->addTab(tabEBandsW, QString("Energy bands"));
 
   readSettings();
 
diff --git a/MantidQt/CustomInterfaces/src/Tomography/ToolConfig.cpp b/MantidQt/CustomInterfaces/src/Tomography/ToolConfig.cpp
index 08391894c2eca282554ed2106c4db5f3a7f05a86..feb959472f6907482fb64850c5e862ecd2cb79cb 100644
--- a/MantidQt/CustomInterfaces/src/Tomography/ToolConfig.cpp
+++ b/MantidQt/CustomInterfaces/src/Tomography/ToolConfig.cpp
@@ -2,12 +2,15 @@
 #include "MantidQtCustomInterfaces/Tomography/ToolConfigCustom.h"
 #include "MantidQtCustomInterfaces/Tomography/ToolConfigTomoPy.h"
 
-
 #include <boost/lexical_cast.hpp>
 
 namespace MantidQt {
 namespace CustomInterfaces {
 
+ToolConfigTomoPy::ToolConfigTomoPy()
+    : TomoRecToolConfig(""), m_pathOut(""), m_pathDark(""), m_pathOpen(""),
+      m_pathSample(""), m_centerRot(.0), m_angleMin(.0), m_angleMax(180.0) {}
+
 ToolConfigTomoPy::ToolConfigTomoPy(const std::string &runnable,
                                    const std::string &pathOut,
                                    const std::string &pathDark,
@@ -28,6 +31,10 @@ std::string ToolConfigTomoPy::makeCmdLineOptions() const {
          boost::lexical_cast<std::string>(m_centerRot);
 }
 
+ToolConfigAstraToolbox::ToolConfigAstraToolbox()
+    : TomoRecToolConfig(""), m_centerRot(.0), m_angleMin(.0), m_angleMax(180.0),
+      m_pathOut(""), m_pathDark(""), m_pathOpen(""), m_pathSample("") {}
+
 ToolConfigAstraToolbox::ToolConfigAstraToolbox(
     const std::string &runnable, double centerRot, double angleMin,
     double angleMax, const std::string &pathOut, const std::string &pathDark,
diff --git a/MantidQt/CustomInterfaces/test/ALCDataLoadingPresenterTest.h b/MantidQt/CustomInterfaces/test/ALCDataLoadingPresenterTest.h
index 86e42f3506fdad1ff4d89b1275cabaa82ce0b8a3..ff393f001040ee9c575bd02765bea5c3457bebce 100644
--- a/MantidQt/CustomInterfaces/test/ALCDataLoadingPresenterTest.h
+++ b/MantidQt/CustomInterfaces/test/ALCDataLoadingPresenterTest.h
@@ -51,8 +51,8 @@ public:
   MOCK_METHOD1(setAvailablePeriods, void(const std::vector<std::string>&));
   MOCK_METHOD2(setTimeLimits, void(double,double));
   MOCK_METHOD2(setTimeRange, void(double,double));
-  MOCK_METHOD0(setWaitingCursor, void());
-  MOCK_METHOD0(restoreCursor, void());
+  MOCK_METHOD0(disableAll, void());
+  MOCK_METHOD0(enableAll, void());
   MOCK_METHOD0(help, void());
 
   void requestLoading() { emit loadRequested(); }
@@ -116,7 +116,7 @@ public:
   void test_defaultLoad()
   {
     InSequence s;
-    EXPECT_CALL(*m_view, setWaitingCursor());
+    EXPECT_CALL(*m_view, disableAll());
 
     EXPECT_CALL(*m_view, setDataCurve(AllOf(Property(&QwtData::size,3),
                                             QwtDataX(0, 1350, 1E-8),
@@ -130,7 +130,7 @@ public:
                                             VectorValue(1,1.284E-3,1E-6),
                                             VectorValue(2,1.280E-3,1E-6))));
 
-    EXPECT_CALL(*m_view, restoreCursor());
+    EXPECT_CALL(*m_view, enableAll());
 
     m_view->requestLoading();
   }
@@ -232,7 +232,7 @@ public:
     ON_CALL(*m_view, deadTimeType()).WillByDefault(Return("FromRunData"));
     EXPECT_CALL(*m_view, deadTimeType()).Times(2);
     EXPECT_CALL(*m_view, deadTimeFile()).Times(0);
-    EXPECT_CALL(*m_view, restoreCursor()).Times(1);
+    EXPECT_CALL(*m_view, enableAll()).Times(1);
     EXPECT_CALL(*m_view, setDataCurve(AllOf(Property(&QwtData::size,3),
                                             QwtDataY(0, 0.150616, 1E-3),
                                             QwtDataY(1, 0.143444, 1E-3),
@@ -251,7 +251,7 @@ public:
     ON_CALL(*m_view, deadTimeType()).WillByDefault(Return("FromSpecifiedFile"));
     EXPECT_CALL(*m_view, deadTimeType()).Times(2);
     EXPECT_CALL(*m_view, deadTimeFile()).Times(1);
-    EXPECT_CALL(*m_view, restoreCursor()).Times(1);
+    EXPECT_CALL(*m_view, enableAll()).Times(1);
     m_view->requestLoading();
   }
 
@@ -264,7 +264,7 @@ public:
     ON_CALL(*m_view, getBackwardGrouping()).WillByDefault(Return("1-32"));
     EXPECT_CALL(*m_view, getForwardGrouping()).Times(1);
     EXPECT_CALL(*m_view, getBackwardGrouping()).Times(1);
-    EXPECT_CALL(*m_view, restoreCursor()).Times(1);
+    EXPECT_CALL(*m_view, enableAll()).Times(1);
     EXPECT_CALL(*m_view, setDataCurve(AllOf(Property(&QwtData::size, 3),
                                             QwtDataX(0, 1350, 1E-8),
                                             QwtDataX(1, 1360, 1E-8),
diff --git a/MantidQt/CustomInterfaces/test/EnggDiffractionPresenterTest.h b/MantidQt/CustomInterfaces/test/EnggDiffractionPresenterTest.h
index 043aba68ed970e70f14f1dd292e947a3ddcf03a6..6a83147a7069e733967abf8766e7cce520a39664 100644
--- a/MantidQt/CustomInterfaces/test/EnggDiffractionPresenterTest.h
+++ b/MantidQt/CustomInterfaces/test/EnggDiffractionPresenterTest.h
@@ -385,6 +385,8 @@ public:
     // check automatic plotting
     EXPECT_CALL(mockView, focusedOutWorkspace()).Times(1).WillOnce(Return(true));
     EXPECT_CALL(mockView, plotFocusedSpectrum(testing::_)).Times(1);
+	// There are two/three other tests that have the disabled_ prefix so they
+	// normally run
 
     // Should not try to use options for other types of focusing
     EXPECT_CALL(mockView, focusingCroppedRunNo()).Times(0);
diff --git a/MantidQt/CustomInterfaces/test/EnggDiffractionViewMock.h b/MantidQt/CustomInterfaces/test/EnggDiffractionViewMock.h
index 36c5bdd0a65a6a4d027c6a2f19146fc64ec9bf73..90e5fc4a27d546725cd7160b03b6ee77588f55ce 100644
--- a/MantidQt/CustomInterfaces/test/EnggDiffractionViewMock.h
+++ b/MantidQt/CustomInterfaces/test/EnggDiffractionViewMock.h
@@ -105,7 +105,22 @@ public:
   MOCK_CONST_METHOD0(saveSettings, void());
 
   // virtual void plotFocusedSpectrum();
-  MOCK_METHOD1(plotFocusedSpectrum, void(const std::string&));
+  MOCK_METHOD1(plotFocusedSpectrum, void(const std::string &));
+
+  // void plotFocusStatus();
+  MOCK_METHOD0(plotFocusStatus, void());
+
+  // void plotRepChanged();
+  MOCK_METHOD1(plotRepChanged, void(int idx));
+
+  // virtual void plotWaterfallSpectrum
+  MOCK_METHOD1(plotWaterfallSpectrum, void(const std::string &wsName));
+
+  // virtual void plotReplacingWindow
+  MOCK_METHOD1(plotReplacingWindow, void(const std::string &wsName));
+
+  // std::string currentPlotType
+  MOCK_CONST_METHOD0(currentPlotType, int());
 };
 
 #endif // MANTID_CUSTOMINTERFACES_ENGGDIFFRACTIONVIEWMOCK_H
diff --git a/MantidQt/CustomInterfaces/test/ImageROIPresenterTest.h b/MantidQt/CustomInterfaces/test/ImageROIPresenterTest.h
new file mode 100644
index 0000000000000000000000000000000000000000..56cb937e2c3046ab444d0fe1540a5c5601d4600d
--- /dev/null
+++ b/MantidQt/CustomInterfaces/test/ImageROIPresenterTest.h
@@ -0,0 +1,320 @@
+#ifndef MANTID_CUSTOMINTERFACES_IMAGEROIPRESENTERTEST_H
+#define MANTID_CUSTOMINTERFACES_IMAGEROIPRESENTERTEST_H
+
+#include "MantidAPI/FrameworkManager.h"
+#include "MantidAPI/MatrixWorkspace.h"
+#include "MantidQtCustomInterfaces/Tomography/ImageROIPresenter.h"
+
+#include <cxxtest/TestSuite.h>
+
+#include <Poco/File.h>
+
+#include "ImageROIViewMock.h"
+
+using namespace MantidQt::CustomInterfaces;
+using testing::TypedEq;
+using testing::Return;
+
+class ImageROIPresenterTest : public CxxTest::TestSuite {
+
+public:
+  // This pair of boilerplate methods prevent the suite being created statically
+  // This means the constructor isn't called when running other tests
+  static ImageROIPresenterTest *createSuite() {
+    return new ImageROIPresenterTest();
+  }
+
+  static void destroySuite(ImageROIPresenterTest *suite) { delete suite; }
+
+  ImageROIPresenterTest() {
+    Mantid::API::FrameworkManager::Instance(); // make sure the framework is
+                                               // initialized
+  }
+
+  void setUp() {
+    m_view.reset(new testing::NiceMock<MockImageROIView>());
+    m_presenter.reset(
+        new MantidQt::CustomInterfaces::ImageROIPresenter(m_view.get()));
+  }
+
+  void tearDown() {
+    TS_ASSERT(testing::Mock::VerifyAndClearExpectations(m_view.get()));
+  }
+
+  void test_initOK() {
+    testing::NiceMock<MockImageROIView> mockView;
+    MantidQt::CustomInterfaces::ImageROIPresenter pres(&mockView);
+
+    EXPECT_CALL(mockView, setParams(testing::_)).Times(1);
+
+    // No errors/warnings
+    EXPECT_CALL(mockView, userError(testing::_, testing::_)).Times(0);
+    EXPECT_CALL(mockView, userWarning(testing::_, testing::_)).Times(0);
+
+    pres.notify(ImageROIPresenter::Init);
+  }
+
+  void test_initWithWrongParams() {
+    testing::NiceMock<MockImageROIView> mockView;
+    MantidQt::CustomInterfaces::ImageROIPresenter pres(&mockView);
+
+    EXPECT_CALL(mockView, setParams(testing::_)).Times(1);
+
+    // One error, no warnings
+    EXPECT_CALL(mockView, userError(testing::_, testing::_)).Times(0);
+    EXPECT_CALL(mockView, userWarning(testing::_, testing::_)).Times(0);
+
+    pres.notify(ImageROIPresenter::Init);
+  }
+
+  void xxtest_browseImg_EmptyPath() {
+    testing::NiceMock<MockImageROIView> mockView;
+    MantidQt::CustomInterfaces::ImageROIPresenter pres(&mockView);
+
+    EXPECT_CALL(mockView, askImgOrStackPath()).Times(1).WillOnce(Return(""));
+
+    // No error, no warnings, just ignored
+    EXPECT_CALL(mockView, userError(testing::_, testing::_)).Times(0);
+    EXPECT_CALL(mockView, userWarning(testing::_, testing::_)).Times(0);
+
+    // should not get there:
+    EXPECT_CALL(mockView, showStack(testing::An<const std::string &>()))
+        .Times(0);
+    EXPECT_CALL(mockView,
+                showStack(testing::An<Mantid::API::WorkspaceGroup_sptr &>()))
+        .Times(0);
+    EXPECT_CALL(mockView, updateImgWithIndex(testing::_)).Times(0);
+
+    pres.notify(IImageROIPresenter::BrowseImgOrStack);
+  }
+
+  void xxtest_newImg_EmptyPath() {
+    testing::NiceMock<MockImageROIView> mockView;
+    MantidQt::CustomInterfaces::ImageROIPresenter pres(&mockView);
+
+    EXPECT_CALL(mockView, askImgOrStackPath()).Times(0);
+
+    // No error, one warning pop-up because a stack is not found
+    EXPECT_CALL(mockView, userError(testing::_, testing::_)).Times(0);
+    EXPECT_CALL(mockView, userWarning(testing::_, testing::_)).Times(1);
+
+    // should not get there because there's no stack/img - it's just ignored:
+    EXPECT_CALL(mockView, showStack(testing::An<const std::string &>()))
+        .Times(0);
+    EXPECT_CALL(mockView,
+                showStack(testing::An<Mantid::API::WorkspaceGroup_sptr &>()))
+        .Times(0);
+    EXPECT_CALL(mockView, updateImgWithIndex(testing::_)).Times(0);
+
+    pres.notify(IImageROIPresenter::NewImgOrStack);
+  }
+
+  void test_browseImg_WrongPath() {
+    testing::NiceMock<MockImageROIView> mockView;
+    MantidQt::CustomInterfaces::ImageROIPresenter pres(&mockView);
+
+    EXPECT_CALL(mockView, askImgOrStackPath())
+        .Times(1)
+        .WillOnce(Return("dont_look_for_me_i_dont_exist"));
+
+    // A warning
+    EXPECT_CALL(mockView, userError(testing::_, testing::_)).Times(0);
+    EXPECT_CALL(mockView, userWarning(testing::_, testing::_)).Times(1);
+
+    // should not get there because there's no stack/img
+    EXPECT_CALL(mockView, showStack(testing::An<const std::string &>()))
+        .Times(0);
+    EXPECT_CALL(mockView,
+                showStack(testing::An<Mantid::API::WorkspaceGroup_sptr &>()))
+        .Times(0);
+    EXPECT_CALL(mockView, updateImgWithIndex(testing::_)).Times(0);
+
+    // this exception is currently handled, and a warning given
+    //TSM_ASSERT_THROWS("There should be an exception if there is an unexpected "
+    //                  "error with the images path",
+    //                  pres.notify(IImageROIPresenter::BrowseImgOrStack),
+    //                  Poco::FileNotFoundException);
+    pres.notify(IImageROIPresenter::BrowseImgOrStack);
+  }
+
+  void test_updateImgIndex() {
+    testing::NiceMock<MockImageROIView> mockView;
+    MantidQt::CustomInterfaces::ImageROIPresenter pres(&mockView);
+
+    int idx = 0;
+    EXPECT_CALL(mockView, currentImgIndex()).Times(1).WillOnce(Return(idx));
+
+    EXPECT_CALL(mockView, updateImgWithIndex(idx)).Times(1);
+
+    // No errors, no warnings
+    EXPECT_CALL(mockView, userError(testing::_, testing::_)).Times(0);
+    EXPECT_CALL(mockView, userWarning(testing::_, testing::_)).Times(0);
+
+    pres.notify(IImageROIPresenter::UpdateImgIndex);
+  }
+
+  void test_selectCoR() {
+    testing::NiceMock<MockImageROIView> mockView;
+    MantidQt::CustomInterfaces::ImageROIPresenter pres(&mockView);
+
+    EXPECT_CALL(mockView, changeSelectionState(IImageROIView::SelectCoR))
+        .Times(1);
+
+    // No errors, no warnings
+    EXPECT_CALL(mockView, userError(testing::_, testing::_)).Times(0);
+    EXPECT_CALL(mockView, userWarning(testing::_, testing::_)).Times(0);
+
+    pres.notify(IImageROIPresenter::SelectCoR);
+  }
+
+  void test_resetCoR() {
+    testing::NiceMock<MockImageROIView> mockView;
+    MantidQt::CustomInterfaces::ImageROIPresenter pres(&mockView);
+
+    EXPECT_CALL(mockView, resetCoR()).Times(1);
+    EXPECT_CALL(mockView, changeSelectionState(IImageROIView::SelectNone))
+        .Times(1);
+
+    // just a few calls that should not happen
+    EXPECT_CALL(mockView, resetROI()).Times(0);
+    EXPECT_CALL(mockView, showStack(testing::An<const std::string &>()))
+        .Times(0);
+    EXPECT_CALL(mockView,
+                showStack(testing::An<Mantid::API::WorkspaceGroup_sptr &>()))
+        .Times(0);
+    EXPECT_CALL(mockView, updateImgWithIndex(testing::_)).Times(0);
+
+    // No errors, no warnings
+    EXPECT_CALL(mockView, userError(testing::_, testing::_)).Times(0);
+    EXPECT_CALL(mockView, userWarning(testing::_, testing::_)).Times(0);
+
+    pres.notify(IImageROIPresenter::ResetCoR);
+  }
+
+  void test_selectROI() {
+    testing::NiceMock<MockImageROIView> mockView;
+    MantidQt::CustomInterfaces::ImageROIPresenter pres(&mockView);
+
+    EXPECT_CALL(mockView, changeSelectionState(IImageROIView::SelectROIFirst))
+        .Times(1);
+
+    // No errors, no warnings
+    EXPECT_CALL(mockView, userError(testing::_, testing::_)).Times(0);
+    EXPECT_CALL(mockView, userWarning(testing::_, testing::_)).Times(0);
+
+    pres.notify(IImageROIPresenter::SelectROI);
+  }
+
+  void test_finishROI() {
+    testing::NiceMock<MockImageROIView> mockView;
+    MantidQt::CustomInterfaces::ImageROIPresenter pres(&mockView);
+
+    EXPECT_CALL(mockView, changeSelectionState(IImageROIView::SelectNone))
+        .Times(1);
+
+    // No errors, no warnings
+    EXPECT_CALL(mockView, userError(testing::_, testing::_)).Times(0);
+    EXPECT_CALL(mockView, userWarning(testing::_, testing::_)).Times(0);
+
+    pres.notify(IImageROIPresenter::FinishedROI);
+  }
+
+  void test_resetROI() {
+    testing::NiceMock<MockImageROIView> mockView;
+    MantidQt::CustomInterfaces::ImageROIPresenter pres(&mockView);
+
+    EXPECT_CALL(mockView, resetROI()).Times(1);
+    EXPECT_CALL(mockView, changeSelectionState(IImageROIView::SelectNone))
+        .Times(1);
+
+    // just a few calls that should not happen
+    EXPECT_CALL(mockView, resetCoR()).Times(0);
+    EXPECT_CALL(mockView, showStack(testing::An<const std::string &>()))
+        .Times(0);
+    EXPECT_CALL(mockView,
+                showStack(testing::An<Mantid::API::WorkspaceGroup_sptr &>()))
+        .Times(0);
+    EXPECT_CALL(mockView, updateImgWithIndex(testing::_)).Times(0);
+
+    // No errors, no warnings
+    EXPECT_CALL(mockView, userError(testing::_, testing::_)).Times(0);
+    EXPECT_CALL(mockView, userWarning(testing::_, testing::_)).Times(0);
+
+    pres.notify(IImageROIPresenter::ResetROI);
+  }
+
+  void test_selectNormalization() {
+    testing::NiceMock<MockImageROIView> mockView;
+    MantidQt::CustomInterfaces::ImageROIPresenter pres(&mockView);
+
+    EXPECT_CALL(mockView, changeSelectionState(
+                              IImageROIView::SelectNormAreaFirst)).Times(1);
+
+    // No errors, no warnings
+    EXPECT_CALL(mockView, userError(testing::_, testing::_)).Times(0);
+    EXPECT_CALL(mockView, userWarning(testing::_, testing::_)).Times(0);
+
+    pres.notify(IImageROIPresenter::SelectNormalization);
+  }
+
+  void test_finishNormalization() {
+    testing::NiceMock<MockImageROIView> mockView;
+    MantidQt::CustomInterfaces::ImageROIPresenter pres(&mockView);
+
+    EXPECT_CALL(mockView, changeSelectionState(IImageROIView::SelectNone))
+        .Times(1);
+
+    // No errors, no warnings
+    EXPECT_CALL(mockView, userError(testing::_, testing::_)).Times(0);
+    EXPECT_CALL(mockView, userWarning(testing::_, testing::_)).Times(0);
+
+    pres.notify(IImageROIPresenter::FinishedNormalization);
+  }
+
+  void test_resetNormalization() {
+    testing::NiceMock<MockImageROIView> mockView;
+    MantidQt::CustomInterfaces::ImageROIPresenter pres(&mockView);
+
+    EXPECT_CALL(mockView, resetNormArea()).Times(1);
+    EXPECT_CALL(mockView, changeSelectionState(IImageROIView::SelectNone))
+        .Times(1);
+
+    // just a few calls that should not happen
+    EXPECT_CALL(mockView, resetCoR()).Times(0);
+    EXPECT_CALL(mockView, resetROI()).Times(0);
+    EXPECT_CALL(mockView, showStack(testing::An<const std::string &>()))
+        .Times(0);
+    EXPECT_CALL(mockView,
+                showStack(testing::An<Mantid::API::WorkspaceGroup_sptr &>()))
+        .Times(0);
+    EXPECT_CALL(mockView, updateImgWithIndex(testing::_)).Times(0);
+
+    // No errors, no warnings
+    EXPECT_CALL(mockView, userError(testing::_, testing::_)).Times(0);
+    EXPECT_CALL(mockView, userWarning(testing::_, testing::_)).Times(0);
+
+    pres.notify(IImageROIPresenter::ResetNormalization);
+  }
+
+  void test_shutDown() {
+    testing::NiceMock<MockImageROIView> mockView;
+    MantidQt::CustomInterfaces::ImageROIPresenter pres(&mockView);
+
+    EXPECT_CALL(mockView, saveSettings()).Times(1);
+    // No errors, no warnings
+    EXPECT_CALL(mockView, userError(testing::_, testing::_)).Times(0);
+    EXPECT_CALL(mockView, userWarning(testing::_, testing::_)).Times(0);
+
+    pres.notify(ImageROIPresenter::ShutDown);
+  }
+
+private:
+  // boost::shared_ptr
+  boost::scoped_ptr<testing::NiceMock<MockImageROIView>> m_view;
+  boost::scoped_ptr<MantidQt::CustomInterfaces::ImageROIPresenter> m_presenter;
+
+  // To have one FITS, etc.
+  Mantid::API::MatrixWorkspace_sptr m_ws;
+};
+
+#endif // MANTID_CUSTOMINTERFACES_IMAGEROIPRESENTERTEST_H
diff --git a/MantidQt/CustomInterfaces/test/ImageROIViewMock.h b/MantidQt/CustomInterfaces/test/ImageROIViewMock.h
new file mode 100644
index 0000000000000000000000000000000000000000..6ba7ebca13e036ac6569eb64b51857e61ae79e44
--- /dev/null
+++ b/MantidQt/CustomInterfaces/test/ImageROIViewMock.h
@@ -0,0 +1,66 @@
+#ifndef MANTID_CUSTOMINTERFACES_IMAGEROIVIEWMOCK_H
+#define MANTID_CUSTOMINTERFACES_IMAGEROIVIEWMOCK_H
+
+#include "MantidQtCustomInterfaces/Tomography/ITomographyIfaceView.h"
+
+#include <gmock/gmock.h>
+
+class MockImageROIView : public MantidQt::CustomInterfaces::IImageROIView {
+public:
+  // void initParams(ImageStackPreParams &params)
+  MOCK_METHOD1(setParams,
+               void(MantidQt::CustomInterfaces::ImageStackPreParams &));
+
+  // ImageStackPreParams userSelection() const;
+  MOCK_CONST_METHOD0(userSelection,
+                     MantidQt::CustomInterfaces::ImageStackPreParams());
+
+  // SelectionState selectionState() const;
+  MOCK_CONST_METHOD0(selectionState, SelectionState());
+
+  // void changeSelectionState(const SelectionState state);
+  MOCK_METHOD1(changeSelectionState, void(const IImageROIView::SelectionState&));
+
+  // void showStack(const std::string &path);
+  MOCK_METHOD1(showStack, void(const std::string &));
+
+  // void showStack(const Mantid::API::WorkspaceGroup_sptr &ws);
+  MOCK_METHOD1(showStack, void(Mantid::API::WorkspaceGroup_sptr &));
+
+  // const Mantid::API::WorkspaceGroup_sptr stack() const;
+  MOCK_CONST_METHOD0(stack, const Mantid::API::WorkspaceGroup_sptr());
+
+  // void showProjection(const Mantid::API::WorkspaceGroup_sptr &wsg, size_t idx);
+  MOCK_METHOD2(showProjection, void(const Mantid::API::WorkspaceGroup_sptr &wsg, size_t idx));
+
+  // void userWarning(const std::string &warn, const std::string &description)
+  MOCK_METHOD2(userWarning,
+               void(const std::string &warn, const std::string &description));
+
+  // void userError(const std::string &err, const std::string &description)
+  MOCK_METHOD2(userError,
+               void(const std::string &err, const std::string &description));
+
+  // size_t currentImgIndex() const;
+  MOCK_CONST_METHOD0(currentImgIndex, size_t());
+
+  // void updateImgWithIndex(size_t idx)
+  MOCK_METHOD1(updateImgWithIndex, void(size_t));
+
+  // std::string askImgOrStackPath();
+  MOCK_METHOD0(askImgOrStackPath, std::string());
+
+  // void saveSettings() const {}
+  MOCK_CONST_METHOD0(saveSettings, void());
+
+  // void resetCoR()
+  MOCK_METHOD0(resetCoR, void());
+
+  // void resetROI()
+  MOCK_METHOD0(resetROI, void());
+
+  // void resetNormArea()
+  MOCK_METHOD0(resetNormArea, void());
+};
+
+#endif // MANTID_CUSTOMINTERFACES_IMAGEROIVIEWMOCK_H
diff --git a/MantidQt/CustomInterfaces/test/ReflMainViewMockObjects.h b/MantidQt/CustomInterfaces/test/ReflMainViewMockObjects.h
index 2d7f91d24a4c10c40bf3b3b3eb28cd15585c7b90..026b49d21b3e9966e32a84f26c1b3df3b72ea023 100644
--- a/MantidQt/CustomInterfaces/test/ReflMainViewMockObjects.h
+++ b/MantidQt/CustomInterfaces/test/ReflMainViewMockObjects.h
@@ -33,6 +33,7 @@ public:
   MOCK_METHOD2(giveUserCritical, void(std::string, std::string));
   MOCK_METHOD2(giveUserInfo, void(std::string, std::string));
   MOCK_METHOD2(giveUserWarning, void(std::string, std::string));
+  MOCK_METHOD0(requestNotebookPath, std::string());
 
   MOCK_METHOD1(showAlgorithmDialog, void(const std::string&));
   MOCK_METHOD1(plotWorkspaces, void(const std::set<std::string>&));
@@ -46,6 +47,7 @@ public:
   MOCK_CONST_METHOD0(getClipboard, std::string());
   MOCK_CONST_METHOD0(getSearchString, std::string());
   MOCK_CONST_METHOD0(getSearchInstrument, std::string());
+  MOCK_METHOD0(getEnableNotebook, bool());
 
   //Calls we don't care about
   virtual void showTable(QReflTableModel_sptr) {};
@@ -53,7 +55,6 @@ public:
   virtual void setOptionsHintStrategy(MantidQt::MantidWidgets::HintStrategy*) {};
   virtual void setProgressRange(int,int) {};
   virtual void setProgress(int) {};
-  virtual bool getEnableNotebook() {return false;};
   virtual void setTableList(const std::set<std::string>&) {};
   virtual void setInstrumentList(const std::vector<std::string>&, const std::string&) {};
   virtual std::string getProcessInstrument() const {return "FAKE";}
diff --git a/MantidQt/CustomInterfaces/test/ReflMainViewPresenterTest.h b/MantidQt/CustomInterfaces/test/ReflMainViewPresenterTest.h
index 4c53fb56bf68c8693e9933f650f7aa5440c18545..36d043f921e47425dc4ed88c241c0207f61cee26 100644
--- a/MantidQt/CustomInterfaces/test/ReflMainViewPresenterTest.h
+++ b/MantidQt/CustomInterfaces/test/ReflMainViewPresenterTest.h
@@ -13,6 +13,7 @@
 #include "MantidQtCustomInterfaces/ReflMainViewPresenter.h"
 
 #include "ReflMainViewMockObjects.h"
+#include "../inc/MantidQtCustomInterfaces/IReflPresenter.h"
 
 using namespace MantidQt::CustomInterfaces;
 using namespace Mantid::API;
@@ -136,6 +137,8 @@ public:
 
     TS_ASSERT(AnalysisDataService::Instance().doesExist("TestWorkspace"));
     AnalysisDataService::Instance().remove("TestWorkspace");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testSaveExisting() {
@@ -152,6 +155,8 @@ public:
     presenter.notify(IReflPresenter::SaveFlag);
 
     AnalysisDataService::Instance().remove("TestWorkspace");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testSaveAs() {
@@ -180,6 +185,8 @@ public:
 
     AnalysisDataService::Instance().remove("TestWorkspace");
     AnalysisDataService::Instance().remove("Workspace");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testAppendRow() {
@@ -220,6 +227,8 @@ public:
 
     // Tidy up
     AnalysisDataService::Instance().remove("TestWorkspace");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testAppendRowSpecify() {
@@ -263,6 +272,8 @@ public:
 
     // Tidy up
     AnalysisDataService::Instance().remove("TestWorkspace");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testAppendRowSpecifyPlural() {
@@ -305,6 +316,8 @@ public:
 
     // Tidy up
     AnalysisDataService::Instance().remove("TestWorkspace");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testPrependRow() {
@@ -344,6 +357,8 @@ public:
 
     // Tidy up
     AnalysisDataService::Instance().remove("TestWorkspace");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testPrependRowSpecify() {
@@ -386,6 +401,8 @@ public:
 
     // Tidy up
     AnalysisDataService::Instance().remove("TestWorkspace");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testPrependRowSpecifyPlural() {
@@ -429,6 +446,8 @@ public:
 
     // Tidy up
     AnalysisDataService::Instance().remove("TestWorkspace");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testDeleteRowNone() {
@@ -460,6 +479,8 @@ public:
 
     // Tidy up
     AnalysisDataService::Instance().remove("TestWorkspace");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testDeleteRowSingle() {
@@ -495,6 +516,8 @@ public:
 
     // Tidy up
     AnalysisDataService::Instance().remove("TestWorkspace");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testDeleteRowPlural() {
@@ -533,6 +556,8 @@ public:
 
     // Tidy up
     AnalysisDataService::Instance().remove("TestWorkspace");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testProcess() {
@@ -559,6 +584,11 @@ public:
     EXPECT_CALL(mockView, getSelectedRows())
         .Times(1)
         .WillRepeatedly(Return(rowlist));
+    EXPECT_CALL(mockView, getEnableNotebook())
+      .Times(1)
+      .WillRepeatedly(Return(false));
+    EXPECT_CALL(mockView, requestNotebookPath())
+      .Times(0);
     presenter.notify(IReflPresenter::ProcessFlag);
 
     // Check output workspaces were created as expected
@@ -579,6 +609,52 @@ public:
     AnalysisDataService::Instance().remove("IvsLam_12346");
     AnalysisDataService::Instance().remove("TOF_12346");
     AnalysisDataService::Instance().remove("IvsQ_12345_12346");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
+  }
+
+  void testProcessWithNotebook() {
+    MockView mockView;
+    ReflMainViewPresenter presenter(&mockView);
+
+    createPrefilledWorkspace("TestWorkspace");
+    EXPECT_CALL(mockView, getWorkspaceToOpen())
+      .Times(1)
+      .WillRepeatedly(Return("TestWorkspace"));
+    presenter.notify(IReflPresenter::OpenTableFlag);
+
+    std::set<int> rowlist;
+    rowlist.insert(0);
+    rowlist.insert(1);
+
+    createTOFWorkspace("TOF_12345", "12345");
+    createTOFWorkspace("TOF_12346", "12346");
+
+    // We should not receive any errors
+    EXPECT_CALL(mockView, giveUserCritical(_, _)).Times(0);
+
+    // The user hits the "process" button with the first two rows selected
+    EXPECT_CALL(mockView, getSelectedRows())
+      .Times(1)
+      .WillRepeatedly(Return(rowlist));
+    EXPECT_CALL(mockView, getEnableNotebook())
+      .Times(1)
+      .WillRepeatedly(Return(true));
+    EXPECT_CALL(mockView, requestNotebookPath())
+      .Times(1);
+    presenter.notify(IReflPresenter::ProcessFlag);
+
+    // Tidy up
+    AnalysisDataService::Instance().remove("TestWorkspace");
+    AnalysisDataService::Instance().remove("IvsQ_12345");
+    AnalysisDataService::Instance().remove("IvsLam_12345");
+    AnalysisDataService::Instance().remove("TOF_12345");
+    AnalysisDataService::Instance().remove("IvsQ_12346");
+    AnalysisDataService::Instance().remove("IvsLam_12346");
+    AnalysisDataService::Instance().remove("TOF_12346");
+    AnalysisDataService::Instance().remove("IvsQ_12345_12346");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   /*
@@ -641,6 +717,8 @@ public:
     AnalysisDataService::Instance().remove("IvsQ_12346");
     AnalysisDataService::Instance().remove("IvsLam_12346");
     AnalysisDataService::Instance().remove("IvsQ_dataA_12346");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testBadWorkspaceType() {
@@ -671,6 +749,8 @@ public:
     presenter.notify(IReflPresenter::OpenTableFlag);
 
     AnalysisDataService::Instance().remove("TestWorkspace");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testBadWorkspaceLength() {
@@ -705,6 +785,8 @@ public:
     presenter.notify(IReflPresenter::OpenTableFlag);
 
     AnalysisDataService::Instance().remove("TestWorkspace");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testPromptSaveAfterAppendRow() {
@@ -732,6 +814,8 @@ public:
     // The user tries to create a new table again, and does not get bothered
     EXPECT_CALL(mockView, askUserYesNo(_, _)).Times(0);
     presenter.notify(IReflPresenter::NewTableFlag);
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testPromptSaveAfterDeleteRow() {
@@ -771,6 +855,8 @@ public:
     // The user tries to create a new table again, and does not get bothered
     EXPECT_CALL(mockView, askUserYesNo(_, _)).Times(0);
     presenter.notify(IReflPresenter::NewTableFlag);
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testPromptSaveAndDiscard() {
@@ -791,6 +877,8 @@ public:
     // These next two times they don't get prompted - they have a new table
     presenter.notify(IReflPresenter::NewTableFlag);
     presenter.notify(IReflPresenter::NewTableFlag);
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testPromptSaveOnOpen() {
@@ -823,6 +911,8 @@ public:
         .WillRepeatedly(Return("TestWorkspace"));
     EXPECT_CALL(mockView, askUserYesNo(_, _)).Times(0);
     presenter.notify(IReflPresenter::OpenTableFlag);
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testExpandSelection() {
@@ -984,6 +1074,8 @@ public:
 
     // Tidy up
     AnalysisDataService::Instance().remove("TestWorkspace");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testClearRows() {
@@ -1043,6 +1135,8 @@ public:
 
     // Tidy up
     AnalysisDataService::Instance().remove("TestWorkspace");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testCopyRow() {
@@ -1066,6 +1160,8 @@ public:
         .Times(1)
         .WillRepeatedly(Return(rowlist));
     presenter.notify(IReflPresenter::CopySelectedFlag);
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testCopyRows() {
@@ -1095,6 +1191,8 @@ public:
         .Times(1)
         .WillRepeatedly(Return(rowlist));
     presenter.notify(IReflPresenter::CopySelectedFlag);
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testCutRow() {
@@ -1129,6 +1227,8 @@ public:
     TS_ASSERT_EQUALS(ws->String(0, RunCol), "12345");
     TS_ASSERT_EQUALS(ws->String(1, RunCol), "24681");
     TS_ASSERT_EQUALS(ws->String(2, RunCol), "24682");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testCutRows() {
@@ -1165,6 +1265,8 @@ public:
     TS_ASSERT_EQUALS(ws->rowCount(), 1);
     // Check the only unselected row is left behind
     TS_ASSERT_EQUALS(ws->String(0, RunCol), "24682");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testPasteRow() {
@@ -1212,6 +1314,8 @@ public:
     TS_ASSERT_EQUALS(ws->Double(1, ScaleCol), 5.0);
     TS_ASSERT_EQUALS(ws->Int(1, GroupCol), 6);
     TS_ASSERT_EQUALS(ws->String(1, OptionsCol), "abc");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testPasteNewRow() {
@@ -1257,6 +1361,8 @@ public:
     TS_ASSERT_EQUALS(ws->Double(4, ScaleCol), 5.0);
     TS_ASSERT_EQUALS(ws->Int(4, GroupCol), 6);
     TS_ASSERT_EQUALS(ws->String(4, OptionsCol), "abc");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testPasteRows() {
@@ -1315,6 +1421,8 @@ public:
     TS_ASSERT_EQUALS(ws->Double(2, ScaleCol), 3.0);
     TS_ASSERT_EQUALS(ws->Int(2, GroupCol), 2);
     TS_ASSERT_EQUALS(ws->String(2, OptionsCol), "def");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testPasteNewRows() {
@@ -1371,6 +1479,8 @@ public:
     TS_ASSERT_EQUALS(ws->Double(5, ScaleCol), 3.0);
     TS_ASSERT_EQUALS(ws->Int(5, GroupCol), 2);
     TS_ASSERT_EQUALS(ws->String(5, OptionsCol), "def");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testImportTable() {
@@ -1378,6 +1488,8 @@ public:
     ReflMainViewPresenter presenter(&mockView);
     EXPECT_CALL(mockView, showAlgorithmDialog("LoadReflTBL"));
     presenter.notify(IReflPresenter::ImportTableFlag);
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testExportTable() {
@@ -1385,6 +1497,8 @@ public:
     ReflMainViewPresenter presenter(&mockView);
     EXPECT_CALL(mockView, showAlgorithmDialog("SaveReflTBL"));
     presenter.notify(IReflPresenter::ExportTableFlag);
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testPlotRowWarn() {
@@ -1416,6 +1530,8 @@ public:
     // Tidy up
     AnalysisDataService::Instance().remove("TestWorkspace");
     AnalysisDataService::Instance().remove("TOF_12345");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testPlotGroupWarn() {
@@ -1447,6 +1563,8 @@ public:
     AnalysisDataService::Instance().remove("TestWorkspace");
     AnalysisDataService::Instance().remove("TOF_12345");
     AnalysisDataService::Instance().remove("TOF_12346");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 };
 
diff --git a/MantidQt/CustomInterfaces/test/StackOfImagesDirsTest.h b/MantidQt/CustomInterfaces/test/StackOfImagesDirsTest.h
new file mode 100644
index 0000000000000000000000000000000000000000..641dd70eb5d6e709690c04aa1560be5b0d8a9eb6
--- /dev/null
+++ b/MantidQt/CustomInterfaces/test/StackOfImagesDirsTest.h
@@ -0,0 +1,111 @@
+#ifndef MANTID_CUSTOMINTERFACES_STACKOFIMAGESDIRSTEST_H
+#define MANTID_CUSTOMINTERFACES_STACKOFIMAGESDIRSTEST_H
+
+#include "MantidAPI/FrameworkManager.h"
+#include "MantidQtCustomInterfaces/Tomography/StackOfImagesDirs.h"
+
+#include <boost/scoped_ptr.hpp>
+
+#include <cxxtest/TestSuite.h>
+
+using namespace MantidQt::CustomInterfaces;
+
+class StackOfImagesDirsTest : public CxxTest::TestSuite {
+
+public:
+  // This pair of boilerplate methods prevent the suite being created statically
+  // This means the constructor isn't called when running other tests
+  static StackOfImagesDirsTest *createSuite() {
+    return new StackOfImagesDirsTest();
+  }
+
+  static void destroySuite(StackOfImagesDirsTest *suite) { delete suite; }
+
+  StackOfImagesDirsTest() {
+    Mantid::API::FrameworkManager::Instance(); // make sure the framework is
+                                               // initialized
+  }
+
+  void setUp() {
+    // just to test more dynamic allocation
+    m_soid.reset(new StackOfImagesDirs(""));
+  }
+
+  void tearDown() {}
+
+  void test_construct() {
+    StackOfImagesDirs obj("");
+
+    TSM_ASSERT("A stack just constructed with an empty path string should not "
+               "be valid",
+               !obj.isValid());
+  }
+
+  void test_description() {
+    StackOfImagesDirs obj("");
+
+    TS_ASSERT_THROWS_NOTHING(obj.description());
+    TSM_ASSERT("A description string should be produced",
+               "" != obj.description());
+  }
+
+  void test_status() {
+    StackOfImagesDirs obj("");
+
+    TS_ASSERT_THROWS_NOTHING(obj.description());
+    TSM_ASSERT("A status string should be produced", "" != obj.status());
+  }
+
+  void test_sampleImagesDir() {
+    StackOfImagesDirs obj("");
+
+    TS_ASSERT_THROWS_NOTHING(obj.description());
+    TSM_ASSERT("The sample images directory of an empty stack should be empty",
+               "" == obj.sampleImagesDir());
+  }
+
+  void test_flatImagesDir() {
+    StackOfImagesDirs obj("");
+
+    TS_ASSERT_THROWS_NOTHING(obj.description());
+    TSM_ASSERT("The flat images directory of an empty stack should be empty",
+               "" == obj.flatImagesDir());
+  }
+
+  void test_darkImagesDir() {
+    StackOfImagesDirs obj("");
+
+    TS_ASSERT_THROWS_NOTHING(obj.description());
+    TSM_ASSERT("The dark images directory of an empty stack should be empty",
+               "" == obj.flatImagesDir());
+  }
+
+  void test_sampleFiles() {
+    StackOfImagesDirs obj("");
+
+    TS_ASSERT_THROWS_NOTHING(obj.description());
+    TSM_ASSERT("There should not be any sample files in an empty stack",
+               0 == obj.sampleImagesDir().size());
+  }
+
+  void test_flatFiles() {
+    StackOfImagesDirs obj("");
+
+    TS_ASSERT_THROWS_NOTHING(obj.description());
+    TSM_ASSERT("There should not be any flat image files in an empty stack",
+               0 == obj.flatImagesDir().size());
+  }
+
+  void test_darkFiles() {
+    StackOfImagesDirs obj("");
+
+    TS_ASSERT_THROWS_NOTHING(obj.description());
+    TSM_ASSERT("There should not be any dark image files in an empty stack",
+               0 == obj.darkImagesDir().size());
+  }
+
+private:
+  boost::scoped_ptr<StackOfImagesDirs> m_soid;
+};
+
+#endif /*  MANTID_CUSTOMINTERFACES_STACKOFIMAGESDIRSTEST_H */
diff --git a/MantidQt/Factory/test/WidgetFactoryTest.h b/MantidQt/Factory/test/WidgetFactoryTest.h
index c1c0ba1a3b2cf56e972b3fb63b33bee18c07d904..c71fdc3eb2f0b2adcb22296c1022943e81b60e05 100644
--- a/MantidQt/Factory/test/WidgetFactoryTest.h
+++ b/MantidQt/Factory/test/WidgetFactoryTest.h
@@ -4,8 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/Timer.h"
 #include "MantidKernel/System.h"
-#include <iostream>
-#include <iomanip>
 
 #include "MantidFactory/WidgetFactory.h"
 
diff --git a/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/FunctionBrowser.h b/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/FunctionBrowser.h
index 87c698152d416147984d697f1388586bcfcbb8c6..c9ed1e70dcc5161d9133979b1a95a8ff6dcd466e 100644
--- a/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/FunctionBrowser.h
+++ b/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/FunctionBrowser.h
@@ -296,6 +296,8 @@ protected slots:
   void parameterChanged(QtProperty*);
   void parameterButtonClicked(QtProperty*);
   void globalChanged(QtProperty*, const QString&, bool);
+  /// Set value of an attribute (as a property) to a function
+  void setAttributeToFunction(Mantid::API::IFunction& fun, QtProperty* prop);
 
 protected:
   /// Manager for function group properties
diff --git a/MantidQt/MantidWidgets/src/FunctionBrowser.cpp b/MantidQt/MantidWidgets/src/FunctionBrowser.cpp
index edd8806fe5a7c6193b98df76b252a8d114346712..4184cc459586d37d77b198d246ceac180de1eab4 100644
--- a/MantidQt/MantidWidgets/src/FunctionBrowser.cpp
+++ b/MantidQt/MantidWidgets/src/FunctionBrowser.cpp
@@ -1348,6 +1348,28 @@ void FunctionBrowser::addFunction()
   emit functionStructureChanged();
 }
 
+/**
+ * Set value of an attribute (as a property) to a function.
+ * @param fun :: Function to which attribute is set.
+ * @param prop :: A property with the name and value of the attribute.
+ */
+void FunctionBrowser::setAttributeToFunction(Mantid::API::IFunction& fun, QtProperty* prop)
+{
+    std::string attName = prop->propertyName().toStdString();
+    SetAttributeFromProperty setter(this,prop);
+    Mantid::API::IFunction::Attribute attr = fun.getAttribute(attName);
+    attr.apply(setter);
+    try
+    {
+      fun.setAttribute(attName,attr);
+    }
+    catch(std::exception& expt)
+    {
+      QMessageBox::critical(this,"MantidPlot - Error", "Cannot set attribute " + QString::fromStdString(attName) + 
+        " of function " + prop->propertyName() + ":\n\n" + QString::fromStdString(expt.what()));
+    }
+}
+
 /**
  * Return the function 
  * @param prop :: Function property 
@@ -1380,6 +1402,10 @@ Mantid::API::IFunction_sptr FunctionBrowser::getFunction(QtProperty* prop, bool
           cf->addFunction(f);
         }
       }
+      else if (isAttribute(child))
+      {
+        setAttributeToFunction(*fun, child);
+      }
     }
   }
   else
@@ -1390,19 +1416,7 @@ Mantid::API::IFunction_sptr FunctionBrowser::getFunction(QtProperty* prop, bool
     {
       if (isAttribute(child))
       {
-        std::string attName = child->propertyName().toStdString();
-        SetAttributeFromProperty setter(this,child);
-        Mantid::API::IFunction::Attribute attr = fun->getAttribute(attName);
-        attr.apply(setter);
-        try
-        {
-          fun->setAttribute(attName,attr);
-        }
-        catch(std::exception& expt)
-        {
-          QMessageBox::critical(this,"MantidPlot - Error", "Cannot set attribute " + QString::fromStdString(attName) + 
-            " of function " + prop->propertyName() + ":\n\n" + QString::fromStdString(expt.what()));
-        }
+        setAttributeToFunction(*fun, child);
       }
       else if (!attributesOnly && isParameter(child))
       {
diff --git a/MantidQt/MantidWidgets/src/MantidHelpWindow.cpp b/MantidQt/MantidWidgets/src/MantidHelpWindow.cpp
index 110d04a7ce3b306156982e09c7d770337e3c11f1..c599d37c08ed9c471329b6815bba7326ea8d541c 100644
--- a/MantidQt/MantidWidgets/src/MantidHelpWindow.cpp
+++ b/MantidQt/MantidWidgets/src/MantidHelpWindow.cpp
@@ -6,7 +6,6 @@
 #include "MantidKernel/RegistrationHelper.h"
 #include <boost/make_shared.hpp>
 #include <boost/lexical_cast.hpp>
-#include <iostream>
 #include <Poco/File.h>
 #include <Poco/Path.h>
 #include <QDesktopServices>
diff --git a/MantidQt/MantidWidgets/src/MuonSequentialFitDialog.cpp b/MantidQt/MantidWidgets/src/MuonSequentialFitDialog.cpp
index 49ba9501a901953737b28baed4496415ab89b8c3..2169429a18df8d1b89d87677a524940365dd3ffe 100644
--- a/MantidQt/MantidWidgets/src/MuonSequentialFitDialog.cpp
+++ b/MantidQt/MantidWidgets/src/MuonSequentialFitDialog.cpp
@@ -368,28 +368,23 @@ namespace MantidWidgets
 
       MatrixWorkspace_sptr ws;
 
-      auto load = boost::dynamic_pointer_cast<AlgorithmProxy>( AlgorithmManager::Instance().create("MuonLoad") );
-      load->setChild(true);
-      load->setRethrows(true);
-      load->copyPropertiesFrom(*m_loadAlg);
-
-      try
-      {
+      try {
+        auto load = AlgorithmManager::Instance().create("MuonLoad");
         load->initialize();
-
-        load->setPropertyValue( "Filename", fileIt->toStdString() );
-        load->setPropertyValue( "OutputWorkspace", "__YouDontSeeMeIAmNinja" ); // Is not used
-
-        if ( m_fitPropBrowser->rawData() ) // TODO: or vice verca?
-          load->setPropertyValue( "RebinParams", "" );
+        load->setChild(true);
+        load->setRethrows(true);
+        load->updatePropertyValues(*m_loadAlg);
+        load->setPropertyValue("Filename", fileIt->toStdString());
+        load->setPropertyValue("OutputWorkspace", "__YouDontSeeMeIAmNinja");
+        if (m_fitPropBrowser->rawData()) // TODO: or vice verca?
+          load->setPropertyValue("RebinParams", "");
 
         load->execute();
 
         ws = load->getProperty("OutputWorkspace");
-      }
-      catch(...)
-      {
-        QMessageBox::critical(this, "Loading failed", 
+      } catch (...) {
+        QMessageBox::critical(
+            this, "Loading failed",
             "Unable to load one of the files.\n\nCheck log for details");
         break;
       }
diff --git a/MantidQt/MantidWidgets/src/ScriptEditor.cpp b/MantidQt/MantidWidgets/src/ScriptEditor.cpp
index 5e4c2bdfdc1e08b8674f9fe6e1656ad1400032d5..c43f2cfbb1a1d9c4097ab94b1005affc319fd729 100644
--- a/MantidQt/MantidWidgets/src/ScriptEditor.cpp
+++ b/MantidQt/MantidWidgets/src/ScriptEditor.cpp
@@ -33,7 +33,6 @@
 
 // std
 #include <cmath>
-#include <iostream>
 #include <stdexcept>
 
 //***************************************************************************
diff --git a/MantidQt/MantidWidgets/src/StringDialogEditor.cpp b/MantidQt/MantidWidgets/src/StringDialogEditor.cpp
index e84f62ba44425c25dad7ad366840415801fea769..ade129f78b7cec64e1695fcdae8387ba1a1ba1c2 100644
--- a/MantidQt/MantidWidgets/src/StringDialogEditor.cpp
+++ b/MantidQt/MantidWidgets/src/StringDialogEditor.cpp
@@ -8,7 +8,6 @@
 #include <QDialog>
 #include <QSettings>
 
-#include <iostream>
 
 /**
  * Do nothing to connect a manager.
diff --git a/MantidQt/RefDetectorViewer/src/RefDetectorViewDemo.cpp b/MantidQt/RefDetectorViewer/src/RefDetectorViewDemo.cpp
index e2ea0e8b756fe4cea00cad7c259f1c9b67ca2e74..1b1e345cf845a06d583b199a8a3cdaa859bdde2b 100644
--- a/MantidQt/RefDetectorViewer/src/RefDetectorViewDemo.cpp
+++ b/MantidQt/RefDetectorViewer/src/RefDetectorViewDemo.cpp
@@ -1,5 +1,4 @@
 
-#include <iostream>
 
 #include <qapplication.h>
 #include <QMainWindow>
diff --git a/MantidQt/RefDetectorViewer/src/RefIVConnections.cpp b/MantidQt/RefDetectorViewer/src/RefIVConnections.cpp
index 42109cf39cb741c66532ba2f48175657f912c1f1..fede037dfe08d334af22b6e2ac84e3a69c6ce4ab 100644
--- a/MantidQt/RefDetectorViewer/src/RefIVConnections.cpp
+++ b/MantidQt/RefDetectorViewer/src/RefIVConnections.cpp
@@ -1,4 +1,3 @@
-#include <iostream>
 #include <QLineEdit>
 #include <qwt_plot_canvas.h>
 
diff --git a/MantidQt/RefDetectorViewer/src/RefImageView.cpp b/MantidQt/RefDetectorViewer/src/RefImageView.cpp
index d5385cb4dfabf1705b33836cfad1a80b317c0b04..6c35c6eca90f9310165abb98770d2187e8b33ac9 100644
--- a/MantidQt/RefDetectorViewer/src/RefImageView.cpp
+++ b/MantidQt/RefDetectorViewer/src/RefImageView.cpp
@@ -1,4 +1,3 @@
-#include <iostream>
 #include  "MantidQtRefDetectorViewer/RefImageView.h"
 #include  "MantidQtSpectrumViewer/ColorMaps.h"
 
diff --git a/MantidQt/RefDetectorViewer/src/RefMatrixWSImageView.cpp b/MantidQt/RefDetectorViewer/src/RefMatrixWSImageView.cpp
index 91e32036086d49609005d0d6a88c4c2bc5b425cb..f63397e1da6a002c61af56b0009f4e82f0e7347d 100644
--- a/MantidQt/RefDetectorViewer/src/RefMatrixWSImageView.cpp
+++ b/MantidQt/RefDetectorViewer/src/RefMatrixWSImageView.cpp
@@ -1,4 +1,3 @@
-#include <iostream>
 #include "MantidQtRefDetectorViewer/RefMatrixWSImageView.h"
 #include "MantidQtSpectrumViewer/ArrayDataSource.h"
 #include "MantidQtRefDetectorViewer/RefIVConnections.h"
diff --git a/MantidQt/RefDetectorViewer/src/RefRangeHandler.cpp b/MantidQt/RefDetectorViewer/src/RefRangeHandler.cpp
index 437a3cc7efab6c8ff53384b2bb074d8bc1ecceb7..a2f7d1d8b70fe1c2a2c23a6b0b45742bd0783a0b 100644
--- a/MantidQt/RefDetectorViewer/src/RefRangeHandler.cpp
+++ b/MantidQt/RefDetectorViewer/src/RefRangeHandler.cpp
@@ -1,4 +1,3 @@
-#include <iostream>
 #include <QLineEdit>
 
 #include "MantidQtRefDetectorViewer/RefRangeHandler.h"
diff --git a/MantidQt/RefDetectorViewer/src/RefSliderHandler.cpp b/MantidQt/RefDetectorViewer/src/RefSliderHandler.cpp
index 2fc6a2faef46f94b33b14e63c443c04e88a27983..e11b1cbf4651ad74ecfed24339d28e2f569de825 100644
--- a/MantidQt/RefDetectorViewer/src/RefSliderHandler.cpp
+++ b/MantidQt/RefDetectorViewer/src/RefSliderHandler.cpp
@@ -1,5 +1,4 @@
 
-#include <iostream>
 
 #include <QScrollBar>
 #include "MantidQtRefDetectorViewer/RefSliderHandler.h"
diff --git a/MantidQt/SliceViewer/inc/MantidQtSliceViewer/ColorBarWidget.h b/MantidQt/SliceViewer/inc/MantidQtSliceViewer/ColorBarWidget.h
index a6b08722eeee9f4a95503a74710bb2ba8d442f32..c2f95a52d1608a637176d0ed8cd988b66ccf34d2 100644
--- a/MantidQt/SliceViewer/inc/MantidQtSliceViewer/ColorBarWidget.h
+++ b/MantidQt/SliceViewer/inc/MantidQtSliceViewer/ColorBarWidget.h
@@ -6,7 +6,6 @@
 #include <qwt_color_map.h>
 #include <qwt_scale_widget.h>
 #include "MantidQtAPI/MantidColorMap.h"
-#include <iostream>
 #include <QKeyEvent>
 #include <QtGui>
 #include "DllOption.h"
diff --git a/MantidQt/SliceViewer/src/ColorBarWidget.cpp b/MantidQt/SliceViewer/src/ColorBarWidget.cpp
index 0f3c72044c8c09bbe04904e703fb789d0e477169..0d07267f6758ba5d21e982224e0d161bbf40ce69 100644
--- a/MantidQt/SliceViewer/src/ColorBarWidget.cpp
+++ b/MantidQt/SliceViewer/src/ColorBarWidget.cpp
@@ -4,7 +4,6 @@
 #include "qwt_scale_div.h"
 #include "MantidQtAPI/PowerScaleEngine.h"
 #include <iosfwd>
-#include <iostream>
 #include <qwt_scale_map.h>
 #include <qwt_scale_widget.h>
 #include <QKeyEvent>
diff --git a/MantidQt/SliceViewer/src/CustomTools.cpp b/MantidQt/SliceViewer/src/CustomTools.cpp
index 34439d2e5dce221ff7dc0492d684240de0cfd454..f0a8f6ca9a73528e657fb7715094bfe700e17d03 100644
--- a/MantidQt/SliceViewer/src/CustomTools.cpp
+++ b/MantidQt/SliceViewer/src/CustomTools.cpp
@@ -1,7 +1,5 @@
 #include "MantidQtSliceViewer/CustomTools.h"
-#include <iomanip>
 #include <iosfwd>
-#include <iostream>
 
 namespace MantidQt
 {
diff --git a/MantidQt/SliceViewer/src/DimensionSliceWidget.cpp b/MantidQt/SliceViewer/src/DimensionSliceWidget.cpp
index 7d2892969e789160b0fa17b9d92cfc4b37f306ee..9572cd4842eb5ff001fe9849a8321fed75d67e13 100644
--- a/MantidQt/SliceViewer/src/DimensionSliceWidget.cpp
+++ b/MantidQt/SliceViewer/src/DimensionSliceWidget.cpp
@@ -1,8 +1,6 @@
 #include "MantidQtSliceViewer/DimensionSliceWidget.h"
 #include "MantidKernel/UnitLabel.h"
 #include <iosfwd>
-#include <iostream>
-#include <iomanip>
 #include <qlayout.h>
 
 namespace MantidQt
diff --git a/MantidQt/SliceViewer/src/LineOverlay.cpp b/MantidQt/SliceViewer/src/LineOverlay.cpp
index b68d0a89adb8c7a8fb8409041db2bb6178765fa8..4a172e3a2b9abaf003ac506deb8d8d4bb82aef08 100644
--- a/MantidQt/SliceViewer/src/LineOverlay.cpp
+++ b/MantidQt/SliceViewer/src/LineOverlay.cpp
@@ -1,7 +1,6 @@
 #include "MantidQtSliceViewer/LineOverlay.h"
 #include <qwt_plot.h>
 #include <qwt_plot_canvas.h>
-#include <iostream>
 #include <qpainter.h>
 #include <QRect>
 #include <QShowEvent>
diff --git a/MantidQt/SliceViewer/src/PeaksTableColumnsDialog.cpp b/MantidQt/SliceViewer/src/PeaksTableColumnsDialog.cpp
index 1de3e15906ed4a4ec91005183d2ad4ac03338d36..bde8b1a41bd512e6db1f627a7af807d8becad7f5 100644
--- a/MantidQt/SliceViewer/src/PeaksTableColumnsDialog.cpp
+++ b/MantidQt/SliceViewer/src/PeaksTableColumnsDialog.cpp
@@ -3,7 +3,6 @@
 #include "ui_PeaksTableColumnsDialog.h"
 
 // REMOVE
-#include <iostream>
 
 namespace MantidQt
 {
diff --git a/MantidQt/SliceViewer/src/PeaksViewer.cpp b/MantidQt/SliceViewer/src/PeaksViewer.cpp
index 8034a80c7909877c78b2e430082b98b8e5b4776a..ac8fb544ccfb0608c79fc78374bcc485ece737eb 100644
--- a/MantidQt/SliceViewer/src/PeaksViewer.cpp
+++ b/MantidQt/SliceViewer/src/PeaksViewer.cpp
@@ -122,9 +122,9 @@ PeaksViewer::~PeaksViewer() {}
  */
 bool PeaksViewer::hasThingsToShow() const { return m_presenter->size() >= 1; }
 
-void PeaksViewer::   clearPeaksModeRequest(
+void PeaksViewer::clearPeaksModeRequest(
     const PeaksWorkspaceWidget *const originWidget, const bool on) {
-  EditMode mode;
+  EditMode mode = None;
   if (on) {
     QList<PeaksWorkspaceWidget *> children =
         qFindChildren<PeaksWorkspaceWidget *>(this);
@@ -149,7 +149,7 @@ void PeaksViewer::   clearPeaksModeRequest(
 
 void PeaksViewer::addPeaksModeRequest(const PeaksWorkspaceWidget * const originWidget, const bool on)
 {
-    EditMode mode;
+    EditMode mode = None;
     if(on) {
     QList<PeaksWorkspaceWidget *> children =
         qFindChildren<PeaksWorkspaceWidget *>(this);
diff --git a/MantidQt/SliceViewer/src/SliceViewer.cpp b/MantidQt/SliceViewer/src/SliceViewer.cpp
index 003b774d559d147bd58d8499864d82b2bd81c4b3..f251baaf4445e9f32142a3d54ea3d16ef6fe62a6 100644
--- a/MantidQt/SliceViewer/src/SliceViewer.cpp
+++ b/MantidQt/SliceViewer/src/SliceViewer.cpp
@@ -1,6 +1,4 @@
-#include <iomanip>
 #include <iosfwd>
-#include <iostream>
 #include <limits>
 #include <sstream>
 #include <vector>
diff --git a/MantidQt/SliceViewer/src/main_ColorBarWidgetDemo.cpp b/MantidQt/SliceViewer/src/main_ColorBarWidgetDemo.cpp
index a0fb09e4c9b4bb58d0ddee2733d3effd3be311fe..e15a843addf5892282fac9202ba3da551bc98cf3 100644
--- a/MantidQt/SliceViewer/src/main_ColorBarWidgetDemo.cpp
+++ b/MantidQt/SliceViewer/src/main_ColorBarWidgetDemo.cpp
@@ -1,6 +1,5 @@
 #include "MantidQtSliceViewer/ColorBarWidget.h"
 #include "qmainwindow.h"
-#include <iostream>
 #include <QApplication>
 #include <QDir>
 #include <QMessageBox>
diff --git a/MantidQt/SliceViewer/src/main_LineViewerDemo.cpp b/MantidQt/SliceViewer/src/main_LineViewerDemo.cpp
index ab70ae54f0271fe4bf4c37cfa2405b75a5aeff61..cd15090523f4ee85b23614b04c3b795b40e11b72 100644
--- a/MantidQt/SliceViewer/src/main_LineViewerDemo.cpp
+++ b/MantidQt/SliceViewer/src/main_LineViewerDemo.cpp
@@ -1,4 +1,3 @@
-#include <iostream>
 #include <QApplication>
 #include <QSplashScreen>
 #include <QMessageBox>
diff --git a/MantidQt/SliceViewer/src/main_SliceViewerDemo.cpp b/MantidQt/SliceViewer/src/main_SliceViewerDemo.cpp
index cb76eb2a00ba7dcc091b2380be3c8fa129947142..37ce5d6153da9efdc8fd18557ff2fa19f4d6b181 100644
--- a/MantidQt/SliceViewer/src/main_SliceViewerDemo.cpp
+++ b/MantidQt/SliceViewer/src/main_SliceViewerDemo.cpp
@@ -1,4 +1,3 @@
-#include <iostream>
 #include <QApplication>
 #include <QSplashScreen>
 #include <QMessageBox>
diff --git a/MantidQt/SliceViewer/src/main_SliceViewerWindowDemo.cpp b/MantidQt/SliceViewer/src/main_SliceViewerWindowDemo.cpp
index 0167bc47a4bc670947ec60b07d1b7fb3cb9de8d5..41db0d8e18dc94191842f2690d089868d87bb850 100644
--- a/MantidQt/SliceViewer/src/main_SliceViewerWindowDemo.cpp
+++ b/MantidQt/SliceViewer/src/main_SliceViewerWindowDemo.cpp
@@ -1,4 +1,3 @@
-#include <iostream>
 #include <QApplication>
 #include <QSplashScreen>
 #include <QMessageBox>
diff --git a/MantidQt/SpectrumViewer/inc/MantidQtSpectrumViewer/GraphDisplay.h b/MantidQt/SpectrumViewer/inc/MantidQtSpectrumViewer/GraphDisplay.h
index b3cd39f36e9a261ea1cfe2f29978d28b1efbb2c1..a7cdd630803f9bf82ed17fe8141e2dfad3eaac94 100644
--- a/MantidQt/SpectrumViewer/inc/MantidQtSpectrumViewer/GraphDisplay.h
+++ b/MantidQt/SpectrumViewer/inc/MantidQtSpectrumViewer/GraphDisplay.h
@@ -96,7 +96,7 @@ class EXPORT_OPT_MANTIDQT_SPECTRUMVIEWER GraphDisplay
    double m_minY;
    double m_maxY;
 
-   static QColor g_curveColors[];
+   static std::vector<QColor> g_curveColors;
 
 };
 
diff --git a/MantidQt/SpectrumViewer/src/ArrayDataSource.cpp b/MantidQt/SpectrumViewer/src/ArrayDataSource.cpp
index f07a4d1fff274132afedc075123d55301a0956df..30953f04ffdcde5c30572b985a691b892834a208 100644
--- a/MantidQt/SpectrumViewer/src/ArrayDataSource.cpp
+++ b/MantidQt/SpectrumViewer/src/ArrayDataSource.cpp
@@ -1,4 +1,3 @@
-#include <iostream>
 
 #include <math.h>
 
diff --git a/MantidQt/SpectrumViewer/src/ColorMaps.cpp b/MantidQt/SpectrumViewer/src/ColorMaps.cpp
index 9b09dc5da6ff87ffbf88eb1e6993e5262301410e..b140b53c22bafb0599af6efc2fb638afae0b8783 100644
--- a/MantidQt/SpectrumViewer/src/ColorMaps.cpp
+++ b/MantidQt/SpectrumViewer/src/ColorMaps.cpp
@@ -1,5 +1,4 @@
 
-#include <iostream>
 #include <sstream>
 #include <math.h>
 
diff --git a/MantidQt/SpectrumViewer/src/DataArray.cpp b/MantidQt/SpectrumViewer/src/DataArray.cpp
index b18fa1015585a98773ed6764dc13755cb4fb2902..e3c58c8b73203f83d7f76378c28678db3bd9b482 100644
--- a/MantidQt/SpectrumViewer/src/DataArray.cpp
+++ b/MantidQt/SpectrumViewer/src/DataArray.cpp
@@ -2,7 +2,6 @@
  * File DataArray.cpp
  */
 
-#include <iostream>
 #include <math.h>
 
 #include "MantidQtSpectrumViewer/DataArray.h"
diff --git a/MantidQt/SpectrumViewer/src/EModeHandler.cpp b/MantidQt/SpectrumViewer/src/EModeHandler.cpp
index 6176600a7cfde795a86f65d6ce8425e016a9eb7f..3ec420a5f46b67074a5dc8bb45ff47fbdc32b121 100644
--- a/MantidQt/SpectrumViewer/src/EModeHandler.cpp
+++ b/MantidQt/SpectrumViewer/src/EModeHandler.cpp
@@ -1,10 +1,10 @@
 #include <iostream>
-#include <QLineEdit>
 
 #include "MantidQtSpectrumViewer/EModeHandler.h"
 #include "MantidQtSpectrumViewer/QtUtils.h"
 #include "MantidKernel/Logger.h"
 
+#include <QLineEdit>
 
 namespace
 {
diff --git a/MantidQt/SpectrumViewer/src/GraphDisplay.cpp b/MantidQt/SpectrumViewer/src/GraphDisplay.cpp
index 2cf6a0fdb433a816e7fef527d354594f7128de58..3b3f3f25de46e91737a218ce8c00db2f5d172919 100644
--- a/MantidQt/SpectrumViewer/src/GraphDisplay.cpp
+++ b/MantidQt/SpectrumViewer/src/GraphDisplay.cpp
@@ -1,4 +1,3 @@
-#include <iostream>
 #include <QtGui>
 #include <QVector>
 #include <QString>
@@ -13,7 +12,7 @@ namespace MantidQt
 namespace SpectrumView
 {
 
-QColor GraphDisplay::g_curveColors[] = {Qt::black, Qt::red, Qt::green, Qt::blue};
+std::vector<QColor> GraphDisplay::g_curveColors;
 
 /**
  *  Construct a GraphDisplay to display selected graph on the specifed plot
@@ -41,6 +40,11 @@ GraphDisplay::GraphDisplay( QwtPlot*      graphPlot,
 {
   if(isVertical)
     graphPlot->setAxisMaxMajor( QwtPlot::xBottom, 3 );
+
+  g_curveColors.push_back(Qt::black);
+  g_curveColors.push_back(Qt::red);
+  g_curveColors.push_back(Qt::green);
+  g_curveColors.push_back(Qt::blue);
 }
 
 
@@ -131,7 +135,7 @@ void GraphDisplay::setData(const QVector<double> & xData,
   auto curve = new QwtPlotCurve;
   curve->setData( xData, yData );
   curve->attach( m_graphPlot );
-  auto colorIndex = m_curves.size() % sizeof(g_curveColors);
+  auto colorIndex = m_curves.size() % g_curveColors.size();
   curve->setPen(QPen(g_curveColors[colorIndex]));
   m_curves.append(curve);
 
diff --git a/MantidQt/SpectrumViewer/src/MatrixWSDataSource.cpp b/MantidQt/SpectrumViewer/src/MatrixWSDataSource.cpp
index 583079fd990ea83b10b122b2e1ae4ac438dd1a90..4992d41c67bab03a64312e6eb7eb3383f293ab59 100644
--- a/MantidQt/SpectrumViewer/src/MatrixWSDataSource.cpp
+++ b/MantidQt/SpectrumViewer/src/MatrixWSDataSource.cpp
@@ -3,7 +3,6 @@
  */
 
 #include <boost/lexical_cast.hpp>
-#include <iostream>
 #include <sstream>
 #include <math.h>
 
diff --git a/MantidQt/SpectrumViewer/src/MatrixWSSpectrumView.cpp b/MantidQt/SpectrumViewer/src/MatrixWSSpectrumView.cpp
index a7622cd74bf117470e53961d4d91e7b9bea8e99c..07f3aa6ea64f2560069afb4caaa5ef794c3086ef 100644
--- a/MantidQt/SpectrumViewer/src/MatrixWSSpectrumView.cpp
+++ b/MantidQt/SpectrumViewer/src/MatrixWSSpectrumView.cpp
@@ -1,4 +1,3 @@
-#include <iostream>
 #include "MantidQtSpectrumViewer/MatrixWSSpectrumView.h"
 
 #include "MantidAPI/MatrixWorkspace.h"
diff --git a/MantidQt/SpectrumViewer/src/RangeHandler.cpp b/MantidQt/SpectrumViewer/src/RangeHandler.cpp
index 416b7f2a44461e84f48fb5d5c8ee0d156090ab5d..5f48eb5654681b3bafb2f370b28ab07f6b979d4a 100644
--- a/MantidQt/SpectrumViewer/src/RangeHandler.cpp
+++ b/MantidQt/SpectrumViewer/src/RangeHandler.cpp
@@ -1,4 +1,3 @@
-#include <iostream>
 #include <QLineEdit>
 
 #include "MantidQtSpectrumViewer/RangeHandler.h"
diff --git a/MantidQt/SpectrumViewer/src/SVConnections.cpp b/MantidQt/SpectrumViewer/src/SVConnections.cpp
index ca5442b9f602b98fb662cc00490f4fd71ce93d79..1d01bd1363492d1c408689f1fb80582408feb90f 100644
--- a/MantidQt/SpectrumViewer/src/SVConnections.cpp
+++ b/MantidQt/SpectrumViewer/src/SVConnections.cpp
@@ -1,4 +1,3 @@
-#include <iostream>
 #include <qwt_plot_canvas.h>
 
 #include <QDesktopServices>
diff --git a/MantidQt/SpectrumViewer/src/SliderHandler.cpp b/MantidQt/SpectrumViewer/src/SliderHandler.cpp
index d5fec750d75f7ff095511da02ab005be42f79d6c..715029998eacdf4deb8abc781b9b2b9414a24471 100644
--- a/MantidQt/SpectrumViewer/src/SliderHandler.cpp
+++ b/MantidQt/SpectrumViewer/src/SliderHandler.cpp
@@ -1,4 +1,3 @@
-#include <iostream>
 
 #include <QScrollBar>
 #include "MantidQtSpectrumViewer/SliderHandler.h"
diff --git a/MantidQt/SpectrumViewer/src/SpectrumDataSource.cpp b/MantidQt/SpectrumViewer/src/SpectrumDataSource.cpp
index 510b583f2d4b6993a18de0e986ce017ae024d9d8..680ceb0a500e665e692aa6cb7f7903391db09e9c 100644
--- a/MantidQt/SpectrumViewer/src/SpectrumDataSource.cpp
+++ b/MantidQt/SpectrumViewer/src/SpectrumDataSource.cpp
@@ -1,4 +1,3 @@
-#include <iostream>
 
 #include <math.h>
 
diff --git a/MantidQt/SpectrumViewer/src/SpectrumDisplay.cpp b/MantidQt/SpectrumViewer/src/SpectrumDisplay.cpp
index f66bb0b012b50251e8f6ef3d33016b7ce23fa132..408c6d7f79c21773f60b97ea9bcc0078001c5f8b 100644
--- a/MantidQt/SpectrumViewer/src/SpectrumDisplay.cpp
+++ b/MantidQt/SpectrumViewer/src/SpectrumDisplay.cpp
@@ -1,4 +1,3 @@
-#include <iostream>
 #include <sstream>
 #include <cfloat>
 
diff --git a/MantidQt/SpectrumViewer/src/SpectrumPlotItem.cpp b/MantidQt/SpectrumViewer/src/SpectrumPlotItem.cpp
index 1ae3028c5dee447cd2f9ab02dea924b17d3c52ce..84b355b43ed59c8981e4a351feaabd81c9a42d5b 100644
--- a/MantidQt/SpectrumViewer/src/SpectrumPlotItem.cpp
+++ b/MantidQt/SpectrumViewer/src/SpectrumPlotItem.cpp
@@ -1,4 +1,3 @@
-#include <iostream>
 #include <QThread>
 #include "MantidQtSpectrumViewer/SpectrumPlotItem.h"
 
diff --git a/MantidQt/SpectrumViewer/src/SpectrumView.cpp b/MantidQt/SpectrumViewer/src/SpectrumView.cpp
index 9b01297abec173f4261802af8a946c3693ef28b5..272a637544fa05f57351c722db3fca4a8be882fe 100644
--- a/MantidQt/SpectrumViewer/src/SpectrumView.cpp
+++ b/MantidQt/SpectrumViewer/src/SpectrumView.cpp
@@ -1,4 +1,3 @@
-#include <iostream>
 #include "MantidQtSpectrumViewer/SpectrumView.h"
 
 #include "MantidAPI/MatrixWorkspace.h"
diff --git a/QtPropertyBrowser/src/DoubleEditorFactory.cpp b/QtPropertyBrowser/src/DoubleEditorFactory.cpp
index 666130ec533e86688c3390288d89edcd15564f9b..6e93ddb27ccc28408af51011f62f5405f61b7e68 100644
--- a/QtPropertyBrowser/src/DoubleEditorFactory.cpp
+++ b/QtPropertyBrowser/src/DoubleEditorFactory.cpp
@@ -4,7 +4,6 @@
 
 #include <QDoubleValidator>
 
-#include <iostream>
 #include <cfloat>
 #include <sstream>
 #include <cmath>
diff --git a/QtPropertyBrowser/src/qttreepropertybrowser.cpp b/QtPropertyBrowser/src/qttreepropertybrowser.cpp
index 53f493d7bee8d791a84e17494c4fdab5350c34ff..63b6b13a9ace25a0f4f8a7199204b4fa24376f9e 100644
--- a/QtPropertyBrowser/src/qttreepropertybrowser.cpp
+++ b/QtPropertyBrowser/src/qttreepropertybrowser.cpp
@@ -100,7 +100,6 @@
 #include <QtGui/qcheckbox.h>
 #include <QtGui/qlineedit.h>
 
-#include <iostream>
 
 #if QT_VERSION >= 0x040400
 QT_BEGIN_NAMESPACE
diff --git a/Testing/Data/DocTest/EVS15289.raw.md5 b/Testing/Data/DocTest/EVS15289.raw.md5
new file mode 100644
index 0000000000000000000000000000000000000000..dc2506b23352680b70b700899227c9fd2fc8a379
--- /dev/null
+++ b/Testing/Data/DocTest/EVS15289.raw.md5
@@ -0,0 +1 @@
+ea1cb1b0d1daa9579fbeb4acf3716162
\ No newline at end of file
diff --git a/Testing/Data/UnitTest/EVS15289.raw.md5 b/Testing/Data/UnitTest/EVS15289.raw.md5
new file mode 100644
index 0000000000000000000000000000000000000000..dc2506b23352680b70b700899227c9fd2fc8a379
--- /dev/null
+++ b/Testing/Data/UnitTest/EVS15289.raw.md5
@@ -0,0 +1 @@
+ea1cb1b0d1daa9579fbeb4acf3716162
\ No newline at end of file
diff --git a/Testing/SystemTests/tests/analysis/LoadVesuvioTest.py b/Testing/SystemTests/tests/analysis/LoadVesuvioTest.py
index d0fbaa674ef409534fa863367f3485c382d0a7c4..11fa3b62ea0893150faf633ee78992f4c4117bdd 100644
--- a/Testing/SystemTests/tests/analysis/LoadVesuvioTest.py
+++ b/Testing/SystemTests/tests/analysis/LoadVesuvioTest.py
@@ -238,6 +238,10 @@ class VesuvioTests(unittest.TestCase):
 
     #================== Failure cases ================================
 
+    def test_run_range_bad_order_raises_error(self):
+        self.assertRaises(RuntimeError, ms.LoadVesuvio, Filename="14188-14187",
+                          OutputWorkspace=self.ws_name)
+
     def test_missing_spectra_property_raises_error(self):
         self.assertRaises(RuntimeError, ms.LoadVesuvio, Filename="14188",
                           OutputWorkspace=self.ws_name)
diff --git a/Testing/SystemTests/tests/analysis/SNSPowderRedux.py b/Testing/SystemTests/tests/analysis/SNSPowderRedux.py
index 7db8091f619f1dcf2c0250cc97f6dbacadb17943..2f6331ed6f310ef032875a9aa46700b0c3b4093a 100644
--- a/Testing/SystemTests/tests/analysis/SNSPowderRedux.py
+++ b/Testing/SystemTests/tests/analysis/SNSPowderRedux.py
@@ -17,7 +17,8 @@ def getSaveDir():
     return os.path.abspath(os.path.curdir)
 
 def do_cleanup():
-    Files = ["PG3_9829.gsa",
+    Files = ["PG3_9829.getn",
+             "PG3_9829.gsa",
              "PG3_9829.py",
              "PG3_9830.gsa",
              "PG3_9830.py",
@@ -249,3 +250,38 @@ class SeriesAndConjoinFilesTest(stresstesting.MantidStressTest):
         self.tolerance = 1.0e-2
         return ('PG3_9829','PG3_9829_golden')
         #return ('PG3_9830','PG3_9830_golden') # can only validate one workspace
+
+class ToPDFgetNTest(stresstesting.MantidStressTest):
+    cal_file   = "PG3_FERNS_d4832_2011_08_24.cal"
+    char_file  = "PG3_characterization_2012_02_23-HR-ILL.txt"
+    data_file = "PG3_9829_event.nxs"
+    getn_file = "PG3_9829.getn"
+
+    def cleanup(self):
+        do_cleanup()
+        return True
+
+    def requiredMemoryMB(self):
+        """Requires 3Gb"""
+        return 3000
+
+    def requiredFiles(self):
+        files = [self.cal_file, self.char_file, self.data_file]
+        return files
+
+    def runTest(self):
+        savedir = getSaveDir()
+        PDToPDFgetN(Filename=self.data_file,
+                    FilterBadPulses=25,
+                    OutputWorkspace=self.data_file,
+                    PDFgetNFile=os.path.join(savedir, self.getn_file),
+                    CalibrationFile=self.cal_file,
+                    CharacterizationRunsFile=self.char_file,
+                    RemovePromptPulseWidth=50,
+                    Binning=-.0004)
+
+    def validateMethod(self):
+        return None # it running is all that we need
+
+    def validate(self):
+        pass
diff --git a/Vates/VatesAPI/inc/MantidVatesAPI/BoxInfo.h b/Vates/VatesAPI/inc/MantidVatesAPI/BoxInfo.h
index b2f5520e9d5c55ec514ab270c3caf020b51200c1..dec4eabbd7d3cd7c9aec07346fcfcada4775bcf6 100644
--- a/Vates/VatesAPI/inc/MantidVatesAPI/BoxInfo.h
+++ b/Vates/VatesAPI/inc/MantidVatesAPI/BoxInfo.h
@@ -2,7 +2,6 @@
 #define MANTID_VATESAPI_BOXINFO_H
 
 #include "MantidKernel/System.h"
-#include <iostream>
 #include <boost/optional.hpp>
 
 namespace Mantid
diff --git a/Vates/VatesAPI/src/vtkMDHistoQuadFactory.cpp b/Vates/VatesAPI/src/vtkMDHistoQuadFactory.cpp
index 748722813c5ac3a15ecafcdd812c525e03cee2c2..5413e173b246519bac7a43cb2f923107b971d8ea 100644
--- a/Vates/VatesAPI/src/vtkMDHistoQuadFactory.cpp
+++ b/Vates/VatesAPI/src/vtkMDHistoQuadFactory.cpp
@@ -92,6 +92,12 @@ namespace Mantid
         coord_t incrementX = (maxX - minX) / static_cast<coord_t>(nBinsX);
         coord_t incrementY = (maxY - minY) / static_cast<coord_t>(nBinsY);
 
+        boost::scoped_ptr<MDHistoWorkspaceIterator> iterator(dynamic_cast<MDHistoWorkspaceIterator*>(createIteratorWithNormalization(m_normalizationOption, m_workspace.get())));
+        if (!iterator) {
+          throw std::runtime_error(
+              "Could not convert IMDIterator to a MDHistoWorkspaceIterator");
+        }
+
         const int imageSize = (nBinsX ) * (nBinsY );
         vtkPoints *points = vtkPoints::New();
         points->Allocate(static_cast<int>(imageSize));
@@ -119,8 +125,7 @@ namespace Mantid
 
         double progressFactor = 0.5/double(nBinsX);
         double progressOffset = 0.5;
-        boost::scoped_ptr<MDHistoWorkspaceIterator> iterator(dynamic_cast<MDHistoWorkspaceIterator*>(createIteratorWithNormalization(m_normalizationOption, m_workspace.get())));
-    
+
         size_t index = 0;
         for (int i = 0; i < nBinsX; i++)
         {
diff --git a/Vates/VatesAPI/src/vtkNullStructuredGrid.cpp b/Vates/VatesAPI/src/vtkNullStructuredGrid.cpp
index a246ffbe36d9d1b3524688f9db95f96e5a657ca9..7947450b22da6c73d4ee8252a95eea5457b8fc21 100644
--- a/Vates/VatesAPI/src/vtkNullStructuredGrid.cpp
+++ b/Vates/VatesAPI/src/vtkNullStructuredGrid.cpp
@@ -7,7 +7,7 @@
 #include <vtkFloatArray.h>
 #include <vtkSmartPointer.h>
 #include <vtkStructuredGrid.h>
-#include <iostream>
+
 namespace Mantid {
 namespace VATES {
 
diff --git a/Vates/VatesAPI/test/vtkNullStructuredGridTest.h b/Vates/VatesAPI/test/vtkNullStructuredGridTest.h
index b8ecc47ac82ccdb3aed0b4811e5c066c033085af..64a31dfec1469d20dff5306a94db7d4f0529d546 100644
--- a/Vates/VatesAPI/test/vtkNullStructuredGridTest.h
+++ b/Vates/VatesAPI/test/vtkNullStructuredGridTest.h
@@ -9,7 +9,6 @@
 
 #include <vtkStructuredGrid.h>
 #include <vtkPoints.h>
-#include <iostream>
 
 using namespace Mantid::VATES;
 
diff --git a/Vates/VatesSimpleGui/QtWidgets/src/GeometryParser.cpp b/Vates/VatesSimpleGui/QtWidgets/src/GeometryParser.cpp
index e8aa4715613c8895ac59bf79898ef0fd591db0f6..28f88d9e6f24210e44346d13a18b719cf9c25a0c 100644
--- a/Vates/VatesSimpleGui/QtWidgets/src/GeometryParser.cpp
+++ b/Vates/VatesSimpleGui/QtWidgets/src/GeometryParser.cpp
@@ -1,4 +1,3 @@
-#include <iostream>
 #include <sstream>
 
 #include "MantidVatesSimpleGuiQtWidgets/GeometryParser.h"
diff --git a/Vates/VatesSimpleGui/ViewWidgets/src/ColorSelectionWidget.cpp b/Vates/VatesSimpleGui/ViewWidgets/src/ColorSelectionWidget.cpp
index 2a56dae548867a9dd3969297b3b24ad199812192..d215e3aaa5365be30bc86a45144a951818488879 100644
--- a/Vates/VatesSimpleGui/ViewWidgets/src/ColorSelectionWidget.cpp
+++ b/Vates/VatesSimpleGui/ViewWidgets/src/ColorSelectionWidget.cpp
@@ -1,5 +1,4 @@
 #include <cfloat>
-#include <iostream>
 
 #include "MantidVatesSimpleGuiViewWidgets/ColorSelectionWidget.h"
 #include "MantidKernel/ConfigService.h"
diff --git a/Vates/VatesSimpleGui/ViewWidgets/src/MdViewerWidget.cpp b/Vates/VatesSimpleGui/ViewWidgets/src/MdViewerWidget.cpp
index d5cc40e9793a1ac9ce2792379dbbc078d7068e10..dbf6fd817431f0591b7576ca4777a10e31aa9b97 100644
--- a/Vates/VatesSimpleGui/ViewWidgets/src/MdViewerWidget.cpp
+++ b/Vates/VatesSimpleGui/ViewWidgets/src/MdViewerWidget.cpp
@@ -1,4 +1,3 @@
-#include <iostream>
 #include <vector>
 #include <set>
 #include <string>
diff --git a/Vates/VatesSimpleGui/ViewWidgets/src/MultisliceView.cpp b/Vates/VatesSimpleGui/ViewWidgets/src/MultisliceView.cpp
index 65311bdb14ca17768bbf9381059f61cbcf0af138..00e3995b05cd779744b32d892e331ea96c1bbdc3 100644
--- a/Vates/VatesSimpleGui/ViewWidgets/src/MultisliceView.cpp
+++ b/Vates/VatesSimpleGui/ViewWidgets/src/MultisliceView.cpp
@@ -36,7 +36,6 @@
 
 #include <QString>
 
-#include <iostream>
 
 using namespace Mantid::Geometry;
 using namespace MantidQt::SliceViewer;
diff --git a/Vates/VatesSimpleGui/ViewWidgets/src/ThreesliceView.cpp b/Vates/VatesSimpleGui/ViewWidgets/src/ThreesliceView.cpp
index b56216a22074ec3fec22343aef92b3741bf73436..962a116fc526c277ffadd1f32643bdb7623737f4 100644
--- a/Vates/VatesSimpleGui/ViewWidgets/src/ThreesliceView.cpp
+++ b/Vates/VatesSimpleGui/ViewWidgets/src/ThreesliceView.cpp
@@ -27,9 +27,6 @@
 
 #include <QMessageBox>
 
-#include <iostream>
-#include <string>
-
 namespace Mantid
 {
 namespace Vates
diff --git a/buildconfig/CMake/PylintSetup.cmake b/buildconfig/CMake/PylintSetup.cmake
index cb29dd4f648ff8e008c3a66f99566ecf1395c589..a83e20ff094e59e3a171bd0f85a12a4b0007cd2f 100644
--- a/buildconfig/CMake/PylintSetup.cmake
+++ b/buildconfig/CMake/PylintSetup.cmake
@@ -33,6 +33,7 @@ if ( PYLINT_FOUND )
         Framework/PythonInterface/plugins
         scripts
         Testing/SystemTests/tests/analysis
+        tools
   )
   set ( PYLINT_EXCLUDES
         scripts/lib1to2
diff --git a/buildconfig/move_class.py b/buildconfig/move_class.py
index e51e53c45c28785f805f69b2f99f707b9d2a239b..09b62d51fee7a4296d2b399b93a97d5dfda56511 100755
--- a/buildconfig/move_class.py
+++ b/buildconfig/move_class.py
@@ -15,32 +15,36 @@ def move_one(subproject, classname, newproject, newclassname, oldfilename, newfi
     """Move one file """
 
     # Move the file
-    cmd = "mv " + oldfilename + " " + newfilename
-    if not args.no_vcs:
-        cmd = "git " + cmd
-    print "Running:", cmd
-    retval = os.system(cmd)
-    if retval != 0:
-        raise RuntimeError("Error executing cmd '%s'" % cmd)
-
-    f = open(newfilename, 'r')
-    text = f.read()
-    f.close()
-
-    # Replace any includes of it
-    text = text.replace("Mantid" + subproject + "/" + args.source_subfolder + classname + ".h",
-                        "Mantid" + newproject + "/" + args.dest_subfolder + newclassname + ".h")
-
-    #Replace the guard
-    old_guard = "MANTID_%s_%s_H_" % (subproject.upper(), classname.upper())
-    new_guard = "MANTID_%s_%s_H_" % (newproject.upper(), newclassname.upper())
-    text = text.replace(old_guard, new_guard)
-
-    # Replace the namespace declaration
-    text = text.replace("namespace " + subproject, "namespace " + newproject)
-    # Replace the conents
-    f = open(newfilename, 'w')
-    f.write(text)
+    try:
+        cmd = "mv " + oldfilename + " " + newfilename
+        cmd = cmd.replace("\\","/")
+        if not args.no_vcs:
+            cmd = "git " + cmd
+        print "Running:", cmd
+        retval = os.system(cmd)
+        if retval != 0:
+            raise RuntimeError("Error executing cmd '%s'" % cmd)
+
+        f = open(newfilename, 'r')
+        text = f.read()
+        f.close()
+
+        # Replace any includes of it
+        text = text.replace("Mantid" + subproject + "/" + args.source_subfolder + classname + ".h",
+                            "Mantid" + newproject + "/" + args.dest_subfolder + newclassname + ".h")
+
+        #Replace the guard
+        old_guard = "MANTID_%s_%s_H_" % (subproject.upper(), classname.upper())
+        new_guard = "MANTID_%s_%s_H_" % (newproject.upper(), newclassname.upper())
+        text = text.replace(old_guard, new_guard)
+
+        # Replace the namespace declaration
+        text = text.replace("namespace " + subproject, "namespace " + newproject)
+        # Replace the conents
+        f = open(newfilename, 'w')
+        f.write(text)
+    except RuntimeError as err:
+        print err
 
 
 
@@ -57,7 +61,7 @@ def move_all(subproject, classname, newproject, newclassname, args):
 
     newheaderfile = os.path.join(newbasedir, "inc/" + new_header_folder + "/" + args.dest_subfolder + newclassname + ".h")
     newsourcefile = os.path.join(newbasedir, "src/" + args.dest_subfolder + newclassname + ".cpp")
-    newtestfile = os.path.join(newbasedir, "test/" + newclassname + "Test.h")
+    newtestfile = os.path.join(newbasedir, "test/" + args.dest_subfolder + newclassname + "Test.h")
 
     if args.header and not overwrite and os.path.exists(newheaderfile):
         print "\nError! Header file %s already exists. Use --force to overwrite.\n" % newheaderfile
diff --git a/docs/source/algorithms/CompactMD-v1.rst b/docs/source/algorithms/CompactMD-v1.rst
new file mode 100644
index 0000000000000000000000000000000000000000..388f9ca7a084c437305608994667507b9665158f
--- /dev/null
+++ b/docs/source/algorithms/CompactMD-v1.rst
@@ -0,0 +1,62 @@
+.. algorithm::
+
+.. summary::
+
+.. alias::
+
+.. properties::
+
+Description
+-----------
+Used to crop an n-dimensional :ref:`MDHistoWorkspace <MDHistoWorkspace>` to the first non-zero signal values found in all dimensions.
+
+Cropping
+--------
+The cropping is done by supplying `IntegrateMDHistoWorkspace <http://docs.mantidproject.org/nightly/algorithms/IntegrateMDHistoWorkspace-v1.html>`__ with the minimum and maximum extents associated with the first non-zero
+signal values in the workspace.
+
+
+Usage
+-----
+
+
+**Example - CompactMD on MDHistoWorkspace**
+
+.. testcode:: CompactMDOnMDHistoWorkspace
+
+    import math
+    #create an MDEventWorkspace for Rebinning
+    mdws = CreateMDWorkspace(Dimensions=3, Extents='-10,10,-10,10,-10,10', Names='A,B,C', Units='U,U,U')
+    FakeMDEventData(InputWorkspace=mdws, PeakParams='100000,-5,-5,0,1')
+    FakeMDEventData(InputWorkspace=mdws, PeakParams='100000,0,0,0,1')
+    FakeMDEventData(InputWorkspace=mdws, PeakParams='100000,5,5,0,1')
+    #Rebin mdws to create an MDHistoWorkspace
+    binned_ws = BinMD(InputWorkspace=mdws, AxisAligned=False, BasisVector0='a,unit,1,1,0',BasisVector1='b,unit,-1,1,0',BasisVector2='c,unit,0,0,1',NormalizeBasisVectors=True,Translation=[-10,-10,0], OutputExtents=[0,math.sqrt(2*20*20),-2,2,-10,10], OutputBins=[100, 100, 1] )
+    
+    #A visualisation of the rebinned_ws can be found in the 'Input' section below.
+    
+    #run CompactMD on the rebinned workspace 
+    compact_output = CompactMD(binned_ws)
+    
+    #A visualisation of the compacted workspace can be found in the 'Output' section below.
+
+Input:
+
+.. figure:: /images/RebbinedWorkspaceNoCompactMDApplied.jpg
+   :alt: RebbinedWorkspaceNoCompactMDApplied.jpg
+   :width: 400px
+   :align: center
+
+   
+Output:
+
+.. figure:: /images/RebbinedWorkspaceWithCompactMDApplied.jpg
+   :alt: RebbinedWorkspaceWithCompactMDApplied.jpg
+   :width: 400px
+   :align: center
+
+   
+   
+.. categories::
+
+.. sourcelink::
\ No newline at end of file
diff --git a/docs/source/algorithms/EVSDiffractionReduction-v1.rst b/docs/source/algorithms/EVSDiffractionReduction-v1.rst
new file mode 100644
index 0000000000000000000000000000000000000000..c6fd73dc8b257b04e86d4a71bb6d984f9da39d6e
--- /dev/null
+++ b/docs/source/algorithms/EVSDiffractionReduction-v1.rst
@@ -0,0 +1,44 @@
+.. algorithm::
+
+.. summary::
+
+.. alias::
+
+.. properties::
+
+Description
+-----------
+
+A version of :ref:`ISISIndirectDiffractionReduction
+<algm-ISISIndirectDiffractionReduction>` specific to use with VESUVIO (EVS)
+data, the reduction is performed in the same way however there is the additional
+option to load a PAR file.
+
+Usage
+-----
+
+**Example - Running EVSDiffractionReduction.**
+
+.. testcode:: ExEVSDiffractionReductionSimple
+
+    EVSDiffractionReduction(InputFiles='EVS15289.raw',
+                            OutputWorkspace='DiffractionReductions',
+                            InstrumentParFile='IP0005.dat')
+
+    ws = mtd['DiffractionReductions'].getItem(0)
+
+    print 'Workspace name: %s' % ws.getName()
+    print 'Number of spectra: %d' % ws.getNumberHistograms()
+    print 'Number of bins: %s' % ws.blocksize()
+
+Output:
+
+.. testoutput:: ExEVSDiffractionReductionSimple
+
+    Workspace name: EVS15289_diffspec_red
+    Number of spectra: 1
+    Number of bins: 3875
+
+.. categories::
+
+.. sourcelink::
diff --git a/docs/source/algorithms/Fit-v1.rst b/docs/source/algorithms/Fit-v1.rst
index 55baf7dfbf7fbf9ae2af351d8b9afc0e82a8af2a..691219743c2e8a3c20358c1cb28e1cc099dbd908 100644
--- a/docs/source/algorithms/Fit-v1.rst
+++ b/docs/source/algorithms/Fit-v1.rst
@@ -355,5 +355,5 @@ Output:
 .. categories::
 
 .. sourcelink::
- :h: Framework/CurveFitting/inc/MantidCurveFitting/Fit.h
- :cpp: Framework/CurveFitting/src/Fit.cpp
\ No newline at end of file
+ :h: Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/Fit.h
+ :cpp: Framework/CurveFitting/src/Algorithms/Fit.cpp
\ No newline at end of file
diff --git a/docs/source/algorithms/LoadMuonNexus-v1.rst b/docs/source/algorithms/LoadMuonNexus-v1.rst
index acd6e582bb31550062f1022df13e320769f1b1b6..5f8aaf88a3c54b19f06667b7430512ea550aefdc 100644
--- a/docs/source/algorithms/LoadMuonNexus-v1.rst
+++ b/docs/source/algorithms/LoadMuonNexus-v1.rst
@@ -79,77 +79,6 @@ The ChildAlgorithms used by LoadMuonNexus are:
    LoadInstrument fails. As the Nexus file has limited instrument data,
    this only populates a few fields.
 
-Usage
------
-
-.. include:: ../usagedata-note.txt
-
-**Example - Load ISIS muon MUSR dataset:**
-
-.. testcode:: LoadMuonNexusOnePeriod
-
-   # Load MUSR dataset
-   ws = LoadMuonNexus(Filename="MUSR00015189.nxs",EntryNumber=1)
-   print "Workspace has ",  ws[0].getNumberHistograms(), " spectra"
-
-Output:
-
-.. testoutput:: LoadMuonNexusOnePeriod
-
-   Workspace has  64  spectra
-
-**Example - Load event nexus file with time filtering:**
-
-.. testcode:: ExLoadMuonNexusSomeSpectra
-
-   # Load some spectra
-   ws = LoadMuonNexus(Filename="MUSR00015189.nxs",SpectrumMin=5,SpectrumMax=10,EntryNumber=1)
-   print "Workspace has ",  ws[0].getNumberHistograms(), " spectra"
-
-Output:
-
-.. testoutput:: ExLoadMuonNexusSomeSpectra
-
-   Workspace has  6  spectra
-
-**Example - Load dead times into table:**
-
-.. testcode:: ExLoadDeadTimeTable
-
-   # Load some spectra
-   ws = LoadMuonNexus(Filename="emu00006473.nxs",SpectrumMin=5,SpectrumMax=10,DeadTimeTable="deadTimeTable")
-   tab = mtd['deadTimeTable']
-   for i in range(0,tab.rowCount()):
-       print tab.cell(i,0), tab.cell(i,1)
-
-Output:
-
-.. testoutput:: ExLoadDeadTimeTable
-
-   5 0.00161112251226
-   6 0.00215016817674
-   7 0.0102171599865
-   8 0.00431686220691
-   9 0.00743605662137
-   10 0.00421147653833
-
-**Example - Load detector grouping into table:**
-
-.. testcode:: ExLoadDetectorGrouping
-
-   # Load some spectra
-   ws = LoadMuonNexus(Filename="emu00006473.nxs",SpectrumList="1,16,17,32",DetectorGroupingTable="detectorTable")
-   tab = mtd['detectorTable']
-   for i in range(0,tab.rowCount()):
-       print tab.cell(i,0)
-
-Output:
-
-.. testoutput:: ExLoadDetectorGrouping
-
-   [ 1 16]
-   [17 32]
-
 .. categories::
 
 .. sourcelink::
diff --git a/docs/source/algorithms/LoadMuonNexus-v2.rst b/docs/source/algorithms/LoadMuonNexus-v2.rst
index 0ca954061e4aad8e1f7858f51b8fbd86d6ad6d88..2e0732e98a485b22bc128fe43e25cb757d49a566 100644
--- a/docs/source/algorithms/LoadMuonNexus-v2.rst
+++ b/docs/source/algorithms/LoadMuonNexus-v2.rst
@@ -80,6 +80,77 @@ detects that it has been asked to load a previous version muon nexus
 file it will call the previous version of the algorithm to perform the
 task.
 
+Usage
+-----
+
+.. include:: ../usagedata-note.txt
+
+**Example - Load ISIS muon MUSR dataset:**
+
+.. testcode:: LoadMuonNexusOnePeriod
+
+   # Load MUSR dataset
+   ws = LoadMuonNexus(Filename="MUSR00015189.nxs",EntryNumber=1)
+   print "Workspace has ",  ws[0].getNumberHistograms(), " spectra"
+
+Output:
+
+.. testoutput:: LoadMuonNexusOnePeriod
+
+   Workspace has  64  spectra
+
+**Example - Load event nexus file with time filtering:**
+
+.. testcode:: ExLoadMuonNexusSomeSpectra
+
+   # Load some spectra
+   ws = LoadMuonNexus(Filename="MUSR00015189.nxs",SpectrumMin=5,SpectrumMax=10,EntryNumber=1)
+   print "Workspace has ",  ws[0].getNumberHistograms(), " spectra"
+
+Output:
+
+.. testoutput:: ExLoadMuonNexusSomeSpectra
+
+   Workspace has  6  spectra
+
+**Example - Load dead times into table:**
+
+.. testcode:: ExLoadDeadTimeTable
+
+   # Load some spectra
+   ws = LoadMuonNexus(Filename="emu00006473.nxs",SpectrumMin=5,SpectrumMax=10,DeadTimeTable="deadTimeTable")
+   tab = mtd['deadTimeTable']
+   for i in range(0,tab.rowCount()):
+       print tab.cell(i,0), tab.cell(i,1)
+
+Output:
+
+.. testoutput:: ExLoadDeadTimeTable
+
+   5 0.00161112251226
+   6 0.00215016817674
+   7 0.0102171599865
+   8 0.00431686220691
+   9 0.00743605662137
+   10 0.00421147653833
+
+**Example - Load detector grouping into table:**
+
+.. testcode:: ExLoadDetectorGrouping
+
+   # Load some spectra
+   ws = LoadMuonNexus(Filename="emu00006473.nxs",SpectrumList="1,16,17,32",DetectorGroupingTable="detectorTable")
+   tab = mtd['detectorTable']
+   for i in range(0,tab.rowCount()):
+       print tab.cell(i,0)
+
+Output:
+
+.. testoutput:: ExLoadDetectorGrouping
+
+   [ 1 16]
+   [17 32]
+
 .. categories::
 
 .. sourcelink::
diff --git a/docs/source/algorithms/PDToPDFgetN-v1.rst b/docs/source/algorithms/PDToPDFgetN-v1.rst
new file mode 100644
index 0000000000000000000000000000000000000000..f37aae644e29dee983a0c7e1ab829a772546b5a4
--- /dev/null
+++ b/docs/source/algorithms/PDToPDFgetN-v1.rst
@@ -0,0 +1,32 @@
+.. algorithm::
+
+.. summary::
+
+.. alias::
+
+.. properties::
+
+Description
+-----------
+
+This is a workflow algorithm that creates files suitable as input
+into `PDFgetN <http://pdfgetn.sourceforge.net/>`_.
+
+#. :ref:`algm-PDLoadCharacterizations`
+#. :ref:`algm-LoadEventAndCompress` if ``InputWorkspace`` is not
+   provided
+#. :ref:`algm-PDDetermineCharacterizations` to determine information
+   from the characterization file
+#. :ref:`algm-AlignAndFocusPowder`
+#. :ref:`algm-NormaliseByCurrent`
+#. :ref:`algm-SetUncertainties` (``SetError="sqrt"``)
+#. :ref:`algm-SaveGSS`
+
+Workflow
+########
+
+.. diagram:: PDToPDFgetN-v1_wkflw.dot
+
+.. categories::
+
+.. sourcelink::
diff --git a/docs/source/algorithms/SavePlot1DAsJson-v1.rst b/docs/source/algorithms/SavePlot1DAsJson-v1.rst
index 86cbeeefd4e066d2a6f835388fa7cd9269f02e8e..85bb7a8d062628aad864fac2e7a84bdde2c6c871 100644
--- a/docs/source/algorithms/SavePlot1DAsJson-v1.rst
+++ b/docs/source/algorithms/SavePlot1DAsJson-v1.rst
@@ -26,12 +26,12 @@ Usage
 
   import os, numpy as np
   # prepare input
-  E = np.arange(-50, 50, 1.0)
+  E = np.arange(-50, 50, 10.0)
   I = 1000 * np.exp(-E**2/10**2)
   err = I ** .5
   dataws = CreateWorkspace(
       DataX = E, DataY = I, DataE = err, NSpec = 1,
-      UnitX = "Energy(meV)")
+      UnitX = "Energy")
   # output path
   out_json = "myplot.json"
   # run algorithm
diff --git a/docs/source/algorithms/TOFTOFCropWorkspace-v1.rst b/docs/source/algorithms/TOFTOFCropWorkspace-v1.rst
new file mode 100644
index 0000000000000000000000000000000000000000..2a390bc98a778ae33750d5aaaa43175e39501f3b
--- /dev/null
+++ b/docs/source/algorithms/TOFTOFCropWorkspace-v1.rst
@@ -0,0 +1,59 @@
+.. algorithm::
+
+.. summary::
+
+.. alias::
+
+.. properties::
+
+Description
+-----------
+
+Applies algorithm :ref:`algm-Cropworkspace` to an input workspace or a group of workspaces to crop the empty time channels. Boundaries are calculated as follows:
+
+    :math:`X_{min} = 0`
+
+    :math:`X_{max} = N_{fc}\times\Delta t`
+
+where :math:`N_{fc}` is the number of full time channels defined in the *full_channels* sample log and :math:`\Delta t` is the channel width defined in the *channel_width* sample log.
+
+
+Restrictions on the input workspace
+###################################
+
+-  The unit of the X-axis must be **Time-of-flight**.
+-  Workspace must contain *channel_width* and *full_channels* sample logs.
+
+
+Usage
+-----
+
+**Example**
+
+.. testcode:: ExTOFTOFCropWorkspace
+
+    # Load data
+    ws=Load(Filename='TOFTOFTestdata.nxs')
+
+    print "Input workspace"
+    print "Total number of time channels: ",  len(ws.readX(0))
+    print  "Number of filled time channels: ", ws.getRun().getLogData('full_channels').value
+
+    wscropped = TOFTOFCropWorkspace(ws)
+
+    print "Output workspace"
+    print "Total number of time channels: ",  len(wscropped.readX(0))    
+
+Output:
+
+.. testoutput:: ExTOFTOFCropWorkspace
+
+    Input workspace
+    Total number of time channels:  1025
+    Number of filled time channels:  1020.0
+    Output workspace
+    Total number of time channels:  1020
+    
+.. categories::
+
+.. sourcelink::
diff --git a/docs/source/algorithms/TOFTOFMergeRuns-v1.rst b/docs/source/algorithms/TOFTOFMergeRuns-v1.rst
new file mode 100644
index 0000000000000000000000000000000000000000..25aec61d5f1324450adf5eb51a07564d619897ff
--- /dev/null
+++ b/docs/source/algorithms/TOFTOFMergeRuns-v1.rst
@@ -0,0 +1,150 @@
+.. algorithm::
+
+.. summary::
+
+.. alias::
+
+.. properties::
+
+Description
+-----------
+
+Merges workspaces from a given list using :ref:`algm-MergeRuns` algorithm. Sample logs are merged in the following way.
+
++---------++-------------------------------+
+| Type of || Parameter                     |
+| merging ||                               |
++=========++===============================+
+| Average || temperature                   |
++---------++-------------------------------+
+| Minimum || run_start                     |
++---------++-------------------------------+
+| Maximum || run_end                       |
++---------++-------------------------------+
+| Summed  || duration, monitor_counts      |
++---------++-------------------------------+
+| Listed  || run_number                    |
++---------++-------------------------------+
+
+Other sample logs are copied from the first workspace.
+
+**Valid input workspaces**
+
+Algorithm accepts both, matrix workspaces and groups of matrix workspaces. Valid input workspaces
+
+- must have following sample logs: *channel_width*, *chopper_ratio*, *chopper_speed*, *Ei*, *wavelength*, *full_channels*, *EPP*, *monitor_counts*, *duration*, *run_number*, *run_start*, *run_end*
+- must have identical following sample logs: *channel_width*, *chopper_ratio*, *chopper_speed*, *Ei*, *wavelength*, *full_channels*, *EPP*. Tolerance for double comparison is 0.01.
+- must have common binning for all its spectra for each input workspace.
+
+If these conditions are not fulfilled, algorithm terminates with an error message.
+
+Sample log *temperature* is optional. If it is present in some of input workspaces, mean value will be calculated. Otherwise, no *temperature* sample log will be created in the output workspace.
+
+Algorithm will produce warning if 
+- *temperature* and *run_title* sample logs are not present or different,
+- some of input workspaces have zero monitor counts.
+
+Usage
+-----
+
+**Example - Merge list of workspaces**
+
+.. testcode:: ExTOFTOFMergeRuns2ws
+
+    ws1 = LoadMLZ(Filename='TOFTOFTestdata.nxs')
+    ws2 = LoadMLZ(Filename='TOFTOFTestdata.nxs')
+
+    # change sample logs for a second workspace, not needed for real workspaces
+    lognames = 'temperature,run_start,run_end,monitor_counts,run_number'
+    logvalues = '296.15,2013-07-28T11:32:19+0053,2013-07-28T12:32:19+0053,145145,TOFTOFTestdata2'
+    AddSampleLogMultiple(ws2, lognames, logvalues)
+
+    # Input = list of workspaces
+    ws3 = TOFTOFMergeRuns('ws1,ws2')
+
+    # Temperature 
+    print "Temperature of experiment for 1st workspace (in K): ", ws1.getRun().getLogData('temperature').value
+    print "Temperature of experiment for 2nd workspace (in K): ", ws2.getRun().getLogData('temperature').value
+    print "Temperature of experiment for merged workspaces = average over workspaces (in K): ",  ws3.getRun().getLogData('temperature').value
+
+    # Duration
+    print "Duration of experiment for 1st workspace (in s): ",  ws1.getRun().getLogData('duration').value
+    print "Duration of experiment for 2nd workspace (in s): ",  ws2.getRun().getLogData('duration').value
+    print "Duration of experiment for merged workspaces = sum of all durations (in s): ",  ws3.getRun().getLogData('duration').value
+
+    # Run start 
+    print "Start of experiment for 1st workspace: ",  ws1.getRun().getLogData('run_start').value
+    print "Start of experiment for 2nd workspace: ",  ws2.getRun().getLogData('run_start').value
+    print "Start of experiment for merged workspaces = miminum of all workspaces: ",  ws3.getRun().getLogData('run_start').value
+
+    # Run end 
+    print "End of experiment for 1st workspace: ",  ws1.getRun().getLogData('run_end').value
+    print "End of experiment for 2nd workspace: ",  ws2.getRun().getLogData('run_end').value
+    print "End of experiment for merged workspaces = maximum of all workspaces: ",  ws3.getRun().getLogData('run_end').value
+    
+    # Run number 
+    print "Run number for 1st workspace: ",  ws1.getRun().getLogData('run_number').value
+    print "Run number for 2nd workspace: ",  ws2.getRun().getLogData('run_number').value
+    print "Run number for merged workspaces = list of all workspaces: ",  ws3.getRun().getLogData('run_number').value      
+ 
+    # Monitor counts
+    print "Monitor counts for 1st workspace: ",  ws1.getRun().getLogData('monitor_counts').value
+    print "Monitor counts for 2nd workspace: ",  ws2.getRun().getLogData('monitor_counts').value
+    print "Monitor counts for merged workspaces = sum over all workspaces: ",  ws3.getRun().getLogData('monitor_counts').value      
+   
+
+Output:
+
+.. testoutput:: ExTOFTOFMergeRuns2ws
+
+    Temperature of experiment for 1st workspace (in K):  294.149414
+    Temperature of experiment for 2nd workspace (in K):  296.15
+    Temperature of experiment for merged workspaces = average over workspaces (in K):  295.149707
+    Duration of experiment for 1st workspace (in s):  3601
+    Duration of experiment for 2nd workspace (in s):  3601
+    Duration of experiment for merged workspaces = sum of all durations (in s):  7202
+    Start of experiment for 1st workspace:  2013-07-28T10:32:19+0053
+    Start of experiment for 2nd workspace:  2013-07-28T11:32:19+0053
+    Start of experiment for merged workspaces = miminum of all workspaces:  2013-07-28T10:32:19+0053
+    End of experiment for 1st workspace:  2013-07-28T11:32:20+0053
+    End of experiment for 2nd workspace:  2013-07-28T12:32:19+0053
+    End of experiment for merged workspaces = maximum of all workspaces:  2013-07-28T12:32:19+0053
+    Run number for 1st workspace:  TOFTOFTestdata
+    Run number for 2nd workspace:  TOFTOFTestdata2
+    Run number for merged workspaces = list of all workspaces:  ['TOFTOFTestdata', 'TOFTOFTestdata2']
+    Monitor counts for 1st workspace:  136935
+    Monitor counts for 2nd workspace:  145145
+    Monitor counts for merged workspaces = sum over all workspaces:  282080
+
+**Example - Merge group of workspaces**
+
+.. testcode:: ExTOFTOFMergeRunsGroup
+
+    ws1 = LoadMLZ(Filename='TOFTOFTestdata.nxs')
+    ws2 = LoadMLZ(Filename='TOFTOFTestdata.nxs')
+
+    # change sample logs for a second workspace, not needed for real workspaces
+    lognames = 'temperature,run_start,run_end,monitor_counts,run_number'
+    logvalues = '296.15,2013-07-28T11:32:19+0053,2013-07-28T12:32:19+0053,145145,TOFTOFTestdata2'
+    AddSampleLogMultiple(ws2, lognames, logvalues)
+
+    group=GroupWorkspaces('ws1,ws2')
+    groupmerged=TOFTOFMergeRuns(group)
+    print "Monitor counts for 1st workspace: ",  ws1.getRun().getLogData('monitor_counts').value
+    print "Monitor counts for 2nd workspace: ",  ws2.getRun().getLogData('monitor_counts').value
+    print "Monitor counts for merged workspaces = sum over all workspaces: ",  groupmerged.getRun().getLogData('monitor_counts').value         
+
+Output:
+
+.. testoutput:: ExTOFTOFMergeRunsGroup
+
+    Monitor counts for 1st workspace:  136935
+    Monitor counts for 2nd workspace:  145145
+    Monitor counts for merged workspaces = sum over all workspaces:  282080
+
+.. categories::
+
+.. sourcelink::
+
+  
+
diff --git a/docs/source/diagrams/PDToPDFgetN-v1_wkflw.dot b/docs/source/diagrams/PDToPDFgetN-v1_wkflw.dot
new file mode 100644
index 0000000000000000000000000000000000000000..23d7d3128f5710701b37233d9e12463bd670748e
--- /dev/null
+++ b/docs/source/diagrams/PDToPDFgetN-v1_wkflw.dot
@@ -0,0 +1,34 @@
+digraph AlignAndFocusPowder {
+  label="AlignAndFocusPowder Flowchart"
+  $global_style
+
+  subgraph params {
+    $param_style
+    InputWorkspace
+  }
+
+  subgraph algoritms {
+    $algorithm_style
+    loadChar          [label="PDLoadCharacterizations v1"]
+    loadEvent         [label="LoadEventAndCompress v1"]
+    determineChar     [label="PDDetermineCharacterizations v1"]
+    alignAndFocus     [label="AlignAndFocusPowder v1"]
+    norm              [label="NormaliseByCurrent v1"]
+    setUncert         [label="SetUncertainties v1"]
+    saveGSS           [label="SaveGSS v1"]
+  }
+
+  subgraph decisions {
+    $decision_style
+  }
+
+
+  loadChar         -> determineChar
+  loadEvent        -> InputWorkspace
+  InputWorkspace   -> determineChar
+  InputWorkspace   -> alignAndFocus
+  determineChar    -> alignAndFocus
+  alignAndFocus    -> norm
+  norm             -> setUncert
+  setUncert        -> saveGSS
+}
diff --git a/docs/source/fitfunctions/Convolution.rst b/docs/source/fitfunctions/Convolution.rst
index 4131d38a6c02f0a7699718f67a20c12abd0adb33..2d1effda494a58834752a49bd3c7ab410c77c1ce 100644
--- a/docs/source/fitfunctions/Convolution.rst
+++ b/docs/source/fitfunctions/Convolution.rst
@@ -45,5 +45,5 @@ Note that the box function is defined on interval [-5, 5]:
 .. categories::
 
 .. sourcelink::
-   :h: Framework/CurveFitting/inc/MantidCurveFitting/Convolution.h
-   :cpp: Framework/CurveFitting/src/Convolution.cpp
\ No newline at end of file
+   :h: Framework/CurveFitting/inc/MantidCurveFitting/Functions/Convolution.h
+   :cpp: Framework/CurveFitting/src/Functions/Convolution.cpp
\ No newline at end of file
diff --git a/docs/source/fitfunctions/Quadratic.rst b/docs/source/fitfunctions/Quadratic.rst
index ec969de22b9b6177cdc4299d1f9a2d8f8cfcc9c0..8ff860a418240b00e5bc2f381b9f03c666f4c98e 100644
--- a/docs/source/fitfunctions/Quadratic.rst
+++ b/docs/source/fitfunctions/Quadratic.rst
@@ -26,5 +26,5 @@ where
 .. categories::
 
 .. sourcelink::
-    :h: Framework/CurveFitting/inc/MantidCurveFitting/Quadratic.h
-    :cpp: Framework/CurveFitting/src/Quadratic.cpp
\ No newline at end of file
+    :h: Framework/CurveFitting/inc/MantidCurveFitting/Functions/Quadratic.h
+    :cpp: Framework/CurveFitting/src/Functions/Quadratic.cpp
\ No newline at end of file
diff --git a/docs/source/fitfunctions/UserFunction.rst b/docs/source/fitfunctions/UserFunction.rst
index 9cda7f413fdb76f7d3bbc3a30e82de60e69f4a32..9a8201cec132e63b0bd6cfd040011538f6b8b9b7 100644
--- a/docs/source/fitfunctions/UserFunction.rst
+++ b/docs/source/fitfunctions/UserFunction.rst
@@ -25,5 +25,5 @@ go first in UserFunction definition.
 .. categories::
 
 .. sourcelink::
-    :h: Framework/CurveFitting/inc/MantidCurveFitting/UserFunction.h
-    :cpp: Framework/CurveFitting/src/UserFunction.cpp
\ No newline at end of file
+    :h: Framework/CurveFitting/inc/MantidCurveFitting/Functions/UserFunction.h
+    :cpp: Framework/CurveFitting/src/Functions/UserFunction.cpp
\ No newline at end of file
diff --git a/docs/source/images/RebbinedWorkspaceNoCompactMDApplied.JPG b/docs/source/images/RebbinedWorkspaceNoCompactMDApplied.JPG
new file mode 100644
index 0000000000000000000000000000000000000000..977b23d832c1c10900d09d518dd9e1745776aa92
Binary files /dev/null and b/docs/source/images/RebbinedWorkspaceNoCompactMDApplied.JPG differ
diff --git a/docs/source/images/RebbinedWorkspaceWithCompactMDApplied.JPG b/docs/source/images/RebbinedWorkspaceWithCompactMDApplied.JPG
new file mode 100644
index 0000000000000000000000000000000000000000..36a4fbc0a412fce0fbb71bd17b3e0c75414ebce4
Binary files /dev/null and b/docs/source/images/RebbinedWorkspaceWithCompactMDApplied.JPG differ
diff --git a/docs/source/interfaces/Tomographic_Reconstruction.rst b/docs/source/interfaces/Tomographic_Reconstruction.rst
index d31f16f6ad90f25f598f33de0f037bcb527bc861..10218297b0180cf65a005cfe5af11202a362303f 100644
--- a/docs/source/interfaces/Tomographic_Reconstruction.rst
+++ b/docs/source/interfaces/Tomographic_Reconstruction.rst
@@ -140,6 +140,43 @@ To be able to run jobs on a remote compute resource (cluster, supercomputer, etc
 You can monitor the status of the jobs currently running (and recently
 run) on remote compute resources in the same tab.
 
+Setting common parameters for the reconstruction jobs
+-----------------------------------------------------
+
+Several parameters can be set in the "ROI etc." section or tab. These
+parameters will be used for all the reconstruction jobs, regardless of
+the tool and/or reconstruction method used.
+
+* Region of interest (ROI) for the analysis
+* Area for normalization (open beam, not blocked by sample)
+* Center of rotation, for tomographic reconstruction
+
+At any stage during the process of selecting the regions it is also
+possible to see how the selections fit different images by sliding
+through the images of the stack (using the slider or scroll bar).
+
+The center of rotation can be selected interactively by clicking on
+the select button and then clicking on an image pixel. To select the
+regions of interest or the area of normalization, just click on the
+respective "select" button and then click and drag with the mouse to
+select a rectangle. The precise coordinates of the center and regions
+can be set via the boxes of the right panel as well.
+
+Once you have selected or set one of the regions, or the center, they
+can be selected again by pushing the respective "Select" buttons
+and/or editing their coordinates manually.
+
+The default values, set in principle when a new stack of images is
+loaded, is as follows. The region of intererest is set to cover all
+the images. The regions of normalization is not set (empty), and the
+center of rotation is set to the center of the image. The option to
+find the center of rotation automatically is disabled at present.
+
+If when selection a region the mouse is moved outside of the images,
+it is possible to continue the selection of the region (second corner)
+by clicking again inside the image. Alternatively, any selection can
+be reset at any point by using the "reset" buttons.
+
 Running jobs locally
 --------------------
 
diff --git a/scripts/Interface/ui/reflectometer/refl_save.py b/scripts/Interface/ui/reflectometer/refl_save.py
index 6dabce7fe2a500d16899e687dde973628f1c98de..52f4c8dc61f64444d7263953e7a70dcf40d99a0a 100644
--- a/scripts/Interface/ui/reflectometer/refl_save.py
+++ b/scripts/Interface/ui/reflectometer/refl_save.py
@@ -1,8 +1,8 @@
-#pylint: disable=invalid-name
+#pylint: disable-all
 from PyQt4 import QtCore, QtGui
 import os
 from mantid.simpleapi import *
-from mantid.api import WorkspaceGroup
+from mantid.api import WorkspaceGroup, AnalysisDataService
 import xml.etree.ElementTree as xml
 from isis_reflectometry.quick import *
 from isis_reflectometry.procedures import *
@@ -32,10 +32,12 @@ class Ui_SaveWindow(object):
     def setupUi(self, SaveWindow):
         self.SavePath=""
         SaveWindow.setObjectName(_fromUtf8("SaveWindow"))
-        SaveWindow.resize(700, 450)
+        SaveWindow.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding))
         SaveWindow.setAcceptDrops(True)
-
+        main_layout = QtGui.QHBoxLayout()
+        SaveWindow.setLayout(main_layout)
         self.centralWidget = QtGui.QWidget(SaveWindow)
+        main_layout.addWidget(self.centralWidget)
         self.centralWidget.setObjectName(_fromUtf8("centralWidget"))
         self.gridLayout_2 = QtGui.QGridLayout(self.centralWidget)
         self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
@@ -236,12 +238,18 @@ class Ui_SaveWindow(object):
 
     def retranslateUi(self, SaveWindow):
         SaveWindow.setWindowTitle(QtGui.QApplication.translate("SaveWindow", "SaveWindow", None, QtGui.QApplication.UnicodeUTF8))
-        self.pushButton.setText(QtGui.QApplication.translate("SaveWindow", "SAVE", None, QtGui.QApplication.UnicodeUTF8))
+        self.pushButton.setText(QtGui.QApplication.translate("SaveWindow", "Save", None, QtGui.QApplication.UnicodeUTF8))
         self.pushButton_2.setText(QtGui.QApplication.translate("SaveWindow", "Refresh", None, QtGui.QApplication.UnicodeUTF8))
 
+    def _get_saveable_workspace_names(self):
+        names = mtd.getObjectNames()
+        # Exclude WorkspaceGroups from our list. We cannot save them to ASCII.
+        names = [i for i in names if not isinstance(AnalysisDataService.retrieve(i), WorkspaceGroup)]
+        return names
+    
     def filterWksp(self):
         self.listWidget.clear()
-        names = mtd.getObjectNames()
+        names = self._get_saveable_workspace_names()
         if self.regExCheckBox.isChecked():
             regex=re.compile(self.filterEdit.text())
             filtered = list()
@@ -268,7 +276,7 @@ class Ui_SaveWindow(object):
 
     def populateList(self):
         self.listWidget.clear()
-        names = mtd.getObjectNames()
+        names = self._get_saveable_workspace_names()
         if len(names):
             RB_Number=groupGet(names[0],'samp','rb_proposal')
             for ws in names:
diff --git a/tools/DAEserv/DAEserv/isisds_command.cpp b/tools/DAEserv/DAEserv/isisds_command.cpp
index 131c03ade6e7f6eb2eb5305ea564ecab6bfb421c..b354735c73272a643e4cd6d5e4e83a4756458797 100644
--- a/tools/DAEserv/DAEserv/isisds_command.cpp
+++ b/tools/DAEserv/DAEserv/isisds_command.cpp
@@ -20,8 +20,6 @@
 #include <stdio.h>
 #include "isisds_command.h"
 
-#include <iostream>
-
 using namespace std;
 
 /*