diff --git a/CONTRIBUTING.md b/.github/CONTRIBUTING.md
similarity index 100%
rename from CONTRIBUTING.md
rename to .github/CONTRIBUTING.md
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 0000000000000000000000000000000000000000..dc592195cac835e1a6a922d1b79c6d704c9b0f21
--- /dev/null
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,31 @@
+Description of work.
+
+**To test:**
+
+<!-- Instructions for testing. -->
+
+Fixes #xxxx.
+
+Either link to [Release notes](http://www.mantidproject.org/Release_Notes_3.7) change-set or state "Does not need to be in the release notes."
+
+---
+
+#### Reviewer ####
+
+Please comment on the following ([full description](http://www.mantidproject.org/Individual_Ticket_Testing)):
+
+##### Code Review #####
+
+- [ ] Is the code of an acceptable quality?
+- [ ] Does the code conform to the coding standards? Is it well structured with small focussed classes/methods/functions?
+- [ ] Are there unit/system tests in place? Are the unit tests small and test the a class in isolation?
+
+##### Functional Tests #####
+
+- [ ] Do changes function as described? Add comments below that describe the tests performed?
+- [ ] How do the changes handle unexpected situations, e.g. bad input?
+- [ ] Has the relevant documentation been added/updated?
+- [ ] Is user-facing documentation written in a user-friendly manner?
+- [ ] Has developer documentation been updated if required?
+
+- Does everything look good? Comment with the ship it emoji but don't merge. A member of `@mantidproject/gatekeepers` will take care of it.
diff --git a/.gitignore b/.gitignore
index 18de4bea04c9e665461c60d7192633d57592bbbc..02816108ddf299c2e3c7e81a8f7bfbc329deb1cc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -79,6 +79,7 @@ local.properties
 # Build results
 [Dd]ebug/
 [Rr]elease/
+build/
 *_i.c
 *_p.c
 *.ilk
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 61b7afc3852b42eab3da83fb0d2dde3007047c86..b3be1419fcdaa1f39c31df31196b141a176bedd4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -251,7 +251,7 @@ if ( ENABLE_CPACK )
       message ( STATUS " CPACK_PACKAGE_FILE_NAME = ${CPACK_PACKAGE_FILE_NAME}" )
 
       # rhel requirements
-      set ( CPACK_RPM_PACKAGE_REQUIRES "boost >= 1.34.1,qt4 >= 4.2,nexus >= 4.3.1,nexus-python >= 4.3.1,gsl,glibc,qwtplot3d-qt4,muParser,numpy" )
+      set ( CPACK_RPM_PACKAGE_REQUIRES "qt4 >= 4.2,nexus >= 4.3.1,nexus-python >= 4.3.1,gsl,glibc,qwtplot3d-qt4,muParser,numpy" )
       # OCE
       set( CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES},OCE-draw,OCE-foundation,OCE-modeling,OCE-ocaf,OCE-visualization")
       set ( CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES},poco-crypto,poco-data,poco-mysql,poco-sqlite,poco-odbc,poco-util,poco-xml,poco-zip,poco-net,poco-netssl,poco-foundation,PyQt4,sip" )
@@ -262,11 +262,11 @@ if ( ENABLE_CPACK )
 
       if( "${UNIX_CODENAME}" MATCHES "Santiago" )
         # On RHEL6 we have to use an updated qscintilla to fix an auto complete bug
-        set ( CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES} qscintilla >= 2.4.6" )
+        set ( CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES} qscintilla >= 2.4.6, boost148" )
         # On RHEL6 we are using SCL packages for Qt
         set ( CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES},scl-utils,mantidlibs34,mantidlibs34-runtime,mantidlibs34-qt,mantidlibs34-qt-x11,mantidlibs34-qt-webkit,mantidlibs34-qwt5-qt4" )
       else()
-        set ( CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES} qscintilla,qwt5-qt4,python-matplotlib-qt4" )
+        set ( CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES} qscintilla,qwt5-qt4,python-matplotlib-qt4,boost >= 1.48.0" )
       endif()
 
       # Add software collections for RHEL
diff --git a/Framework/API/CMakeLists.txt b/Framework/API/CMakeLists.txt
index b9e08b45bc5f22b14eb9498ab48112fcc8cbc34e..c93e7e953395f722c4241e012f0a038ff476f654 100644
--- a/Framework/API/CMakeLists.txt
+++ b/Framework/API/CMakeLists.txt
@@ -44,6 +44,8 @@ set ( SRC_FILES
 	src/FunctionParameterDecorator.cpp
 	src/FunctionProperty.cpp
 	src/FunctionValues.cpp
+	src/GeometryInfoFactory.cpp
+	src/GeometryInfo.cpp
 	src/GridDomain.cpp
 	src/GridDomain1D.cpp
 	src/GroupingLoader.cpp
@@ -197,6 +199,8 @@ set ( INC_FILES
 	inc/MantidAPI/FunctionParameterDecorator.h
 	inc/MantidAPI/FunctionProperty.h
 	inc/MantidAPI/FunctionValues.h
+	inc/MantidAPI/GeometryInfoFactory.h
+	inc/MantidAPI/GeometryInfo.h
 	inc/MantidAPI/GridDomain.h
 	inc/MantidAPI/GridDomain1D.h
 	inc/MantidAPI/GroupingLoader.h
@@ -358,6 +362,8 @@ set ( TEST_FILES
 	FunctionPropertyTest.h
 	FunctionTest.h
 	FunctionValuesTest.h
+	GeometryInfoFactoryTest.h
+	GeometryInfoTest.h
 	GroupingLoaderTest.h
 	HistogramValidatorTest.h
 	HistoryItemTest.h
diff --git a/Framework/API/inc/MantidAPI/AlgorithmFactory.h b/Framework/API/inc/MantidAPI/AlgorithmFactory.h
index 4e35e283e1f853b1f9a356224c706d8718316ab7..c9b4f6b36b6d557bf93017c1e5e4166a3604ecf5 100644
--- a/Framework/API/inc/MantidAPI/AlgorithmFactory.h
+++ b/Framework/API/inc/MantidAPI/AlgorithmFactory.h
@@ -5,7 +5,7 @@
 // Includes
 //----------------------------------------------------------------------
 #include <vector>
-#include <set>
+#include <unordered_set>
 #include <sstream>
 #include "MantidAPI/DllConfig.h"
 #include "MantidKernel/DynamicFactory.h"
@@ -57,7 +57,7 @@ class Algorithm;
 
     File change history is stored at: <https://github.com/mantidproject/mantid>
 */
-class MANTID_API_DLL AlgorithmFactoryImpl
+class MANTID_API_DLL AlgorithmFactoryImpl final
     : public Kernel::DynamicFactory<Algorithm> {
 public:
   // Unhide the base class version (to satisfy the intel compiler)
@@ -126,7 +126,8 @@ public:
   int highestVersion(const std::string &algorithmName) const;
 
   /// Get the algorithm categories
-  const std::set<std::string> getCategories(bool includeHidden = false) const;
+  const std::unordered_set<std::string>
+  getCategories(bool includeHidden = false) const;
 
   /// Get the algorithm categories
   const std::map<std::string, bool> getCategoriesWithState() const;
@@ -162,7 +163,7 @@ private:
   /// creates an algorithm name convolved from an name and version
   std::string createName(const std::string &, const int &) const;
   /// fills a set with the hidden categories
-  void fillHiddenCategories(std::set<std::string> *categorySet) const;
+  void fillHiddenCategories(std::unordered_set<std::string> *categorySet) const;
 
   /// A typedef for the map of algorithm versions
   typedef std::map<std::string, int> VersionMap;
diff --git a/Framework/API/inc/MantidAPI/AlgorithmHistory.h b/Framework/API/inc/MantidAPI/AlgorithmHistory.h
index feff2bd876be75df48e48834038529768b23fb56..a6c4a70e64f09f60dd2f4345c84581540b5f2949 100644
--- a/Framework/API/inc/MantidAPI/AlgorithmHistory.h
+++ b/Framework/API/inc/MantidAPI/AlgorithmHistory.h
@@ -60,7 +60,7 @@ typedef std::set<AlgorithmHistory_sptr,
     Code Documentation is available at: <http://doxygen.mantidproject.org>
     */
 
-class MANTID_API_DLL AlgorithmHistory {
+class MANTID_API_DLL AlgorithmHistory final {
 
 public:
   /// History container
diff --git a/Framework/API/inc/MantidAPI/AnalysisDataService.h b/Framework/API/inc/MantidAPI/AnalysisDataService.h
index 20f3c363da02cacd4a8a07091198ec1dd4ada9c3..83bd3fa9730bc654ae75381f32d6f58868156842 100644
--- a/Framework/API/inc/MantidAPI/AnalysisDataService.h
+++ b/Framework/API/inc/MantidAPI/AnalysisDataService.h
@@ -56,7 +56,7 @@ class WorkspaceGroup;
     File change history is stored at: <https://github.com/mantidproject/mantid>.
     Code Documentation is available at: <http://doxygen.mantidproject.org>
 */
-class DLLExport AnalysisDataServiceImpl
+class DLLExport AnalysisDataServiceImpl final
     : public Kernel::DataService<API::Workspace> {
 public:
   /** @name Extra notifications only applicable to the ADS */
diff --git a/Framework/API/inc/MantidAPI/BoxController.h b/Framework/API/inc/MantidAPI/BoxController.h
index c94259fec10e30422f173fd6b417963198c497ce..d0d67ae50748a9409d251b3d94cd0dd9474e2fbe 100644
--- a/Framework/API/inc/MantidAPI/BoxController.h
+++ b/Framework/API/inc/MantidAPI/BoxController.h
@@ -366,7 +366,7 @@ public:
   // { return m_useWriteBuffer; }
   /// Returns if current box controller is file backed. Assumes that
   /// BC(workspace) is fileBackd if fileIO is defined;
-  bool isFileBacked() const { return (m_fileIO != 0); }
+  bool isFileBacked() const { return bool(m_fileIO); }
   /// returns the pointer to the class, responsible for fileIO operations;
   IBoxControllerIO *getFileIO() { return m_fileIO.get(); }
   /// makes box controller file based by providing class, responsible for
diff --git a/Framework/API/inc/MantidAPI/ConstraintFactory.h b/Framework/API/inc/MantidAPI/ConstraintFactory.h
index a60ec97ad88e937d7ea02a61e342673f5083f2d8..18975f08e07abba606be056990e6e169a77ee9b5 100644
--- a/Framework/API/inc/MantidAPI/ConstraintFactory.h
+++ b/Framework/API/inc/MantidAPI/ConstraintFactory.h
@@ -51,7 +51,7 @@ class Expression;
     File change history is stored at: <https://github.com/mantidproject/mantid>
 */
 
-class MANTID_API_DLL ConstraintFactoryImpl
+class MANTID_API_DLL ConstraintFactoryImpl final
     : public Kernel::DynamicFactory<IConstraint> {
 public:
   /// Creates an instance of a Constraint
diff --git a/Framework/API/inc/MantidAPI/EnabledWhenWorkspaceIsType.h b/Framework/API/inc/MantidAPI/EnabledWhenWorkspaceIsType.h
index 41d8fc23d5a807f55fb2e495e932c109d2fb18e0..ff77b8836ed5aa2b81515cdb571e2bd1f13d18ee 100644
--- a/Framework/API/inc/MantidAPI/EnabledWhenWorkspaceIsType.h
+++ b/Framework/API/inc/MantidAPI/EnabledWhenWorkspaceIsType.h
@@ -65,9 +65,9 @@ public:
    */
   virtual bool fulfillsCriterion(const Kernel::IPropertyManager *algo) const {
     // Find the property
-    if (algo == NULL)
+    if (!algo)
       return true;
-    Mantid::Kernel::Property *prop = NULL;
+    Mantid::Kernel::Property *prop = nullptr;
     try {
       prop = algo->getPointerToProperty(m_otherPropName);
     } catch (Mantid::Kernel::Exception::NotFoundError &) {
diff --git a/Framework/API/inc/MantidAPI/Expression.h b/Framework/API/inc/MantidAPI/Expression.h
index f5addaab581d4eb4ddca4130c007f41dd87d7cdf..e7229bd668bde377c41ecf386f9c91d1b4c6d16f 100644
--- a/Framework/API/inc/MantidAPI/Expression.h
+++ b/Framework/API/inc/MantidAPI/Expression.h
@@ -10,7 +10,7 @@
 #include <string>
 #include <vector>
 #include <map>
-#include <set>
+#include <unordered_set>
 
 namespace Mantid {
 namespace API {
@@ -56,7 +56,7 @@ public:
   Expression(const std::vector<std::string> &ops);
   /// contructor
   Expression(const std::vector<std::string> &binary,
-             const std::set<std::string> &unary);
+             const std::unordered_set<std::string> &unary);
   /// copy contructor
   Expression(const Expression &expr);
   /// Assignment operator
@@ -104,7 +104,7 @@ public:
   /// This method returns first sub-expression without brackets
   const Expression &bracketsRemoved() const;
   /// Return a list of all variable names in this expression
-  std::set<std::string> getVariables() const;
+  std::unordered_set<std::string> getVariables() const;
   /**
    * Rename all variables with a given name
    * @param oldName :: The old name
@@ -192,10 +192,10 @@ private:
   struct Operators {
     std::vector<std::string>
         binary; ///< Binary operators in reverse precedence order
-    std::set<std::string> unary; ///< Unary operators
+    std::unordered_set<std::string> unary; ///< Unary operators
     std::map<std::string, size_t>
         precedence; ///< Map of the operator precedence order
-    std::set<char>
+    std::unordered_set<char>
         symbols; ///< All the symbols that are used in the binary operators
     std::map<std::string, char> op_number; ///< map of operators
   };
@@ -215,7 +215,7 @@ private:
    * Adds new unary operators to the expression
    * @param ops :: A vector with unary operators
    */
-  void add_unary(const std::set<std::string> &ops);
+  void add_unary(const std::unordered_set<std::string> &ops);
   /**
    * Check if a string is a unary operator
    * @param op :: The string to check
diff --git a/Framework/API/inc/MantidAPI/FunctionFactory.h b/Framework/API/inc/MantidAPI/FunctionFactory.h
index 35e0b2310d59f616dbdbac957a7aa6f3411d18cc..6d2d9c045858261580790a96da1c0a4058545542 100644
--- a/Framework/API/inc/MantidAPI/FunctionFactory.h
+++ b/Framework/API/inc/MantidAPI/FunctionFactory.h
@@ -53,7 +53,7 @@ class Expression;
     File change history is stored at: <https://github.com/mantidproject/mantid>
 */
 
-class MANTID_API_DLL FunctionFactoryImpl
+class MANTID_API_DLL FunctionFactoryImpl final
     : public Kernel::DynamicFactory<IFunction> {
 public:
   /**Creates an instance of a function
diff --git a/Framework/API/inc/MantidAPI/GeometryInfo.h b/Framework/API/inc/MantidAPI/GeometryInfo.h
new file mode 100644
index 0000000000000000000000000000000000000000..1bda41194d3de45b14ba7c35500c77e90cb91a87
--- /dev/null
+++ b/Framework/API/inc/MantidAPI/GeometryInfo.h
@@ -0,0 +1,95 @@
+#ifndef MANTID_API_GEOMETRYINFO_H_
+#define MANTID_API_GEOMETRYINFO_H_
+
+#include "MantidAPI/GeometryInfoFactory.h"
+
+namespace Mantid {
+
+namespace Geometry {
+class Instrument;
+class IDetector;
+}
+
+namespace API {
+class ISpectrum;
+
+/** GeometryInfo is a small wrapper around the Instrument/Geometry and provides
+  easy access to commonly used parameters, such as L1, L2, and 2-theta.
+
+  Usage:
+  This is mainly intented for use in algorithms that need access to simple
+  instrument parameters and work with spectra. For example:
+
+  ~~~{.cpp}
+  void exec() {
+    // Some setup code
+    GeometryInfoFactory factory(*inputWorkspace);
+    // Loop over spectra
+    for(size_t i=0; i<inputWorkspace->getNumberHistograms(); ++i) {
+      auto geometry = factory.create(i);
+      if (!geometry.isMasked()) {
+        auto L1 = geometry.getL1();
+        auto L2 = geometry.getL2();
+        auto twoTheta = geometry.getTwoTheta();
+        // Your code
+      }
+    }
+  }
+  ~~~
+
+  @author Simon Heybrock, ESS
+
+  Copyright &copy; 2016 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 MANTID_API_DLL GeometryInfo {
+public:
+  /// Constructor, usually not used directy. Creation of GeometryInfo is done
+  /// via GeometryInfoFactory.
+  GeometryInfo(const GeometryInfoFactory &factory, const ISpectrum &spectrum);
+
+  /// Returns true if the spectrum is a monitor.
+  bool isMonitor() const;
+  /// Returns true if the spectrum is masked.
+  bool isMasked() const;
+  /// Returns L1 (distance from source to sample).
+  double getL1() const;
+  /** Returns L2 (distance from sample to spectrum).
+   *
+   * For monitors this is defined such that L1+L2 = source-detector distance,
+   * i.e., for a monitor in the beamline between source and sample L2 is
+   * negative. */
+  double getL2() const;
+  /// Returns 2 theta (angle w.r.t. to beam direction).
+  double getTwoTheta() const;
+  /// Returns signed 2 theta (signed angle w.r.t. to beam direction).
+  double getSignedTwoTheta() const;
+  /// Returns the detector or detector group associated with the spectrum.
+  boost::shared_ptr<const Geometry::IDetector> getDetector() const;
+
+private:
+  const GeometryInfoFactory &m_factory;
+  boost::shared_ptr<const Geometry::IDetector> m_detector;
+};
+}
+}
+
+#endif /*MANTID_API_GEOMETRYINFO_H_*/
diff --git a/Framework/API/inc/MantidAPI/GeometryInfoFactory.h b/Framework/API/inc/MantidAPI/GeometryInfoFactory.h
new file mode 100644
index 0000000000000000000000000000000000000000..b9a03423125a86b9710e8d33b8852b63608a60cc
--- /dev/null
+++ b/Framework/API/inc/MantidAPI/GeometryInfoFactory.h
@@ -0,0 +1,81 @@
+#ifndef MANTID_API_GEOMETRYINFOFACTORY_H_
+#define MANTID_API_GEOMETRYINFOFACTORY_H_
+
+#include <boost/shared_ptr.hpp>
+
+#include "MantidKernel/V3D.h"
+#include "MantidAPI/DllConfig.h"
+
+namespace Mantid {
+
+namespace Geometry {
+class Instrument;
+class IComponent;
+}
+
+namespace API {
+class MatrixWorkspace;
+class GeometryInfo;
+
+/** Factory for GeometryInfo, see there for detailed information.
+
+  @author Simon Heybrock, ESS
+
+  Copyright &copy; 2016 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 MANTID_API_DLL GeometryInfoFactory {
+public:
+  GeometryInfoFactory(const MatrixWorkspace &workspace);
+
+  /// Returns a GeometryInfo instance for workspace index "index".
+  GeometryInfo create(const size_t index) const;
+
+  /// Returns a reference to the instrument. The value is cached, so calling it
+  /// repeatedly is cheap.
+  const Geometry::Instrument &getInstrument() const;
+  /// Returns a reference to the source component. The value is cached, so
+  /// calling it repeatedly is cheap.
+  const Geometry::IComponent &getSource() const;
+  /// Returns a reference to the sample component. The value is cached, so
+  /// calling it repeatedly is cheap.
+  const Geometry::IComponent &getSample() const;
+  /// Returns the source position. The value is cached, so calling it repeatedly
+  /// is cheap.
+  Kernel::V3D getSourcePos() const;
+  /// Returns the sample position. The value is cached, so calling it repeatedly
+  /// is cheap.
+  Kernel::V3D getSamplePos() const;
+  double getL1() const;
+
+private:
+  const MatrixWorkspace &m_workspace;
+  boost::shared_ptr<const Geometry::Instrument> m_instrument;
+  boost::shared_ptr<const Geometry::IComponent> m_source;
+  boost::shared_ptr<const Geometry::IComponent> m_sample;
+  Kernel::V3D m_sourcePos;
+  Kernel::V3D m_samplePos;
+  double m_L1;
+};
+}
+}
+
+#endif /* MANTID_API_GEOMETRYINFOFACTORY_H_ */
diff --git a/Framework/API/inc/MantidAPI/IFunction.h b/Framework/API/inc/MantidAPI/IFunction.h
index e4d675c3fd6fe385abe40690eb3fc8335bc7d275..008a6e9bfefb4397d4c1ff90ea052163ae4845d0 100644
--- a/Framework/API/inc/MantidAPI/IFunction.h
+++ b/Framework/API/inc/MantidAPI/IFunction.h
@@ -314,7 +314,7 @@ public:
 
   /// Constructor
   IFunction()
-      : m_isParallel(false), m_handler(NULL), m_progReporter(NULL),
+      : m_isParallel(false), m_handler(nullptr), m_progReporter(nullptr),
         m_chiSquared(0.0) {}
   /// Virtual destructor
   virtual ~IFunction();
diff --git a/Framework/API/inc/MantidAPI/IMDHistoWorkspace.h b/Framework/API/inc/MantidAPI/IMDHistoWorkspace.h
index 8800b57f04eb6237e9a2ae47f643838c94da4eac..bdadb2430a98658dd9b34dada1c413d34c9d49f0 100644
--- a/Framework/API/inc/MantidAPI/IMDHistoWorkspace.h
+++ b/Framework/API/inc/MantidAPI/IMDHistoWorkspace.h
@@ -91,11 +91,9 @@ public:
   virtual size_t getLinearIndex(size_t index1, size_t index2, size_t index3,
                                 size_t index4) const = 0;
 
-  virtual void getLineData(const Mantid::Kernel::VMD &start,
-                           const Mantid::Kernel::VMD &end,
-                           Mantid::API::MDNormalization normalize,
-                           std::vector<coord_t> &x, std::vector<signal_t> &y,
-                           std::vector<signal_t> &e) const = 0;
+  virtual LinePlot
+  getLineData(const Mantid::Kernel::VMD &start, const Mantid::Kernel::VMD &end,
+              Mantid::API::MDNormalization normalize) const = 0;
 
   virtual double &operator[](const size_t &index) = 0;
 
diff --git a/Framework/API/inc/MantidAPI/IMDNode.h b/Framework/API/inc/MantidAPI/IMDNode.h
index 887defa8d30a8e1f4d44bb74810c735fdee39aad..b02a87747494935ccfd563a3e8a927eee00e1ce5 100644
--- a/Framework/API/inc/MantidAPI/IMDNode.h
+++ b/Framework/API/inc/MantidAPI/IMDNode.h
@@ -241,9 +241,9 @@ public:
 
   /** Split sub-boxes, if this is possible and neede for this box */
   virtual void
-  splitAllIfNeeded(Mantid::Kernel::ThreadScheduler * /*ts*/ = NULL) = 0;
+  splitAllIfNeeded(Mantid::Kernel::ThreadScheduler * /*ts*/ = nullptr) = 0;
   /** Recalculate signal etc. */
-  virtual void refreshCache(Kernel::ThreadScheduler * /*ts*/ = NULL) = 0;
+  virtual void refreshCache(Kernel::ThreadScheduler * /*ts*/ = nullptr) = 0;
   /** Calculate the centroid of this box and all sub-boxes. */
   virtual void calculateCentroid(coord_t * /*centroid*/) const = 0;
   /** Calculate the centroid of this box and all sub-boxes. */
diff --git a/Framework/API/inc/MantidAPI/IMDWorkspace.h b/Framework/API/inc/MantidAPI/IMDWorkspace.h
index 8cb1281f0600daad8c48b2208f452efe054fdb13..7e284bd307996c2d5b82166c139a09ce4c8b7dcb 100644
--- a/Framework/API/inc/MantidAPI/IMDWorkspace.h
+++ b/Framework/API/inc/MantidAPI/IMDWorkspace.h
@@ -74,6 +74,15 @@ public:
   IMDWorkspace();
   ~IMDWorkspace() override;
 
+  /**
+   * Holds X, Y, E for a line plot
+   */
+  struct LinePlot {
+    std::vector<coord_t> x;
+    std::vector<signal_t> y;
+    std::vector<signal_t> e;
+  };
+
   /// Returns a clone of the workspace
   std::unique_ptr<IMDWorkspace> clone() const {
     return std::unique_ptr<IMDWorkspace>(doClone());
@@ -96,7 +105,7 @@ public:
   /// Creates a new iterator pointing to the first cell in the workspace
   virtual std::vector<IMDIterator *> createIterators(
       size_t suggestedNumCores = 1,
-      Mantid::Geometry::MDImplicitFunction *function = NULL) const = 0;
+      Mantid::Geometry::MDImplicitFunction *function = nullptr) const = 0;
 
   /// Returns the (normalized) signal at a given coordinates
   virtual signal_t
@@ -110,14 +119,12 @@ public:
       const Mantid::API::MDNormalization &normalization) const = 0;
 
   /// Method to generate a line plot through a MD-workspace
-  virtual void getLinePlot(const Mantid::Kernel::VMD &start,
-                           const Mantid::Kernel::VMD &end,
-                           Mantid::API::MDNormalization normalize,
-                           std::vector<coord_t> &x, std::vector<signal_t> &y,
-                           std::vector<signal_t> &e) const;
-
-  IMDIterator *
-  createIterator(Mantid::Geometry::MDImplicitFunction *function = NULL) const;
+  virtual LinePlot getLinePlot(const Mantid::Kernel::VMD &start,
+                               const Mantid::Kernel::VMD &end,
+                               Mantid::API::MDNormalization normalize) const;
+
+  IMDIterator *createIterator(
+      Mantid::Geometry::MDImplicitFunction *function = nullptr) const;
 
   std::string getConvention() const;
   void setConvention(std::string m_convention);
diff --git a/Framework/API/inc/MantidAPI/ImplicitFunctionParser.h b/Framework/API/inc/MantidAPI/ImplicitFunctionParser.h
index c651428cc518169bf718d75e05f6223da541559a..1f85a04a7376a7d5a94886f6837ed1ef3a5e051c 100644
--- a/Framework/API/inc/MantidAPI/ImplicitFunctionParser.h
+++ b/Framework/API/inc/MantidAPI/ImplicitFunctionParser.h
@@ -83,7 +83,7 @@ protected:
   }
 
   void checkSuccessorExists() {
-    if (0 == m_successor.get()) {
+    if (!m_successor) {
       std::string message = "There is no successor function parser. Is this an "
                             "empty composite function?";
       throw std::runtime_error(message);
diff --git a/Framework/API/inc/MantidAPI/LiveListenerFactory.h b/Framework/API/inc/MantidAPI/LiveListenerFactory.h
index 1475485f63d30a34346a70a2886ba96c204b93eb..f4b1b323300b54fbf056f37f068c7f50506f3082 100644
--- a/Framework/API/inc/MantidAPI/LiveListenerFactory.h
+++ b/Framework/API/inc/MantidAPI/LiveListenerFactory.h
@@ -52,7 +52,7 @@ class MANTID_API_DLL LiveListenerFactoryImpl
 public:
   boost::shared_ptr<ILiveListener>
   create(const std::string &instrumentName, bool connect,
-         const Kernel::IPropertyManager *props = NULL) const;
+         const Kernel::IPropertyManager *props = nullptr) const;
   bool checkConnection(const std::string &instrumentName) const;
 
 private:
diff --git a/Framework/API/inc/MantidAPI/MatrixWorkspace.h b/Framework/API/inc/MantidAPI/MatrixWorkspace.h
index b71eee9a2ad27e00ab578e8a4e0370beb3dd6c7a..f2479e7177abdd335be2b1f6283f09129261e7c5 100644
--- a/Framework/API/inc/MantidAPI/MatrixWorkspace.h
+++ b/Framework/API/inc/MantidAPI/MatrixWorkspace.h
@@ -127,18 +127,18 @@ public:
   spec2index_map getSpectrumToWorkspaceIndexMap() const;
   detid2index_map
   getDetectorIDToWorkspaceIndexMap(bool throwIfMultipleDets = false) const;
-  virtual void
-  getDetectorIDToWorkspaceIndexVector(std::vector<size_t> &out, detid_t &offset,
+  virtual std::vector<size_t>
+  getDetectorIDToWorkspaceIndexVector(detid_t &offset,
                                       bool throwIfMultipleDets = false) const;
-  virtual void getSpectrumToWorkspaceIndexVector(std::vector<size_t> &out,
-                                                 specid_t &offset) const;
-  void getIndicesFromSpectra(const std::vector<specid_t> &spectraList,
-                             std::vector<size_t> &indexList) const;
+  virtual std::vector<size_t>
+  getSpectrumToWorkspaceIndexVector(specid_t &offset) const;
+  std::vector<size_t>
+  getIndicesFromSpectra(const std::vector<specid_t> &spectraList) const;
   size_t getIndexFromSpectrumNumber(const specid_t specNo) const;
-  void getIndicesFromDetectorIDs(const std::vector<detid_t> &detIdList,
-                                 std::vector<size_t> &indexList) const;
-  void getSpectraFromDetectorIDs(const std::vector<detid_t> &detIdList,
-                                 std::vector<specid_t> &spectraList) const;
+  std::vector<size_t>
+  getIndicesFromDetectorIDs(const std::vector<detid_t> &detIdList) const;
+  std::vector<specid_t>
+  getSpectraFromDetectorIDs(const std::vector<detid_t> &detIdList) const;
 
   bool hasGroupedDetectors() const;
 
@@ -405,11 +405,9 @@ public:
   /// Dimensin id for y-dimension.
   static const std::string yDimensionId;
   /// Generate a line plot through the matrix workspace.
-  void getLinePlot(const Mantid::Kernel::VMD &start,
-                   const Mantid::Kernel::VMD &end,
-                   Mantid::API::MDNormalization normalize,
-                   std::vector<coord_t> &x, std::vector<signal_t> &y,
-                   std::vector<signal_t> &e) const override;
+  LinePlot getLinePlot(const Mantid::Kernel::VMD &start,
+                       const Mantid::Kernel::VMD &end,
+                       Mantid::API::MDNormalization normalize) const override;
   /// Get the signal at a coordinate in the workspace.
   signal_t getSignalAtCoord(
       const coord_t *coords,
@@ -422,7 +420,7 @@ public:
   /// cores.
   std::vector<IMDIterator *> createIterators(
       size_t suggestedNumCores = 1,
-      Mantid::Geometry::MDImplicitFunction *function = NULL) const override;
+      Mantid::Geometry::MDImplicitFunction *function = nullptr) const override;
 
   /// Apply masking.
   void
@@ -470,7 +468,8 @@ protected:
   /// Protected copy assignment operator. Assignment not implemented.
   MatrixWorkspace &operator=(const MatrixWorkspace &other);
 
-  MatrixWorkspace(Mantid::Geometry::INearestNeighboursFactory *factory = NULL);
+  MatrixWorkspace(
+      Mantid::Geometry::INearestNeighboursFactory *factory = nullptr);
 
   /// Initialises the workspace. Sets the size and lengths of the arrays. Must
   /// be overloaded.
diff --git a/Framework/API/inc/MantidAPI/ParameterTie.h b/Framework/API/inc/MantidAPI/ParameterTie.h
index 195b44453def3dd7d96b1bb534ab72a427acf4e8..822e9bd32e0be3c3524cec56509c029005495200 100644
--- a/Framework/API/inc/MantidAPI/ParameterTie.h
+++ b/Framework/API/inc/MantidAPI/ParameterTie.h
@@ -45,7 +45,7 @@ namespace API {
     File change history is stored at: <https://github.com/mantidproject/mantid>
     Code Documentation is available at: <http://doxygen.mantidproject.org>
   */
-class MANTID_API_DLL ParameterTie : public ParameterReference {
+class MANTID_API_DLL ParameterTie final : public ParameterReference {
 public:
   /// Constructor
   ParameterTie(IFunction *funct, const std::string &parName,
@@ -57,7 +57,7 @@ public:
   /// Evaluate the expression
   virtual double eval();
   /// Return the string that can be used to recreate this tie
-  virtual std::string asString(const IFunction *fun = NULL) const;
+  virtual std::string asString(const IFunction *fun = nullptr) const;
 
   /// Check if the tie has any references to certain parameters
   bool findParametersOf(const IFunction *fun) const;
diff --git a/Framework/API/inc/MantidAPI/Progress.h b/Framework/API/inc/MantidAPI/Progress.h
index c8ac73e006a291bfdea2fdc58f3f8e1068922a48..92657e0f99a04d97ea5a54d80272d73a18f1d0c2 100644
--- a/Framework/API/inc/MantidAPI/Progress.h
+++ b/Framework/API/inc/MantidAPI/Progress.h
@@ -38,7 +38,7 @@ class Algorithm;
  File change history is stored at: <https://github.com/mantidproject/mantid>.
  Code Documentation is available at: <http://doxygen.mantidproject.org>
  */
-class MANTID_API_DLL Progress : public Mantid::Kernel::ProgressBase {
+class MANTID_API_DLL Progress final : public Mantid::Kernel::ProgressBase {
 public:
   Progress();
   Progress(Algorithm *alg, double start, double end, int numSteps);
diff --git a/Framework/API/inc/MantidAPI/PropertyManagerDataService.h b/Framework/API/inc/MantidAPI/PropertyManagerDataService.h
index 15da7f7d89393e285d070f881390f0ace531640f..220d86c18ed7ac3af695ec4adb28ffa516cbe83b 100644
--- a/Framework/API/inc/MantidAPI/PropertyManagerDataService.h
+++ b/Framework/API/inc/MantidAPI/PropertyManagerDataService.h
@@ -30,7 +30,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 MANTID_API_DLL PropertyManagerDataServiceImpl
+class MANTID_API_DLL PropertyManagerDataServiceImpl final
     : public Mantid::Kernel::DataService<Mantid::Kernel::PropertyManager> {
 private:
   friend struct Mantid::Kernel::CreateUsingNew<PropertyManagerDataServiceImpl>;
diff --git a/Framework/API/inc/MantidAPI/SpectraAxis.h b/Framework/API/inc/MantidAPI/SpectraAxis.h
index 65732a3121df5d57fad6bc54f6929b026e03e25c..edc20cde3f646815bec274a6ddf0f84813e34647 100644
--- a/Framework/API/inc/MantidAPI/SpectraAxis.h
+++ b/Framework/API/inc/MantidAPI/SpectraAxis.h
@@ -63,8 +63,8 @@ public:
 
   specid_t spectraNo(const std::size_t &index) const override;
   // Get a map that contains the spectra index as the key and the index in the
-  // array as teh value
-  void getSpectraIndexMap(spec2index_map &) const;
+  // array as the value
+  spec2index_map getSpectraIndexMap() const;
 
   double getMin() const override;
   double getMax() const override;
diff --git a/Framework/API/inc/MantidAPI/VectorParameter.h b/Framework/API/inc/MantidAPI/VectorParameter.h
index 0ba618f1f154a32e5059d2c153fa817e04a021f3..6b4ba6dba5a98b369e231f67680b0d5d2de6f15b 100644
--- a/Framework/API/inc/MantidAPI/VectorParameter.h
+++ b/Framework/API/inc/MantidAPI/VectorParameter.h
@@ -143,7 +143,7 @@ VectorParameter<Derived, ElemType>::VectorParameter(
 /// Default constructor
 template <typename Derived, typename ElemType>
 VectorParameter<Derived, ElemType>::VectorParameter()
-    : m_arry(NULL), m_size(0) {
+    : m_arry(nullptr), m_size(0) {
   m_isValid = false;
 }
 
diff --git a/Framework/API/inc/MantidAPI/WorkspaceProperty.h b/Framework/API/inc/MantidAPI/WorkspaceProperty.h
index 78a3993565041f05d43c5bcaa6cba1151491bc71..6bdb1bbe503d89a889e6c946fe06315c749c20c4 100644
--- a/Framework/API/inc/MantidAPI/WorkspaceProperty.h
+++ b/Framework/API/inc/MantidAPI/WorkspaceProperty.h
@@ -322,8 +322,7 @@ public:
     if (this->direction() == Kernel::Direction::Input ||
         this->direction() == Kernel::Direction::InOut) {
       // If an input workspace, get the list of workspaces currently in the ADS
-      std::set<std::string> vals =
-          AnalysisDataService::Instance().getObjectNames();
+      auto vals = AnalysisDataService::Instance().getObjectNames();
       if (isOptional()) // Insert an empty option
       {
         vals.insert("");
@@ -331,8 +330,7 @@ public:
       // Copy-construct a temporary workspace property to test the validity of
       // each workspace
       WorkspaceProperty<TYPE> tester(*this);
-      std::set<std::string>::iterator it;
-      for (it = vals.begin(); it != vals.end();) {
+      for (auto it = vals.begin(); it != vals.end();) {
         // Remove any workspace that's not valid for this algorithm
         if (!tester.setValue(*it).empty()) {
           vals.erase(
@@ -401,12 +399,10 @@ private:
     g_log.debug() << " Input WorkspaceGroup found " << std::endl;
 
     std::vector<std::string> wsGroupNames = wsGroup->getNames();
-    std::vector<std::string>::iterator it = wsGroupNames.begin();
-
     std::string error;
 
     // Cycle through each workspace in the group ...
-    for (; it != wsGroupNames.end(); ++it) {
+    for (auto it = wsGroupNames.begin(); it != wsGroupNames.end(); ++it) {
       std::string memberWsName = *it;
       boost::shared_ptr<Workspace> memberWs =
           AnalysisDataService::Instance().retrieve(memberWsName);
@@ -421,7 +417,7 @@ private:
       } else {
         // ... and if it is a workspace of incorrect type, exclude the group by
         // returning an error.
-        if (NULL == boost::dynamic_pointer_cast<TYPE>(memberWs)) {
+        if (!boost::dynamic_pointer_cast<TYPE>(memberWs)) {
           error = "Workspace " + memberWsName + " is not of type " +
                   Kernel::PropertyWithValue<boost::shared_ptr<TYPE>>::type() +
                   ".";
diff --git a/Framework/API/src/Algorithm.cpp b/Framework/API/src/Algorithm.cpp
index 9320fc423a43cbbf679a3d5bd3a9b24b54ca42aa..24fe882565fb120c26d8371f83503bc0715e1d5a 100644
--- a/Framework/API/src/Algorithm.cpp
+++ b/Framework/API/src/Algorithm.cpp
@@ -26,7 +26,7 @@
 #include <Poco/ActiveResult.h>
 #include <Poco/NotificationCenter.h>
 #include <Poco/RWLock.h>
-#include <Poco/StringTokenizer.h>
+#include <MantidKernel/StringTokenizer.h>
 #include <Poco/Void.h>
 
 #include <json/json.h>
@@ -201,11 +201,12 @@ void Algorithm::progress(double p, const std::string &msg, double estimatedTime,
 //---------------------------------------------------------------------------------------------
 /// Function to return all of the categories that contain this algorithm
 const std::vector<std::string> Algorithm::categories() const {
-  Poco::StringTokenizer tokenizer(category(), categorySeparator(),
-                                  Poco::StringTokenizer::TOK_TRIM |
-                                      Poco::StringTokenizer::TOK_IGNORE_EMPTY);
+  Mantid::Kernel::StringTokenizer tokenizer(
+      category(), categorySeparator(),
+      Mantid::Kernel::StringTokenizer::TOK_TRIM |
+          Mantid::Kernel::StringTokenizer::TOK_IGNORE_EMPTY);
 
-  std::vector<std::string> res(tokenizer.begin(), tokenizer.end());
+  auto res = tokenizer.asVector();
 
   const DeprecatedAlgorithm *depo =
       dynamic_cast<const DeprecatedAlgorithm *>(this);
@@ -227,12 +228,11 @@ const std::string Algorithm::workspaceMethodName() const { return ""; }
  *workspaceMethodName attached
  */
 const std::vector<std::string> Algorithm::workspaceMethodOn() const {
-  Poco::StringTokenizer tokenizer(this->workspaceMethodOnTypes(),
-                                  WORKSPACE_TYPES_SEPARATOR,
-                                  Poco::StringTokenizer::TOK_TRIM |
-                                      Poco::StringTokenizer::TOK_IGNORE_EMPTY);
-
-  return std::vector<std::string>(tokenizer.begin(), tokenizer.end());
+  Mantid::Kernel::StringTokenizer tokenizer(
+      this->workspaceMethodOnTypes(), WORKSPACE_TYPES_SEPARATOR,
+      Mantid::Kernel::StringTokenizer::TOK_TRIM |
+          Mantid::Kernel::StringTokenizer::TOK_IGNORE_EMPTY);
+  return tokenizer.asVector();
 }
 
 /**
@@ -1230,7 +1230,7 @@ bool Algorithm::processGroups() {
   for (auto &pureOutputWorkspaceProp : m_pureOutputWorkspaceProps) {
     Property *prop = dynamic_cast<Property *>(pureOutputWorkspaceProp);
     if (prop) {
-      WorkspaceGroup_sptr outWSGrp = WorkspaceGroup_sptr(new WorkspaceGroup());
+      auto outWSGrp = boost::make_shared<WorkspaceGroup>();
       outGroups.push_back(outWSGrp);
       // Put the GROUP in the ADS
       AnalysisDataService::Instance().addOrReplace(prop->value(), outWSGrp);
diff --git a/Framework/API/src/AlgorithmFactory.cpp b/Framework/API/src/AlgorithmFactory.cpp
index db39e91f5563a33f165fe249335aaefc4e6b03dc..510801beece5b076ab93e5b97b29a881515acb32 100644
--- a/Framework/API/src/AlgorithmFactory.cpp
+++ b/Framework/API/src/AlgorithmFactory.cpp
@@ -7,7 +7,7 @@
 #include "MantidKernel/LibraryManager.h"
 #include "MantidKernel/ConfigService.h"
 
-#include "Poco/StringTokenizer.h"
+#include "MantidKernel/StringTokenizer.h"
 
 namespace Mantid {
 namespace API {
@@ -178,7 +178,7 @@ AlgorithmFactoryImpl::getKeys(bool includeHidden) const {
     return names;
   } else {
     // hidden categories
-    std::set<std::string> hiddenCategories;
+    std::unordered_set<std::string> hiddenCategories;
     fillHiddenCategories(&hiddenCategories);
 
     // strip out any algorithms names where all of the categories are hidden
@@ -245,7 +245,7 @@ AlgorithmFactoryImpl::getCategoriesWithState() const {
   std::map<std::string, bool> resultCategories;
 
   // hidden categories - empty initially
-  std::set<std::string> hiddenCategories;
+  std::unordered_set<std::string> hiddenCategories;
   fillHiddenCategories(&hiddenCategories);
 
   // get all of the algorithm keys, including the hidden ones for speed purposes
@@ -287,20 +287,18 @@ AlgorithmFactoryImpl::getCategoriesWithState() const {
 * the default is false
 * @returns The category strings
 */
-const std::set<std::string>
+const std::unordered_set<std::string>
 AlgorithmFactoryImpl::getCategories(bool includeHidden) const {
-  std::set<std::string> validCategories;
+  std::unordered_set<std::string> validCategories;
 
   // get all of the information we need
-  std::map<std::string, bool> categoryMap = getCategoriesWithState();
+  auto categoryMap = getCategoriesWithState();
 
   // iterate around the map
-  std::map<std::string, bool>::const_iterator it_end = categoryMap.end();
-  for (std::map<std::string, bool>::const_iterator it = categoryMap.begin();
-       it != it_end; ++it) {
-    bool isHidden = (*it).second;
+  for (auto const &category : categoryMap) {
+    bool isHidden = (category).second;
     if (includeHidden || (!isHidden)) {
-      validCategories.insert((*it).first);
+      validCategories.insert((category).first);
     }
   }
 
@@ -319,20 +317,18 @@ AlgorithmFactoryImpl::getCategories(bool includeHidden) const {
 std::vector<Algorithm_descriptor>
 AlgorithmFactoryImpl::getDescriptors(bool includeHidden) const {
   // algorithm names
-  std::vector<std::string> sv;
-  sv = getKeys(true);
+  auto sv = getKeys(true);
 
   // hidden categories
-  std::set<std::string> hiddenCategories;
-  if (includeHidden == false) {
+  std::unordered_set<std::string> hiddenCategories;
+  if (!includeHidden) {
     fillHiddenCategories(&hiddenCategories);
   }
 
   // results vector
   std::vector<Algorithm_descriptor> res;
 
-  for (std::vector<std::string>::const_iterator s = sv.begin(); s != sv.end();
-       ++s) {
+  for (auto s = sv.cbegin(); s != sv.cend(); ++s) {
     if (s->empty())
       continue;
     Algorithm_descriptor desc;
@@ -348,7 +344,7 @@ AlgorithmFactoryImpl::getDescriptors(bool includeHidden) const {
       continue;
 
     boost::shared_ptr<IAlgorithm> alg = create(desc.name, desc.version);
-    std::vector<std::string> categories = alg->categories();
+    auto categories = alg->categories();
     desc.alias = alg->alias();
 
     // For each category
@@ -387,12 +383,13 @@ AlgorithmFactoryImpl::getDescriptors(bool includeHidden) const {
 }
 
 void AlgorithmFactoryImpl::fillHiddenCategories(
-    std::set<std::string> *categorySet) const {
+    std::unordered_set<std::string> *categorySet) const {
   std::string categoryString = Kernel::ConfigService::Instance().getString(
       "algorithms.categories.hidden");
-  Poco::StringTokenizer tokenizer(categoryString, ";",
-                                  Poco::StringTokenizer::TOK_TRIM |
-                                      Poco::StringTokenizer::TOK_IGNORE_EMPTY);
+  Mantid::Kernel::StringTokenizer tokenizer(
+      categoryString, ";",
+      Mantid::Kernel::StringTokenizer::TOK_TRIM |
+          Mantid::Kernel::StringTokenizer::TOK_IGNORE_EMPTY);
   std::copy(tokenizer.begin(), tokenizer.end(),
             std::inserter(*categorySet, categorySet->end()));
 }
diff --git a/Framework/API/src/AlgorithmProxy.cpp b/Framework/API/src/AlgorithmProxy.cpp
index 845c0bcd91257efaf2cab8221454aafbb9edc8f9..42b381eb24a53d5c50acc086dce6f65c0359316c 100644
--- a/Framework/API/src/AlgorithmProxy.cpp
+++ b/Framework/API/src/AlgorithmProxy.cpp
@@ -309,11 +309,12 @@ std::string AlgorithmProxy::toString() const {
 
 /// Function to return all of the categories that contain this algorithm
 const std::vector<std::string> AlgorithmProxy::categories() const {
-  Poco::StringTokenizer tokenizer(category(), categorySeparator(),
-                                  Poco::StringTokenizer::TOK_TRIM |
-                                      Poco::StringTokenizer::TOK_IGNORE_EMPTY);
+  Mantid::Kernel::StringTokenizer tokenizer(
+      category(), categorySeparator(),
+      Mantid::Kernel::StringTokenizer::TOK_TRIM |
+          Mantid::Kernel::StringTokenizer::TOK_IGNORE_EMPTY);
 
-  std::vector<std::string> res(tokenizer.begin(), tokenizer.end());
+  auto res = tokenizer.asVector();
 
   const DeprecatedAlgorithm *depo =
       dynamic_cast<const DeprecatedAlgorithm *>(this);
diff --git a/Framework/API/src/ConstraintFactory.cpp b/Framework/API/src/ConstraintFactory.cpp
index 69184b86f97f194eeb55dcbeb9a50855b549b0ad..5f40d7747b30357ce2615b093b727946c80fe31e 100644
--- a/Framework/API/src/ConstraintFactory.cpp
+++ b/Framework/API/src/ConstraintFactory.cpp
@@ -2,7 +2,7 @@
 #include "MantidAPI/Expression.h"
 #include "MantidAPI/IConstraint.h"
 #include "MantidKernel/LibraryManager.h"
-#include <Poco/StringTokenizer.h>
+#include <MantidKernel/StringTokenizer.h>
 
 namespace Mantid {
 namespace API {
diff --git a/Framework/API/src/ExperimentInfo.cpp b/Framework/API/src/ExperimentInfo.cpp
index 095ac6780241a809928b95a96adbfb44d85dae7a..814dd67b87c0744fef682ba4bda8bf0ae6fd2e28 100644
--- a/Framework/API/src/ExperimentInfo.cpp
+++ b/Framework/API/src/ExperimentInfo.cpp
@@ -789,18 +789,14 @@ std::string ExperimentInfo::getAvailableWorkspaceEndDate() const {
 
 //---------------------------------------------------------------------------------------
 /** A given instrument may have multiple IDFs associated with it. This method
-*return an
-*  identifier which identify a given IDF for a given instrument. An IDF filename
-*is
-*  required to be of the form IDFname + _Definition + Identifier + .xml, the
-*identifier
-*  then is the part of a filename that identifies the IDF valid at a given date.
+*return an identifier which identify a given IDF for a given instrument.
+* An IDF filename is required to be of the form IDFname + _Definition +
+*Identifier + .xml, the identifier then is the part of a filename that
+*identifies the IDF valid at a given date.
 *
 *  If several IDF files are valid at the given date the file with the most
-*recent from
-*  date is selected. If no such files are found the file with the latest from
-*date is
-*  selected.
+*recent from date is selected. If no such files are found the file with the
+*latest from date is selected.
 *
 *  If no file is found for the given instrument, an empty string is returned.
 *
@@ -1129,14 +1125,14 @@ void ExperimentInfo::readParameterMap(const std::string &parameterStr) {
   Geometry::ParameterMap &pmap = this->instrumentParameters();
   Instrument_const_sptr instr = this->getInstrument()->baseInstrument();
 
-  int options = Poco::StringTokenizer::TOK_IGNORE_EMPTY;
-  options += Poco::StringTokenizer::TOK_TRIM;
-  Poco::StringTokenizer splitter(parameterStr, "|", options);
+  int options = Mantid::Kernel::StringTokenizer::TOK_IGNORE_EMPTY;
+  options += Mantid::Kernel::StringTokenizer::TOK_TRIM;
+  Mantid::Kernel::StringTokenizer splitter(parameterStr, "|", options);
 
   auto iend = splitter.end();
   // std::string prev_name;
   for (auto itr = splitter.begin(); itr != iend; ++itr) {
-    Poco::StringTokenizer tokens(*itr, ";");
+    Mantid::Kernel::StringTokenizer tokens(*itr, ";");
     if (tokens.count() < 4)
       continue;
     std::string comp_name = tokens[0];
diff --git a/Framework/API/src/Expression.cpp b/Framework/API/src/Expression.cpp
index 765c7664ac6d68e6d4621c500296b814f39acb58..ec8ba7247905b98852c8cd68caa01b1f7ad6f9ff 100644
--- a/Framework/API/src/Expression.cpp
+++ b/Framework/API/src/Expression.cpp
@@ -4,12 +4,12 @@
 
 #include "MantidAPI/Expression.h"
 
-#include <Poco/StringTokenizer.h>
+#include <MantidKernel/StringTokenizer.h>
 
 namespace Mantid {
 namespace API {
 
-typedef Poco::StringTokenizer tokenizer;
+typedef Mantid::Kernel::StringTokenizer tokenizer;
 
 const std::string DEFAULT_OPS_STR[] = {";", ",", "=", "== != > < <= >=",
                                        "&& || ^^", "+ -", "* /", "^"};
@@ -24,7 +24,7 @@ Expression::Expression() {
   add_operators(ops);
 
   // Define unary operators
-  std::set<std::string> unary;
+  std::unordered_set<std::string> unary;
   unary.insert("+");
   unary.insert("-");
 
@@ -39,7 +39,7 @@ Expression::Expression(const std::vector<std::string> &ops) {
 
 /// contructor
 Expression::Expression(const std::vector<std::string> &binary,
-                       const std::set<std::string> &unary) {
+                       const std::unordered_set<std::string> &unary) {
   m_operators.reset(new Operators());
   add_operators(binary);
   add_unary(unary);
@@ -86,7 +86,7 @@ void Expression::add_operators(const std::vector<std::string> &ops) {
   }
 }
 
-void Expression::add_unary(const std::set<std::string> &ops) {
+void Expression::add_unary(const std::unordered_set<std::string> &ops) {
   m_operators->unary = ops;
   for (const auto &op : ops) {
     m_operators->symbols.insert(op.cbegin(), op.cend());
@@ -479,8 +479,8 @@ const Expression &Expression::bracketsRemoved() const {
 /**
  * Return a list of all variable names in this expression
  */
-std::set<std::string> Expression::getVariables() const {
-  std::set<std::string> out;
+std::unordered_set<std::string> Expression::getVariables() const {
+  std::unordered_set<std::string> out;
   if (!isFunct()) {
     std::string s = name();
     if (!s.empty() && !isdigit(s[0])) {
@@ -489,7 +489,7 @@ std::set<std::string> Expression::getVariables() const {
   } else {
     for (const auto &e : *this) {
       if (e.isFunct()) {
-        std::set<std::string> tout = e.getVariables();
+        std::unordered_set<std::string> tout = e.getVariables();
         out.insert(tout.begin(), tout.end());
       } else {
         std::string s = e.name();
diff --git a/Framework/API/src/FileFinder.cpp b/Framework/API/src/FileFinder.cpp
index 32d391eb2606311ce7f1fd9a6b8c4d592b82ca5e..a9b5484678371c9d1419c927811f0ac53bb8ba5b 100644
--- a/Framework/API/src/FileFinder.cpp
+++ b/Framework/API/src/FileFinder.cpp
@@ -14,7 +14,7 @@
 
 #include <Poco/Path.h>
 #include <Poco/File.h>
-#include <Poco/StringTokenizer.h>
+#include <MantidKernel/StringTokenizer.h>
 #include <Poco/Exception.h>
 #include <boost/regex.hpp>
 #include <boost/lexical_cast.hpp>
@@ -594,9 +594,9 @@ FileFinderImpl::findRuns(const std::string &hintstr) const {
   std::string hint = Kernel::Strings::strip(hintstr);
   g_log.debug() << "findRuns hint = " << hint << "\n";
   std::vector<std::string> res;
-  Poco::StringTokenizer hints(hint, ",",
-                              Poco::StringTokenizer::TOK_TRIM |
-                                  Poco::StringTokenizer::TOK_IGNORE_EMPTY);
+  Mantid::Kernel::StringTokenizer hints(
+      hint, ",", Mantid::Kernel::StringTokenizer::TOK_TRIM |
+                     Mantid::Kernel::StringTokenizer::TOK_IGNORE_EMPTY);
   auto h = hints.begin();
 
   for (; h != hints.end(); ++h) {
@@ -613,9 +613,9 @@ FileFinderImpl::findRuns(const std::string &hintstr) const {
       fileSuspected = true;
     }
 
-    Poco::StringTokenizer range(*h, "-",
-                                Poco::StringTokenizer::TOK_TRIM |
-                                    Poco::StringTokenizer::TOK_IGNORE_EMPTY);
+    Mantid::Kernel::StringTokenizer range(
+        *h, "-", Mantid::Kernel::StringTokenizer::TOK_TRIM |
+                     Mantid::Kernel::StringTokenizer::TOK_IGNORE_EMPTY);
     if ((range.count() > 2) && (!fileSuspected)) {
       throw std::invalid_argument("Malformed range of runs: " + *h);
     } else if ((range.count() == 2) && (!fileSuspected)) {
diff --git a/Framework/API/src/FunctionFactory.cpp b/Framework/API/src/FunctionFactory.cpp
index 80479e1b4e039c3a3b4ffe97e04f254d72d1f5b0..fc20cc6c57919fd00e0ff9ce1c03b388b96b8afa 100644
--- a/Framework/API/src/FunctionFactory.cpp
+++ b/Framework/API/src/FunctionFactory.cpp
@@ -8,7 +8,7 @@
 #include "MantidAPI/Workspace.h"
 #include "MantidAPI/AnalysisDataService.h"
 #include "MantidKernel/LibraryManager.h"
-#include <Poco/StringTokenizer.h>
+#include <MantidKernel/StringTokenizer.h>
 #include <sstream>
 
 namespace Mantid {
diff --git a/Framework/API/src/GeometryInfo.cpp b/Framework/API/src/GeometryInfo.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..622af6fb8a62dcd0f7201720916a31ebc8408fb2
--- /dev/null
+++ b/Framework/API/src/GeometryInfo.cpp
@@ -0,0 +1,90 @@
+#include "MantidAPI/GeometryInfo.h"
+
+#include "MantidAPI/ISpectrum.h"
+#include "MantidKernel/Exception.h"
+#include "MantidGeometry/Instrument.h"
+#include "MantidGeometry/Instrument/DetectorGroup.h"
+#include "MantidGeometry/Instrument/ReferenceFrame.h"
+
+namespace Mantid {
+namespace API {
+
+GeometryInfo::GeometryInfo(const GeometryInfoFactory &factory,
+                           const ISpectrum &spectrum)
+    : m_factory(factory) {
+  // Note: This constructor body has big overlap with the method
+  // MatrixWorkspace::getDetector(). The plan is to eventually remove the
+  // latter, once GeometryInfo is in widespread use.
+  const std::set<detid_t> &dets = spectrum.getDetectorIDs();
+
+  const size_t ndets = dets.size();
+  if (ndets == 1) {
+    // If only 1 detector for the spectrum number, just return it
+    m_detector = m_factory.getInstrument().getDetector(*dets.begin());
+  } else if (ndets == 0) {
+    throw Kernel::Exception::NotFoundError("MatrixWorkspace::getDetector(): No "
+                                           "detectors for this workspace "
+                                           "index.",
+                                           "");
+  } else {
+    // Else need to construct a DetectorGroup and use that
+    std::vector<Geometry::IDetector_const_sptr> dets_ptr =
+        m_factory.getInstrument().getDetectors(dets);
+    m_detector = Geometry::IDetector_const_sptr(
+        new Geometry::DetectorGroup(dets_ptr, false));
+  }
+}
+
+bool GeometryInfo::isMonitor() const { return m_detector->isMonitor(); }
+
+bool GeometryInfo::isMasked() const { return m_detector->isMasked(); }
+
+double GeometryInfo::getL1() const { return m_factory.getL1(); }
+
+double GeometryInfo::getL2() const {
+  if (!isMonitor()) {
+    auto &sample = m_factory.getSample();
+    return m_detector->getDistance(sample);
+  } else {
+    auto &source = m_factory.getSource();
+    return m_detector->getDistance(source) - getL1();
+  }
+}
+
+double GeometryInfo::getTwoTheta() const {
+  // Note: This function has big overlap with the method
+  // MatrixWorkspace::detectorTwoTheta(). The plan is to eventually remove the
+  // latter, once GeometryInfo is in widespread use.
+  const Kernel::V3D samplePos = m_factory.getSamplePos();
+  const Kernel::V3D beamLine = samplePos - m_factory.getSourcePos();
+
+  if (beamLine.nullVector()) {
+    throw Kernel::Exception::InstrumentDefinitionError(
+        "Source and sample are at same position!");
+  }
+
+  return m_detector->getTwoTheta(samplePos, beamLine);
+}
+
+double GeometryInfo::getSignedTwoTheta() const {
+  // Note: This function has big overlap with the method
+  // MatrixWorkspace::detectorSignedTwoTheta(). The plan is to eventually remove
+  // the latter, once GeometryInfo is in widespread use.
+  const Kernel::V3D samplePos = m_factory.getSamplePos();
+  const Kernel::V3D beamLine = samplePos - m_factory.getSourcePos();
+
+  if (beamLine.nullVector()) {
+    throw Kernel::Exception::InstrumentDefinitionError(
+        "Source and sample are at same position!");
+  }
+  // Get the instrument up axis.
+  const Kernel::V3D &instrumentUpAxis =
+      m_factory.getInstrument().getReferenceFrame()->vecPointingUp();
+  return m_detector->getSignedTwoTheta(samplePos, beamLine, instrumentUpAxis);
+}
+
+boost::shared_ptr<const Geometry::IDetector> GeometryInfo::getDetector() const {
+  return m_detector;
+}
+}
+}
diff --git a/Framework/API/src/GeometryInfoFactory.cpp b/Framework/API/src/GeometryInfoFactory.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..0fa61b5239db3492700dbc79b72658beedd148b1
--- /dev/null
+++ b/Framework/API/src/GeometryInfoFactory.cpp
@@ -0,0 +1,59 @@
+#include "MantidAPI/GeometryInfoFactory.h"
+
+#include "MantidGeometry/Instrument.h"
+#include "MantidAPI/GeometryInfo.h"
+#include "MantidAPI/MatrixWorkspace.h"
+
+namespace Mantid {
+namespace API {
+
+GeometryInfoFactory::GeometryInfoFactory(const MatrixWorkspace &workspace)
+    : m_workspace(workspace), m_instrument(workspace.getInstrument()) {
+  if (!m_instrument)
+    throw std::runtime_error("Workspace " + workspace.getName() +
+                             " does not contain an instrument!");
+
+  // TODO: Create these only when needed (thread-safe via atomics)
+  m_source = m_instrument->getSource();
+  m_sample = m_instrument->getSample();
+
+  if (!m_source)
+    throw std::runtime_error("Instrument in workspace " + workspace.getName() +
+                             " does not contain source!");
+  if (!m_sample)
+    throw std::runtime_error("Instrument in workspace " + workspace.getName() +
+                             "  does not contain sample!");
+
+  m_sourcePos = m_source->getPos();
+  m_samplePos = m_sample->getPos();
+  m_L1 = getSource().getDistance(getSample());
+}
+
+GeometryInfo GeometryInfoFactory::create(const size_t index) const {
+  // Note: Why return by value? We want to avoid memory allocation, since this
+  // is used in a loop over all histograms in a workspace. Obviously, with the
+  // current (2016) instrument code there are memory allocations when getting
+  // the detector, so this additional allocation may be negligible, but we want
+  // this class to be future proof. GeometryInfo should be kept small.
+  return {*this, *(m_workspace.getSpectrum(index))};
+}
+
+const Geometry::Instrument &GeometryInfoFactory::getInstrument() const {
+  return *m_instrument;
+}
+
+const Geometry::IComponent &GeometryInfoFactory::getSource() const {
+  return *m_source;
+}
+
+const Geometry::IComponent &GeometryInfoFactory::getSample() const {
+  return *m_sample;
+}
+
+Kernel::V3D GeometryInfoFactory::getSourcePos() const { return m_sourcePos; }
+
+Kernel::V3D GeometryInfoFactory::getSamplePos() const { return m_samplePos; }
+
+double GeometryInfoFactory::getL1() const { return m_L1; }
+}
+}
diff --git a/Framework/API/src/IFunction.cpp b/Framework/API/src/IFunction.cpp
index e0e73ef28e29a5536ad716d47ca06a5fdc096f72..3f4aa0a16988d0ad57c3c09b0fd708445ad8bb94 100644
--- a/Framework/API/src/IFunction.cpp
+++ b/Framework/API/src/IFunction.cpp
@@ -25,7 +25,7 @@
 
 #include <boost/lexical_cast.hpp>
 
-#include <Poco/StringTokenizer.h>
+#include <MantidKernel/StringTokenizer.h>
 
 #include <limits>
 #include <sstream>
@@ -253,10 +253,11 @@ void IFunction::setHandler(FunctionHandler *handler) {
 
 /// Function to return all of the categories that contain this function
 const std::vector<std::string> IFunction::categories() const {
-  Poco::StringTokenizer tokenizer(category(), categorySeparator(),
-                                  Poco::StringTokenizer::TOK_TRIM |
-                                      Poco::StringTokenizer::TOK_IGNORE_EMPTY);
-  return std::vector<std::string>(tokenizer.begin(), tokenizer.end());
+  Mantid::Kernel::StringTokenizer tokenizer(
+      category(), categorySeparator(),
+      Mantid::Kernel::StringTokenizer::TOK_TRIM |
+          Mantid::Kernel::StringTokenizer::TOK_IGNORE_EMPTY);
+  return tokenizer.asVector();
 }
 
 /**
@@ -576,8 +577,8 @@ protected:
         m_value.erase(m_value.size() - 1);
       }
     }
-    Poco::StringTokenizer tokenizer(m_value, ",",
-                                    Poco::StringTokenizer::TOK_TRIM);
+    Mantid::Kernel::StringTokenizer tokenizer(
+        m_value, ",", Mantid::Kernel::StringTokenizer::TOK_TRIM);
     v.resize(tokenizer.count());
     for (size_t i = 0; i < v.size(); ++i) {
       v[i] = boost::lexical_cast<double>(tokenizer[i]);
diff --git a/Framework/API/src/IMDWorkspace.cpp b/Framework/API/src/IMDWorkspace.cpp
index 50554c3a8b68a2ddb1b215abab5a81de292aab81..607da05414ebc1f880927559250870ff99776d26 100644
--- a/Framework/API/src/IMDWorkspace.cpp
+++ b/Framework/API/src/IMDWorkspace.cpp
@@ -134,41 +134,36 @@ const std::string IMDWorkspace::toString() const {
  * @param start :: coordinates of the start point of the line
  * @param end :: coordinates of the end point of the line
  * @param normalize :: how to normalize the signal
- * @param x :: is set to the boundaries of the bins, relative to start of the
- *line.
- * @param y :: is set to the normalized signal for each bin. Length = length(x)
- *- 1
- * @param e :: is set to the normalized errors for each bin. Length = length(x)
- *- 1
+ * @returns :: a LinePlot in which x is set to the boundaries of the bins,
+ * relative to start of the line, y is set to the normalized signal for
+ * each bin with Length = length(x) - 1 and e is set to the normalized
+ * errors for each bin with Length = length(x) - 1.
  */
-void IMDWorkspace::getLinePlot(const Mantid::Kernel::VMD &start,
-                               const Mantid::Kernel::VMD &end,
-                               Mantid::API::MDNormalization normalize,
-                               std::vector<coord_t> &x,
-                               std::vector<signal_t> &y,
-                               std::vector<signal_t> &e) const {
+IMDWorkspace::LinePlot
+IMDWorkspace::getLinePlot(const Mantid::Kernel::VMD &start,
+                          const Mantid::Kernel::VMD &end,
+                          Mantid::API::MDNormalization normalize) const {
   // TODO: Don't use a fixed number of points later
   size_t numPoints = 200;
 
   VMD step = (end - start) / double(numPoints);
   double stepLength = step.norm();
 
-  // These will be the curve as plotted
-  x.clear();
-  y.clear();
-  e.clear();
+  // This will be the curve as plotted
+  LinePlot line;
   for (size_t i = 0; i < numPoints; i++) {
     // Coordinate along the line
     VMD coord = start + step * double(i);
     // Record the position along the line
-    x.push_back(static_cast<coord_t>(stepLength * double(i)));
+    line.x.push_back(static_cast<coord_t>(stepLength * double(i)));
 
     signal_t yVal = this->getSignalAtCoord(coord.getBareArray(), normalize);
-    y.push_back(yVal);
-    e.push_back(0.0);
+    line.y.push_back(yVal);
+    line.e.push_back(0.0);
   }
   // And the last point
-  x.push_back((end - start).norm());
+  line.x.push_back((end - start).norm());
+  return line;
 }
 
 /**
diff --git a/Framework/API/src/ImplicitFunctionParserFactory.cpp b/Framework/API/src/ImplicitFunctionParserFactory.cpp
index e00c3724224fcb7d1ea57f56c0c4c99f4d36d5f4..2c6b2fbd9a30058fb7bf4c3d67a0125e7a9e5c2b 100644
--- a/Framework/API/src/ImplicitFunctionParserFactory.cpp
+++ b/Framework/API/src/ImplicitFunctionParserFactory.cpp
@@ -46,13 +46,9 @@ ImplicitFunctionParserFactoryImpl::createImplicitFunctionParserFromXML(
       functionElement->getElementsByTagName("Function");
   ImplicitFunctionParser *childParser = nullptr;
   for (unsigned long i = 0; i < childFunctions->length(); i++) {
-    Poco::XML::Node *childFunctionNode = childFunctions->item(i);
-
     // Recursive call to handle nested parameters.
-    Poco::XML::Element *childFunctionElement =
-        (Poco::XML::Element *)childFunctionNode;
-    ImplicitFunctionParser *tempParser =
-        createImplicitFunctionParserFromXML(childFunctionElement);
+    ImplicitFunctionParser *tempParser = createImplicitFunctionParserFromXML(
+        dynamic_cast<Poco::XML::Element *>(childFunctions->item(i)));
     if (i == 0) {
       childParser = tempParser;
       // Add the first child function parser to the parent (composite) directly.
diff --git a/Framework/API/src/MDGeometry.cpp b/Framework/API/src/MDGeometry.cpp
index a79ad7f20a99af83b8158aaf20963f72636bc611..61f15fd5667e541d570c36989f6632df40905682 100644
--- a/Framework/API/src/MDGeometry.cpp
+++ b/Framework/API/src/MDGeometry.cpp
@@ -4,6 +4,7 @@
 #include "MantidGeometry/MDGeometry/MDGeometryXMLBuilder.h"
 #include "MantidGeometry/MDGeometry/IMDDimension.h"
 #include "MantidGeometry/MDGeometry/MDHistoDimension.h"
+#include <boost/make_shared.hpp>
 
 using namespace Mantid::Kernel;
 using namespace Mantid::API;
@@ -34,8 +35,8 @@ MDGeometry::MDGeometry(const MDGeometry &other)
   std::vector<Mantid::Geometry::IMDDimension_sptr> dimensions;
   for (size_t d = 0; d < other.getNumDims(); d++) {
     // Copy the dimension
-    MDHistoDimension_sptr dim(
-        new MDHistoDimension(other.getDimension(d).get()));
+    auto dim =
+        boost::make_shared<MDHistoDimension>(other.getDimension(d).get());
     dimensions.push_back(dim);
   }
   this->initGeometry(dimensions);
diff --git a/Framework/API/src/MatrixWorkspace.cpp b/Framework/API/src/MatrixWorkspace.cpp
index 00160da154c309d61ae7963c4c63225eaba21125..a1cc342bf580fdaa107b5caba621f79d7ef0c6ac 100644
--- a/Framework/API/src/MatrixWorkspace.cpp
+++ b/Framework/API/src/MatrixWorkspace.cpp
@@ -296,9 +296,8 @@ MatrixWorkspace::getNeighbours(const Geometry::IDetector *comp,
     buildNearestNeighbours(ignoreMaskedDetectors);
   }
   // Find the spectrum number
-  std::vector<specid_t> spectra;
-  this->getSpectraFromDetectorIDs(std::vector<detid_t>(1, comp->getID()),
-                                  spectra);
+  std::vector<specid_t> spectra =
+      this->getSpectraFromDetectorIDs(std::vector<detid_t>(1, comp->getID()));
   if (spectra.empty()) {
     throw Kernel::Exception::NotFoundError("MatrixWorkspace::getNeighbours - "
                                            "Cannot find spectrum number for "
@@ -363,14 +362,13 @@ spec2index_map MatrixWorkspace::getSpectrumToWorkspaceIndexMap() const {
     throw std::runtime_error("MatrixWorkspace::getSpectrumToWorkspaceIndexMap: "
                              "axis[1] is not a SpectraAxis, so I cannot "
                              "generate a map.");
-  spec2index_map map;
   try {
-    ax->getSpectraIndexMap(map);
+    return ax->getSpectraIndexMap();
   } catch (std::runtime_error &) {
-    throw std::runtime_error(
-        "MatrixWorkspace::getSpectrumToWorkspaceIndexMap: no elements!");
+    g_log.error()
+        << "MatrixWorkspace::getSpectrumToWorkspaceIndexMap: no elements!";
+    throw;
   }
-  return map;
 }
 
 //---------------------------------------------------------------------------------------
@@ -378,12 +376,12 @@ spec2index_map MatrixWorkspace::getSpectrumToWorkspaceIndexMap() const {
 *    The index into the vector = spectrum number + offset
 *    The value at that index = the corresponding Workspace Index
 *
-*  @param out :: vector set to above definition
+*  @returns :: vector set to above definition
 *  @param offset :: add this to the detector ID to get the index into the
 *vector.
 */
-void MatrixWorkspace::getSpectrumToWorkspaceIndexVector(
-    std::vector<size_t> &out, specid_t &offset) const {
+std::vector<size_t>
+MatrixWorkspace::getSpectrumToWorkspaceIndexVector(specid_t &offset) const {
   SpectraAxis *ax = dynamic_cast<SpectraAxis *>(this->m_axes[1]);
   if (!ax)
     throw std::runtime_error("MatrixWorkspace::getSpectrumToWorkspaceIndexMap: "
@@ -408,14 +406,16 @@ void MatrixWorkspace::getSpectrumToWorkspaceIndexVector(
   // Offset so that the "min" value goes to index 0
   offset = -min;
 
-  // Resize correctly
-  out.resize(max - min + 1, 0);
+  // Size correctly
+  std::vector<size_t> out(max - min + 1, 0);
 
   // Make the vector
   for (size_t i = 0; i < length; i++) {
     specid_t spec = ax->spectraNo(i);
     out[spec + offset] = i;
   }
+
+  return out;
 }
 
 //---------------------------------------------------------------------------------------
@@ -486,19 +486,18 @@ detid2index_map MatrixWorkspace::getDetectorIDToWorkspaceIndexMap(
 *    The index into the vector = DetectorID (pixel ID) + offset
 *    The value at that index = the corresponding Workspace Index
 *
-*  @param out :: vector set to above definition
 *  @param offset :: add this to the detector ID to get the index into the
 *vector.
 *  @param throwIfMultipleDets :: set to true to make the algorithm throw an
-*error
-*         if there is more than one detector for a specific workspace index.
+*error if there is more than one detector for a specific workspace index.
 *  @throw runtime_error if there is more than one detector per spectrum (if
 *throwIfMultipleDets is true)
+*  @returns :: vector set to above definition
 */
-void MatrixWorkspace::getDetectorIDToWorkspaceIndexVector(
-    std::vector<size_t> &out, detid_t &offset, bool throwIfMultipleDets) const {
+std::vector<size_t> MatrixWorkspace::getDetectorIDToWorkspaceIndexVector(
+    detid_t &offset, bool throwIfMultipleDets) const {
   // Make a correct initial size
-  out.clear();
+  std::vector<size_t> out;
   detid_t minId = 0;
   detid_t maxId = 0;
   this->getInstrument()->getMinMaxDetectorIDs(minId, maxId);
@@ -534,6 +533,7 @@ void MatrixWorkspace::getDetectorIDToWorkspaceIndexVector(
     }
 
   } // (for each workspace index)
+  return out;
 }
 
 //---------------------------------------------------------------------------------------
@@ -541,14 +541,12 @@ void MatrixWorkspace::getDetectorIDToWorkspaceIndexVector(
 *  Not a very efficient operation, but unfortunately it's sometimes required.
 *
 *  @param spectraList :: The list of spectrum numbers required
-*  @param indexList ::   Returns a reference to the vector of indices (empty if
-*not a Workspace2D)
+*  @returns :: the vector of indices (empty if not a Workspace2D)
 */
-void MatrixWorkspace::getIndicesFromSpectra(
-    const std::vector<specid_t> &spectraList,
-    std::vector<size_t> &indexList) const {
+std::vector<size_t> MatrixWorkspace::getIndicesFromSpectra(
+    const std::vector<specid_t> &spectraList) const {
   // Clear the output index list
-  indexList.clear();
+  std::vector<size_t> indexList;
   indexList.reserve(this->getNumberHistograms());
 
   auto iter = spectraList.cbegin();
@@ -561,6 +559,7 @@ void MatrixWorkspace::getIndicesFromSpectra(
     }
     ++iter;
   }
+  return indexList;
 }
 
 //---------------------------------------------------------------------------------------
@@ -589,11 +588,10 @@ MatrixWorkspace::getIndexFromSpectrumNumber(const specid_t specNo) const {
      *  effectively a set (i.e. there are no duplicates).
      *
 *  @param detIdList :: The list of detector IDs required
-*  @param indexList :: Returns a reference to the vector of indices
+*  @returns :: a vector of indices
 */
-void MatrixWorkspace::getIndicesFromDetectorIDs(
-    const std::vector<detid_t> &detIdList,
-    std::vector<size_t> &indexList) const {
+std::vector<size_t> MatrixWorkspace::getIndicesFromDetectorIDs(
+    const std::vector<detid_t> &detIdList) const {
   std::map<detid_t, std::set<size_t>> detectorIDtoWSIndices;
   for (size_t i = 0; i < getNumberHistograms(); ++i) {
     auto detIDs = getSpectrum(i)->getDetectorIDs();
@@ -602,7 +600,7 @@ void MatrixWorkspace::getIndicesFromDetectorIDs(
     }
   }
 
-  indexList.clear();
+  std::vector<size_t> indexList;
   indexList.reserve(detIdList.size());
   for (const auto detId : detIdList) {
     auto wsIndices = detectorIDtoWSIndices.find(detId);
@@ -612,6 +610,7 @@ void MatrixWorkspace::getIndicesFromDetectorIDs(
       }
     }
   }
+  return indexList;
 }
 
 //---------------------------------------------------------------------------------------
@@ -619,14 +618,13 @@ void MatrixWorkspace::getIndicesFromDetectorIDs(
 *be slow!
 *
 * @param detIdList :: The list of detector IDs required
-* @param spectraList :: Returns a reference to the vector of spectrum numbers.
+* @returns :: a reference to the vector of spectrum numbers.
 *                       0 for not-found detectors
 */
-void MatrixWorkspace::getSpectraFromDetectorIDs(
-    const std::vector<detid_t> &detIdList,
-    std::vector<specid_t> &spectraList) const {
+std::vector<specid_t> MatrixWorkspace::getSpectraFromDetectorIDs(
+    const std::vector<detid_t> &detIdList) const {
 
-  spectraList.clear();
+  std::vector<specid_t> spectraList;
 
   // Try every detector in the list
   for (auto detId : detIdList) {
@@ -645,6 +643,7 @@ void MatrixWorkspace::getSpectraFromDetectorIDs(
     if (foundDet)
       spectraList.push_back(foundSpecNum);
   } // for each detector ID in the list
+  return spectraList;
 }
 
 double MatrixWorkspace::getXMin() const {
@@ -761,7 +760,7 @@ MatrixWorkspace::getDetector(const size_t workspaceIndex) const {
                                            "workspace index.",
                                            "");
 
-  const std::set<detid_t> &dets = spec->getDetectorIDs();
+  const auto &dets = spec->getDetectorIDs();
   Instrument_const_sptr localInstrument = getInstrument();
   if (!localInstrument) {
     g_log.debug() << "No instrument defined.\n";
@@ -1012,7 +1011,7 @@ void MatrixWorkspace::maskWorkspaceIndex(const std::size_t index) {
   // Virtual method clears the spectrum as appropriate
   spec->clearData();
 
-  const std::set<detid_t> dets = spec->getDetectorIDs();
+  const auto dets = spec->getDetectorIDs();
   for (auto detId : dets) {
     try {
       if (const Geometry::Detector *det =
@@ -1508,20 +1507,16 @@ std::vector<IMDIterator *> MatrixWorkspace::createIterators(
 * @param start :: coordinates of the start point of the line
 * @param end :: coordinates of the end point of the line
 * @param normalize :: how to normalize the signal
-* @param x :: is set to the boundaries of the bins, relative to start of the
-*line.
-* @param y :: is set to the normalized signal for each bin. Length = length(x) -
-*1
-* @param e :: is set to the normalized errors for each bin. Length = length(x) -
-*1
+* @returns :: a LinePlot in which x is set to the boundaries of the bins,
+* relative to start of the line, y is set to the normalized signal for
+* each bin with Length = length(x) - 1 and e is set to the normalized
+* errors for each bin with Length = length(x) - 1.
 */
-void MatrixWorkspace::getLinePlot(const Mantid::Kernel::VMD &start,
-                                  const Mantid::Kernel::VMD &end,
-                                  Mantid::API::MDNormalization normalize,
-                                  std::vector<coord_t> &x,
-                                  std::vector<signal_t> &y,
-                                  std::vector<signal_t> &e) const {
-  IMDWorkspace::getLinePlot(start, end, normalize, x, y, e);
+IMDWorkspace::LinePlot
+MatrixWorkspace::getLinePlot(const Mantid::Kernel::VMD &start,
+                             const Mantid::Kernel::VMD &end,
+                             Mantid::API::MDNormalization normalize) const {
+  return IMDWorkspace::getLinePlot(start, end, normalize);
 }
 
 //------------------------------------------------------------------------------------
@@ -1661,7 +1656,7 @@ void MatrixWorkspace::saveSpectraMapNexus(
     spectra[i] = int32_t(spectrum->getSpectrumNo());
 
     // The detectors in this spectrum
-    const std::set<detid_t> &detectorgroup = spectrum->getDetectorIDs();
+    const auto &detectorgroup = spectrum->getDetectorIDs();
     const int ndet1 = static_cast<int>(detectorgroup.size());
 
     detector_index[i + 1] = int32_t(
diff --git a/Framework/API/src/MultipleExperimentInfos.cpp b/Framework/API/src/MultipleExperimentInfos.cpp
index 01c60a60f20ff2bf1de8a2e0be3c04b55e187fca..011d0365ead34e6a59ec7b9d81e79104e00e0624 100644
--- a/Framework/API/src/MultipleExperimentInfos.cpp
+++ b/Framework/API/src/MultipleExperimentInfos.cpp
@@ -100,7 +100,7 @@ void MultipleExperimentInfos::copyExperimentInfos(
   m_expInfos.reserve(other.m_expInfos.size());
   // Do a deep copy of ExperimentInfo's
   for (const auto &expInfo : other.m_expInfos) {
-    ExperimentInfo_sptr copy(new ExperimentInfo(*expInfo));
+    auto copy(boost::make_shared<ExperimentInfo>(*expInfo));
     m_expInfos.push_back(copy);
   }
 }
diff --git a/Framework/API/src/NotebookWriter.cpp b/Framework/API/src/NotebookWriter.cpp
index 7c6f4ea560872f0758231fba0dcf80973e143b68..1c6682c6d77b271236a177e39245491259d9c884 100644
--- a/Framework/API/src/NotebookWriter.cpp
+++ b/Framework/API/src/NotebookWriter.cpp
@@ -130,55 +130,16 @@ void NotebookWriter::headerCode() {
 
   Json::Value import_mantid(Json::arrayValue);
 
-  import_mantid.append(
-      Json::Value("import sys\n"
-                  "import os\n"
-                  "\n"
-                  "#Find where Mantid is installed and tell python.\n"
-                  "def find_path():\n"
-                  "    for r,d,f in os.walk(os.path.abspath(os.sep)):\n"
-                  "        for files in f:\n"
-                  "            if files == 'MantidPlot.exe' or files == "
-                  "'MantidPlot' or files == 'MantidPlot.app':\n"
-                  "                return r\n"
-                  "\n"
-                  "mantidPath = 'C://MantidInstall/bin'\n"
-                  "if os.path.isdir(mantidPath): sys.path.append(mantidPath)\n"
-                  "else: sys.path.append(find_path())\n"
-                  "\n"
-                  "#We can now import Mantid's Python API\n"
-                  "from mantid.simpleapi import *\n"
-                  "#If import fails then replace path on line \"mantidPath = "
-                  "...\" with correct path to the MantidPlot executable"));
+  import_mantid.append(Json::Value(
+      "#Import Mantid's Python API and IPython plotting tools\n"
+      "from mantid.simpleapi import *\n"
+      "from MantidIPython import *\n"
+      "\n"
+      "#Some magic to tell matplotlib how to behave in IPython Notebook. Use "
+      "'%matplotlib nbagg' for interactive plots, if available.\n"
+      "%matplotlib inline"));
 
   codeCell(import_mantid);
-
-  Json::Value check_version(Json::arrayValue);
-
-  check_version.append(Json::Value("import warnings"));
-  check_version.append(Json::Value("import mantid.kernel"));
-  check_version.append(
-      Json::Value("# Check if the version of Mantid being used matches"
-                  " the version which created the notebook."));
-  check_version.append(Json::Value(
-      std::string("if \"") + Mantid::Kernel::MantidVersion::version() +
-      "\" != mantid.kernel.version_str(): warnings.warn(\"Version of Mantid"
-      " being used does not match version which created the notebook.\")"));
-
-  codeCell(check_version);
-
-  Json::Value import_matplotlib(Json::arrayValue);
-
-  import_matplotlib.append(Json::Value(
-      "#Import matplotlib's pyplot interface under the name 'plt'\n"));
-  import_matplotlib.append(Json::Value("import matplotlib.pyplot as plt\n\n"));
-
-  import_matplotlib.append(Json::Value(
-      "#Some magic to tell matplotlib how to behave in IPython Notebook. "
-      "Use '%matplotlib nbagg' for interactive plots, if available.\n"));
-  import_matplotlib.append(Json::Value("%matplotlib inline"));
-
-  codeCell(import_matplotlib);
 }
 
 /**
diff --git a/Framework/API/src/ScriptRepositoryFactory.cpp b/Framework/API/src/ScriptRepositoryFactory.cpp
index 6fce2310fa7be303c8eb316b8438049992bc3280..c9e4a6a7890271893690edf3ec1781ee6b24b46a 100644
--- a/Framework/API/src/ScriptRepositoryFactory.cpp
+++ b/Framework/API/src/ScriptRepositoryFactory.cpp
@@ -1,7 +1,7 @@
 #include "MantidAPI/ScriptRepositoryFactory.h"
 #include "MantidAPI/ScriptRepository.h"
 #include "MantidKernel/LibraryManager.h"
-#include <Poco/StringTokenizer.h>
+#include <MantidKernel/StringTokenizer.h>
 #include <sstream>
 
 namespace Mantid {
diff --git a/Framework/API/src/SpectraAxis.cpp b/Framework/API/src/SpectraAxis.cpp
index 804ede103848336b92f6398f7c75f5a06172ce22..5eda2484a3d678d26bab6807b24a3eea7a1dfa1d 100644
--- a/Framework/API/src/SpectraAxis.cpp
+++ b/Framework/API/src/SpectraAxis.cpp
@@ -120,17 +120,18 @@ specid_t SpectraAxis::spectraNo(const std::size_t &index) const {
 
 /** Returns a map where spectra is the key and index is the value
  *  This is used for efficient search of spectra number within a workspace
- *  @param  map Reference to the map
+ *  @returns :: map of spectra to index
  */
-void SpectraAxis::getSpectraIndexMap(spec2index_map &map) const {
+spec2index_map SpectraAxis::getSpectraIndexMap() const {
   size_t nel = length();
 
   if (nel == 0)
     throw std::runtime_error("getSpectraIndexMap(),  zero elements");
-  map.clear();
+  spec2index_map map;
   for (size_t i = 0; i < nel; ++i) {
     map.emplace(m_parentWS->getSpectrum(i)->getSpectrumNo(), i);
   }
+  return map;
 }
 
 /** Check if two axis defined as spectra or numeric axis are equivalent
diff --git a/Framework/API/src/SpectrumDetectorMapping.cpp b/Framework/API/src/SpectrumDetectorMapping.cpp
index e54a293581ee99bd664204d4438ffb0e44944dfc..de51be6d8740cb89bbbf3e80317cbd29f72fc4bd 100644
--- a/Framework/API/src/SpectrumDetectorMapping.cpp
+++ b/Framework/API/src/SpectrumDetectorMapping.cpp
@@ -104,7 +104,7 @@ std::set<specid_t> SpectrumDetectorMapping::getSpectrumNumbers() const {
 const std::set<detid_t> &SpectrumDetectorMapping::getDetectorIDsForSpectrumNo(
     const specid_t spectrumNo) const {
   if (!m_indexIsSpecNo)
-    throw std::runtime_error("Indicies are in spectrum index, not number.");
+    throw std::runtime_error("Indices are in spectrum index, not number.");
   return m_mapping.at(spectrumNo);
 }
 
@@ -112,7 +112,7 @@ const std::set<detid_t> &
 SpectrumDetectorMapping::getDetectorIDsForSpectrumIndex(
     const size_t spectrumIndex) const {
   if (m_indexIsSpecNo)
-    throw std::runtime_error("Indicies are in spectrum number, not index.");
+    throw std::runtime_error("Indices are in spectrum number, not index.");
   return m_mapping.at(static_cast<int>(spectrumIndex));
 }
 
diff --git a/Framework/API/src/WorkspaceHistory.cpp b/Framework/API/src/WorkspaceHistory.cpp
index ade44cf96a143937ba940562d741e16a7357c290..0be9957a5b0567a42d8654abe970e19298ece56e 100644
--- a/Framework/API/src/WorkspaceHistory.cpp
+++ b/Framework/API/src/WorkspaceHistory.cpp
@@ -203,7 +203,8 @@ void WorkspaceHistory::saveNexus(::NeXus::File *file) const {
  */
 void getWordsInString(const std::string &words3, std::string &w1,
                       std::string &w2, std::string &w3) {
-  Poco::StringTokenizer data(words3, " ", Poco::StringTokenizer::TOK_TRIM);
+  Mantid::Kernel::StringTokenizer data(
+      words3, " ", Mantid::Kernel::StringTokenizer::TOK_TRIM);
   if (data.count() != 3)
     throw std::out_of_range("Algorithm list line " + words3 +
                             " is not of the correct format\n");
@@ -226,7 +227,8 @@ void getWordsInString(const std::string &words3, std::string &w1,
  */
 void getWordsInString(const std::string &words4, std::string &w1,
                       std::string &w2, std::string &w3, std::string &w4) {
-  Poco::StringTokenizer data(words4, " ", Poco::StringTokenizer::TOK_TRIM);
+  Mantid::Kernel::StringTokenizer data(
+      words4, " ", Mantid::Kernel::StringTokenizer::TOK_TRIM);
   if (data.count() != 4)
     throw std::out_of_range("Algorithm list line " + words4 +
                             " is not of the correct format\n");
diff --git a/Framework/API/test/AlgorithmFactoryTest.h b/Framework/API/test/AlgorithmFactoryTest.h
index a1b841fd2b96bd38fe346cf25dd4d05ec8582d0f..5b8554ffec077924949bcb0eee0cd6eb4e242ac5 100644
--- a/Framework/API/test/AlgorithmFactoryTest.h
+++ b/Framework/API/test/AlgorithmFactoryTest.h
@@ -189,7 +189,7 @@ public:
 
   void testGetCategories() {
     AlgorithmFactory::Instance().subscribe<CategoryAlgorithm>();
-    std::set<std::string> validCategories;
+    std::unordered_set<std::string> validCategories;
     TS_ASSERT_THROWS_NOTHING(
         validCategories = AlgorithmFactory::Instance().getCategories(true));
 
diff --git a/Framework/API/test/CMakeLists.txt b/Framework/API/test/CMakeLists.txt
index 5bc227eabfa3c7855aca7e98bf62aabf1ab47ad9..597646c3bc5117d23f18fc0edd8b91d1379289e3 100644
--- a/Framework/API/test/CMakeLists.txt
+++ b/Framework/API/test/CMakeLists.txt
@@ -7,6 +7,7 @@ if ( CXXTEST_FOUND )
   set ( TESTHELPER_SRCS ../../TestHelpers/src/TearDownWorld.cpp
                         ../../TestHelpers/src/ComponentCreationHelper.cpp
                         ../../TestHelpers/src/BoxControllerDummyIO.cpp
+                        ../../TestHelpers/src/InstrumentCreationHelper.cpp
                         ../../TestHelpers/src/NexusTestHelper.cpp
       )
   cxxtest_add_test ( APITest ${TEST_FILES} ${GMOCK_TEST_FILES})
diff --git a/Framework/API/test/ExperimentInfoTest.h b/Framework/API/test/ExperimentInfoTest.h
index dcfed7df77a813ecd88ed7028990304f8050a955..4dac282c5f6c3d4ed00503575252dadb18aa8419 100644
--- a/Framework/API/test/ExperimentInfoTest.h
+++ b/Framework/API/test/ExperimentInfoTest.h
@@ -26,6 +26,7 @@
 #include <Poco/DirectoryIterator.h>
 
 #include <set>
+#include <unordered_map>
 
 using namespace Mantid::API;
 using namespace Mantid::Kernel;
@@ -464,8 +465,8 @@ public:
 
     // Collect all IDF filenames and put them in a multimap where the instrument
     // identifier is the key
-    std::multimap<std::string, fromToEntry> idfFiles;
-    std::set<std::string> idfIdentifiers;
+    std::unordered_multimap<std::string, fromToEntry> idfFiles;
+    std::unordered_set<std::string> idfIdentifiers;
 
     boost::regex regex(".*_Definition.*\\.xml", boost::regex_constants::icase);
     Poco::DirectoryIterator end_iter;
@@ -498,12 +499,11 @@ public:
     }
 
     // iterator to browse through the multimap: paramInfoFromIDF
-    std::multimap<std::string, fromToEntry>::const_iterator it1, it2;
-    std::pair<std::multimap<std::string, fromToEntry>::iterator,
-              std::multimap<std::string, fromToEntry>::iterator> ret;
+    std::unordered_multimap<std::string, fromToEntry>::const_iterator it1, it2;
+    std::pair<std::unordered_multimap<std::string, fromToEntry>::iterator,
+              std::unordered_multimap<std::string, fromToEntry>::iterator> ret;
 
-    std::set<std::string>::iterator setIt;
-    for (setIt = idfIdentifiers.begin(); setIt != idfIdentifiers.end();
+    for (auto setIt = idfIdentifiers.begin(); setIt != idfIdentifiers.end();
          setIt++) {
       ret = idfFiles.equal_range(*setIt);
       for (it1 = ret.first; it1 != ret.second; ++it1) {
diff --git a/Framework/API/test/ExpressionTest.h b/Framework/API/test/ExpressionTest.h
index 44db56d28e15286a6d542c0c945c6a8080cf3fae..752376ed88f8f10bfc43295c99c98f640325ea79 100644
--- a/Framework/API/test/ExpressionTest.h
+++ b/Framework/API/test/ExpressionTest.h
@@ -171,7 +171,7 @@ public:
     TS_ASSERT_EQUALS(e4[1].name(), "+");
 
     std::vector<std::string> bin_ops{"="};
-    std::set<std::string> un_ops{"!", "%%"};
+    std::unordered_set<std::string> un_ops{"!", "%%"};
 
     Expression e5(bin_ops, un_ops);
     TS_ASSERT_THROWS_NOTHING(e5.parse("x=!1"));
@@ -206,7 +206,7 @@ public:
     TS_ASSERT_EQUALS(e8[1].name(), "%%");
 
     std::vector<std::string> bin_ops1{"=="};
-    std::set<std::string> un_ops1{"!", "%%"};
+    std::unordered_set<std::string> un_ops1{"!", "%%"};
 
     Expression e9(bin_ops1, un_ops1);
     TS_ASSERT_THROWS_NOTHING(e9.parse("x==!1"));
@@ -247,7 +247,7 @@ public:
     TS_ASSERT_THROWS(e14.parse("x==%% "), std::runtime_error);
 
     std::vector<std::string> bin_ops2{"-", "--"};
-    std::set<std::string> un_ops2{"-", "--"};
+    std::unordered_set<std::string> un_ops2{"-", "--"};
 
     Expression e15(bin_ops2, un_ops2);
     TS_ASSERT_THROWS_NOTHING(e15.parse("x--1"));
@@ -339,7 +339,7 @@ public:
   void testGetVariables() {
     Expression e;
     e.parse("a+b*sin(x)*fun1(fun2(a+c))");
-    std::set<std::string> vars = e.getVariables();
+    std::unordered_set<std::string> vars = e.getVariables();
     TS_ASSERT_EQUALS(vars.size(), 4);
     TS_ASSERT(vars.find("a") != vars.end());
     TS_ASSERT(vars.find("b") != vars.end());
diff --git a/Framework/API/test/FilePropertyTest.h b/Framework/API/test/FilePropertyTest.h
index 971bb99a7ad20d244fcd2d9a4565697d683722ea..efd2256f2e51dc7c2dd102e31e1a44059a9cb4e0 100644
--- a/Framework/API/test/FilePropertyTest.h
+++ b/Framework/API/test/FilePropertyTest.h
@@ -144,7 +144,7 @@ public:
     ConfigService::Instance().setString("default.instrument", "LOQ");
     error = fp.setValue("25654");
     TS_ASSERT_EQUALS(error, "");
-    TS_ASSERT(fp.value().find("LOQ25654") != std::string::npos);
+    TS_ASSERT_DIFFERS(fp.value().find("LOQ25654"), std::string::npos);
 
     fileFinder.setCaseSensitive(startingCaseOption);
   }
diff --git a/Framework/API/test/GeometryInfoFactoryTest.h b/Framework/API/test/GeometryInfoFactoryTest.h
new file mode 100644
index 0000000000000000000000000000000000000000..31f1dceddb3e327bb425c23a0f97697d5e6fdb5f
--- /dev/null
+++ b/Framework/API/test/GeometryInfoFactoryTest.h
@@ -0,0 +1,128 @@
+#ifndef MANTID_API_GEOMETRYINFOFACTORY_TEST_H_
+#define MANTID_API_GEOMETRYINFOFACTORY_TEST_H_
+
+#include <cxxtest/TestSuite.h>
+
+#include "MantidTestHelpers/FakeObjects.h"
+#include "MantidTestHelpers/InstrumentCreationHelper.h"
+#include "MantidAPI/GeometryInfoFactory.h"
+#include "MantidAPI/GeometryInfo.h"
+
+using namespace Mantid;
+using namespace Mantid::API;
+
+class GeometryInfoFactoryTest : public CxxTest::TestSuite {
+public:
+  static GeometryInfoFactoryTest *createSuite() {
+    return new GeometryInfoFactoryTest();
+  }
+  static void destroySuite(GeometryInfoFactoryTest *suite) { delete suite; }
+
+  GeometryInfoFactoryTest() : m_workspace(nullptr) {
+    size_t numberOfHistograms = 1;
+    size_t numberOfBins = 1;
+    m_workspace.init(numberOfHistograms, numberOfBins, numberOfBins - 1);
+    bool includeMonitors = false;
+    bool startYNegative = true;
+    const std::string instrumentName("SimpleFakeInstrument");
+    InstrumentCreationHelper::addFullInstrumentToWorkspace(
+        m_workspace, includeMonitors, startYNegative, instrumentName);
+  }
+
+  void test_constructor() {
+    TS_ASSERT_THROWS_NOTHING(GeometryInfoFactory factory(m_workspace));
+  }
+
+  void test_constructor_no_instrument() {
+    WorkspaceTester ws;
+    size_t numberOfHistograms = 1;
+    size_t numberOfBins = 1;
+    ws.init(numberOfHistograms, numberOfBins, numberOfBins - 1);
+    TS_ASSERT_THROWS(GeometryInfoFactory factory(ws), std::runtime_error);
+  }
+
+  void test_create() {
+    auto factory = GeometryInfoFactory(m_workspace);
+    TS_ASSERT_THROWS_NOTHING(factory.create(0).getDetector());
+  }
+
+  void test_getInstrument() {
+    auto factory = GeometryInfoFactory(m_workspace);
+    // This might fail if we get a null instrument, so we test for throw. Since
+    // workspace->getInstrument() creates a copy of the instrument there is no
+    // point in attempting to verify that the pointer is "correct".
+    TS_ASSERT_THROWS_NOTHING(factory.getInstrument());
+  }
+
+  void test_getSource() {
+    auto factory = GeometryInfoFactory(m_workspace);
+    TS_ASSERT_THROWS_NOTHING(factory.getSource());
+  }
+
+  void test_getSample() {
+    auto factory = GeometryInfoFactory(m_workspace);
+    TS_ASSERT_THROWS_NOTHING(factory.getSample());
+  }
+
+  void test_getSourcePos() {
+    auto factory = GeometryInfoFactory(m_workspace);
+    TS_ASSERT_EQUALS(factory.getSourcePos(), Kernel::V3D(-20.0, 0.0, 0.0));
+  }
+
+  void test_getSamplePos() {
+    auto factory = GeometryInfoFactory(m_workspace);
+    TS_ASSERT_EQUALS(factory.getSamplePos(), Kernel::V3D(0.0, 0.0, 0.0));
+  }
+
+  void test_getL1() {
+    auto factory = GeometryInfoFactory(m_workspace);
+    TS_ASSERT_EQUALS(factory.getL1(), 20.0);
+  }
+
+private:
+  WorkspaceTester m_workspace;
+};
+
+class GeometryInfoFactoryTestPerformance : public CxxTest::TestSuite {
+public:
+  static GeometryInfoFactoryTestPerformance *createSuite() {
+    return new GeometryInfoFactoryTestPerformance();
+  }
+  static void destroySuite(GeometryInfoFactoryTestPerformance *suite) {
+    delete suite;
+  }
+
+  GeometryInfoFactoryTestPerformance() : m_workspace(nullptr) {
+    size_t numberOfHistograms = 10000;
+    size_t numberOfBins = 1;
+    m_workspace.init(numberOfHistograms, numberOfBins, numberOfBins - 1);
+    bool includeMonitors = false;
+    bool startYNegative = true;
+    const std::string instrumentName("SimpleFakeInstrument");
+    InstrumentCreationHelper::addFullInstrumentToWorkspace(
+        m_workspace, includeMonitors, startYNegative, instrumentName);
+  }
+
+  void test_typical() {
+    // Typically:
+    // - workspace with > 10k histograms
+    // - need L1, L2, and 2-theta
+    // Note that the instrument in this case is extremely simple, with few
+    // detectors and no parameters, so the actual performance will be worse.
+    double result = 0.0;
+    GeometryInfoFactory factory(m_workspace);
+    for (size_t i = 0; i < 10000; ++i) {
+      auto info = factory.create(i);
+      result += info.getL1();
+      result += info.getL2();
+      result += info.getTwoTheta();
+    }
+    // We are computing an using the result to fool the optimizer.
+    TS_ASSERT_DELTA(result, 5214709.740869, 1e-6);
+  }
+
+private:
+  WorkspaceTester m_workspace;
+};
+
+#endif /* MANTID_API_GEOMETRYINFOFACTORY_TEST_H_ */
diff --git a/Framework/API/test/GeometryInfoTest.h b/Framework/API/test/GeometryInfoTest.h
new file mode 100644
index 0000000000000000000000000000000000000000..0fb16b6e67c799487b3041aa94e3f3dd466e4238
--- /dev/null
+++ b/Framework/API/test/GeometryInfoTest.h
@@ -0,0 +1,155 @@
+#ifndef MANTID_API_GEOMETRYINFOTEST_H_
+#define MANTID_API_GEOMETRYINFOTEST_H_
+
+#include <cxxtest/TestSuite.h>
+
+#include "MantidKernel/make_unique.h"
+#include "MantidGeometry/Instrument/ParameterMap.h"
+#include "MantidAPI/GeometryInfo.h"
+
+#include "MantidTestHelpers/FakeObjects.h"
+#include "MantidTestHelpers/InstrumentCreationHelper.h"
+
+using namespace Mantid;
+using namespace Mantid::Geometry;
+using namespace Mantid::API;
+
+class GeometryInfoTest : public CxxTest::TestSuite {
+public:
+  static GeometryInfoTest *createSuite() { return new GeometryInfoTest(); }
+  static void destroySuite(GeometryInfoTest *suite) { delete suite; }
+
+  GeometryInfoTest() : m_workspace(nullptr) {
+    size_t numberOfHistograms = 5;
+    size_t numberOfBins = 1;
+    m_workspace.init(numberOfHistograms, numberOfBins, numberOfBins - 1);
+
+    bool includeMonitors = true;
+    bool startYNegative = true;
+    const std::string instrumentName("SimpleFakeInstrument");
+    InstrumentCreationHelper::addFullInstrumentToWorkspace(
+        m_workspace, includeMonitors, startYNegative, instrumentName);
+
+    std::set<int64_t> toMask{0, 3};
+    ParameterMap &pmap = m_workspace.instrumentParameters();
+    for (size_t i = 0; i < m_workspace.getNumberHistograms(); ++i) {
+      if (toMask.find(i) != toMask.end()) {
+        IDetector_const_sptr det = m_workspace.getDetector(i);
+        pmap.addBool(det.get(), "masked", true);
+      }
+    }
+
+    m_factory = Kernel::make_unique<GeometryInfoFactory>(m_workspace);
+  }
+
+  void test_constructor() {
+    TS_ASSERT_THROWS_NOTHING(
+        GeometryInfo(*m_factory, *(m_workspace.getSpectrum(0))));
+  }
+
+  void test_isMonitor() {
+    TS_ASSERT_EQUALS(
+        GeometryInfo(*m_factory, *(m_workspace.getSpectrum(0))).isMonitor(),
+        false);
+    TS_ASSERT_EQUALS(
+        GeometryInfo(*m_factory, *(m_workspace.getSpectrum(1))).isMonitor(),
+        false);
+    TS_ASSERT_EQUALS(
+        GeometryInfo(*m_factory, *(m_workspace.getSpectrum(2))).isMonitor(),
+        false);
+    TS_ASSERT_EQUALS(
+        GeometryInfo(*m_factory, *(m_workspace.getSpectrum(3))).isMonitor(),
+        true);
+    TS_ASSERT_EQUALS(
+        GeometryInfo(*m_factory, *(m_workspace.getSpectrum(4))).isMonitor(),
+        true);
+  }
+
+  void test_isMasked() {
+    auto factory = GeometryInfoFactory(m_workspace);
+    TS_ASSERT_EQUALS(
+        GeometryInfo(*m_factory, *(m_workspace.getSpectrum(0))).isMasked(),
+        true);
+    TS_ASSERT_EQUALS(
+        GeometryInfo(*m_factory, *(m_workspace.getSpectrum(1))).isMasked(),
+        false);
+    TS_ASSERT_EQUALS(
+        GeometryInfo(*m_factory, *(m_workspace.getSpectrum(2))).isMasked(),
+        false);
+    TS_ASSERT_EQUALS(
+        GeometryInfo(*m_factory, *(m_workspace.getSpectrum(3))).isMasked(),
+        true);
+    TS_ASSERT_EQUALS(
+        GeometryInfo(*m_factory, *(m_workspace.getSpectrum(4))).isMasked(),
+        false);
+  }
+
+  void test_getL1() {
+    auto info = GeometryInfo(*m_factory, *(m_workspace.getSpectrum(0)));
+    TS_ASSERT_EQUALS(info.getL1(), 20.0);
+  }
+
+  void test_getL2() {
+    double x2 = 5.0 * 5.0;
+    double y2 = 2.0 * 2.0 * 0.05 * 0.05;
+    TS_ASSERT_EQUALS(
+        GeometryInfo(*m_factory, *(m_workspace.getSpectrum(0))).getL2(),
+        sqrt(x2 + 1 * 1 * y2));
+    TS_ASSERT_EQUALS(
+        GeometryInfo(*m_factory, *(m_workspace.getSpectrum(1))).getL2(),
+        sqrt(x2 + 0 * 0 * y2));
+    TS_ASSERT_EQUALS(
+        GeometryInfo(*m_factory, *(m_workspace.getSpectrum(2))).getL2(),
+        sqrt(x2 + 1 * 1 * y2));
+    TS_ASSERT_EQUALS(
+        GeometryInfo(*m_factory, *(m_workspace.getSpectrum(3))).getL2(), -9.0);
+    TS_ASSERT_EQUALS(
+        GeometryInfo(*m_factory, *(m_workspace.getSpectrum(4))).getL2(), -2.0);
+  }
+
+  void test_getTwoTheta() {
+    TS_ASSERT_DELTA(
+        GeometryInfo(*m_factory, *(m_workspace.getSpectrum(0))).getTwoTheta(),
+        0.0199973, 1e-6);
+    TS_ASSERT_DELTA(
+        GeometryInfo(*m_factory, *(m_workspace.getSpectrum(1))).getTwoTheta(),
+        0.0, 1e-6);
+    TS_ASSERT_DELTA(
+        GeometryInfo(*m_factory, *(m_workspace.getSpectrum(2))).getTwoTheta(),
+        0.0199973, 1e-6);
+  }
+
+  // Legacy test via the workspace method detectorTwoTheta(), which might be
+  // removed at some point.
+  void test_getTwoThetaLegacy() {
+    auto info = GeometryInfo(*m_factory, *(m_workspace.getSpectrum(2)));
+    TS_ASSERT_EQUALS(info.getTwoTheta(),
+                     m_workspace.detectorTwoTheta(info.getDetector()));
+  }
+
+  void test_getSignedTwoTheta() {
+    TS_ASSERT_DELTA(GeometryInfo(*m_factory, *(m_workspace.getSpectrum(0)))
+                        .getSignedTwoTheta(),
+                    -0.0199973, 1e-6);
+    TS_ASSERT_DELTA(GeometryInfo(*m_factory, *(m_workspace.getSpectrum(1)))
+                        .getSignedTwoTheta(),
+                    0.0, 1e-6);
+    TS_ASSERT_DELTA(GeometryInfo(*m_factory, *(m_workspace.getSpectrum(2)))
+                        .getSignedTwoTheta(),
+                    0.0199973, 1e-6);
+  }
+
+  // Legacy test via the workspace method detectorSignedTwoTheta(), which might
+  // be removed at some point.
+  void test_getSignedTwoThetaLegacy() {
+    auto info = GeometryInfo(*m_factory, *(m_workspace.getSpectrum(2)));
+    TS_ASSERT_EQUALS(info.getSignedTwoTheta(),
+                     m_workspace.detectorSignedTwoTheta(info.getDetector()));
+  }
+
+private:
+  WorkspaceTester m_workspace;
+  std::unique_ptr<GeometryInfoFactory> m_factory;
+};
+
+#endif /* MANTID_API_GEOMETRYINFOTEST_H_ */
diff --git a/Framework/API/test/InstrumentDataServiceTest.h b/Framework/API/test/InstrumentDataServiceTest.h
index 034b18bd9e3e82e909e45ebd6126a6385e930378..6826175e0531b55631b125abc43e9b0c72123fcf 100644
--- a/Framework/API/test/InstrumentDataServiceTest.h
+++ b/Framework/API/test/InstrumentDataServiceTest.h
@@ -99,11 +99,10 @@ public:
 
   void testGetObjectNames() {
     InstrumentDataService::Instance().add("inst2", inst2);
-    std::set<std::string> names;
+    std::unordered_set<std::string> names;
     names.insert("inst1");
     names.insert("inst2");
-    std::set<std::string> result;
-    result = InstrumentDataService::Instance().getObjectNames();
+    auto result = InstrumentDataService::Instance().getObjectNames();
     TS_ASSERT_EQUALS(result, names);
     // Check with an empty store
     InstrumentDataService::Instance().clear();
diff --git a/Framework/API/test/MatrixWorkspaceTest.h b/Framework/API/test/MatrixWorkspaceTest.h
index deba37922d39886398ca67d119786ec698ec41ae..a3fda30a2722940f34dd4996e64b553b8e27ff27 100644
--- a/Framework/API/test/MatrixWorkspaceTest.h
+++ b/Framework/API/test/MatrixWorkspaceTest.h
@@ -13,6 +13,7 @@
 #include "MantidKernel/VMD.h"
 #include "MantidTestHelpers/FakeGmockObjects.h"
 #include "MantidTestHelpers/FakeObjects.h"
+#include "MantidTestHelpers/InstrumentCreationHelper.h"
 #include "MantidTestHelpers/NexusTestHelper.h"
 #include "PropertyManagerHelper.h"
 
@@ -109,8 +110,7 @@ public:
     dets.push_back(60);
     dets.push_back(20);
     dets.push_back(90);
-    std::vector<size_t> indices;
-    ws.getIndicesFromDetectorIDs(dets, indices);
+    std::vector<size_t> indices = ws.getIndicesFromDetectorIDs(dets);
     TS_ASSERT_EQUALS(indices.size(), 3);
     TS_ASSERT_EQUALS(indices[0], 6);
     TS_ASSERT_EQUALS(indices[1], 2);
@@ -604,7 +604,7 @@ public:
     std::vector<size_t> out;
     detid_t offset = -1234;
     TS_ASSERT_THROWS_NOTHING(
-        ws->getDetectorIDToWorkspaceIndexVector(out, offset));
+        out = ws->getDetectorIDToWorkspaceIndexVector(offset));
     TS_ASSERT_EQUALS(offset, 0);
     TS_ASSERT_EQUALS(out.size(), 100);
     TS_ASSERT_EQUALS(out[0], 0);
@@ -634,7 +634,7 @@ public:
     ws->getSpectrum(66)->clearDetectorIDs();
 
     TS_ASSERT_THROWS_NOTHING(
-        ws->getDetectorIDToWorkspaceIndexVector(out, offset));
+        out = ws->getDetectorIDToWorkspaceIndexVector(offset));
     TS_ASSERT_EQUALS(offset, 1);
     TS_ASSERT_EQUALS(out.size(), 112);
     TS_ASSERT_EQUALS(out[66 + offset], std::numeric_limits<size_t>::max());
@@ -647,8 +647,8 @@ public:
     auto ws = makeWorkspaceWithDetectors(100, 10);
     std::vector<size_t> out;
     detid_t offset = -1234;
-    TS_ASSERT_THROWS_NOTHING(
-        ws->getSpectrumToWorkspaceIndexVector(out, offset));
+    TS_ASSERT_THROWS_NOTHING(out =
+                                 ws->getSpectrumToWorkspaceIndexVector(offset));
     TS_ASSERT_EQUALS(offset, -1);
     TS_ASSERT_EQUALS(out.size(), 100);
     TS_ASSERT_EQUALS(out[0], 0);
@@ -1307,4 +1307,45 @@ private:
   boost::shared_ptr<MatrixWorkspace> ws;
 };
 
+class MatrixWorkspaceTestPerformance : public CxxTest::TestSuite {
+public:
+  static MatrixWorkspaceTestPerformance *createSuite() {
+    return new MatrixWorkspaceTestPerformance();
+  }
+  static void destroySuite(MatrixWorkspaceTestPerformance *suite) {
+    delete suite;
+  }
+
+  MatrixWorkspaceTestPerformance() : m_workspace(nullptr) {
+    size_t numberOfHistograms = 10000;
+    size_t numberOfBins = 1;
+    m_workspace.init(numberOfHistograms, numberOfBins, numberOfBins - 1);
+    bool includeMonitors = false;
+    bool startYNegative = true;
+    const std::string instrumentName("SimpleFakeInstrument");
+    InstrumentCreationHelper::addFullInstrumentToWorkspace(
+        m_workspace, includeMonitors, startYNegative, instrumentName);
+  }
+
+  /// This test is equivalent to GeometryInfoFactoryTestPerformance, see there.
+  void test_typical() {
+    auto instrument = m_workspace.getInstrument();
+    auto source = instrument->getSource();
+    auto sample = instrument->getSample();
+    auto L1 = source->getDistance(*sample);
+    double result = 0.0;
+    for (size_t i = 0; i < 10000; ++i) {
+      auto detector = m_workspace.getDetector(i);
+      result += L1;
+      result += detector->getDistance(*sample);
+      result += m_workspace.detectorTwoTheta(detector);
+    }
+    // We are computing an using the result to fool the optimizer.
+    TS_ASSERT_DELTA(result, 5214709.740869, 1e-6);
+  }
+
+private:
+  WorkspaceTester m_workspace;
+};
+
 #endif /*WORKSPACETEST_H_*/
diff --git a/Framework/API/test/MultipleFilePropertyTest.h b/Framework/API/test/MultipleFilePropertyTest.h
index d036dd14e73700e9ac3d49f023a89d8ba9dc98f0..7ebe06dc06b87b60e5486f81cfe63c183c8539c1 100644
--- a/Framework/API/test/MultipleFilePropertyTest.h
+++ b/Framework/API/test/MultipleFilePropertyTest.h
@@ -12,8 +12,8 @@
 #include <Poco/Path.h>
 #include <Poco/File.h>
 
-#include <boost/assign/list_of.hpp>
 #include <boost/algorithm/string/join.hpp>
+#include <unordered_set>
 
 using namespace Mantid;
 using namespace Mantid::API;
@@ -46,11 +46,10 @@ std::string createAbsoluteDirectory(const std::string &dirPath) {
  * @param filenames :: the names of the files to create.
  * @param dirPath   :: the directory in which to create the files.
  */
-void createFilesInDirectory(const std::set<std::string> &filenames,
+void createFilesInDirectory(const std::unordered_set<std::string> &filenames,
                             const std::string &dirPath) {
-  for (auto filename = filenames.begin(); filename != filenames.end();
-       ++filename) {
-    Poco::File file(dirPath + "/" + *filename);
+  for (const auto &filename : filenames) {
+    Poco::File file(dirPath + "/" + filename);
     file.createFile();
   }
 }
@@ -74,7 +73,7 @@ private:
   std::string m_oldDefaultInstrument;
   std::string m_dummyFilesDir;
   std::string m_dirWithWhitespace;
-  std::set<std::string> m_tempDirs;
+  std::unordered_set<std::string> m_tempDirs;
   std::vector<std::string> m_exts;
 
   Mantid::Kernel::ConfigServiceImpl &g_config;
@@ -105,35 +104,35 @@ public:
     m_tempDirs.insert(m_dummyFilesDir);
     m_tempDirs.insert(m_dirWithWhitespace);
 
-    std::set<std::string> dummyFilenames = boost::assign::list_of
+    std::unordered_set<std::string> dummyFilenames = {
         // Standard raw file runs.
-        ("TSC00001.raw")("TSC00002.raw")("TSC00003.raw")("TSC00004.raw")(
-            "TSC00005.raw")
+        "TSC00001.raw", "TSC00002.raw", "TSC00003.raw", "TSC00004.raw",
+        "TSC00005.raw",
         // Duplicates, but in NeXuS format.
-        ("TSC00001.nxs")("TSC00002.nxs")("TSC00003.nxs")("TSC00004.nxs")(
-            "TSC00005.nxs")
+        "TSC00001.nxs", "TSC00002.nxs", "TSC00003.nxs", "TSC00004.nxs",
+        "TSC00005.nxs",
         // Standard NeXuS runs for another instrument.
-        ("IRS00001.raw")("IRS00002.raw")("IRS00003.raw")("IRS00004.raw")(
-            "IRS00005.raw")
+        "IRS00001.raw", "IRS00002.raw", "IRS00003.raw", "IRS00004.raw",
+        "IRS00005.raw",
         // Duplicates, but in NeXuS format.
-        ("IRS00001.nxs")("IRS00002.nxs")("IRS00003.nxs")("IRS00004.nxs")(
-            "IRS00005.nxs")
+        "IRS00001.nxs", "IRS00002.nxs", "IRS00003.nxs", "IRS00004.nxs",
+        "IRS00005.nxs",
         // "Incorrect" zero padding file.
-        ("TSC9999999.raw")
+        "TSC9999999.raw",
         // "Non-run" files.
-        ("IRS10001_graphite002_info.nxs")("IRS10002_graphite002_info.nxs")(
-            "IRS10003_graphite002_info.nxs")("IRS10004_graphite002_info.nxs")(
-            "IRS10005_graphite002_info.nxs")
+        "IRS10001_graphite002_info.nxs", "IRS10002_graphite002_info.nxs",
+        "IRS10003_graphite002_info.nxs", "IRS10004_graphite002_info.nxs",
+        "IRS10005_graphite002_info.nxs",
         // File with no extension.
-        ("bl6_flux_at_sample")
+        "bl6_flux_at_sample",
         // A single "non-run" file, that we should be able to load.
-        ("IRS10001-10005_graphite002_info.nxs")
+        "IRS10001-10005_graphite002_info.nxs",
         // A file with a "+" and "," in the name, to see if it can be loaded
         // when multifileloading is turned off via the preferences file.
-        ("_test_multiFileLoadingSwitchedOff_tempFileWithA+AndA,InTheName.txt");
+        "_test_multiFileLoadingSwitchedOff_tempFileWithA+AndA,InTheName.txt"};
 
-    std::set<std::string> whiteSpaceDirFilenames =
-        boost::assign::list_of("file with whitespace.txt");
+    std::unordered_set<std::string> whiteSpaceDirFilenames = {
+        "file with whitespace.txt"};
 
     createFilesInDirectory(dummyFilenames, m_dummyFilesDir);
     createFilesInDirectory(whiteSpaceDirFilenames, m_dummyFilesDir);
@@ -146,9 +145,8 @@ public:
    */
   ~MultipleFilePropertyTest() {
     // Remove temp dirs.
-    for (auto tempDir = m_tempDirs.begin(); tempDir != m_tempDirs.end();
-         ++tempDir) {
-      Poco::File dir(*tempDir);
+    for (const auto &tempDir : m_tempDirs) {
+      Poco::File dir(tempDir);
       dir.remove(true);
     }
   }
diff --git a/Framework/API/test/NotebookBuilderTest.h b/Framework/API/test/NotebookBuilderTest.h
index e158363d40e1eb99df2a9bdbb125b30712f68fef..f38d7270cfa4b25ef9eae876408d58e55f3650ac 100644
--- a/Framework/API/test/NotebookBuilderTest.h
+++ b/Framework/API/test/NotebookBuilderTest.h
@@ -2,6 +2,7 @@
 #define MANTID_NOTEBOOKBUILDERTEST_H_
 
 #include <cxxtest/TestSuite.h>
+#include <algorithm>
 
 #include "MantidAPI/AnalysisDataService.h"
 #include "MantidAPI/DataProcessorAlgorithm.h"
@@ -192,8 +193,9 @@ public:
     while (std::getline(buffer, line))
       notebookLines.push_back(line);
 
-    // Compare line with expected result
-    TS_ASSERT_EQUALS(notebookLines[64], result)
+    // Check that the expected line does appear in the output
+    TS_ASSERT(std::find(notebookLines.cbegin(), notebookLines.cend(), result) !=
+              notebookLines.cend())
 
     AnalysisDataService::Instance().remove("test_output_workspace");
     AnalysisDataService::Instance().remove("test_input_workspace");
@@ -232,8 +234,11 @@ public:
     while (std::getline(buffer, line))
       notebookLines.push_back(line);
 
-    TS_ASSERT_EQUALS(notebookLines[64], result_markdown)
-    TS_ASSERT_EQUALS(notebookLines[100], result_code)
+    // Check that the expected lines do appear in the output
+    TS_ASSERT(std::find(notebookLines.cbegin(), notebookLines.cend(),
+                        result_markdown) != notebookLines.cend())
+    TS_ASSERT(std::find(notebookLines.cbegin(), notebookLines.cend(),
+                        result_code) != notebookLines.cend())
 
     AnalysisDataService::Instance().remove("test_output_workspace");
     AnalysisDataService::Instance().remove("test_input_workspace");
@@ -281,8 +286,11 @@ public:
     while (std::getline(buffer, line))
       notebookLines.push_back(line);
 
-    TS_ASSERT_EQUALS(notebookLines[64], result_markdown)
-    TS_ASSERT_EQUALS(notebookLines[74], result_code)
+    // Check that the expected lines do appear in the output
+    TS_ASSERT(std::find(notebookLines.cbegin(), notebookLines.cend(),
+                        result_markdown) != notebookLines.cend())
+    TS_ASSERT(std::find(notebookLines.cbegin(), notebookLines.cend(),
+                        result_code) != notebookLines.cend())
 
     AnalysisDataService::Instance().remove("test_output_workspace");
     AnalysisDataService::Instance().remove("test_input_workspace");
@@ -321,7 +329,9 @@ public:
     while (std::getline(buffer, line))
       notebookLines.push_back(line);
 
-    TS_ASSERT_EQUALS(notebookLines[64], result)
+    // Check that the expected line does appear in the output
+    TS_ASSERT(std::find(notebookLines.cbegin(), notebookLines.cend(), result) !=
+              notebookLines.cend())
 
     AnalysisDataService::Instance().remove("test_output_workspace");
     AnalysisDataService::Instance().remove("test_inp\\ut_workspace");
diff --git a/Framework/API/test/NotebookWriterTest.h b/Framework/API/test/NotebookWriterTest.h
index e37733940c20bdeb34c22260515fca66e69f1d1e..4e7d46f2eb09d14d7365fb4bfd97c67a77aa0d56 100644
--- a/Framework/API/test/NotebookWriterTest.h
+++ b/Framework/API/test/NotebookWriterTest.h
@@ -12,7 +12,7 @@ using namespace Mantid::Kernel;
 class NotebookWriterTest : public CxxTest::TestSuite {
 public:
   void test_writeNotebook() {
-    std::unique_ptr<NotebookWriter> notebook(new NotebookWriter());
+    auto notebook = make_unique<NotebookWriter>();
 
     std::string notebookText = notebook->writeNotebook();
 
@@ -24,7 +24,7 @@ public:
   }
 
   void test_markdownCell() {
-    std::unique_ptr<NotebookWriter> notebook(new NotebookWriter());
+    auto notebook = make_unique<NotebookWriter>();
     std::string test_data = "Test markdown cell";
     std::string notebookText = notebook->markdownCell(test_data);
 
@@ -38,7 +38,7 @@ public:
   }
 
   void test_codeCell() {
-    std::unique_ptr<NotebookWriter> notebook(new NotebookWriter());
+    auto notebook = make_unique<NotebookWriter>();
     std::string test_data = "print 'Test code cell'";
     std::string notebookText = notebook->codeCell(test_data);
 
diff --git a/Framework/API/test/PropertyManagerDataServiceTest.h b/Framework/API/test/PropertyManagerDataServiceTest.h
index 77063af16abb294dac4c712d26bf36f8a8b730a9..2874f1768a78c46f4b3e02f754259cb5bc30eb51 100644
--- a/Framework/API/test/PropertyManagerDataServiceTest.h
+++ b/Framework/API/test/PropertyManagerDataServiceTest.h
@@ -95,10 +95,10 @@ public:
   }
   void testGetObjectNames() {
     PropertyManagerDataService::Instance().add("inst2", inst2);
-    std::set<std::string> names;
+    std::unordered_set<std::string> names;
     names.insert("inst1");
     names.insert("inst2");
-    std::set<std::string> result;
+    std::unordered_set<std::string> result;
     result = PropertyManagerDataService::Instance().getObjectNames();
     TS_ASSERT_EQUALS(result, names);
     // Check with an empty store
diff --git a/Framework/Algorithms/inc/MantidAlgorithms/CalculateFlatBackground.h b/Framework/Algorithms/inc/MantidAlgorithms/CalculateFlatBackground.h
index e61aa86f0572dd19ae9f4842814582cf0e32f553..19e133456a0612922203ff8e3686d93472d74b12 100644
--- a/Framework/Algorithms/inc/MantidAlgorithms/CalculateFlatBackground.h
+++ b/Framework/Algorithms/inc/MantidAlgorithms/CalculateFlatBackground.h
@@ -54,12 +54,12 @@ public:
   /// (Empty) Constructor
   CalculateFlatBackground()
       : API::Algorithm(), m_convertedFromRawCounts(false),
-        m_skipMonitors(false), m_nullifyNegative(true), m_progress(NULL) {}
+        m_skipMonitors(false), m_nullifyNegative(true), m_progress(nullptr) {}
   /// Virtual destructor
   ~CalculateFlatBackground() override {
     if (m_progress)
       delete m_progress;
-    m_progress = NULL;
+    m_progress = nullptr;
   }
   /// Algorithm's name
   const std::string name() const override { return "CalculateFlatBackground"; }
diff --git a/Framework/Algorithms/inc/MantidAlgorithms/CorrectKiKf.h b/Framework/Algorithms/inc/MantidAlgorithms/CorrectKiKf.h
index b58a0909470f47381def124247c103594ba9201d..d3f0b5b38bfcbd2a7c51a8ee4275f2adbf48ad5d 100644
--- a/Framework/Algorithms/inc/MantidAlgorithms/CorrectKiKf.h
+++ b/Framework/Algorithms/inc/MantidAlgorithms/CorrectKiKf.h
@@ -94,10 +94,6 @@ private:
   template <class T>
   void correctKiKfEventHelper(std::vector<T> &events, double efixed,
                               const std::string emodeStr);
-  /// The user selected (input) workspace
-  API::MatrixWorkspace_const_sptr inputWS;
-  /// The output workspace, maybe the same as the input one
-  API::MatrixWorkspace_sptr outputWS;
 };
 
 } // namespace Algorithm
diff --git a/Framework/Algorithms/inc/MantidAlgorithms/CrossCorrelate.h b/Framework/Algorithms/inc/MantidAlgorithms/CrossCorrelate.h
index bd07a06895afbc10c08aa28c36dda6884ff32214..4f37d32766a510e23f5170f2bc4a8d2ec6e9a69f 100644
--- a/Framework/Algorithms/inc/MantidAlgorithms/CrossCorrelate.h
+++ b/Framework/Algorithms/inc/MantidAlgorithms/CrossCorrelate.h
@@ -59,12 +59,12 @@ namespace Algorithms {
 class DLLExport CrossCorrelate : public API::Algorithm {
 public:
   /// (Empty) Constructor
-  CrossCorrelate() : API::Algorithm(), m_progress(NULL) {}
+  CrossCorrelate() : API::Algorithm(), m_progress(nullptr) {}
   /// Virtual destructor
   ~CrossCorrelate() override {
     if (m_progress)
       delete m_progress;
-    m_progress = NULL;
+    m_progress = nullptr;
   }
   /// Algorithm's name
   const std::string name() const override { return "CrossCorrelate"; }
diff --git a/Framework/Algorithms/inc/MantidAlgorithms/DiffractionFocussing.h b/Framework/Algorithms/inc/MantidAlgorithms/DiffractionFocussing.h
index 7131df28119a5e748b94c8fcfa95a5dc8f5af465..395f33e08cbc407b6965793b0046116d85c67b7d 100644
--- a/Framework/Algorithms/inc/MantidAlgorithms/DiffractionFocussing.h
+++ b/Framework/Algorithms/inc/MantidAlgorithms/DiffractionFocussing.h
@@ -93,8 +93,8 @@ private:
   void RebinWorkspace(API::MatrixWorkspace_sptr &workspace);
   void calculateRebinParams(const API::MatrixWorkspace_const_sptr &workspace,
                             double &min, double &max, double &step);
-  bool readGroupingFile(std::string groupingFileName,
-                        std::multimap<int64_t, int64_t> &detectorGroups);
+  std::multimap<int64_t, int64_t>
+  readGroupingFile(std::string groupingFileName);
 };
 
 } // namespace Algorithm
diff --git a/Framework/Algorithms/inc/MantidAlgorithms/ExtractMaskToTable.h b/Framework/Algorithms/inc/MantidAlgorithms/ExtractMaskToTable.h
index 10af051bd2489320b26acc289b90ab62c2a3cbb3..c211e6c3ba753fa4e1a45e4a4f612f2abc989c98 100644
--- a/Framework/Algorithms/inc/MantidAlgorithms/ExtractMaskToTable.h
+++ b/Framework/Algorithms/inc/MantidAlgorithms/ExtractMaskToTable.h
@@ -69,12 +69,12 @@ private:
 
   /// Parse input TableWorkspace to get a list of detectors IDs of which
   /// detector are already masked
-  void parseMaskTable(DataObjects::TableWorkspace_sptr masktablews,
-                      std::vector<detid_t> &maskeddetectorids);
+  std::vector<detid_t>
+  parseMaskTable(DataObjects::TableWorkspace_sptr masktablews);
 
   /// Parse a string containing list in format (x, xx-yy, x, x, ...) to a vector
   /// of detid_t
-  void parseStringToVector(std::string liststr, std::vector<detid_t> &detidvec);
+  std::vector<detid_t> parseStringToVector(std::string liststr);
 
   /// Extract mask from a workspace to a list of detectors
   std::vector<detid_t> extractMaskFromMatrixWorkspace();
diff --git a/Framework/Algorithms/inc/MantidAlgorithms/FFT.h b/Framework/Algorithms/inc/MantidAlgorithms/FFT.h
index 153a617ab9f13e6bdd1393f88eafc8d40a0e0c4e..2a95097a3e1dd8385828e29b63af6c1a5397e832 100644
--- a/Framework/Algorithms/inc/MantidAlgorithms/FFT.h
+++ b/Framework/Algorithms/inc/MantidAlgorithms/FFT.h
@@ -6,6 +6,7 @@
 //----------------------------------------------------------------------
 #include "MantidAPI/Algorithm.h"
 #include "MantidAPI/Workspace_fwd.h"
+#include "MantidKernel/cow_ptr.h"
 
 namespace Mantid {
 namespace Algorithms {
@@ -58,6 +59,10 @@ private:
   // Overridden Algorithm methods
   void init() override;
   void exec() override;
+  /// Perform validation of inputs
+  std::map<std::string, std::string> validateInputs() override;
+  /// Check whether supplied values are evenly spaced
+  bool areBinWidthsUneven(const MantidVec &xValues) const;
 };
 
 } // namespace Algorithm
diff --git a/Framework/Algorithms/inc/MantidAlgorithms/FilterEvents.h b/Framework/Algorithms/inc/MantidAlgorithms/FilterEvents.h
index 162021480dbd842496d9d1603e3fddceef0bc8b8..267bd95173826bfbcc0e21b77fa3eb95a12d9005 100644
--- a/Framework/Algorithms/inc/MantidAlgorithms/FilterEvents.h
+++ b/Framework/Algorithms/inc/MantidAlgorithms/FilterEvents.h
@@ -124,7 +124,7 @@ private:
   /// Flag to use matrix splitters or table splitters
   bool m_useTableSplitters;
 
-  std::set<int> m_workGroupIndexes;
+  std::unordered_set<int> m_workGroupIndexes;
   Kernel::TimeSplitterType m_splitters;
   std::map<int, DataObjects::EventWorkspace_sptr> m_outputWS;
   std::vector<std::string> m_wsNames;
@@ -139,9 +139,9 @@ private:
 
   double m_progress;
 
-  void getTimeSeriesLogNames(std::vector<std::string> &lognames);
+  std::vector<std::string> getTimeSeriesLogNames();
 
-  void generateSplitters(int wsindex, Kernel::TimeSplitterType &splitters);
+  Kernel::TimeSplitterType generateSplitters(int wsindex);
 
   void splitLog(DataObjects::EventWorkspace_sptr eventws, std::string logname,
                 Kernel::TimeSplitterType &splitters);
diff --git a/Framework/Algorithms/inc/MantidAlgorithms/FindPeaks.h b/Framework/Algorithms/inc/MantidAlgorithms/FindPeaks.h
index 1c28c3936aa2a5d922458718cd1cbeffcd48196d..514201432cab0f9b8b08fcf994620bc97395a922 100644
--- a/Framework/Algorithms/inc/MantidAlgorithms/FindPeaks.h
+++ b/Framework/Algorithms/inc/MantidAlgorithms/FindPeaks.h
@@ -67,7 +67,7 @@ public:
   ~FindPeaks() override {
     if (m_progress)
       delete m_progress;
-    m_progress = NULL;
+    m_progress = nullptr;
   }
   /// Algorithm's name
   const std::string name() const override { return "FindPeaks"; }
diff --git a/Framework/Algorithms/inc/MantidAlgorithms/FitPeak.h b/Framework/Algorithms/inc/MantidAlgorithms/FitPeak.h
index 3831edc57b9338a7bf0a23648c8247179ef6d0ba..6c181c6c64c86fd805d550cb00c82d27b31ca470 100644
--- a/Framework/Algorithms/inc/MantidAlgorithms/FitPeak.h
+++ b/Framework/Algorithms/inc/MantidAlgorithms/FitPeak.h
@@ -60,26 +60,18 @@ public:
   /// Fit peak first considering high background
   void highBkgdFit();
 
-  /// Get fitting error
-  void getFitError(std::map<std::string, double> &peakerrormap,
-                   std::map<std::string, double> &bkgderrormap);
+  /// Get fitting error for peak function
+  std::map<std::string, double> getPeakError();
+
+  /// Get fitting error for background function
+  std::map<std::string, double> getBackgroundError();
 
   /// Get cost function value from fitting
   double getFitCostFunctionValue();
 
-  /// Get peak
-  // API::IPeakFunction_sptr getPeakFunction();
-
-  /// Get background
-  // API::IBackgroundFunction_sptr getBackgroundFunction();
-
   /// Generate a partial workspace at fit window
   API::MatrixWorkspace_sptr genFitWindowWS();
 
-  // void setPeakParameterValues();
-
-  // void setBackgroundParameterValues();
-
 private:
   /// Name
   const std::string name() const override { return "FitOneSinglePeak"; }
@@ -136,15 +128,15 @@ private:
   /// Process and store fit result
   void processNStoreFitResult(double rwp, bool storebkgd);
 
-  void push(API::IFunction_const_sptr func,
-            std::map<std::string, double> &funcparammap);
+  /// Back up fit result
+  std::map<std::string, double> backup(API::IFunction_const_sptr func);
 
   void pop(const std::map<std::string, double> &funcparammap,
            API::IFunction_sptr func);
 
   /// Store function fitting error
-  void storeFunctionError(const API::IFunction_const_sptr &func,
-                          std::map<std::string, double> &paramerrormap);
+  std::map<std::string, double>
+  storeFunctionError(const API::IFunction_const_sptr &func);
 
   API::IBackgroundFunction_sptr
   fitBackground(API::IBackgroundFunction_sptr bkgdfunc);
@@ -322,11 +314,6 @@ private:
   /// Set up a vector of guessed FWHM
   void setupGuessedFWHM(std::vector<double> &vec_FWHM);
 
-  /// Push/store a fit result
-  void push(API::IFunction_const_sptr func,
-            std::map<std::string, double> &funcparammap,
-            std::map<std::string, double> &paramerrormap);
-
   /// Pop
   void pop(const std::map<std::string, double> &funcparammap,
            API::IFunction_sptr func);
diff --git a/Framework/Algorithms/inc/MantidAlgorithms/Integration.h b/Framework/Algorithms/inc/MantidAlgorithms/Integration.h
index 964660a2ffe635ce9de914b821db58ac2c26106f..802714e3bbae12c89f46f37bc667add549bf7f21 100644
--- a/Framework/Algorithms/inc/MantidAlgorithms/Integration.h
+++ b/Framework/Algorithms/inc/MantidAlgorithms/Integration.h
@@ -5,7 +5,6 @@
 // Includes
 //----------------------------------------------------------------------
 #include "MantidAPI/Algorithm.h"
-#include "MantidDataObjects/EventWorkspace.h"
 
 namespace Mantid {
 namespace Algorithms {
@@ -82,15 +81,16 @@ private:
   void init() override;
   void exec() override;
 
-  /// Get the input workspace
-  API::MatrixWorkspace_const_sptr getInputWorkspace();
-  /// Create the outputworkspace
   API::MatrixWorkspace_sptr
-  getOutputWorkspace(API::MatrixWorkspace_const_sptr inWS, const int minSpec,
-                     const int maxSpec);
+  rangeFilterEventWorkspace(API::MatrixWorkspace_sptr eventWorkspace,
+                            double minRange, double maxRange);
 
-  /// Input event workspace
-  DataObjects::EventWorkspace_const_sptr inputEventWS;
+  /// Get the input workspace
+  API::MatrixWorkspace_sptr getInputWorkspace();
+  /// Create the outputworkspace
+  API::MatrixWorkspace_sptr getOutputWorkspace(API::MatrixWorkspace_sptr inWS,
+                                               const int minSpec,
+                                               const int maxSpec);
 };
 
 } // namespace Algorithm
diff --git a/Framework/Algorithms/inc/MantidAlgorithms/RebinToWorkspace.h b/Framework/Algorithms/inc/MantidAlgorithms/RebinToWorkspace.h
index b9ee5461e27d71f11780737e717ee906598cc211..1d638e35ccf44d1206653626d4fea3d1dddb85e9 100644
--- a/Framework/Algorithms/inc/MantidAlgorithms/RebinToWorkspace.h
+++ b/Framework/Algorithms/inc/MantidAlgorithms/RebinToWorkspace.h
@@ -71,8 +71,8 @@ private:
   void exec() override;
 
   /// Create the rebin paraeters
-  void createRebinParameters(Mantid::API::MatrixWorkspace_sptr toMatch,
-                             std::vector<double> &rb_params);
+  std::vector<double>
+  createRebinParameters(Mantid::API::MatrixWorkspace_sptr toMatch);
 };
 }
 }
diff --git a/Framework/Algorithms/inc/MantidAlgorithms/RemoveBackground.h b/Framework/Algorithms/inc/MantidAlgorithms/RemoveBackground.h
index e3ddd10af7a13edc1b52d8a2ad5011e7bc6b7bcd..3b1cc44813bdb1b0074af8e1131b086c20184b8a 100644
--- a/Framework/Algorithms/inc/MantidAlgorithms/RemoveBackground.h
+++ b/Framework/Algorithms/inc/MantidAlgorithms/RemoveBackground.h
@@ -5,6 +5,7 @@
 // Includes
 //----------------------------------------------------------------------
 #include "MantidAPI/Algorithm.h"
+#include "MantidAPI/GeometryInfoFactory.h"
 #include "MantidKernel/cow_ptr.h"
 #include "MantidGeometry/IComponent.h"
 
@@ -53,7 +54,7 @@ public:
 
   void initialize(const API::MatrixWorkspace_const_sptr &bkgWS,
                   const API::MatrixWorkspace_sptr &sourceWS, int emode,
-                  Kernel::Logger *pLog = NULL, int nTreads = 1,
+                  Kernel::Logger *pLog = nullptr, int nTreads = 1,
                   bool inPlace = true, bool nullifyNegative = false);
   void removeBackground(int hist, MantidVec &XValues, MantidVec &y_data,
                         MantidVec &e_data, int tread_num = 0) const;
@@ -67,6 +68,8 @@ private:
   // shared pointer to the workspace where background should be removed
   API::MatrixWorkspace_const_sptr m_wkWS;
 
+  std::unique_ptr<API::GeometryInfoFactory> m_geometryInfoFactory;
+
   // logger from the hosting algorithm
   Kernel::Logger *m_pgLog;
   // perform background removal in-place
@@ -84,12 +87,8 @@ private:
   double m_ErrSq;
   // energy conversion mode
   int m_Emode;
-  // source-sample distance
-  double m_L1;
   // incident for direct or analysis for indirect energy for units conversion
   double m_Efix;
-  // shared pointer to the sample
-  Geometry::IComponent_const_sptr m_Sample;
   // if true, negative signals are nullified
   bool m_nullifyNegative;
   // removing negative values from ws with background removed previously.
diff --git a/Framework/Algorithms/src/AlignDetectors.cpp b/Framework/Algorithms/src/AlignDetectors.cpp
index 3b0bc6e291ff93c9cb5fe9a75a0277cd600d9de8..2278ec480b068628ab63e4b0119dc7881a5a2a29 100644
--- a/Framework/Algorithms/src/AlignDetectors.cpp
+++ b/Framework/Algorithms/src/AlignDetectors.cpp
@@ -166,7 +166,6 @@ AlignDetectors::AlignDetectors() : m_numberOfSpectra(0) {
 /// Destructor
 AlignDetectors::~AlignDetectors() { delete this->tofToDmap; }
 
-//-----------------------------------------------------------------------
 void AlignDetectors::init() {
   auto wsValidator = boost::make_shared<CompositeValidator>();
   // Workspace unit must be TOF.
@@ -285,7 +284,6 @@ void setXAxisUnits(API::MatrixWorkspace_sptr outputWS) {
   outputWS->getAxis(0)->unit() = UnitFactory::Instance().create("dSpacing");
 }
 
-//-----------------------------------------------------------------------
 /** Executes the algorithm
  *  @throw Exception::FileError If the calibration file cannot be opened and
  * read successfully
@@ -360,42 +358,22 @@ void AlignDetectors::exec() {
   PARALLEL_CHECK_INTERUPT_REGION
 }
 
-//-----------------------------------------------------------------------
 /**
  * Execute the align detectors algorithm for an event workspace.
  */
 void AlignDetectors::execEvent() {
-  // g_log.information("Processing event workspace");
-
   // the calibration information is already read in at this point
 
-  // convert the input workspace into the event workspace we already know it is
   const MatrixWorkspace_const_sptr matrixInputWS =
-      this->getProperty("InputWorkspace");
-  EventWorkspace_const_sptr inputWS =
-      boost::dynamic_pointer_cast<const EventWorkspace>(matrixInputWS);
+      getProperty("InputWorkspace");
 
   // generate the output workspace pointer
-  API::MatrixWorkspace_sptr matrixOutputWS =
-      this->getProperty("OutputWorkspace");
-  EventWorkspace_sptr outputWS;
-  if (matrixOutputWS == matrixInputWS)
-    outputWS = boost::dynamic_pointer_cast<EventWorkspace>(matrixOutputWS);
-  else {
-    // Make a brand new EventWorkspace
-    outputWS = boost::dynamic_pointer_cast<EventWorkspace>(
-        API::WorkspaceFactory::Instance().create(
-            "EventWorkspace", inputWS->getNumberHistograms(), 2, 1));
-    // Copy geometry over.
-    API::WorkspaceFactory::Instance().initializeFromParent(inputWS, outputWS,
-                                                           false);
-    // You need to copy over the data as well.
-    outputWS->copyDataFrom((*inputWS));
-
-    // Cast to the matrixOutputWS and save it
-    matrixOutputWS = boost::dynamic_pointer_cast<MatrixWorkspace>(outputWS);
+  API::MatrixWorkspace_sptr matrixOutputWS = getProperty("OutputWorkspace");
+  if (matrixOutputWS != matrixInputWS) {
+    matrixOutputWS = MatrixWorkspace_sptr(matrixInputWS->clone().release());
     this->setProperty("OutputWorkspace", matrixOutputWS);
   }
+  auto outputWS = boost::dynamic_pointer_cast<EventWorkspace>(matrixOutputWS);
 
   // Set the final unit that our output workspace will have
   setXAxisUnits(outputWS);
@@ -409,7 +387,7 @@ void AlignDetectors::execEvent() {
     PARALLEL_START_INTERUPT_REGION
 
     auto toDspacing = converter.getConversionFunc(
-        inputWS->getSpectrum(size_t(i))->getDetectorIDs());
+        outputWS->getSpectrum(size_t(i))->getDetectorIDs());
     outputWS->getEventList(i).convertTof(toDspacing);
 
     progress.report();
diff --git a/Framework/Algorithms/src/AsymmetryCalc.cpp b/Framework/Algorithms/src/AsymmetryCalc.cpp
index 13fd6c9ba36855879da26df9cac82468b11f1722..3d8d8e23aef8768d7959b861448d9d5375b256e7 100644
--- a/Framework/Algorithms/src/AsymmetryCalc.cpp
+++ b/Framework/Algorithms/src/AsymmetryCalc.cpp
@@ -46,24 +46,23 @@ std::map<std::string, std::string> AsymmetryCalc::validateInputs() {
 
   std::map<std::string, std::string> result;
 
-  std::vector<size_t> list;
   std::vector<int> forwd = getProperty("ForwardSpectra");
   std::vector<int> backwd = getProperty("BackwardSpectra");
 
   API::MatrixWorkspace_sptr inputWS = getProperty("InputWorkspace");
+  if (inputWS) {
+    auto list = inputWS->getIndicesFromSpectra(forwd);
+    if (forwd.size() != list.size()) {
+      result["ForwardSpectra"] =
+          "Some of the spectra can not be found in the input workspace";
+    }
 
-  inputWS->getIndicesFromSpectra(forwd, list);
-  if (forwd.size() != list.size()) {
-    result["ForwardSpectra"] =
-        "Some of the spectra can not be found in the input workspace";
-  }
-
-  inputWS->getIndicesFromSpectra(backwd, list);
-  if (backwd.size() != list.size()) {
-    result["BackwardSpectra"] =
-        "Some of the spectra can not be found in the input workspace";
+    list = inputWS->getIndicesFromSpectra(backwd);
+    if (backwd.size() != list.size()) {
+      result["BackwardSpectra"] =
+          "Some of the spectra can not be found in the input workspace";
+    }
   }
-
   return result;
 }
 
@@ -117,8 +116,7 @@ void AsymmetryCalc::exec() {
     std::vector<specid_t> specIDs(2);
     specIDs[0] = forward;
     specIDs[1] = backward;
-    std::vector<size_t> indices;
-    tmpWS->getIndicesFromSpectra(specIDs, indices);
+    std::vector<size_t> indices = tmpWS->getIndicesFromSpectra(specIDs);
 
     forward = static_cast<int>(indices[0]);
     backward = static_cast<int>(indices[1]);
diff --git a/Framework/Algorithms/src/BinaryOperation.cpp b/Framework/Algorithms/src/BinaryOperation.cpp
index ca0056c8f5cefa9863b8510f41b847a123422214..fc571422deeef71889f36fa1439fce071290dda5 100644
--- a/Framework/Algorithms/src/BinaryOperation.cpp
+++ b/Framework/Algorithms/src/BinaryOperation.cpp
@@ -225,18 +225,9 @@ void BinaryOperation::exec() {
             "Contact the developers.");
     } else {
       // You HAVE to copy the data from lhs to to the output!
-
-      // Create a copy of the lhs workspace
-      m_eout = boost::dynamic_pointer_cast<EventWorkspace>(
-          API::WorkspaceFactory::Instance().create(
-              "EventWorkspace", m_elhs->getNumberHistograms(), 2, 1));
-      // Copy geometry, spectra map, etc. over.
-      API::WorkspaceFactory::Instance().initializeFromParent(m_elhs, m_eout,
-                                                             false);
-      // And we copy all the events from the lhs
-      m_eout->copyDataFrom(*m_elhs);
-      // Make sure m_out still points to the same as m_eout;
-      m_out = boost::dynamic_pointer_cast<API::MatrixWorkspace>(m_eout);
+      m_out = MatrixWorkspace_sptr(m_lhs->clone().release());
+      // Make sure m_eout still points to the same as m_out;
+      m_eout = boost::dynamic_pointer_cast<EventWorkspace>(m_out);
     }
 
     // Always clear the MRUs.
diff --git a/Framework/Algorithms/src/CalculateDIFC.cpp b/Framework/Algorithms/src/CalculateDIFC.cpp
index 35ce77f1750ed7049d4868d74c6d8a10fb49679a..896e6146f1ef475458d97d797ebe07ab13c27ccc 100644
--- a/Framework/Algorithms/src/CalculateDIFC.cpp
+++ b/Framework/Algorithms/src/CalculateDIFC.cpp
@@ -71,11 +71,14 @@ void CalculateDIFC::exec() {
   DataObjects::OffsetsWorkspace_sptr offsetsWs =
       getProperty("OffsetsWorkspace");
   API::MatrixWorkspace_sptr inputWs = getProperty("InputWorkspace");
-  API::MatrixWorkspace_sptr outputWs =
-      boost::dynamic_pointer_cast<MatrixWorkspace>(SpecialWorkspace2D_sptr(
-          new SpecialWorkspace2D(inputWs->getInstrument())));
+  API::MatrixWorkspace_sptr outputWs = getProperty("OutputWorkspace");
 
-  outputWs->setTitle("DIFC workspace");
+  if ((!bool(inputWs == outputWs)) ||
+      (!bool(boost::dynamic_pointer_cast<SpecialWorkspace2D>(outputWs)))) {
+    outputWs = boost::dynamic_pointer_cast<MatrixWorkspace>(
+        boost::make_shared<SpecialWorkspace2D>(inputWs->getInstrument()));
+    outputWs->setTitle("DIFC workspace");
+  }
 
   Instrument_const_sptr instrument = inputWs->getInstrument();
 
diff --git a/Framework/Algorithms/src/CalculateTransmission.cpp b/Framework/Algorithms/src/CalculateTransmission.cpp
index 7d8816e2f16c194b5af586252b32374b53dec856..89466e1c6fb49886b0cdd72654fd2c2b0a346349 100644
--- a/Framework/Algorithms/src/CalculateTransmission.cpp
+++ b/Framework/Algorithms/src/CalculateTransmission.cpp
@@ -21,7 +21,6 @@
 #include <cmath>
 
 #include <boost/algorithm/string/join.hpp>
-#include <boost/assign/list_of.hpp>
 #include <boost/foreach.hpp>
 #include <boost/lexical_cast.hpp>
 
@@ -47,10 +46,8 @@ const detid_t LOQ_TRANSMISSION_MONITOR_UDET = 3;
  * @returns workspace index corresponding to the given detector ID
  */
 size_t getIndexFromDetectorID(MatrixWorkspace_sptr ws, detid_t detid) {
-  const std::vector<detid_t> input = boost::assign::list_of(detid);
-  std::vector<size_t> result;
-
-  ws->getIndicesFromDetectorIDs(input, result);
+  const std::vector<detid_t> input = {detid};
+  std::vector<size_t> result = ws->getIndicesFromDetectorIDs(input);
   if (result.empty())
     throw std::invalid_argument(
         "Could not find the spectra corresponding to detector ID " +
@@ -172,7 +169,7 @@ void CalculateTransmission::exec() {
     transmissionIndices.push_back(transmissionMonitorIndex);
     logIfNotMonitor(sampleWS, directWS, transmissionMonitorIndex);
   } else if (usingROI) {
-    sampleWS->getIndicesFromDetectorIDs(transDetList, transmissionIndices);
+    transmissionIndices = sampleWS->getIndicesFromDetectorIDs(transDetList);
   } else
     assert(false);
 
@@ -275,8 +272,9 @@ CalculateTransmission::extractSpectra(API::MatrixWorkspace_sptr ws,
   // lexical_cast function
   typedef std::string (*from_size_t)(const size_t &);
 
-  std::transform(indices.begin(), indices.end(), indexStrings.begin(),
-                 (from_size_t)boost::lexical_cast<std::string, size_t>);
+  std::transform(
+      indices.begin(), indices.end(), indexStrings.begin(),
+      static_cast<from_size_t>(boost::lexical_cast<std::string, size_t>));
   const std::string commaIndexList = boost::algorithm::join(indexStrings, ",");
 
   double start = m_done;
diff --git a/Framework/Algorithms/src/CalculateTransmissionBeamSpreader.cpp b/Framework/Algorithms/src/CalculateTransmissionBeamSpreader.cpp
index 2f2d4701693c934edf347d4f86f8b93226047ab8..e9162454a25d39e6035a9f62c868b9775f9b0db4 100644
--- a/Framework/Algorithms/src/CalculateTransmissionBeamSpreader.cpp
+++ b/Framework/Algorithms/src/CalculateTransmissionBeamSpreader.cpp
@@ -112,12 +112,12 @@ void CalculateTransmissionBeamSpreader::exec() {
 
   // Extract the required spectra into separate workspaces
   std::vector<detid_t> udets{getProperty("IncidentBeamMonitor")};
-  std::vector<size_t> indices;
 
   // Convert UDETs to workspace indices
   // Get monitors (assume that the detector mapping is the same for all data
   // sets)
-  sample_scatterWS->getIndicesFromDetectorIDs(udets, indices);
+  std::vector<size_t> indices =
+      sample_scatterWS->getIndicesFromDetectorIDs(udets);
   if (indices.size() != 1) {
     g_log.error() << "Could not find the incident monitor spectra\n";
     throw std::invalid_argument(
diff --git a/Framework/Algorithms/src/ChangeBinOffset.cpp b/Framework/Algorithms/src/ChangeBinOffset.cpp
index ef807267c9ea5d0b546d93f790627f88df015409..d6ac59fbd42d94da4340b4fbfe6ffe1f6ba8b0eb 100644
--- a/Framework/Algorithms/src/ChangeBinOffset.cpp
+++ b/Framework/Algorithms/src/ChangeBinOffset.cpp
@@ -149,33 +149,17 @@ void ChangeBinOffset::execEvent() {
   g_log.information("Processing event workspace");
 
   const MatrixWorkspace_const_sptr matrixInputWS =
-      this->getProperty("InputWorkspace");
-  EventWorkspace_const_sptr inputWS =
-      boost::dynamic_pointer_cast<const EventWorkspace>(matrixInputWS);
+      getProperty("InputWorkspace");
 
   // generate the output workspace pointer
-  API::MatrixWorkspace_sptr matrixOutputWS =
-      this->getProperty("OutputWorkspace");
-  EventWorkspace_sptr outputWS;
-  if (matrixOutputWS == matrixInputWS)
-    outputWS = boost::dynamic_pointer_cast<EventWorkspace>(matrixOutputWS);
-  else {
-    // Make a brand new EventWorkspace
-    outputWS = boost::dynamic_pointer_cast<EventWorkspace>(
-        API::WorkspaceFactory::Instance().create(
-            "EventWorkspace", inputWS->getNumberHistograms(), 2, 1));
-    // Copy geometry over.
-    API::WorkspaceFactory::Instance().initializeFromParent(inputWS, outputWS,
-                                                           false);
-    // You need to copy over the data as well.
-    outputWS->copyDataFrom((*inputWS));
-
-    // Cast to the matrixOutputWS and save it
-    matrixOutputWS = boost::dynamic_pointer_cast<MatrixWorkspace>(outputWS);
+  API::MatrixWorkspace_sptr matrixOutputWS = getProperty("OutputWorkspace");
+  if (matrixOutputWS != matrixInputWS) {
+    matrixOutputWS = MatrixWorkspace_sptr(matrixInputWS->clone().release());
     this->setProperty("OutputWorkspace", matrixOutputWS);
   }
+  auto outputWS = boost::dynamic_pointer_cast<EventWorkspace>(matrixOutputWS);
 
-  int64_t numHistograms = static_cast<int64_t>(inputWS->getNumberHistograms());
+  int64_t numHistograms = static_cast<int64_t>(outputWS->getNumberHistograms());
   PARALLEL_FOR1(outputWS)
   for (int64_t i = 0; i < numHistograms; ++i) {
     PARALLEL_START_INTERUPT_REGION
diff --git a/Framework/Algorithms/src/ChangePulsetime.cpp b/Framework/Algorithms/src/ChangePulsetime.cpp
index 534d5a1922e0515598101534b1456594ceb36fbf..db45f0c9b116bfc0ced3b1ac0bbfe78e24e05a19 100644
--- a/Framework/Algorithms/src/ChangePulsetime.cpp
+++ b/Framework/Algorithms/src/ChangePulsetime.cpp
@@ -52,15 +52,7 @@ void ChangePulsetime::exec() {
   EventWorkspace_const_sptr in_ws = getProperty("InputWorkspace");
   EventWorkspace_sptr out_ws = getProperty("OutputWorkspace");
   if (!out_ws) {
-    // Make a brand new EventWorkspace
-    out_ws = boost::dynamic_pointer_cast<EventWorkspace>(
-        API::WorkspaceFactory::Instance().create(
-            "EventWorkspace", in_ws->getNumberHistograms(), 2, 1));
-    // Copy geometry over.
-    API::WorkspaceFactory::Instance().initializeFromParent(in_ws, out_ws,
-                                                           false);
-    // You need to copy over the data as well.
-    out_ws->copyDataFrom((*in_ws));
+    out_ws = EventWorkspace_sptr(in_ws->clone().release());
   }
 
   // Either use the given list or use all spectra
diff --git a/Framework/Algorithms/src/ChopData.cpp b/Framework/Algorithms/src/ChopData.cpp
index 0f2ed0f7774b5585174060380f854352f00be41c..5d1814715929c8f4aa661f53598417a767c9637a 100644
--- a/Framework/Algorithms/src/ChopData.cpp
+++ b/Framework/Algorithms/src/ChopData.cpp
@@ -162,7 +162,7 @@ void ChopData::exec() {
   }
 
   // Create workspace group that holds output workspaces
-  WorkspaceGroup_sptr wsgroup = WorkspaceGroup_sptr(new WorkspaceGroup());
+  auto wsgroup = boost::make_shared<WorkspaceGroup>();
 
   for (auto &workspace : workspaces) {
     wsgroup->addWorkspace(workspace);
diff --git a/Framework/Algorithms/src/ConjoinWorkspaces.cpp b/Framework/Algorithms/src/ConjoinWorkspaces.cpp
index 6c9534667016d823b41472bd3e0286bf5c575e80..8946cc0f06192c9d52ef7f3bcb1761cee4d237a0 100644
--- a/Framework/Algorithms/src/ConjoinWorkspaces.cpp
+++ b/Framework/Algorithms/src/ConjoinWorkspaces.cpp
@@ -123,10 +123,9 @@ void ConjoinWorkspaces::checkForOverlap(API::MatrixWorkspace_const_sptr ws1,
     const ISpectrum *spec = ws1->getSpectrum(i);
     const specid_t spectrum = spec->getSpectrumNo();
     spectra.insert(spectrum);
-    const std::set<detid_t> &dets = spec->getDetectorIDs();
-    std::set<detid_t>::const_iterator it;
-    for (it = dets.begin(); it != dets.end(); ++it) {
-      detectors.insert(*it);
+    const auto &dets = spec->getDetectorIDs();
+    for (auto const &det : dets) {
+      detectors.insert(det);
     }
   }
 
@@ -145,11 +144,10 @@ void ConjoinWorkspaces::checkForOverlap(API::MatrixWorkspace_const_sptr ws1,
             "The input workspaces have overlapping spectrum numbers");
       }
     }
-    const std::set<detid_t> &dets = spec->getDetectorIDs();
-    std::set<detid_t>::const_iterator it;
-    for (it = dets.begin(); it != dets.end(); ++it) {
-      if (detectors.find(*it) != detectors.end()) {
-        g_log.error() << "The input workspaces have common detectors: " << (*it)
+    const auto &dets = spec->getDetectorIDs();
+    for (const auto &det : dets) {
+      if (detectors.find(det) != detectors.end()) {
+        g_log.error() << "The input workspaces have common detectors: " << (det)
                       << "\n";
         throw std::invalid_argument(
             "The input workspaces have common detectors");
diff --git a/Framework/Algorithms/src/ConvertAxesToRealSpace.cpp b/Framework/Algorithms/src/ConvertAxesToRealSpace.cpp
index c54efb9abff30d0b0b7fe57e6f2e5df75e69efd5..b9d91b78c61ad582229c99720ab91304d0e85e4e 100644
--- a/Framework/Algorithms/src/ConvertAxesToRealSpace.cpp
+++ b/Framework/Algorithms/src/ConvertAxesToRealSpace.cpp
@@ -271,7 +271,7 @@ void ConvertAxesToRealSpace::exec() {
   for (int i = 0; i < nOutputHist; ++i) {
     MantidVec &errorVec = outputWs->dataE(i);
     std::transform(errorVec.begin(), errorVec.end(), errorVec.begin(),
-                   (double (*)(double))sqrt);
+                   static_cast<double (*)(double)>(sqrt));
     progress.report("Completing Error Calculation");
   }
 
diff --git a/Framework/Algorithms/src/ConvertEmptyToTof.cpp b/Framework/Algorithms/src/ConvertEmptyToTof.cpp
index 8fba84db5e460c7c21d38379a07a7a089d532249..dd86f371812a7e370f61bbe0f60338a23c974705 100644
--- a/Framework/Algorithms/src/ConvertEmptyToTof.cpp
+++ b/Framework/Algorithms/src/ConvertEmptyToTof.cpp
@@ -376,13 +376,7 @@ bool ConvertEmptyToTof::doFitGaussianPeak(int workspaceindex, double &center,
   center = gaussianpeak->centre();
   height = gaussianpeak->height();
   double fwhm = gaussianpeak->fwhm();
-  if (fwhm <= 0.0) {
-    return false;
-  }
-  //    sigma = fwhm*2;
-  //  sigma = fwhm/2.35;
-
-  return true;
+  return fwhm > 0.0;
 }
 
 /**
diff --git a/Framework/Algorithms/src/ConvertSpectrumAxis.cpp b/Framework/Algorithms/src/ConvertSpectrumAxis.cpp
index fac339636a818b894535c1d973b7040e5f6a9b70..a43827690a7d96f7583e4ce0100a1dd3efefb39a 100644
--- a/Framework/Algorithms/src/ConvertSpectrumAxis.cpp
+++ b/Framework/Algorithms/src/ConvertSpectrumAxis.cpp
@@ -68,8 +68,7 @@ void ConvertSpectrumAxis::exec() {
   MatrixWorkspace_const_sptr inputWS = getProperty("InputWorkspace");
   std::string unitTarget = getProperty("Target");
   // Loop over the original spectrum axis, finding the theta (n.b. not 2theta!)
-  // for each spectrum
-  // and storing it's corresponding workspace index
+  // for each spectrum and storing it's corresponding workspace index
   // Map will be sorted on theta, so resulting axis will be ordered as well
   std::multimap<double, size_t> indexMap;
   const size_t nHist = inputWS->getNumberHistograms();
diff --git a/Framework/Algorithms/src/ConvertUnits.cpp b/Framework/Algorithms/src/ConvertUnits.cpp
index e73d321bb8bacd8f1a6fc5c3416d4f2fe1f24f8d..255f62cd2772bfac1230c5ed1141db20896b2cd2 100644
--- a/Framework/Algorithms/src/ConvertUnits.cpp
+++ b/Framework/Algorithms/src/ConvertUnits.cpp
@@ -213,18 +213,7 @@ API::MatrixWorkspace_sptr ConvertUnits::setupOutputWorkspace(
   // the output
   if (outputWS != inputWS) {
     if (m_inputEvents) {
-      // Need to create by name as WorkspaceFactory otherwise spits out
-      // Workspace2D when EventWS passed in
-      outputWS = WorkspaceFactory::Instance().create(
-          "EventWorkspace", inputWS->getNumberHistograms(), 2, 1);
-      // Copy geometry etc. over
-      WorkspaceFactory::Instance().initializeFromParent(inputWS, outputWS,
-                                                        false);
-      // Need to copy over the data as well
-      EventWorkspace_const_sptr inputEventWS =
-          boost::dynamic_pointer_cast<const EventWorkspace>(inputWS);
-      boost::dynamic_pointer_cast<EventWorkspace>(outputWS)
-          ->copyDataFrom(*inputEventWS);
+      outputWS = MatrixWorkspace_sptr(inputWS->clone().release());
     } else {
       // Create the output workspace
       outputWS = WorkspaceFactory::Instance().create(inputWS);
diff --git a/Framework/Algorithms/src/ConvertUnitsUsingDetectorTable.cpp b/Framework/Algorithms/src/ConvertUnitsUsingDetectorTable.cpp
index 3149fcbb96776a5d48fe1e069eb727c8b2451909..b636d24ed12d4f3ef737b689c5c4358ffca5a17d 100644
--- a/Framework/Algorithms/src/ConvertUnitsUsingDetectorTable.cpp
+++ b/Framework/Algorithms/src/ConvertUnitsUsingDetectorTable.cpp
@@ -227,18 +227,7 @@ API::MatrixWorkspace_sptr ConvertUnitsUsingDetectorTable::setupOutputWorkspace(
   // the output
   if (outputWS != inputWS) {
     if (m_inputEvents) {
-      // Need to create by name as WorkspaceFactory otherwise spits out
-      // Workspace2D when EventWS passed in
-      outputWS = WorkspaceFactory::Instance().create(
-          "EventWorkspace", inputWS->getNumberHistograms(), 2, 1);
-      // Copy geometry etc. over
-      WorkspaceFactory::Instance().initializeFromParent(inputWS, outputWS,
-                                                        false);
-      // Need to copy over the data as well
-      EventWorkspace_const_sptr inputEventWS =
-          boost::dynamic_pointer_cast<const EventWorkspace>(inputWS);
-      boost::dynamic_pointer_cast<EventWorkspace>(outputWS)
-          ->copyDataFrom(*inputEventWS);
+      outputWS = MatrixWorkspace_sptr(inputWS->clone().release());
     } else {
       // Create the output workspace
       outputWS = WorkspaceFactory::Instance().create(inputWS);
diff --git a/Framework/Algorithms/src/CorelliCrossCorrelate.cpp b/Framework/Algorithms/src/CorelliCrossCorrelate.cpp
index 2c46ca188cf557e1e25e6752c849a13e8a6393a5..13b809cc1396708d9d9bfe4774d80e98146892f9 100644
--- a/Framework/Algorithms/src/CorelliCrossCorrelate.cpp
+++ b/Framework/Algorithms/src/CorelliCrossCorrelate.cpp
@@ -111,15 +111,7 @@ void CorelliCrossCorrelate::exec() {
   outputWS = getProperty("OutputWorkspace");
 
   if (outputWS != inputWS) {
-    // Make a brand new EventWorkspace
-    outputWS = boost::dynamic_pointer_cast<EventWorkspace>(
-        API::WorkspaceFactory::Instance().create(
-            "EventWorkspace", inputWS->getNumberHistograms(), 2, 1));
-    // Copy geometry over.
-    API::WorkspaceFactory::Instance().initializeFromParent(inputWS, outputWS,
-                                                           false);
-    // You need to copy over the data as well.
-    outputWS->copyDataFrom((*inputWS));
+    outputWS = EventWorkspace_sptr(inputWS->clone().release());
   }
 
   // Read in chopper sequence from IDF.
diff --git a/Framework/Algorithms/src/CorrectKiKf.cpp b/Framework/Algorithms/src/CorrectKiKf.cpp
index 18bfdac13e5f1c1cca85614ad5de10ba46ea1afd..fac31662063b6f5020d837a4260a71e124869c8a 100644
--- a/Framework/Algorithms/src/CorrectKiKf.cpp
+++ b/Framework/Algorithms/src/CorrectKiKf.cpp
@@ -56,14 +56,8 @@ void CorrectKiKf::init() {
 
 void CorrectKiKf::exec() {
   // Get the workspaces
-  this->inputWS = this->getProperty("InputWorkspace");
-  this->outputWS = this->getProperty("OutputWorkspace");
-
-  // If input and output workspaces are not the same, create a new workspace for
-  // the output
-  if (this->outputWS != this->inputWS) {
-    this->outputWS = API::WorkspaceFactory::Instance().create(this->inputWS);
-  }
+  MatrixWorkspace_const_sptr inputWS = this->getProperty("InputWorkspace");
+  MatrixWorkspace_sptr outputWS = this->getProperty("OutputWorkspace");
 
   // Check if it is an event workspace
   EventWorkspace_const_sptr eventW =
@@ -73,11 +67,17 @@ void CorrectKiKf::exec() {
     return;
   }
 
-  const size_t size = this->inputWS->blocksize();
+  // If input and output workspaces are not the same, create a new workspace for
+  // the output
+  if (outputWS != inputWS) {
+    outputWS = API::WorkspaceFactory::Instance().create(inputWS);
+  }
+
+  const size_t size = inputWS->blocksize();
   // Calculate the number of spectra in this workspace
-  const int numberOfSpectra = static_cast<int>(this->inputWS->size() / size);
+  const int numberOfSpectra = static_cast<int>(inputWS->size() / size);
   API::Progress prog(this, 0.0, 1.0, numberOfSpectra);
-  const bool histogram = this->inputWS->isHistogramData();
+  const bool histogram = inputWS->isHistogramData();
   bool negativeEnergyWarning = false;
 
   const std::string emodeStr = getProperty("EMode");
@@ -86,8 +86,8 @@ void CorrectKiKf::exec() {
   if (efixedProp == EMPTY_DBL()) {
     if (emodeStr == "Direct") {
       // Check if it has been store on the run object for this workspace
-      if (this->inputWS->run().hasProperty("Ei")) {
-        Kernel::Property *eiprop = this->inputWS->run().getProperty("Ei");
+      if (inputWS->run().hasProperty("Ei")) {
+        Kernel::Property *eiprop = inputWS->run().getProperty("Ei");
         efixedProp = boost::lexical_cast<double>(eiprop->value());
         g_log.debug() << "Using stored Ei value " << efixedProp << "\n";
       } else {
@@ -181,7 +181,7 @@ void CorrectKiKf::exec() {
                         << std::endl;
   if ((negativeEnergyWarning) && (efixedProp == EMPTY_DBL()))
     g_log.information() << "Try to set fixed energy" << std::endl;
-  this->setProperty("OutputWorkspace", this->outputWS);
+  this->setProperty("OutputWorkspace", outputWS);
   return;
 }
 
@@ -194,31 +194,17 @@ void CorrectKiKf::execEvent() {
   g_log.information("Processing event workspace");
 
   const MatrixWorkspace_const_sptr matrixInputWS =
-      this->getProperty("InputWorkspace");
-  EventWorkspace_const_sptr inputWS =
+      getProperty("InputWorkspace");
+  auto inputWS =
       boost::dynamic_pointer_cast<const EventWorkspace>(matrixInputWS);
 
   // generate the output workspace pointer
-  API::MatrixWorkspace_sptr matrixOutputWS =
-      this->getProperty("OutputWorkspace");
-  EventWorkspace_sptr outputWS;
-  if (matrixOutputWS == matrixInputWS)
-    outputWS = boost::dynamic_pointer_cast<EventWorkspace>(matrixOutputWS);
-  else {
-    // Make a brand new EventWorkspace
-    outputWS = boost::dynamic_pointer_cast<EventWorkspace>(
-        API::WorkspaceFactory::Instance().create(
-            "EventWorkspace", inputWS->getNumberHistograms(), 2, 1));
-    // Copy geometry over.
-    API::WorkspaceFactory::Instance().initializeFromParent(inputWS, outputWS,
-                                                           false);
-    // You need to copy over the data as well.
-    outputWS->copyDataFrom((*inputWS));
-
-    // Cast to the matrixOutputWS and save it
-    matrixOutputWS = boost::dynamic_pointer_cast<MatrixWorkspace>(outputWS);
-    this->setProperty("OutputWorkspace", matrixOutputWS);
+  API::MatrixWorkspace_sptr matrixOutputWS = getProperty("OutputWorkspace");
+  if (matrixOutputWS != matrixInputWS) {
+    matrixOutputWS = MatrixWorkspace_sptr(matrixInputWS->clone().release());
+    setProperty("OutputWorkspace", matrixOutputWS);
   }
+  auto outputWS = boost::dynamic_pointer_cast<EventWorkspace>(matrixOutputWS);
 
   const std::string emodeStr = getProperty("EMode");
   double efixedProp = getProperty("EFixed"), efixed;
@@ -226,8 +212,8 @@ void CorrectKiKf::execEvent() {
   if (efixedProp == EMPTY_DBL()) {
     if (emodeStr == "Direct") {
       // Check if it has been store on the run object for this workspace
-      if (this->inputWS->run().hasProperty("Ei")) {
-        Kernel::Property *eiprop = this->inputWS->run().getProperty("Ei");
+      if (inputWS->run().hasProperty("Ei")) {
+        Kernel::Property *eiprop = inputWS->run().getProperty("Ei");
         efixedProp = boost::lexical_cast<double>(eiprop->value());
         g_log.debug() << "Using stored Ei value " << efixedProp << "\n";
       } else {
diff --git a/Framework/Algorithms/src/CreateGroupingWorkspace.cpp b/Framework/Algorithms/src/CreateGroupingWorkspace.cpp
index e731536b5ae9c18ac728a6f7cfc903731ec371ae..52b8975ca5c5b80ecfbb5f110144c6dc9bdb19e6 100644
--- a/Framework/Algorithms/src/CreateGroupingWorkspace.cpp
+++ b/Framework/Algorithms/src/CreateGroupingWorkspace.cpp
@@ -122,16 +122,16 @@ void CreateGroupingWorkspace::init() {
 /** Read old-style .cal file to get the grouping
  *
  * @param groupingFileName :: path to .cal multi-col ascii
- * @param detIDtoGroup :: map of key=detectorID, value=group number.
  * @param prog :: progress reporter
+ * @returns :: map of key=detectorID, value=group number.
  */
-void readGroupingFile(const std::string &groupingFileName,
-                      std::map<detid_t, int> &detIDtoGroup, Progress &prog) {
+std::map<detid_t, int> readGroupingFile(const std::string &groupingFileName,
+                                        Progress &prog) {
   std::ifstream grFile(groupingFileName.c_str());
   if (!grFile.is_open()) {
     throw Exception::FileError("Error reading .cal file", groupingFileName);
   }
-  detIDtoGroup.clear();
+  std::map<detid_t, int> detIDtoGroup;
   std::string str;
   while (getline(grFile, str)) {
     // Comment
@@ -147,7 +147,7 @@ void readGroupingFile(const std::string &groupingFileName,
     prog.report();
   }
   grFile.close();
-  return;
+  return detIDtoGroup;
 }
 
 /** Creates a mapping based on a fixed number of groups for a given instrument
@@ -156,13 +156,15 @@ void readGroupingFile(const std::string &groupingFileName,
  * @param compName Name of component in instrument
  * @param numGroups Number of groups to group detectors into
  * @param inst Pointer to instrument
- * @param detIDtoGroup Map of detector IDs to group number
  * @param prog Progress reporter
+ * @returns :: Map of detector IDs to group number
  */
-void makeGroupingByNumGroups(const std::string compName, int numGroups,
-                             Instrument_const_sptr inst,
-                             std::map<detid_t, int> &detIDtoGroup,
-                             Progress &prog) {
+std::map<detid_t, int> makeGroupingByNumGroups(const std::string compName,
+                                               int numGroups,
+                                               Instrument_const_sptr inst,
+                                               Progress &prog) {
+  std::map<detid_t, int> detIDtoGroup;
+
   // Get detectors for given instument component
   std::vector<IDetector_const_sptr> detectors;
   inst->getDetectorsInBank(detectors, compName);
@@ -187,6 +189,7 @@ void makeGroupingByNumGroups(const std::string compName, int numGroups,
 
     prog.report();
   }
+  return detIDtoGroup;
 }
 
 //------------------------------------------------------------------------------------------------
@@ -220,13 +223,16 @@ bool groupnumber(std::string groupi, std::string groupj) {
  *
  * @param GroupNames :: comma-sep list of bank names
  * @param inst :: instrument
- * @param detIDtoGroup :: output: map of detID: to group number
  * @param prog :: progress report
  * @param sortnames :: sort names - a boolean
+ * @returns:: map of detID to group number
  */
-void makeGroupingByNames(std::string GroupNames, Instrument_const_sptr inst,
-                         std::map<detid_t, int> &detIDtoGroup, Progress &prog,
-                         bool sortnames) {
+std::map<detid_t, int> makeGroupingByNames(std::string GroupNames,
+                                           Instrument_const_sptr inst,
+                                           Progress &prog, bool sortnames) {
+  // This will contain the grouping
+  std::map<detid_t, int> detIDtoGroup;
+
   // Split the names of the group and insert in a vector
   std::vector<std::string> vgroups;
   boost::split(vgroups, GroupNames,
@@ -300,9 +306,8 @@ void makeGroupingByNames(std::string GroupNames, Instrument_const_sptr inst,
       }
       prog.report();
     }
-
-    return;
   }
+  return detIDtoGroup;
 }
 
 //----------------------------------------------------------------------------------------------
@@ -349,7 +354,7 @@ void CreateGroupingWorkspace::exec() {
     inst = inWS->getInstrument();
   } else {
     Algorithm_sptr childAlg = createChildAlgorithm("LoadInstrument", 0.0, 0.2);
-    MatrixWorkspace_sptr tempWS(new Workspace2D());
+    MatrixWorkspace_sptr tempWS = boost::make_shared<Workspace2D>();
     childAlg->setProperty<MatrixWorkspace_sptr>("Workspace", tempWS);
     childAlg->setPropertyValue("Filename", InstrumentFilename);
     childAlg->setProperty("RewriteSpectraMap",
@@ -388,20 +393,21 @@ void CreateGroupingWorkspace::exec() {
   }
 
   // --------------------------- Create the output --------------------------
-  GroupingWorkspace_sptr outWS(new GroupingWorkspace(inst));
+  auto outWS = boost::make_shared<GroupingWorkspace>(inst);
   this->setProperty("OutputWorkspace", outWS);
 
   // This will get the grouping
   std::map<detid_t, int> detIDtoGroup;
 
   Progress prog(this, 0.2, 1.0, outWS->getNumberHistograms());
-  // Make the grouping one of two ways:
+  // Make the grouping one of three ways:
   if (!GroupNames.empty())
-    makeGroupingByNames(GroupNames, inst, detIDtoGroup, prog, sortnames);
+    detIDtoGroup = makeGroupingByNames(GroupNames, inst, prog, sortnames);
   else if (!OldCalFilename.empty())
-    readGroupingFile(OldCalFilename, detIDtoGroup, prog);
+    detIDtoGroup = readGroupingFile(OldCalFilename, prog);
   else if ((numGroups > 0) && !componentName.empty())
-    makeGroupingByNumGroups(componentName, numGroups, inst, detIDtoGroup, prog);
+    detIDtoGroup =
+        makeGroupingByNumGroups(componentName, numGroups, inst, prog);
 
   g_log.information() << detIDtoGroup.size()
                       << " entries in the detectorID-to-group map.\n";
@@ -417,7 +423,7 @@ void CreateGroupingWorkspace::exec() {
     // Make the groups, if any
     std::map<detid_t, int>::const_iterator it_end = detIDtoGroup.end();
     std::map<detid_t, int>::const_iterator it;
-    std::set<int> groupCount;
+    std::unordered_set<int> groupCount;
     for (it = detIDtoGroup.begin(); it != it_end; ++it) {
       int detID = it->first;
       int group = it->second;
diff --git a/Framework/Algorithms/src/CreateLogTimeCorrection.cpp b/Framework/Algorithms/src/CreateLogTimeCorrection.cpp
index 75833eafb6e7fdc485fd18a49f899c50e4152e99..59c9dcb1b01f031eaf39fedbcf6b772b1382d92b 100644
--- a/Framework/Algorithms/src/CreateLogTimeCorrection.cpp
+++ b/Framework/Algorithms/src/CreateLogTimeCorrection.cpp
@@ -144,7 +144,7 @@ void CreateLogTimeCorrection::calculateCorrection() {
 /** Write L2 map and correction map to a TableWorkspace
   */
 TableWorkspace_sptr CreateLogTimeCorrection::generateCorrectionTable() {
-  TableWorkspace_sptr tablews(new TableWorkspace());
+  auto tablews = boost::make_shared<TableWorkspace>();
 
   tablews->addColumn("int", "DetectorID");
   tablews->addColumn("double", "Correction");
diff --git a/Framework/Algorithms/src/CreatePeaksWorkspace.cpp b/Framework/Algorithms/src/CreatePeaksWorkspace.cpp
index 24898139121212d034182de18e9c556f6672eabe..e890daefffa7d74cddf64c02e2809dd01fc41f79 100644
--- a/Framework/Algorithms/src/CreatePeaksWorkspace.cpp
+++ b/Framework/Algorithms/src/CreatePeaksWorkspace.cpp
@@ -47,7 +47,7 @@ void CreatePeaksWorkspace::init() {
 void CreatePeaksWorkspace::exec() {
   MatrixWorkspace_sptr instWS = getProperty("InstrumentWorkspace");
 
-  PeaksWorkspace_sptr out(new PeaksWorkspace());
+  auto out = boost::make_shared<PeaksWorkspace>();
   setProperty("OutputWorkspace", out);
   int NumberOfPeaks = getProperty("NumberOfPeaks");
 
diff --git a/Framework/Algorithms/src/CreateSampleWorkspace.cpp b/Framework/Algorithms/src/CreateSampleWorkspace.cpp
index f0a3ee64fade59904e59673e86babb97bce4e9cb..da275efcbe2cbce35ee0b70fb7ab09505fac5f2d 100644
--- a/Framework/Algorithms/src/CreateSampleWorkspace.cpp
+++ b/Framework/Algorithms/src/CreateSampleWorkspace.cpp
@@ -306,7 +306,7 @@ MatrixWorkspace_sptr CreateSampleWorkspace::createHistogramWorkspace(
   std::transform(y.access().begin(), y.access().end(), e.access().begin(),
                  dblSqrt);
 
-  MatrixWorkspace_sptr retVal(new DataObjects::Workspace2D);
+  MatrixWorkspace_sptr retVal = boost::make_shared<DataObjects::Workspace2D>();
   retVal->initialize(numPixels, numBins + 1, numBins);
   retVal->setInstrument(inst);
 
@@ -331,7 +331,7 @@ EventWorkspace_sptr CreateSampleWorkspace::createEventWorkspace(
   // add one to the number of bins as this is histogram
   int numXBins = numBins + 1;
 
-  EventWorkspace_sptr retVal(new EventWorkspace);
+  auto retVal = boost::make_shared<EventWorkspace>();
   retVal->initialize(numPixels, 1, 1);
 
   retVal->setInstrument(inst);
diff --git a/Framework/Algorithms/src/CreateTransmissionWorkspace.cpp b/Framework/Algorithms/src/CreateTransmissionWorkspace.cpp
index b18f7639e859f4df8176c559a0cb48f08e565c60..a45f0d0fbfbb1c09f4857aee45e2baad13d382b8 100644
--- a/Framework/Algorithms/src/CreateTransmissionWorkspace.cpp
+++ b/Framework/Algorithms/src/CreateTransmissionWorkspace.cpp
@@ -3,8 +3,6 @@
 #include "MantidAPI/WorkspaceUnitValidator.h"
 #include "MantidKernel/EnabledWhenProperty.h"
 
-#include <boost/assign/list_of.hpp>
-
 using namespace Mantid::Kernel;
 using namespace Mantid::API;
 
@@ -225,9 +223,8 @@ MatrixWorkspace_sptr CreateTransmissionWorkspace::makeTransmissionCorrection(
     }
     if (stitchingStart.is_initialized() && stitchingEnd.is_initialized() &&
         stitchingDelta.is_initialized()) {
-      const std::vector<double> params =
-          boost::assign::list_of(stitchingStart.get())(stitchingDelta.get())(
-              stitchingEnd.get()).convert_to_container<std::vector<double>>();
+      const std::vector<double> params = {
+          stitchingStart.get(), stitchingDelta.get(), stitchingEnd.get()};
       stitch1DAlg->setProperty("Params", params);
     } else if (stitchingDelta.is_initialized()) {
       const double delta = stitchingDelta.get();
diff --git a/Framework/Algorithms/src/DetectorDiagnostic.cpp b/Framework/Algorithms/src/DetectorDiagnostic.cpp
index ea902236dd7c26dbb69776872182e4cb2e159789..33329f6e4cfdd48d3f138d1914f613cad93cbc0b 100644
--- a/Framework/Algorithms/src/DetectorDiagnostic.cpp
+++ b/Framework/Algorithms/src/DetectorDiagnostic.cpp
@@ -523,7 +523,7 @@ DataObjects::MaskWorkspace_sptr
 DetectorDiagnostic::generateEmptyMask(API::MatrixWorkspace_const_sptr inputWS) {
   // Create a new workspace for the results, copy from the input to ensure that
   // we copy over the instrument and current masking
-  DataObjects::MaskWorkspace_sptr maskWS(new DataObjects::MaskWorkspace());
+  auto maskWS = boost::make_shared<DataObjects::MaskWorkspace>();
   maskWS->initialize(inputWS->getNumberHistograms(), 1, 1);
   WorkspaceFactory::Instance().initializeFromParent(inputWS, maskWS, false);
   maskWS->setTitle(inputWS->getTitle());
diff --git a/Framework/Algorithms/src/DiffractionFocussing.cpp b/Framework/Algorithms/src/DiffractionFocussing.cpp
index b93b2e732c2c3b2eaa4cbfea9b6199dd39f696ee..a90ae7b0ee9dd65117f96ca16820559aeb83decd 100644
--- a/Framework/Algorithms/src/DiffractionFocussing.cpp
+++ b/Framework/Algorithms/src/DiffractionFocussing.cpp
@@ -62,10 +62,7 @@ void DiffractionFocussing::exec() {
   bool dist = inputW->isDistribution();
 
   // do this first to check that a valid file is available before doing any work
-  std::multimap<int64_t, int64_t> detectorGroups; // <group, UDET>
-  if (!readGroupingFile(groupingFileName, detectorGroups)) {
-    throw Exception::FileError("Error reading .cal file", groupingFileName);
-  }
+  auto detectorGroups = readGroupingFile(groupingFileName); // <group, UDET>
 
   // Convert to d-spacing units
   API::MatrixWorkspace_sptr tmpW = convertUnitsToDSpacing(inputW);
@@ -241,18 +238,22 @@ void DiffractionFocussing::calculateRebinParams(
   step = (log(max) - log(min)) / n;
 }
 
-/// Reads in the file with the grouping information
-bool DiffractionFocussing::readGroupingFile(
-    std::string groupingFileName,
-    std::multimap<int64_t, int64_t> &detectorGroups) {
+/**
+ * Reads in the file with the grouping information
+ * @param groupingFileName :: [input] Grouping .cal file name
+ * @returns :: map of groups to detector IDs
+ * @throws FileError if can't read the file
+ */
+std::multimap<int64_t, int64_t>
+DiffractionFocussing::readGroupingFile(std::string groupingFileName) {
   std::ifstream grFile(groupingFileName.c_str());
   if (!grFile) {
     g_log.error() << "Unable to open grouping file " << groupingFileName
                   << std::endl;
-    return false;
+    throw Exception::FileError("Error reading .cal file", groupingFileName);
   }
 
-  detectorGroups.clear();
+  std::multimap<int64_t, int64_t> detectorGroups;
   std::string str;
   while (getline(grFile, str)) {
     if (str.empty() || str[0] == '#')
@@ -268,7 +269,7 @@ bool DiffractionFocussing::readGroupingFile(
       detectorGroups.emplace(group, udet);
     }
   }
-  return true;
+  return detectorGroups;
 }
 
 } // namespace Algorithm
diff --git a/Framework/Algorithms/src/DiffractionFocussing2.cpp b/Framework/Algorithms/src/DiffractionFocussing2.cpp
index 62cc54b1ccc54f55bbda595577a02d5a62a5c75f..d518df3a577cb723757f713fa0606391bea9e06e 100644
--- a/Framework/Algorithms/src/DiffractionFocussing2.cpp
+++ b/Framework/Algorithms/src/DiffractionFocussing2.cpp
@@ -301,7 +301,7 @@ void DiffractionFocussing2::exec() {
 
     // Take the square root of the errors
     std::transform(Eout.begin(), Eout.end(), Eout.begin(),
-                   static_cast<double (*)(double)>(std::sqrt));
+                   static_cast<double (*)(double)>(sqrt));
 
     // Multiply the data and errors by the bin widths because the rebin
     // function, when used
diff --git a/Framework/Algorithms/src/EditInstrumentGeometry.cpp b/Framework/Algorithms/src/EditInstrumentGeometry.cpp
index e9d404988113a6a5b5821b17888bdd0ac86a1d90..fef7776d1e377956f90a0a340c405f1bb8265959 100644
--- a/Framework/Algorithms/src/EditInstrumentGeometry.cpp
+++ b/Framework/Algorithms/src/EditInstrumentGeometry.cpp
@@ -289,7 +289,7 @@ void EditInstrumentGeometry::exec() {
   }
 
   // Create a new instrument from scratch any way.
-  Geometry::Instrument_sptr instrument(new Geometry::Instrument(name));
+  auto instrument = boost::make_shared<Geometry::Instrument>(name);
   if (!bool(instrument)) {
     stringstream errss;
     errss << "Trying to use a Parametrized Instrument as an Instrument.";
diff --git a/Framework/Algorithms/src/ExtractMaskToTable.cpp b/Framework/Algorithms/src/ExtractMaskToTable.cpp
index ced6896f5be65b709e92f5577f5877ea9abcb22e..67c9c6fff7f29746295351068733c98de5fce14b 100644
--- a/Framework/Algorithms/src/ExtractMaskToTable.cpp
+++ b/Framework/Algorithms/src/ExtractMaskToTable.cpp
@@ -81,7 +81,7 @@ void ExtractMaskToTable::exec() {
         "XMin or XMax cannot be empty.  XMin must be less than XMax.");
 
   // Create and set up output workspace
-  TableWorkspace_sptr outws(new TableWorkspace());
+  auto outws = boost::make_shared<TableWorkspace>();
   outws->addColumn("double", "XMin");
   outws->addColumn("double", "XMax");
   outws->addColumn("str", "DetectorIDsList");
@@ -91,7 +91,7 @@ void ExtractMaskToTable::exec() {
   vector<detid_t> prevmaskeddetids;
   if (m_inputTableWS) {
     g_log.notice("Parse input masking table workspace.");
-    parseMaskTable(m_inputTableWS, prevmaskeddetids);
+    prevmaskeddetids = parseMaskTable(m_inputTableWS);
   } else {
     g_log.notice("No input workspace to parse.");
   }
@@ -126,19 +126,18 @@ void ExtractMaskToTable::exec() {
 /** Parse input TableWorkspace to get a list of detectors IDs of which detector
  * are already masked
   * @param masktablews :: TableWorkspace containing masking information
-  * @param maskeddetectorids :: (output) vector of detector IDs that are masked
+  * @returns :: vector of detector IDs that are masked
   */
-void ExtractMaskToTable::parseMaskTable(
-    DataObjects::TableWorkspace_sptr masktablews,
-    std::vector<detid_t> &maskeddetectorids) {
-  // Clear input
-  maskeddetectorids.clear();
+std::vector<detid_t> ExtractMaskToTable::parseMaskTable(
+    DataObjects::TableWorkspace_sptr masktablews) {
+  // Output vector
+  std::vector<detid_t> maskeddetectorids;
 
   // Check format of mask table workspace
   if (masktablews->columnCount() != 3) {
     g_log.error("Mask table workspace must have more than 3 columns.  First 3 "
                 "must be Xmin, Xmax and Spectrum List.");
-    return;
+    return maskeddetectorids;
   } else {
     vector<string> colnames = masktablews->getColumnNames();
     vector<string> chkcolumans(3);
@@ -152,7 +151,7 @@ void ExtractMaskToTable::parseMaskTable(
                       << ", while it should be " << chkcolumans[i]
                       << ". MaskWorkspace is invalid"
                       << " and thus not used.\n";
-        return;
+        return maskeddetectorids;
       }
     }
   }
@@ -165,24 +164,23 @@ void ExtractMaskToTable::parseMaskTable(
     TableRow tmprow = masktablews->getRow(i);
     tmprow >> xmin >> xmax >> specliststr;
 
-    vector<detid_t> tmpdetidvec;
-    parseStringToVector(specliststr, tmpdetidvec);
+    vector<detid_t> tmpdetidvec = parseStringToVector(specliststr);
     maskeddetectorids.insert(maskeddetectorids.end(), tmpdetidvec.begin(),
                              tmpdetidvec.end());
   }
 
-  return;
+  return maskeddetectorids;
 }
 
 //----------------------------------------------------------------------------------------------
 /** Parse a string containing list in format (x, xx-yy, x, x, ...) to a vector
  * of detid_t
   * @param liststr :: string containing list to parse
-  * @param detidvec :: vector genrated from input string containing the list
+  * @returns :: vector genrated from input string containing the list
   */
-void ExtractMaskToTable::parseStringToVector(std::string liststr,
-                                             vector<detid_t> &detidvec) {
-  detidvec.clear();
+std::vector<detid_t>
+ExtractMaskToTable::parseStringToVector(std::string liststr) {
+  std::vector<detid_t> detidvec;
 
   // Use ArrayProperty to parse the list
   ArrayProperty<int> detlist("i", liststr);
@@ -204,7 +202,7 @@ void ExtractMaskToTable::parseStringToVector(std::string liststr,
     g_log.debug() << "[DB] Add detector ID: " << tmpid << ".\n";
   }
 
-  return;
+  return detidvec;
 }
 
 //----------------------------------------------------------------------------------------------
diff --git a/Framework/Algorithms/src/ExtractSpectra.cpp b/Framework/Algorithms/src/ExtractSpectra.cpp
index acca97476d5c928f1d18e2898c7bbb9dc88d5a53..f3b62474a3693032f100e17fa52acdac41a08d0d 100644
--- a/Framework/Algorithms/src/ExtractSpectra.cpp
+++ b/Framework/Algorithms/src/ExtractSpectra.cpp
@@ -421,8 +421,8 @@ void ExtractSpectra::checkProperties() {
   // 3. Start and stop index
   std::vector<detid_t> detectorList = getProperty("DetectorList");
   if (!detectorList.empty()) {
-    m_inputWorkspace->getIndicesFromDetectorIDs(detectorList,
-                                                m_workspaceIndexList);
+    m_workspaceIndexList =
+        m_inputWorkspace->getIndicesFromDetectorIDs(detectorList);
   } else {
     m_workspaceIndexList = getProperty("WorkspaceIndexList");
 
diff --git a/Framework/Algorithms/src/FFT.cpp b/Framework/Algorithms/src/FFT.cpp
index 6a1524bbfc697451161f9a5ac3f7579b9d12e513..fec0ae8092ddf37471e0bc54d0fbac96955913b5 100644
--- a/Framework/Algorithms/src/FFT.cpp
+++ b/Framework/Algorithms/src/FFT.cpp
@@ -60,13 +60,16 @@ void FFT::init() {
                   "Direction of the transform: forward or backward");
   declareProperty("Shift", 0.0, "Apply an extra phase equal to this quantity "
                                 "times 2*pi to the transform");
+  declareProperty(
+      "AcceptXRoundingErrors", false,
+      "Continue to process the data even if X values are not evenly spaced",
+      Direction::Input);
 }
 
 /** Executes the algorithm
  *
- *  @throw std::invalid_argument if the input properties are invalid
-                                 or the bins of the spectrum being transformed
- do not have constant width
+ *  The bins of the spectrum being transformed must have constant width
+ *  (unless AcceptXRoundingErrors is set to true)
  */
 void FFT::exec() {
   MatrixWorkspace_const_sptr inWS = getProperty("InputWorkspace");
@@ -82,34 +85,6 @@ void FFT::exec() {
   const int ySize = static_cast<int>(inWS->blocksize());
   const int xSize = static_cast<int>(X.size());
 
-  int nHist = static_cast<int>(inWS->getNumberHistograms());
-  if (iReal >= nHist)
-    throw std::invalid_argument("Property Real is out of range");
-  if (isComplex) {
-    const int yImagSize = static_cast<int>(inImagWS->blocksize());
-    if (ySize != yImagSize)
-      throw std::length_error("Real and Imaginary sizes do not match");
-    nHist = static_cast<int>(inImagWS->getNumberHistograms());
-    if (iImag >= nHist)
-      throw std::invalid_argument("Property Imaginary is out of range");
-  }
-
-  // check that the workspace isn't empty
-  if (X.size() < 2) {
-    throw std::invalid_argument(
-        "Input workspace must have at least two values");
-  }
-
-  // Check that the x values are evenly spaced
-  const double dx = X[1] - X[0];
-  for (size_t i = 1; i < X.size() - 2; i++)
-    if (std::abs(dx - X[i + 1] + X[i]) / dx > 1e-7) {
-      g_log.error() << "dx=" << X[i + 1] - X[i] << ' ' << dx << ' ' << i
-                    << std::endl;
-      throw std::invalid_argument(
-          "X axis must be linear (all bins have same width)");
-    }
-
   gsl_fft_complex_wavetable *wavetable = gsl_fft_complex_wavetable_alloc(ySize);
   gsl_fft_complex_workspace *workspace = gsl_fft_complex_workspace_alloc(ySize);
 
@@ -128,6 +103,7 @@ void FFT::exec() {
   MatrixWorkspace_sptr outWS =
       WorkspaceFactory::Instance().create(inWS, nOut, xSize, ySize);
 
+  const double dx = X[1] - X[0];
   double df = 1.0 / (dx * ySize);
 
   // Output label
@@ -305,5 +281,109 @@ void FFT::exec() {
   setProperty("OutputWorkspace", outWS);
 }
 
+/**
+ * Perform validation of input properties:
+ * - input workspace must not be empty
+ * - X values must be evenly spaced (unless accepting rounding errors)
+ * - Real and Imaginary spectra must be in range of input workspace
+ * - If complex, real and imaginary workspaces must be the same size
+ * @returns :: map of property names to errors (empty map if no errors)
+ */
+std::map<std::string, std::string> FFT::validateInputs() {
+  std::map<std::string, std::string> errors;
+
+  MatrixWorkspace_const_sptr inWS = getProperty("InputWorkspace");
+  const int iReal = getProperty("Real");
+  const int iImag = getProperty("Imaginary");
+  const MantidVec &X = inWS->readX(iReal);
+
+  // check that the workspace isn't empty
+  if (X.size() < 2) {
+    errors["InputWorkspace"] = "Input workspace must have at least two values";
+  } else {
+    // Check that the x values are evenly spaced
+    // If accepting rounding errors, just give a warning if bins are different.
+    if (areBinWidthsUneven(X)) {
+      errors["InputWorkspace"] =
+          "X axis must be linear (all bins have same width)";
+    }
+  }
+
+  // check real, imaginary spectrum numbers and workspace sizes
+  int nHist = static_cast<int>(inWS->getNumberHistograms());
+  if (iReal >= nHist) {
+    errors["Real"] = "Real out of range";
+  }
+  if (iImag != EMPTY_INT()) {
+    MatrixWorkspace_const_sptr inImagWS = getProperty("InputImagWorkspace");
+    if (inImagWS) {
+      if (inWS->blocksize() != inImagWS->blocksize()) {
+        errors["Imaginary"] = "Real and Imaginary sizes do not match";
+      }
+      nHist = static_cast<int>(inImagWS->getNumberHistograms());
+    }
+    if (iImag >= nHist) {
+      errors["Imaginary"] = "Imaginary out of range";
+    }
+  }
+
+  return errors;
+}
+
+/**
+ * Test input X vector for spacing of values.
+ * In normal use, return true if not evenly spaced (error).
+ * If accepting rounding errors, threshold is more lenient, and don't return an
+ * error but just warn the user.
+ * @param xValues :: [input] Values to check
+ * @returns :: True if unevenly spaced, False if not (or accepting errors)
+ */
+bool FFT::areBinWidthsUneven(const MantidVec &xValues) const {
+  bool widthsUneven = false;
+  const bool acceptXRoundingErrors = getProperty("AcceptXRoundingErrors");
+  const double tolerance = acceptXRoundingErrors ? 0.5 : 1e-7;
+  const double warnValue = 0.1;
+
+  // Width to check against
+  const double dx = [&] {
+    if (acceptXRoundingErrors) {
+      // use average bin width
+      return (xValues[xValues.size() - 1] - xValues[0]) /
+             static_cast<double>(xValues.size() - 1);
+    } else {
+      // use first bin width
+      return xValues[1] - xValues[0];
+    }
+  }();
+
+  // Use cumulative errors if we are accepting rounding errors.
+  // Otherwise just compare each difference in turn to the tolerance.
+  auto difference = [&](size_t i) {
+    if (acceptXRoundingErrors) {
+      return std::abs((xValues[i] - xValues[0] - (double)i * dx) / dx);
+    } else {
+      return std::abs(dx - xValues[i + 1] + xValues[i]) / dx;
+    }
+  };
+
+  // Check each width against dx
+  for (size_t i = 1; i < xValues.size() - 2; i++) {
+    const double diff = difference(i);
+    if (diff > tolerance) {
+      // return an actual error
+      g_log.error() << "dx=" << xValues[i + 1] - xValues[i] << ' ' << dx << ' '
+                    << i << std::endl;
+      widthsUneven = true;
+      break;
+    } else if (acceptXRoundingErrors && diff > warnValue) {
+      // just warn the user
+      g_log.warning() << "Bin widths differ by more than " << warnValue * 100
+                      << "% of average." << std::endl;
+    }
+  }
+
+  return widthsUneven;
+}
+
 } // namespace Algorithm
 } // namespace Mantid
diff --git a/Framework/Algorithms/src/FilterByXValue.cpp b/Framework/Algorithms/src/FilterByXValue.cpp
index 33b9ff3080aca7bbd7a478bcba8b4b5e9ddda462..52c9bcbfcd1c7b41d72b61bafb3cd9b6df602cf5 100644
--- a/Framework/Algorithms/src/FilterByXValue.cpp
+++ b/Framework/Algorithms/src/FilterByXValue.cpp
@@ -79,22 +79,13 @@ void FilterByXValue::exec() {
 
   // Check if we're doing thing in-place.
   if (inputWS != outputWS) {
-    // Create a new output workspace if not doing things in place. Preserve
-    // event-ness.
-    outputWS = boost::dynamic_pointer_cast<EventWorkspace>(
-        WorkspaceFactory::Instance().create("EventWorkspace", numSpec,
-                                            inputWS->blocksize() +
-                                                inputWS->isHistogramData(),
-                                            inputWS->blocksize()));
-    WorkspaceFactory::Instance().initializeFromParent(inputWS, outputWS, false);
-    // Copy over the data.
     // TODO: Make this more efficient by only copying over the events that pass
     // the
     // filter rather than copying everything and then removing some. This should
     // entail new methods (e.g. iterators) on EventList as this algorithm
     // shouldn't
     // need to know about the type of the events (e.g. weighted).
-    outputWS->copyDataFrom(*inputWS);
+    outputWS = EventWorkspace_sptr(inputWS->clone().release());
     setProperty("OutputWorkspace", outputWS);
   }
 
diff --git a/Framework/Algorithms/src/FilterEvents.cpp b/Framework/Algorithms/src/FilterEvents.cpp
index 9f9b6b5ec4dd1b1487e171f18dd555aec3298b39..681835f6e1fe0e3088d953f5f9c52da080e7dfc1 100644
--- a/Framework/Algorithms/src/FilterEvents.cpp
+++ b/Framework/Algorithms/src/FilterEvents.cpp
@@ -520,16 +520,13 @@ void FilterEvents::createOutputWorkspaces() {
   }
 
   // Set up new workspaces
-  std::set<int>::iterator groupit;
   int numoutputws = 0;
   double numnewws = static_cast<double>(m_workGroupIndexes.size());
   double wsgindex = 0.;
 
-  for (groupit = m_workGroupIndexes.begin();
-       groupit != m_workGroupIndexes.end(); ++groupit) {
+  for (auto const wsgroup : m_workGroupIndexes) {
     // Generate new workspace name
     bool add2output = true;
-    int wsgroup = *groupit;
     std::stringstream wsname;
     if (wsgroup >= 0) {
       wsname << m_outputWSNameBase << "_" << (wsgroup + delta_wsindex);
@@ -776,8 +773,7 @@ void FilterEvents::setupCustomizedTOFCorrection() {
       // If there are more than 1 spectrum, it is very likely to have problem
       // with correction factor
       const DataObjects::EventList events = m_eventWS->getEventList(i);
-      std::set<detid_t> detids = events.getDetectorIDs();
-      std::set<detid_t>::iterator detit;
+      auto detids = events.getDetectorIDs();
       if (detids.size() != 1) {
         // Check whether there are more than 1 detector per spectra.
         stringstream errss;
@@ -788,7 +784,7 @@ void FilterEvents::setupCustomizedTOFCorrection() {
         throw runtime_error(errss.str());
       }
       detid_t detid = 0;
-      for (detit = detids.begin(); detit != detids.end(); ++detit)
+      for (auto detit = detids.begin(); detit != detids.end(); ++detit)
         detid = *detit;
       vecDetIDs[i] = detid;
     }
@@ -904,8 +900,7 @@ void FilterEvents::filterEventsBySplitters(double progressamount) {
     return;
   }
 
-  std::vector<std::string> lognames;
-  this->getTimeSeriesLogNames(lognames);
+  auto lognames = this->getTimeSeriesLogNames();
   g_log.debug() << "[FilterEvents D1214]:  Number of TimeSeries Logs = "
                 << lognames.size() << " to " << m_outputWS.size()
                 << " outptu workspaces. \n";
@@ -917,8 +912,7 @@ void FilterEvents::filterEventsBySplitters(double progressamount) {
     DataObjects::EventWorkspace_sptr opws = wsiter->second;
 
     // Generate a list of splitters for current output workspace
-    Kernel::TimeSplitterType splitters;
-    generateSplitters(wsindex, splitters);
+    Kernel::TimeSplitterType splitters = generateSplitters(wsindex);
 
     g_log.debug() << "[FilterEvents D1215]: Output workspace Index " << wsindex
                   << ": Name = " << opws->name()
@@ -1022,17 +1016,15 @@ void FilterEvents::filterEventsByVectorSplitters(double progressamount) {
 /** Generate splitters for specified workspace index as a subset of
  * m_splitters
  */
-void FilterEvents::generateSplitters(int wsindex,
-                                     Kernel::TimeSplitterType &splitters) {
-  splitters.clear();
+Kernel::TimeSplitterType FilterEvents::generateSplitters(int wsindex) {
+  Kernel::TimeSplitterType splitters;
   for (auto splitter : m_splitters) {
     int index = splitter.index();
     if (index == wsindex) {
       splitters.push_back(splitter);
     }
   }
-
-  return;
+  return splitters;
 }
 
 //----------------------------------------------------------------------------------------------
@@ -1065,9 +1057,10 @@ void FilterEvents::splitLog(EventWorkspace_sptr eventws, std::string logname,
 
 //----------------------------------------------------------------------------------------------
 /** Get all filterable logs' names
+ * @returns Vector of names of logs
  */
-void FilterEvents::getTimeSeriesLogNames(std::vector<std::string> &lognames) {
-  lognames.clear();
+std::vector<std::string> FilterEvents::getTimeSeriesLogNames() {
+  std::vector<std::string> lognames;
 
   const std::vector<Kernel::Property *> allprop =
       m_eventWS->mutableRun().getProperties();
@@ -1078,9 +1071,9 @@ void FilterEvents::getTimeSeriesLogNames(std::vector<std::string> &lognames) {
       std::string pname = timeprop->name();
       lognames.push_back(pname);
     }
-  } // FOR
+  }
 
-  return;
+  return lognames;
 }
 
 } // namespace Mantid
diff --git a/Framework/Algorithms/src/FindDeadDetectors.cpp b/Framework/Algorithms/src/FindDeadDetectors.cpp
index 5fb2ce0e2884ae50846e39c76a6d513c4f110fcf..ca3e4059fe225d0dc1ff4fdd66223e90e5d905c3 100644
--- a/Framework/Algorithms/src/FindDeadDetectors.cpp
+++ b/Framework/Algorithms/src/FindDeadDetectors.cpp
@@ -101,14 +101,13 @@ void FindDeadDetectors::exec() {
       // Write the spectrum number to file
       file << i << " " << specNo;
       // Get the list of detectors for this spectrum and iterate over
-      const std::set<detid_t> &dets = spec->getDetectorIDs();
-      std::set<detid_t>::const_iterator it;
-      for (it = dets.begin(); it != dets.end(); ++it) {
+      const auto &dets = spec->getDetectorIDs();
+      for (const auto &det : dets) {
         // Write the detector ID to file, log & the FoundDead output property
-        file << " " << *it;
+        file << " " << det;
         // we could write dead detectors to the log but if they are viewing the
         // log in the MantidPlot viewer it will crash MantidPlot
-        deadDets.push_back(*it);
+        deadDets.push_back(det);
         ++countDets;
       }
       file << std::endl;
diff --git a/Framework/Algorithms/src/FitPeak.cpp b/Framework/Algorithms/src/FitPeak.cpp
index 3d217dfb74a91f1d221636d66f0f944e95f0c449..09e8674ab79954fdc18f14909c2b4e7be157cf54 100644
--- a/Framework/Algorithms/src/FitPeak.cpp
+++ b/Framework/Algorithms/src/FitPeak.cpp
@@ -317,8 +317,8 @@ bool FitOneSinglePeak::simpleFit() {
   m_sstream << "One-Step-Fit Function: " << compfunc->asString() << "\n";
 
   // Store starting setup
-  push(m_peakFunc, m_bkupPeakFunc);
-  push(m_bkgdFunc, m_bkupBkgdFunc);
+  m_bkupPeakFunc = backup(m_peakFunc);
+  m_bkupBkgdFunc = backup(m_bkgdFunc);
 
   // Fit with different starting values of peak width
   size_t numfits = m_vecFWHM.size();
@@ -535,7 +535,7 @@ void FitOneSinglePeak::highBkgdFit() {
   m_peakFunc->setHeight(est_peakheight);
 
   // Store starting setup
-  push(m_peakFunc, m_bkupPeakFunc);
+  m_bkupPeakFunc = backup(m_peakFunc);
 
   Progress progress(this, 0, 1, m_vecFWHM.size());
 
@@ -580,12 +580,11 @@ void FitOneSinglePeak::highBkgdFit() {
 //----------------------------------------------------------------------------------------------
 /** Push/store a fit result (function) to storage
   * @param func :: function to get parameter values stored
-  * @param funcparammap :: map to store function parameter's names and value
+  * @returns :: map to store function parameter's names and value
   */
-void FitOneSinglePeak::push(IFunction_const_sptr func,
-                            std::map<std::string, double> &funcparammap) {
-  // Clear map
-  funcparammap.clear();
+std::map<std::string, double>
+FitOneSinglePeak::backup(IFunction_const_sptr func) {
+  std::map<std::string, double> funcparammap;
 
   // Set up
   vector<string> funcparnames = func->getParameterNames();
@@ -595,20 +594,19 @@ void FitOneSinglePeak::push(IFunction_const_sptr func,
     funcparammap.emplace(funcparnames[i], parvalue);
   }
 
-  return;
+  return funcparammap;
 }
 
 //----------------------------------------------------------------------------------------------
 /** Push/store function parameters' error resulted from fitting
   * @param func :: function to get parameter values stored
-  * @param paramerrormap :: map to store function parameter's names and fitting
+  * @returns :: map to store function parameter's names and fitting
  * error
   */
-void FitOneSinglePeak::storeFunctionError(
-    const IFunction_const_sptr &func,
-    std::map<std::string, double> &paramerrormap) {
-  // Clear output map
-  paramerrormap.clear();
+std::map<std::string, double>
+FitOneSinglePeak::storeFunctionError(const IFunction_const_sptr &func) {
+  // output map
+  std::map<std::string, double> paramerrormap;
 
   // Get function error and store in output map
   vector<string> funcparnames = func->getParameterNames();
@@ -618,7 +616,7 @@ void FitOneSinglePeak::storeFunctionError(
     paramerrormap.emplace(funcparnames[i], parerror);
   }
 
-  return;
+  return paramerrormap;
 }
 
 //----------------------------------------------------------------------------------------------
@@ -859,11 +857,10 @@ double FitOneSinglePeak::fitCompositeFunction(
   m_bestRwp = calChiSquareSD(compfunc, dataws, wsindex, startx, endx);
   m_sstream << "Peak+Background: Pre-fit Goodness = " << m_bestRwp << "\n";
 
-  map<string, double> bkuppeakmap, bkupbkgdmap;
-  push(peakfunc, bkuppeakmap);
-  push(bkgdfunc, bkupbkgdmap);
-  storeFunctionError(peakfunc, m_fitErrorPeakFunc);
-  storeFunctionError(bkgdfunc, m_fitErrorBkgdFunc);
+  auto bkuppeakmap = backup(peakfunc);
+  auto bkupbkgdmap = backup(bkgdfunc);
+  m_fitErrorPeakFunc = storeFunctionError(peakfunc);
+  m_fitErrorBkgdFunc = storeFunctionError(bkgdfunc);
 
   // Fit
   double goodness = fitFunctionSD(compfunc, dataws, wsindex, startx, endx);
@@ -944,7 +941,7 @@ double FitOneSinglePeak::checkFittedPeak(IPeakFunction_sptr peakfunc,
 API::IBackgroundFunction_sptr
 FitOneSinglePeak::fitBackground(API::IBackgroundFunction_sptr bkgdfunc) {
   // Back up background function
-  push(bkgdfunc, m_bkupBkgdFunc);
+  m_bkupBkgdFunc = backup(bkgdfunc);
 
   // Fit in multiple domain
   vector<double> vec_xmin(2);
@@ -959,8 +956,8 @@ FitOneSinglePeak::fitBackground(API::IBackgroundFunction_sptr bkgdfunc) {
   // Process fit result
   if (chi2 < DBL_MAX - 1) {
     // Store fitting result
-    push(bkgdfunc, m_bestBkgdFunc);
-    storeFunctionError(bkgdfunc, m_fitErrorBkgdFunc);
+    m_bestBkgdFunc = backup(bkgdfunc);
+    m_fitErrorBkgdFunc = storeFunctionError(bkgdfunc);
   } else {
     // Restore background function
     pop(m_bkupBkgdFunc, bkgdfunc);
@@ -1019,11 +1016,11 @@ void FitOneSinglePeak::processNStoreFitResult(double rwp, bool storebkgd) {
 
   // Store result if
   if (rwp < m_bestRwp && fitsuccess) {
-    push(m_peakFunc, m_bestPeakFunc);
-    storeFunctionError(m_peakFunc, m_fitErrorPeakFunc);
+    m_bestPeakFunc = backup(m_peakFunc);
+    m_fitErrorPeakFunc = storeFunctionError(m_peakFunc);
     if (storebkgd) {
-      push(m_bkgdFunc, m_bestBkgdFunc);
-      storeFunctionError(m_bkgdFunc, m_fitErrorBkgdFunc);
+      m_bestBkgdFunc = backup(m_bkgdFunc);
+      m_fitErrorBkgdFunc = storeFunctionError(m_bkgdFunc);
     }
     m_bestRwp = rwp;
 
@@ -1041,18 +1038,18 @@ void FitOneSinglePeak::processNStoreFitResult(double rwp, bool storebkgd) {
 double FitOneSinglePeak::getFitCostFunctionValue() { return m_bestRwp; }
 
 //----------------------------------------------------------------------------------------------
-/** Get the fitting error of both peak function and background function
-  */
-void FitOneSinglePeak::getFitError(
-    std::map<std::string, double> &peakerrormap,
-    std::map<std::string, double> &bkgderrormap) {
-  peakerrormap.clear();
-  bkgderrormap.clear();
-
-  peakerrormap.insert(m_fitErrorPeakFunc.begin(), m_fitErrorPeakFunc.end());
-  bkgderrormap.insert(m_fitErrorBkgdFunc.begin(), m_fitErrorBkgdFunc.end());
+/**
+ * Get the fitting error of the peak function
+ */
+std::map<std::string, double> FitOneSinglePeak::getPeakError() {
+  return m_fitErrorPeakFunc;
+}
 
-  return;
+/**
+ * Get the fitting error of the background function
+ */
+std::map<std::string, double> FitOneSinglePeak::getBackgroundError() {
+  return m_fitErrorBkgdFunc;
 }
 
 //----------------------------------------------------------------------------------------------
@@ -1252,11 +1249,8 @@ void FitPeak::exec() {
 
   m_finalGoodnessValue = fit1peakalg.getFitCostFunctionValue();
 
-  map<string, double> peakfuncfiterrormap, bkgdfuncfiterrormap;
-  fit1peakalg.getFitError(peakfuncfiterrormap, bkgdfuncfiterrormap);
-
   // Output
-  setupOutput(peakfuncfiterrormap, bkgdfuncfiterrormap);
+  setupOutput(fit1peakalg.getPeakError(), fit1peakalg.getBackgroundError());
 
   return;
 }
@@ -1608,30 +1602,6 @@ void FitPeak::setupOutput(
   return;
 }
 
-//----------------------------------------------------------------------------------------------
-/** Push/store a fit result
-  */
-void FitPeak::push(IFunction_const_sptr func,
-                   std::map<std::string, double> &funcparammap,
-                   std::map<std::string, double> &paramerrormap) {
-  // Clear map
-  funcparammap.clear();
-  paramerrormap.clear();
-
-  // Set up
-  vector<string> funcparnames = func->getParameterNames();
-  size_t nParam = funcparnames.size();
-  for (size_t i = 0; i < nParam; ++i) {
-    double parvalue = func->getParameter(i);
-    funcparammap.emplace(funcparnames[i], parvalue);
-
-    double parerror = func->getError(i);
-    paramerrormap.emplace(funcparnames[i], parerror);
-  }
-
-  return;
-}
-
 //----------------------------------------------------------------------------------------------
 /** Get an index of a value in a sorted vector.  The index should be the item
  * with value nearest to X
diff --git a/Framework/Algorithms/src/GeneratePeaks.cpp b/Framework/Algorithms/src/GeneratePeaks.cpp
index b5b4d043d5a755a0e9a92494bd049d8a05471aad..35b703449d07e243243f57b6559a9bc89b91adf5 100644
--- a/Framework/Algorithms/src/GeneratePeaks.cpp
+++ b/Framework/Algorithms/src/GeneratePeaks.cpp
@@ -647,9 +647,8 @@ void GeneratePeaks::getSpectraSet(
     g_log.debug(outss.str());
   }
 
-  std::set<specid_t>::iterator pit;
   specid_t icount = 0;
-  for (pit = m_spectraSet.begin(); pit != m_spectraSet.end(); ++pit) {
+  for (auto pit = m_spectraSet.begin(); pit != m_spectraSet.end(); ++pit) {
     m_SpectrumMap.emplace(*pit, icount);
     ++icount;
   }
@@ -720,10 +719,10 @@ API::MatrixWorkspace_sptr GeneratePeaks::createOutputWorkspace() {
         inputWS, inputWS->getNumberHistograms(), inputWS->dataX(0).size(),
         inputWS->dataY(0).size());
 
-    std::set<specid_t>::iterator siter;
     // Only copy the X-values from spectra with peaks specified in the table
     // workspace.
-    for (siter = m_spectraSet.begin(); siter != m_spectraSet.end(); ++siter) {
+    for (auto siter = m_spectraSet.begin(); siter != m_spectraSet.end();
+         ++siter) {
       specid_t iws = *siter;
       std::copy(inputWS->dataX(iws).begin(), inputWS->dataX(iws).end(),
                 outputWS->dataX(iws).begin());
diff --git a/Framework/Algorithms/src/GetDetOffsetsMultiPeaks.cpp b/Framework/Algorithms/src/GetDetOffsetsMultiPeaks.cpp
index 53c47f9faa680ec78992d39b4538ee7562da5f35..dc555af11fc784d9f2af5be79d50723bde8950a3 100644
--- a/Framework/Algorithms/src/GetDetOffsetsMultiPeaks.cpp
+++ b/Framework/Algorithms/src/GetDetOffsetsMultiPeaks.cpp
@@ -349,8 +349,8 @@ void GetDetOffsetsMultiPeaks::processProperties() {
   // Create output workspaces
   m_outputW = boost::make_shared<OffsetsWorkspace>(m_inputWS->getInstrument());
   m_outputNP = boost::make_shared<OffsetsWorkspace>(m_inputWS->getInstrument());
-  MatrixWorkspace_sptr tempmaskws(
-      new MaskWorkspace(m_inputWS->getInstrument()));
+  MatrixWorkspace_sptr tempmaskws =
+      boost::make_shared<MaskWorkspace>(m_inputWS->getInstrument());
   m_maskWS = tempmaskws;
 
   // Input resolution
diff --git a/Framework/Algorithms/src/GetDetectorOffsets.cpp b/Framework/Algorithms/src/GetDetectorOffsets.cpp
index 63657b4e09bb0a67d7de07027352ddbbb109f961..2261ed03e7e8eb6996d50c90c6ccfdb36fd30e78 100644
--- a/Framework/Algorithms/src/GetDetectorOffsets.cpp
+++ b/Framework/Algorithms/src/GetDetectorOffsets.cpp
@@ -110,9 +110,9 @@ void GetDetectorOffsets::exec() {
 
   int64_t nspec = inputW->getNumberHistograms();
   // Create the output OffsetsWorkspace
-  OffsetsWorkspace_sptr outputW(new OffsetsWorkspace(inputW->getInstrument()));
+  auto outputW = boost::make_shared<OffsetsWorkspace>(inputW->getInstrument());
   // Create the output MaskWorkspace
-  MaskWorkspace_sptr maskWS(new MaskWorkspace(inputW->getInstrument()));
+  auto maskWS = boost::make_shared<MaskWorkspace>(inputW->getInstrument());
   // To get the workspace index from the detector ID
   const detid2index_map pixel_to_wi =
       maskWS->getDetectorIDToWorkspaceIndexMap(true);
@@ -131,16 +131,15 @@ void GetDetectorOffsets::exec() {
     }
 
     // Get the list of detectors in this pixel
-    const std::set<detid_t> &dets = inputW->getSpectrum(wi)->getDetectorIDs();
+    const auto &dets = inputW->getSpectrum(wi)->getDetectorIDs();
 
     // Most of the exec time is in FitSpectra, so this critical block should not
     // be a problem.
     PARALLEL_CRITICAL(GetDetectorOffsets_setValue) {
       // Use the same offset for all detectors from this pixel
-      std::set<detid_t>::iterator it;
-      for (it = dets.begin(); it != dets.end(); ++it) {
-        outputW->setValue(*it, offset);
-        const auto mapEntry = pixel_to_wi.find(*it);
+      for (const auto &det : dets) {
+        outputW->setValue(det, offset);
+        const auto mapEntry = pixel_to_wi.find(det);
         if (mapEntry == pixel_to_wi.end())
           continue;
         const size_t workspaceIndex = mapEntry->second;
diff --git a/Framework/Algorithms/src/GetEi.cpp b/Framework/Algorithms/src/GetEi.cpp
index 5d4228fba482454a29f048efe62fcfff85453672..c778cf56927f586dbdfc22666b4fc3277adf4057 100644
--- a/Framework/Algorithms/src/GetEi.cpp
+++ b/Framework/Algorithms/src/GetEi.cpp
@@ -165,7 +165,7 @@ void GetEi::getGeometry(API::MatrixWorkspace_const_sptr WS, specid_t mon0Spec,
     g_log.error() << "Error retrieving data for the first monitor" << std::endl;
     throw std::bad_cast();
   }
-  const std::set<detid_t> &dets = WS->getSpectrum(monWI)->getDetectorIDs();
+  const auto &dets = WS->getSpectrum(monWI)->getDetectorIDs();
 
   if (dets.size() != 1) {
     g_log.error() << "The detector for spectrum number " << mon0Spec
@@ -187,7 +187,7 @@ void GetEi::getGeometry(API::MatrixWorkspace_const_sptr WS, specid_t mon0Spec,
     g_log.error() << "Error retrieving data for the second monitor\n";
     throw std::bad_cast();
   }
-  const std::set<detid_t> &dets2 = WS->getSpectrum(monWI)->getDetectorIDs();
+  const auto &dets2 = WS->getSpectrum(monWI)->getDetectorIDs();
   if (dets2.size() != 1) {
     g_log.error() << "The detector for spectrum number " << mon1Spec
                   << " was either not found or is a group, grouped monitors "
@@ -213,11 +213,10 @@ std::vector<size_t> GetEi::getMonitorSpecIndexs(
                                // hard because the map works the other way,
                                // getting index numbers from spectra numbers has
                                // the same problem and we are about to do both
-  std::vector<size_t> specInds;
 
   // get the index number of the histogram for the first monitor
   std::vector<specid_t> specNumTemp(&specNum1, &specNum1 + 1);
-  WS->getIndicesFromSpectra(specNumTemp, specInds);
+  auto specInds = WS->getIndicesFromSpectra(specNumTemp);
   if (specInds.size() != 1) { // the monitor spectrum isn't present in the
                               // workspace, we can't continue from here
     g_log.error() << "Couldn't find the first monitor spectrum, number "
@@ -226,9 +225,8 @@ std::vector<size_t> GetEi::getMonitorSpecIndexs(
   }
 
   // nowe the second monitor
-  std::vector<size_t> specIndexTemp;
   specNumTemp[0] = specNum2;
-  WS->getIndicesFromSpectra(specNumTemp, specIndexTemp);
+  auto specIndexTemp = WS->getIndicesFromSpectra(specNumTemp);
   if (specIndexTemp.size() != 1) { // the monitor spectrum isn't present in the
                                    // workspace, we can't continue from here
     g_log.error() << "Couldn't find the second monitor spectrum, number "
diff --git a/Framework/Algorithms/src/GetEi2.cpp b/Framework/Algorithms/src/GetEi2.cpp
index c258fe298816d508ecf3c500e67c7d6a06249478..e5e18e16f3df8b99687793186ecc889504429a40 100644
--- a/Framework/Algorithms/src/GetEi2.cpp
+++ b/Framework/Algorithms/src/GetEi2.cpp
@@ -203,10 +203,8 @@ double GetEi2::calculateEi(const double initial_guess) {
   // Covert spectrum numbers to workspace indices
   std::vector<specid_t> spec_nums(2, mon1);
   spec_nums[1] = mon2;
-  std::vector<size_t> mon_indices;
-  mon_indices.reserve(2);
   // get the index number of the histogram for the first monitor
-  m_input_ws->getIndicesFromSpectra(spec_nums, mon_indices);
+  auto mon_indices = m_input_ws->getIndicesFromSpectra(spec_nums);
 
   if (mon_indices.size() != 2) {
     g_log.error() << "Error retrieving monitor spectra from input workspace. "
diff --git a/Framework/Algorithms/src/GetTimeSeriesLogInformation.cpp b/Framework/Algorithms/src/GetTimeSeriesLogInformation.cpp
index a4d5868af52c2056f5c870f3f55cf420aed592c9..6e991e8fd4d0277bcbdaf7a5293b7de6fa5efb22 100644
--- a/Framework/Algorithms/src/GetTimeSeriesLogInformation.cpp
+++ b/Framework/Algorithms/src/GetTimeSeriesLogInformation.cpp
@@ -271,7 +271,7 @@ GetTimeSeriesLogInformation::calculateRelativeTime(double deltatime) {
 /** Generate statistic information table workspace
   */
 TableWorkspace_sptr GetTimeSeriesLogInformation::generateStatisticTable() {
-  TableWorkspace_sptr tablews(new TableWorkspace());
+  auto tablews = boost::make_shared<TableWorkspace>();
 
   tablews->addColumn("str", "Name");
   tablews->addColumn("double", "Value");
diff --git a/Framework/Algorithms/src/He3TubeEfficiency.cpp b/Framework/Algorithms/src/He3TubeEfficiency.cpp
index cdecd069080763b0fd0ee0de482d321e4c8faf65..1dc63cf2a9d25950e2a877b9383d1bb8cb619992 100644
--- a/Framework/Algorithms/src/He3TubeEfficiency.cpp
+++ b/Framework/Algorithms/src/He3TubeEfficiency.cpp
@@ -409,42 +409,25 @@ void He3TubeEfficiency::execEvent() {
   this->g_log.information("Processing event workspace");
 
   const API::MatrixWorkspace_const_sptr matrixInputWS =
-      this->getProperty("InputWorkspace");
-  DataObjects::EventWorkspace_const_sptr inputWS =
-      boost::dynamic_pointer_cast<const DataObjects::EventWorkspace>(
-          matrixInputWS);
+      getProperty("InputWorkspace");
 
   // generate the output workspace pointer
-  API::MatrixWorkspace_sptr matrixOutputWS =
-      this->getProperty("OutputWorkspace");
-  DataObjects::EventWorkspace_sptr outputWS;
-  if (matrixOutputWS == matrixInputWS) {
-    outputWS = boost::dynamic_pointer_cast<DataObjects::EventWorkspace>(
-        matrixOutputWS);
-  } else {
-    // Make a brand new EventWorkspace
-    outputWS = boost::dynamic_pointer_cast<DataObjects::EventWorkspace>(
-        API::WorkspaceFactory::Instance().create(
-            "EventWorkspace", inputWS->getNumberHistograms(), 2, 1));
-    // Copy geometry over.
-    API::WorkspaceFactory::Instance().initializeFromParent(inputWS, outputWS,
-                                                           false);
-    // You need to copy over the data as well.
-    outputWS->copyDataFrom((*inputWS));
-
-    // Cast to the matrixOutputWS and save it
+  API::MatrixWorkspace_sptr matrixOutputWS = getProperty("OutputWorkspace");
+  if (matrixOutputWS != matrixInputWS) {
     matrixOutputWS =
-        boost::dynamic_pointer_cast<API::MatrixWorkspace>(outputWS);
-    this->setProperty("OutputWorkspace", matrixOutputWS);
+        API::MatrixWorkspace_sptr(matrixInputWS->clone().release());
+    setProperty("OutputWorkspace", matrixOutputWS);
   }
+  auto outputWS =
+      boost::dynamic_pointer_cast<DataObjects::EventWorkspace>(matrixOutputWS);
 
-  std::size_t numHistograms = inputWS->getNumberHistograms();
+  std::size_t numHistograms = outputWS->getNumberHistograms();
   this->progress = new API::Progress(this, 0.0, 1.0, numHistograms);
   PARALLEL_FOR1(outputWS)
   for (int i = 0; i < static_cast<int>(numHistograms); ++i) {
     PARALLEL_START_INTERUPT_REGION
 
-    Geometry::IDetector_const_sptr det = inputWS->getDetector(i);
+    Geometry::IDetector_const_sptr det = outputWS->getDetector(i);
     if (det->isMonitor() || det->isMasked()) {
       continue;
     }
@@ -455,7 +438,7 @@ void He3TubeEfficiency::execEvent() {
     } catch (std::out_of_range &) {
       // Parameters are bad so skip correction
       PARALLEL_CRITICAL(deteff_invalid) {
-        this->spectraSkipped.push_back(inputWS->getAxis(1)->spectraNo(i));
+        this->spectraSkipped.push_back(outputWS->getAxis(1)->spectraNo(i));
         outputWS->maskWorkspaceIndex(i);
       }
     }
diff --git a/Framework/Algorithms/src/IntegrateByComponent.cpp b/Framework/Algorithms/src/IntegrateByComponent.cpp
index f4e0d64f31a28f7d4796778ecfbce5c048b293f0..f7b51208d6b5d5cf83cfd1cf502caf687231cb63 100644
--- a/Framework/Algorithms/src/IntegrateByComponent.cpp
+++ b/Framework/Algorithms/src/IntegrateByComponent.cpp
@@ -5,6 +5,7 @@
 
 #include <boost/math/special_functions/fpclassify.hpp>
 #include <gsl/gsl_statistics.h>
+#include <unordered_map>
 
 namespace Mantid {
 namespace Algorithms {
@@ -190,7 +191,7 @@ IntegrateByComponent::makeInstrumentMap(API::MatrixWorkspace_sptr countsWS) {
  */
 std::vector<std::vector<size_t>>
 IntegrateByComponent::makeMap(API::MatrixWorkspace_sptr countsWS, int parents) {
-  std::multimap<Mantid::Geometry::ComponentID, size_t> mymap;
+  std::unordered_multimap<Mantid::Geometry::ComponentID, size_t> mymap;
 
   Geometry::Instrument_const_sptr instrument = countsWS->getInstrument();
   if (parents == 0) // this should not happen in this file, but if one reuses
@@ -226,13 +227,16 @@ IntegrateByComponent::makeMap(API::MatrixWorkspace_sptr countsWS, int parents) {
   std::vector<std::vector<size_t>> speclist;
   std::vector<size_t> speclistsingle;
 
-  std::multimap<Mantid::Geometry::ComponentID, size_t>::iterator m_it, s_it;
+  std::unordered_multimap<Mantid::Geometry::ComponentID, size_t>::iterator m_it,
+      s_it;
 
   for (m_it = mymap.begin(); m_it != mymap.end(); m_it = s_it) {
     Mantid::Geometry::ComponentID theKey = (*m_it).first;
-    std::pair<std::multimap<Mantid::Geometry::ComponentID, size_t>::iterator,
-              std::multimap<Mantid::Geometry::ComponentID, size_t>::iterator>
-        keyRange = mymap.equal_range(theKey);
+    std::pair<std::unordered_multimap<Mantid::Geometry::ComponentID,
+                                      size_t>::iterator,
+              std::unordered_multimap<Mantid::Geometry::ComponentID,
+                                      size_t>::iterator> keyRange =
+        mymap.equal_range(theKey);
 
     // Iterate over all map elements with key == theKey
     speclistsingle.clear();
diff --git a/Framework/Algorithms/src/Integration.cpp b/Framework/Algorithms/src/Integration.cpp
index ab049429488494dc3f6649f743e3a735fc2d8c4c..a56af454bdfeb60f9fa79e2405adfd34553e35be 100644
--- a/Framework/Algorithms/src/Integration.cpp
+++ b/Framework/Algorithms/src/Integration.cpp
@@ -84,7 +84,7 @@ void Integration::exec() {
   bool incPartBins = getProperty("IncludePartialBins");
 
   // Get the input workspace
-  MatrixWorkspace_const_sptr localworkspace = this->getInputWorkspace();
+  MatrixWorkspace_sptr localworkspace = this->getInputWorkspace();
 
   const int numberOfSpectra =
       static_cast<int>(localworkspace->getNumberHistograms());
@@ -106,12 +106,36 @@ void Integration::exec() {
     maxRange = 0.0;
   }
 
+  double progressStart = 0.0;
+  //---------------------------------------------------------------------------------
+  // Now, determine if the input workspace is actually an EventWorkspace
+  EventWorkspace_sptr eventInputWS =
+      boost::dynamic_pointer_cast<EventWorkspace>(localworkspace);
+
+  if (eventInputWS != nullptr) {
+    //------- EventWorkspace as input -------------------------------------
+    // Get the eventworkspace rebinned to apply the upper and lowerrange
+    double evntMinRange =
+        isEmpty(minRange) ? eventInputWS->getEventXMin() : minRange;
+    double evntMaxRange =
+        isEmpty(maxRange) ? eventInputWS->getEventXMax() : maxRange;
+    localworkspace =
+        rangeFilterEventWorkspace(eventInputWS, evntMinRange, evntMaxRange);
+
+    progressStart = 0.5;
+    if ((isEmpty(maxSpec)) && (isEmpty(maxSpec))) {
+      // Assign it to the output workspace property
+      setProperty("OutputWorkspace", localworkspace);
+      return;
+    }
+  }
+
   // Create the 2D workspace (with 1 bin) for the output
   MatrixWorkspace_sptr outputWorkspace =
       this->getOutputWorkspace(localworkspace, minSpec, maxSpec);
 
   bool is_distrib = outputWorkspace->isDistribution();
-  Progress progress(this, 0, 1, maxSpec - minSpec + 1);
+  Progress progress(this, progressStart, 1, maxSpec - minSpec + 1);
 
   const bool axisIsText = localworkspace->getAxis(1)->isText();
   const bool axisIsNumeric = localworkspace->getAxis(1)->isNumeric();
@@ -253,13 +277,30 @@ void Integration::exec() {
   return;
 }
 
+/**
+* Uses rebin to reduce event workspaces to a single bin histogram
+*/
+API::MatrixWorkspace_sptr
+Integration::rangeFilterEventWorkspace(API::MatrixWorkspace_sptr workspace,
+                                       double minRange, double maxRange) {
+  bool childLog = g_log.is(Logger::Priority::PRIO_DEBUG);
+  auto childAlg = createChildAlgorithm("Rebin", 0, 0.5, childLog);
+  childAlg->setProperty("InputWorkspace", workspace);
+  std::ostringstream binParams;
+  binParams << minRange << "," << maxRange - minRange << "," << maxRange;
+  childAlg->setPropertyValue("Params", binParams.str());
+  childAlg->setProperty("PreserveEvents", false);
+  childAlg->executeAsChildAlg();
+  return childAlg->getProperty("OutputWorkspace");
+}
+
 /**
  * This function gets the input workspace. In the case for a RebinnedOutput
  * workspace, it must be cleaned before proceeding. Other workspaces are
  * untouched.
  * @return the input workspace, cleaned if necessary
  */
-MatrixWorkspace_const_sptr Integration::getInputWorkspace() {
+MatrixWorkspace_sptr Integration::getInputWorkspace() {
   MatrixWorkspace_sptr temp = getProperty("InputWorkspace");
 
   if (temp->id() == "RebinnedOutput") {
@@ -302,9 +343,9 @@ MatrixWorkspace_const_sptr Integration::getInputWorkspace() {
  *
  * @return the output workspace
  */
-MatrixWorkspace_sptr
-Integration::getOutputWorkspace(MatrixWorkspace_const_sptr inWS,
-                                const int minSpec, const int maxSpec) {
+MatrixWorkspace_sptr Integration::getOutputWorkspace(MatrixWorkspace_sptr inWS,
+                                                     const int minSpec,
+                                                     const int maxSpec) {
   if (inWS->id() == "RebinnedOutput") {
     MatrixWorkspace_sptr outWS = API::WorkspaceFactory::Instance().create(
         "Workspace2D", maxSpec - minSpec + 1, 2, 1);
diff --git a/Framework/Algorithms/src/MaskBins.cpp b/Framework/Algorithms/src/MaskBins.cpp
index 76fe6c471bbc4603fbaa93d3b1f11ba263deb47c..b2fa7088702bb864319eaa97b322c3d74e2745bb 100644
--- a/Framework/Algorithms/src/MaskBins.cpp
+++ b/Framework/Algorithms/src/MaskBins.cpp
@@ -90,6 +90,13 @@ void MaskBins::exec() {
     }
   }
 
+  // Only create the output workspace if it's different to the input one
+  MatrixWorkspace_sptr outputWS = getProperty("OutputWorkspace");
+  if (outputWS != inputWS) {
+    outputWS = MatrixWorkspace_sptr(inputWS->clone().release());
+    setProperty("OutputWorkspace", outputWS);
+  }
+
   //---------------------------------------------------------------------------------
   // Now, determine if the input workspace is actually an EventWorkspace
   EventWorkspace_const_sptr eventW =
@@ -110,20 +117,6 @@ void MaskBins::exec() {
       this->findIndices(X, startBin, endBin);
     }
 
-    // Only create the output workspace if it's different to the input one
-    MatrixWorkspace_sptr outputWS = getProperty("OutputWorkspace");
-    if (outputWS != inputWS) {
-      outputWS = WorkspaceFactory::Instance().create(inputWS);
-      setProperty("OutputWorkspace", outputWS);
-
-      // Copy over the data
-      for (size_t wi = 0; wi < outputWS->getNumberHistograms(); ++wi) {
-        outputWS->dataX(wi) = inputWS->readX(wi);
-        outputWS->dataY(wi) = inputWS->readY(wi);
-        outputWS->dataE(wi) = inputWS->readE(wi);
-      }
-    }
-
     const int numHists = static_cast<int>(inputWS->getNumberHistograms());
     Progress progress(this, 0.0, 1.0, numHists);
     // Parallel running has problems with a race condition, leading to
@@ -167,35 +160,11 @@ void MaskBins::exec() {
 /** Execution code for EventWorkspaces
  */
 void MaskBins::execEvent() {
-  MatrixWorkspace_const_sptr inputMatrixWS = getProperty("InputWorkspace");
-  EventWorkspace_const_sptr inputWS =
-      boost::dynamic_pointer_cast<const EventWorkspace>(inputMatrixWS);
-  EventWorkspace_sptr outputWS;
-
-  // Only create the output workspace if it's different to the input one
   MatrixWorkspace_sptr outputMatrixWS = getProperty("OutputWorkspace");
-  if (outputMatrixWS != inputWS) {
-    // Make a brand new EventWorkspace
-    outputWS = boost::dynamic_pointer_cast<EventWorkspace>(
-        API::WorkspaceFactory::Instance().create(
-            "EventWorkspace", inputWS->getNumberHistograms(), 2, 1));
-    // Copy geometry over.
-    API::WorkspaceFactory::Instance().initializeFromParent(inputWS, outputWS,
-                                                           false);
-    // You need to copy over the data as well.
-    outputWS->copyDataFrom((*inputWS));
-
-    // Cast to the matrixOutputWS and save it
-    MatrixWorkspace_sptr matrixOutputWS =
-        boost::dynamic_pointer_cast<MatrixWorkspace>(outputWS);
-    this->setProperty("OutputWorkspace", matrixOutputWS);
-  } else {
-    // Output is same as input
-    outputWS = boost::dynamic_pointer_cast<EventWorkspace>(outputMatrixWS);
-  }
+  auto outputWS = boost::dynamic_pointer_cast<EventWorkspace>(outputMatrixWS);
 
   // set up the progress bar
-  const size_t numHists = inputWS->getNumberHistograms();
+  const size_t numHists = outputWS->getNumberHistograms();
   Progress progress(this, 0.0, 1.0, numHists * 2);
 
   // sort the events
diff --git a/Framework/Algorithms/src/MaskDetectorsIf.cpp b/Framework/Algorithms/src/MaskDetectorsIf.cpp
index ef6248b234016ad9e892670dc7e274f953ea4641..eb6a4d81051c7cabcb7f81fd77e82ac6bc499da3 100644
--- a/Framework/Algorithms/src/MaskDetectorsIf.cpp
+++ b/Framework/Algorithms/src/MaskDetectorsIf.cpp
@@ -72,7 +72,7 @@ void MaskDetectorsIf::exec() {
 
   for (size_t i = 0; i < nspec; ++i) {
     // Get the list of udets contributing to this spectra
-    const std::set<detid_t> &dets = inputW->getSpectrum(i)->getDetectorIDs();
+    const auto &dets = inputW->getSpectrum(i)->getDetectorIDs();
 
     if (dets.empty())
       continue;
diff --git a/Framework/Algorithms/src/MergeRuns.cpp b/Framework/Algorithms/src/MergeRuns.cpp
index ea90f536c5c911bec15f130fdb3574a4742768ed..77aec7377284f63fb0fd5c75dce015f4138053dc 100644
--- a/Framework/Algorithms/src/MergeRuns.cpp
+++ b/Framework/Algorithms/src/MergeRuns.cpp
@@ -168,7 +168,7 @@ void MergeRuns::buildAdditionTables() {
     table->reserve(nhist);
     for (int inWI = 0; inWI < static_cast<int>(nhist); inWI++) {
       // Get the set of detectors in the output
-      std::set<detid_t> &inDets = ews->getEventList(inWI).getDetectorIDs();
+      auto &inDets = ews->getEventList(inWI).getDetectorIDs();
 
       bool done = false;
 
@@ -177,7 +177,7 @@ void MergeRuns::buildAdditionTables() {
       int outWI = inWI;
       if (outWI < lhs_nhist) // don't go out of bounds
       {
-        std::set<detid_t> &outDets = lhs->getEventList(outWI).getDetectorIDs();
+        auto &outDets = lhs->getEventList(outWI).getDetectorIDs();
 
         // Checks that inDets is a subset of outDets
         if (std::includes(outDets.begin(), outDets.end(), inDets.begin(),
@@ -264,15 +264,7 @@ void MergeRuns::execEvent() {
 
   // Create a new output event workspace, by copying the first WS in the list
   EventWorkspace_sptr inputWS = m_inEventWS[0];
-
-  // Make a brand new EventWorkspace
-  EventWorkspace_sptr outWS = boost::dynamic_pointer_cast<EventWorkspace>(
-      API::WorkspaceFactory::Instance().create(
-          "EventWorkspace", inputWS->getNumberHistograms(), 2, 1));
-  // Copy geometry over.
-  API::WorkspaceFactory::Instance().initializeFromParent(inputWS, outWS, false);
-  // You need to copy over the data as well.
-  outWS->copyDataFrom((*inputWS));
+  EventWorkspace_sptr outWS(inputWS->clone().release());
 
   int64_t n = m_inEventWS.size() - 1;
   m_progress = new Progress(this, 0.0, 1.0, n);
diff --git a/Framework/Algorithms/src/ModeratorTzero.cpp b/Framework/Algorithms/src/ModeratorTzero.cpp
index 064b72c5756e57c0ab0fccc2c0967c472b3d4c29..39f5eb8524854d7dcfb3f0cab4cc42a10c6ee4a3 100644
--- a/Framework/Algorithms/src/ModeratorTzero.cpp
+++ b/Framework/Algorithms/src/ModeratorTzero.cpp
@@ -245,28 +245,14 @@ void ModeratorTzero::execEvent(const std::string &emode) {
 
   const MatrixWorkspace_const_sptr matrixInputWS =
       getProperty("InputWorkspace");
-  EventWorkspace_const_sptr inputWS =
-      boost::dynamic_pointer_cast<const EventWorkspace>(matrixInputWS);
 
   // generate the output workspace pointer
-  const size_t numHists = static_cast<size_t>(inputWS->getNumberHistograms());
-  Mantid::API::MatrixWorkspace_sptr matrixOutputWS =
-      getProperty("OutputWorkspace");
-  EventWorkspace_sptr outputWS;
-  if (matrixOutputWS == matrixInputWS) {
-    outputWS = boost::dynamic_pointer_cast<EventWorkspace>(matrixOutputWS);
-  } else {
-    // Make a brand new EventWorkspace
-    outputWS = boost::dynamic_pointer_cast<EventWorkspace>(
-        WorkspaceFactory::Instance().create("EventWorkspace", numHists, 2, 1));
-    // Copy geometry over.
-    WorkspaceFactory::Instance().initializeFromParent(inputWS, outputWS, false);
-    // You need to copy over the data as well.
-    outputWS->copyDataFrom((*inputWS));
-    // Cast to the matrixOutputWS and save it
-    matrixOutputWS = boost::dynamic_pointer_cast<MatrixWorkspace>(outputWS);
+  API::MatrixWorkspace_sptr matrixOutputWS = getProperty("OutputWorkspace");
+  if (matrixOutputWS != matrixInputWS) {
+    matrixOutputWS = MatrixWorkspace_sptr(matrixInputWS->clone().release());
     setProperty("OutputWorkspace", matrixOutputWS);
   }
+  auto outputWS = boost::dynamic_pointer_cast<EventWorkspace>(matrixOutputWS);
 
   // Get pointers to sample and source
   IComponent_const_sptr source = m_instrument->getSource();
@@ -276,7 +262,7 @@ void ModeratorTzero::execEvent(const std::string &emode) {
   // calculate tof shift once for all neutrons if emode==Direct
   double t0_direct(-1);
   if (emode == "Direct") {
-    Kernel::Property *eiprop = inputWS->run().getProperty("Ei");
+    Kernel::Property *eiprop = outputWS->run().getProperty("Ei");
     double Ei = boost::lexical_cast<double>(eiprop->value());
     mu::Parser parser;
     parser.DefineVar("incidentEnergy", &Ei); // associate E1 to this parser
@@ -285,6 +271,7 @@ void ModeratorTzero::execEvent(const std::string &emode) {
   }
 
   // Loop over the spectra
+  const size_t numHists = static_cast<size_t>(outputWS->getNumberHistograms());
   Progress prog(this, 0.0, 1.0, numHists); // report progress of algorithm
   PARALLEL_FOR1(outputWS)
   for (int i = 0; i < static_cast<int>(numHists); ++i) {
@@ -298,7 +285,7 @@ void ModeratorTzero::execEvent(const std::string &emode) {
       double L2(-1);  // distance from sample to detector
 
       try {
-        det = inputWS->getDetector(i);
+        det = outputWS->getDetector(i);
         if (det->isMonitor()) {
           // redefine the sample as the monitor
           L1 = source->getDistance(*det);
diff --git a/Framework/Algorithms/src/ModeratorTzeroLinear.cpp b/Framework/Algorithms/src/ModeratorTzeroLinear.cpp
index 871992d499bae8da425df6538c759826e50a28d6..e998662ab4e830305bd070474a158591384d3f15 100644
--- a/Framework/Algorithms/src/ModeratorTzeroLinear.cpp
+++ b/Framework/Algorithms/src/ModeratorTzeroLinear.cpp
@@ -181,29 +181,17 @@ void ModeratorTzeroLinear::execEvent() {
 
   const MatrixWorkspace_const_sptr matrixInputWS =
       getProperty("InputWorkspace");
-  EventWorkspace_const_sptr inputWS =
-      boost::dynamic_pointer_cast<const EventWorkspace>(matrixInputWS);
 
   // generate the output workspace pointer
-  const size_t numHists = inputWS->getNumberHistograms();
   MatrixWorkspace_sptr matrixOutputWS = getProperty("OutputWorkspace");
-  EventWorkspace_sptr outputWS;
-  if (matrixOutputWS == matrixInputWS) {
-    outputWS = boost::dynamic_pointer_cast<EventWorkspace>(matrixOutputWS);
-  } else {
-    // Make a brand new EventWorkspace
-    outputWS = boost::dynamic_pointer_cast<EventWorkspace>(
-        WorkspaceFactory::Instance().create("EventWorkspace", numHists, 2, 1));
-    // Copy geometry over.
-    WorkspaceFactory::Instance().initializeFromParent(inputWS, outputWS, false);
-    // You need to copy over the data as well.
-    outputWS->copyDataFrom((*inputWS));
-    // Cast to the matrixOutputWS and save it
-    matrixOutputWS = boost::dynamic_pointer_cast<MatrixWorkspace>(outputWS);
+  if (matrixOutputWS != matrixInputWS) {
+    matrixOutputWS = MatrixWorkspace_sptr(matrixInputWS->clone().release());
     setProperty("OutputWorkspace", matrixOutputWS);
   }
+  auto outputWS = boost::dynamic_pointer_cast<EventWorkspace>(matrixOutputWS);
 
   // Loop over the spectra
+  const size_t numHists = outputWS->getNumberHistograms();
   Progress prog(this, 0.0, 1.0, numHists); // report progress of algorithm
   PARALLEL_FOR1(outputWS)
   for (int i = 0; i < static_cast<int>(numHists); ++i) {
diff --git a/Framework/Algorithms/src/MonteCarloAbsorption.cpp b/Framework/Algorithms/src/MonteCarloAbsorption.cpp
index e14675753b63a55006b4c1498f5af59e73ae9239..0e5f2b6cbc06e893039ff30775953f6d9871ade7 100644
--- a/Framework/Algorithms/src/MonteCarloAbsorption.cpp
+++ b/Framework/Algorithms/src/MonteCarloAbsorption.cpp
@@ -502,18 +502,14 @@ bool MonteCarloAbsorption::boxIntersectsSample(
     const double xmax, const double ymax, const double zmax, const double xmin,
     const double ymin, const double zmin) const {
   // Check all 8 corners for intersection
-  if (ptIntersectsSample(V3D(xmax, ymin, zmin)) || // left-front-bottom
-      ptIntersectsSample(V3D(xmax, ymax, zmin)) || // left-front-top
-      ptIntersectsSample(V3D(xmin, ymax, zmin)) || // right-front-top
-      ptIntersectsSample(V3D(xmin, ymin, zmin)) || // right-front-bottom
-      ptIntersectsSample(V3D(xmax, ymin, zmax)) || // left-back-bottom
-      ptIntersectsSample(V3D(xmax, ymax, zmax)) || // left-back-top
-      ptIntersectsSample(V3D(xmin, ymax, zmax)) || // right-back-top
-      ptIntersectsSample(V3D(xmin, ymin, zmax)))   // right-back-bottom
-  {
-    return true;
-  } else
-    return false;
+  return (ptIntersectsSample(V3D(xmax, ymin, zmin)) || // left-front-bottom
+          ptIntersectsSample(V3D(xmax, ymax, zmin)) || // left-front-top
+          ptIntersectsSample(V3D(xmin, ymax, zmin)) || // right-front-top
+          ptIntersectsSample(V3D(xmin, ymin, zmin)) || // right-front-bottom
+          ptIntersectsSample(V3D(xmax, ymin, zmax)) || // left-back-bottom
+          ptIntersectsSample(V3D(xmax, ymax, zmax)) || // left-back-top
+          ptIntersectsSample(V3D(xmin, ymax, zmax)) || // right-back-top
+          ptIntersectsSample(V3D(xmin, ymin, zmax)));  // right-back-bottom
 }
 
 /**
diff --git a/Framework/Algorithms/src/MultipleScatteringCylinderAbsorption.cpp b/Framework/Algorithms/src/MultipleScatteringCylinderAbsorption.cpp
index 17cd77d523deec5f280959aa3770001234b0f53a..81f3ce1b68acd89943ba8a61db2a342e398d1d73 100644
--- a/Framework/Algorithms/src/MultipleScatteringCylinderAbsorption.cpp
+++ b/Framework/Algorithms/src/MultipleScatteringCylinderAbsorption.cpp
@@ -160,21 +160,12 @@ void MultipleScatteringCylinderAbsorption::exec() {
   EventWorkspace_sptr in_WSevent =
       boost::dynamic_pointer_cast<EventWorkspace>(in_WS);
   if (in_WSevent) {
-    MatrixWorkspace_sptr out_WS = getProperty("OutputWorkspace");
-    EventWorkspace_sptr out_WSevent =
-        boost::dynamic_pointer_cast<EventWorkspace>(out_WS);
-
     // not in-place so create a new copy
-    if (in_WSevent != out_WSevent) {
-      out_WSevent = boost::dynamic_pointer_cast<EventWorkspace>(
-          API::WorkspaceFactory::Instance().create(
-              "EventWorkspace", in_WSevent->getNumberHistograms(), 2, 1));
-      // Copy geometry over.
-      API::WorkspaceFactory::Instance().initializeFromParent(
-          in_WSevent, out_WSevent, false);
-      // You need to copy over the data as well.
-      out_WSevent->copyDataFrom((*in_WSevent));
+    MatrixWorkspace_sptr out_WS = getProperty("OutputWorkspace");
+    if (in_WS != out_WS) {
+      out_WS = MatrixWorkspace_sptr(in_WS->clone().release());
     }
+    auto out_WSevent = boost::dynamic_pointer_cast<EventWorkspace>(out_WS);
 
     // convert to weighted events
     out_WSevent->switchEventType(API::WEIGHTED_NOTIME);
@@ -210,9 +201,7 @@ void MultipleScatteringCylinderAbsorption::exec() {
     PARALLEL_CHECK_INTERUPT_REGION
 
     // set the output workspace
-    this->setProperty(
-        "OutputWorkspace",
-        boost::dynamic_pointer_cast<MatrixWorkspace>(out_WSevent));
+    setProperty("OutputWorkspace", out_WS);
   } else // histogram case
   {
     // Create the new workspace
diff --git a/Framework/Algorithms/src/MuonGroupDetectors.cpp b/Framework/Algorithms/src/MuonGroupDetectors.cpp
index 167b761a6fdcfe9eab73b2c507b6ab1c6aee968e..5abc5319850466a48446cd9ad2281138b8d0560a 100644
--- a/Framework/Algorithms/src/MuonGroupDetectors.cpp
+++ b/Framework/Algorithms/src/MuonGroupDetectors.cpp
@@ -98,8 +98,8 @@ void MuonGroupDetectors::exec() {
     std::vector<int> &detectorIDs = table->cell<std::vector<int>>(*rowIt, 0);
 
     // Recieve detector IDs, but need workspace indices to group, so convert
-    std::vector<size_t> wsIndices;
-    inWS->getIndicesFromDetectorIDs(detectorIDs, wsIndices);
+    std::vector<size_t> wsIndices =
+        inWS->getIndicesFromDetectorIDs(detectorIDs);
 
     if (wsIndices.size() != detectorIDs.size())
       throw std::invalid_argument("Some of the detector IDs were not found");
diff --git a/Framework/Algorithms/src/NormaliseToMonitor.cpp b/Framework/Algorithms/src/NormaliseToMonitor.cpp
index 0269e1a7559bb172d9014c6b81bd72eeb23459e4..9bb434877a8b9c3a40fc71d4b493b9103eff980c 100644
--- a/Framework/Algorithms/src/NormaliseToMonitor.cpp
+++ b/Framework/Algorithms/src/NormaliseToMonitor.cpp
@@ -117,8 +117,7 @@ bool MonIDPropChanger::monitorIdReader(
   }
   // are these monitors really there?
   // got the index of correspondent spectra.
-  std::vector<size_t> indexList;
-  inputWS->getIndicesFromDetectorIDs(mon, indexList);
+  std::vector<size_t> indexList = inputWS->getIndicesFromDetectorIDs(mon);
   if (indexList.empty()) {
     if (iExistingAllowedValues.empty()) {
       return false;
@@ -385,8 +384,7 @@ API::MatrixWorkspace_sptr NormaliseToMonitor::getInWSMonitorSpectrum(
     // set spectra of detector's ID of one selected monitor ID
     std::vector<detid_t> detID(1, monitorID);
     // got the index of correspondent spectra (should be only one).
-    std::vector<size_t> indexList;
-    inputWorkspace->getIndicesFromDetectorIDs(detID, indexList);
+    auto indexList = inputWorkspace->getIndicesFromDetectorIDs(detID);
     if (indexList.empty()) {
       throw std::runtime_error(
           "Can not find spectra, corresponding to the requested monitor ID");
@@ -397,14 +395,13 @@ API::MatrixWorkspace_sptr NormaliseToMonitor::getInWSMonitorSpectrum(
     }
     spectra_num = static_cast<int>(indexList[0]);
   } else { // monitor spectrum is specified.
-    spec2index_map specs;
     const SpectraAxis *axis =
         dynamic_cast<const SpectraAxis *>(inputWorkspace->getAxis(1));
     if (!axis) {
       throw std::runtime_error("Cannot retrieve monitor spectrum - spectrum "
                                "numbers not attached to workspace");
     }
-    axis->getSpectraIndexMap(specs);
+    auto specs = axis->getSpectraIndexMap();
     if (!specs.count(monitorSpec)) {
       throw std::runtime_error("Input workspace does not contain spectrum "
                                "number given for MonitorSpectrum");
@@ -562,25 +559,16 @@ void NormaliseToMonitor::normaliseBinByBin(
     API::MatrixWorkspace_sptr &outputWorkspace) {
   EventWorkspace_sptr inputEvent =
       boost::dynamic_pointer_cast<EventWorkspace>(inputWorkspace);
-  EventWorkspace_sptr outputEvent =
-      boost::dynamic_pointer_cast<EventWorkspace>(outputWorkspace);
 
   // Only create output workspace if different to input one
   if (outputWorkspace != inputWorkspace) {
     if (inputEvent) {
-      // Make a brand new EventWorkspace
-      outputEvent = boost::dynamic_pointer_cast<EventWorkspace>(
-          API::WorkspaceFactory::Instance().create(
-              "EventWorkspace", inputEvent->getNumberHistograms(), 2, 1));
-      // Copy geometry and data
-      API::WorkspaceFactory::Instance().initializeFromParent(
-          inputEvent, outputEvent, false);
-      outputEvent->copyDataFrom((*inputEvent));
-      outputWorkspace =
-          boost::dynamic_pointer_cast<MatrixWorkspace>(outputEvent);
+      outputWorkspace = MatrixWorkspace_sptr(inputWorkspace->clone().release());
     } else
       outputWorkspace = WorkspaceFactory::Instance().create(inputWorkspace);
   }
+  auto outputEvent =
+      boost::dynamic_pointer_cast<EventWorkspace>(outputWorkspace);
 
   // Get hold of the monitor spectrum
   const MantidVec &monX = m_monitor->readX(0);
diff --git a/Framework/Algorithms/src/PDDetermineCharacterizations.cpp b/Framework/Algorithms/src/PDDetermineCharacterizations.cpp
index 7347441ff8ffa0f91d9629bd76bc06571548a471..ec4d16655d58781534bab540fa2d85deea4f7c2d 100644
--- a/Framework/Algorithms/src/PDDetermineCharacterizations.cpp
+++ b/Framework/Algorithms/src/PDDetermineCharacterizations.cpp
@@ -216,7 +216,7 @@ double PDDetermineCharacterizations::getLogValue(API::Run &run,
   if (propName == WL_PROP_NAME)
     label = "wavelength";
 
-  std::set<std::string> validUnits;
+  std::unordered_set<std::string> validUnits;
   if (propName == WL_PROP_NAME) {
     validUnits.insert("Angstrom");
     validUnits.insert("A");
diff --git a/Framework/Algorithms/src/Q1DWeighted.cpp b/Framework/Algorithms/src/Q1DWeighted.cpp
index 10962a722a45c35eb80ff7def34599c01f622aa7..e97c2069439695aa13ae4a699e850995fdfac83b 100644
--- a/Framework/Algorithms/src/Q1DWeighted.cpp
+++ b/Framework/Algorithms/src/Q1DWeighted.cpp
@@ -334,7 +334,7 @@ void Q1DWeighted::exec() {
   }
 
   // Create workspace group that holds output workspaces
-  WorkspaceGroup_sptr wsgroup = WorkspaceGroup_sptr(new WorkspaceGroup());
+  auto wsgroup = boost::make_shared<WorkspaceGroup>();
 
   for (auto &wedgeWorkspace : wedgeWorkspaces) {
     wsgroup->addWorkspace(wedgeWorkspace);
diff --git a/Framework/Algorithms/src/RadiusSum.cpp b/Framework/Algorithms/src/RadiusSum.cpp
index 5187eb999dd8d02248ba12f4d78152aa3cdbe6e3..98812962aa8b11b3ecde9a05590f6f49aefb0a8a 100644
--- a/Framework/Algorithms/src/RadiusSum.cpp
+++ b/Framework/Algorithms/src/RadiusSum.cpp
@@ -610,14 +610,9 @@ void RadiusSum::normalizeOutputByRadius(std::vector<double> &values,
 double RadiusSum::getMaxDistance(const V3D &centre,
                                  const std::vector<double> &boundary_limits) {
 
-  std::vector<double> Xs;       //  = {boundary_limits[0], boundary_limits[1]};
-  std::vector<double> Ys;       // = {boundary_limits[2], boundary_limits[3]};
-  std::vector<double> Zs(2, 0); //  = {0, 0};
-
-  Xs.push_back(boundary_limits[0]);
-  Xs.push_back(boundary_limits[1]);
-  Ys.push_back(boundary_limits[2]);
-  Ys.push_back(boundary_limits[3]);
+  std::array<double, 2> Xs = {{boundary_limits[0], boundary_limits[1]}};
+  std::array<double, 2> Ys = {{boundary_limits[2], boundary_limits[3]}};
+  std::array<double, 2> Zs = {{0., 0.}};
 
   if (boundary_limits.size() == 6) {
     Zs[0] = boundary_limits[4];
@@ -625,12 +620,12 @@ double RadiusSum::getMaxDistance(const V3D &centre,
   }
 
   double max_distance = 0;
-  for (size_t x = 0; x < 2; x++)
-    for (size_t y = 0; y < 2; y++)
-      for (size_t z = 0; z < 2;
-           z++) { // define all the possible combinations for the limits
+  for (auto &x : Xs)
+    for (auto &y : Ys)
+      for (auto &z : Zs) {
+        // define all the possible combinations for the limits
 
-        double curr_distance = centre.distance(V3D(Xs[x], Ys[y], Zs[z]));
+        double curr_distance = centre.distance(V3D(x, y, z));
 
         if (curr_distance > max_distance)
           max_distance = curr_distance; // keep the maximum distance.
diff --git a/Framework/Algorithms/src/ReadGroupsFromFile.cpp b/Framework/Algorithms/src/ReadGroupsFromFile.cpp
index e5672a74f55b7d74cb89d069c5c37e0b50141c57..12204805a8f37126f7f48159ceee12ad9ee76fe2 100644
--- a/Framework/Algorithms/src/ReadGroupsFromFile.cpp
+++ b/Framework/Algorithms/src/ReadGroupsFromFile.cpp
@@ -112,7 +112,7 @@ void ReadGroupsFromFile::exec() {
 
   for (int64_t i = 0; i < nHist; i++) {
     ISpectrum *spec = localWorkspace->getSpectrum(i);
-    const std::set<detid_t> &dets = spec->getDetectorIDs();
+    const auto &dets = spec->getDetectorIDs();
     if (dets.empty()) // Nothing
     {
       spec->dataY()[0] = 0.0;
@@ -221,7 +221,8 @@ void ReadGroupsFromFile::readXMLGroupingFile(const std::string &filename) {
 
     std::string ids = group->getAttribute("val");
 
-    Poco::StringTokenizer data(ids, ",", Poco::StringTokenizer::TOK_TRIM);
+    Mantid::Kernel::StringTokenizer data(
+        ids, ",", Mantid::Kernel::StringTokenizer::TOK_TRIM);
 
     if (data.begin() != data.end()) {
       for (const auto &value : data) {
diff --git a/Framework/Algorithms/src/Rebin.cpp b/Framework/Algorithms/src/Rebin.cpp
index dda8acbfb4a19c98bbd76f2284ffa53653a93dac..8f42272273f5834ede61a1aa84f575c22e384d4b 100644
--- a/Framework/Algorithms/src/Rebin.cpp
+++ b/Framework/Algorithms/src/Rebin.cpp
@@ -144,41 +144,16 @@ void Rebin::exec() {
 
   if (eventInputWS != nullptr) {
     //------- EventWorkspace as input -------------------------------------
-    EventWorkspace_sptr eventOutputWS =
-        boost::dynamic_pointer_cast<EventWorkspace>(outputWS);
-
-    if (inPlace && PreserveEvents) {
-      // -------------Rebin in-place, preserving events
-      // ----------------------------------------------
-      // This only sets the X axis. Actual rebinning will be done upon data
-      // access.
-      eventOutputWS->setAllX(XValues_new);
-      this->setProperty(
-          "OutputWorkspace",
-          boost::dynamic_pointer_cast<MatrixWorkspace>(eventOutputWS));
-    } else if (!inPlace && PreserveEvents) {
-      // -------- NOT in-place, but you want to keep events for some reason.
-      // ----------------------
-      // Must copy the event workspace to a new EventWorkspace (and bin that).
-
-      // Make a brand new EventWorkspace
-      eventOutputWS = boost::dynamic_pointer_cast<EventWorkspace>(
-          API::WorkspaceFactory::Instance().create(
-              "EventWorkspace", inputWS->getNumberHistograms(), 2, 1));
-      // Copy geometry over.
-      API::WorkspaceFactory::Instance().initializeFromParent(
-          inputWS, eventOutputWS, false);
-      // You need to copy over the data as well.
-      eventOutputWS->copyDataFrom((*eventInputWS));
 
+    if (PreserveEvents) {
+      if (!inPlace) {
+        outputWS = MatrixWorkspace_sptr(inputWS->clone().release());
+      }
+      auto eventOutputWS =
+          boost::dynamic_pointer_cast<EventWorkspace>(outputWS);
       // This only sets the X axis. Actual rebinning will be done upon data
       // access.
       eventOutputWS->setAllX(XValues_new);
-
-      // Cast to the matrixOutputWS and save it
-      this->setProperty(
-          "OutputWorkspace",
-          boost::dynamic_pointer_cast<MatrixWorkspace>(eventOutputWS));
     } else {
       //--------- Different output, OR you're inplace but not preserving Events
       //--- create a Workspace2D -------
@@ -232,11 +207,11 @@ void Rebin::exec() {
         outputWS->getAxis(i)->unit() = inputWS->getAxis(i)->unit();
       outputWS->setYUnit(eventInputWS->YUnit());
       outputWS->setYUnitLabel(eventInputWS->YUnitLabel());
-
-      // Assign it to the output workspace property
-      setProperty("OutputWorkspace", outputWS);
     }
 
+    // Assign it to the output workspace property
+    setProperty("OutputWorkspace", outputWS);
+
   } // END ---- EventWorkspace
 
   else
diff --git a/Framework/Algorithms/src/RebinToWorkspace.cpp b/Framework/Algorithms/src/RebinToWorkspace.cpp
index 338e42fe9194ac1b9c912ef99deed9bdb7b97860..9b909a897f6425739a6c6a766c2e5b617ef4310a 100644
--- a/Framework/Algorithms/src/RebinToWorkspace.cpp
+++ b/Framework/Algorithms/src/RebinToWorkspace.cpp
@@ -47,8 +47,7 @@ void RebinToWorkspace::exec() {
 
   // First we need to create the parameter vector from the workspace with which
   // we are matching
-  std::vector<double> rb_params;
-  createRebinParameters(toMatch, rb_params);
+  std::vector<double> rb_params = createRebinParameters(toMatch);
 
   IAlgorithm_sptr runRebin = createChildAlgorithm("Rebin");
   runRebin->setProperty<MatrixWorkspace_sptr>("InputWorkspace", toRebin);
@@ -64,17 +63,17 @@ void RebinToWorkspace::exec() {
 /**
  * Create the vector of rebin parameters
  * @param toMatch :: A shared pointer to the workspace with the desired binning
- * @param rb_params :: A vector to hold the rebin parameters once they have been
+ * @returns :: A vector to hold the rebin parameters once they have been
  * calculated
  */
-void RebinToWorkspace::createRebinParameters(
-    Mantid::API::MatrixWorkspace_sptr toMatch, std::vector<double> &rb_params) {
+std::vector<double> RebinToWorkspace::createRebinParameters(
+    Mantid::API::MatrixWorkspace_sptr toMatch) {
   using namespace Mantid::API;
 
   const MantidVec &matchXdata = toMatch->readX(0);
   // params vector should have the form [x_1, delta_1,x_2, ...
   // ,x_n-1,delta_n-1,x_n), see Rebin.cpp
-  rb_params.clear();
+  std::vector<double> rb_params;
   int xsize = static_cast<int>(matchXdata.size());
   rb_params.reserve(xsize * 2);
   for (int i = 0; i < xsize; ++i) {
@@ -84,4 +83,5 @@ void RebinToWorkspace::createRebinParameters(
     if (i < xsize - 1)
       rb_params.push_back(matchXdata[i + 1] - matchXdata[i]);
   }
+  return rb_params;
 }
diff --git a/Framework/Algorithms/src/ReflectometryReductionOne.cpp b/Framework/Algorithms/src/ReflectometryReductionOne.cpp
index ab962e9b1fb96800f11a0954997b05bb40a73080..7a333494e03e42b23457a5bdad7636e5e7e2b39c 100644
--- a/Framework/Algorithms/src/ReflectometryReductionOne.cpp
+++ b/Framework/Algorithms/src/ReflectometryReductionOne.cpp
@@ -8,7 +8,6 @@
 #include "MantidKernel/ArrayProperty.h"
 #include "MantidKernel/EnabledWhenProperty.h"
 #include <boost/make_shared.hpp>
-#include <boost/assign/list_of.hpp>
 
 using namespace Mantid::Kernel;
 using namespace Mantid::API;
@@ -195,8 +194,8 @@ void ReflectometryReductionOne::init() {
                                               Direction::Input),
                   "Enforces spectrum number checking prior to normalization");
 
-  std::vector<std::string> correctionAlgorithms = boost::assign::list_of(
-      "None")("PolynomialCorrection")("ExponentialCorrection");
+  std::vector<std::string> correctionAlgorithms = {
+      "None", "PolynomialCorrection", "ExponentialCorrection"};
   declareProperty("CorrectionAlgorithm", "None",
                   boost::make_shared<StringListValidator>(correctionAlgorithms),
                   "The type of correction to perform.");
@@ -690,9 +689,8 @@ MatrixWorkspace_sptr ReflectometryReductionOne::transmissonCorrection(
 
       if (stitchingStart.is_initialized() && stitchingEnd.is_initialized() &&
           stitchingDelta.is_initialized()) {
-        const std::vector<double> params =
-            boost::assign::list_of(stitchingStart.get())(stitchingDelta.get())(
-                stitchingEnd.get()).convert_to_container<std::vector<double>>();
+        const std::vector<double> params = {
+            stitchingStart.get(), stitchingDelta.get(), stitchingEnd.get()};
         alg->setProperty("Params", params);
       } else if (stitchingDelta.is_initialized()) {
         alg->setProperty("Params",
diff --git a/Framework/Algorithms/src/ReflectometryReductionOneAuto.cpp b/Framework/Algorithms/src/ReflectometryReductionOneAuto.cpp
index 9f95d289c133591ff8c97fcc7bfdc756ae43fc2c..7f9efa3507b52eb7f13f30297be4f86520d5d228 100644
--- a/Framework/Algorithms/src/ReflectometryReductionOneAuto.cpp
+++ b/Framework/Algorithms/src/ReflectometryReductionOneAuto.cpp
@@ -6,7 +6,6 @@
 #include "MantidKernel/ListValidator.h"
 #include "MantidKernel/RebinParamsValidator.h"
 #include <boost/optional.hpp>
-#include <boost/assign/list_of.hpp>
 
 namespace Mantid {
 namespace Algorithms {
@@ -153,8 +152,8 @@ void ReflectometryReductionOneAuto::init() {
   declareProperty("StrictSpectrumChecking", true,
                   "Strict checking between spectrum numbers in input "
                   "workspaces and transmission workspaces.");
-  std::vector<std::string> correctionAlgorithms = boost::assign::list_of(
-      "None")("AutoDetect")("PolynomialCorrection")("ExponentialCorrection");
+  std::vector<std::string> correctionAlgorithms = {
+      "None", "AutoDetect", "PolynomialCorrection", "ExponentialCorrection"};
   declareProperty("CorrectionAlgorithm", "AutoDetect",
                   boost::make_shared<StringListValidator>(correctionAlgorithms),
                   "The type of correction to perform.");
diff --git a/Framework/Algorithms/src/ReflectometryWorkflowBase.cpp b/Framework/Algorithms/src/ReflectometryWorkflowBase.cpp
index 94bb19678628d45155eabc132cbe78404505d4bd..66e96a1e21093d1abcefa3f5797c5f1cf54aeba4 100644
--- a/Framework/Algorithms/src/ReflectometryWorkflowBase.cpp
+++ b/Framework/Algorithms/src/ReflectometryWorkflowBase.cpp
@@ -6,8 +6,6 @@
 #include "MantidKernel/MandatoryValidator.h"
 #include "MantidKernel/RebinParamsValidator.h"
 
-#include <boost/assign/list_of.hpp>
-
 using namespace Mantid::API;
 using namespace Mantid::Kernel;
 
@@ -437,7 +435,7 @@ ReflectometryWorkflowBase::toLamDetector(const std::string &processingCommands,
 
   auto rebinWorkspaceAlg = this->createChildAlgorithm("Rebin");
   rebinWorkspaceAlg->initialize();
-  std::vector<double> params = boost::assign::list_of(wavelengthStep);
+  std::vector<double> params = {wavelengthStep};
   rebinWorkspaceAlg->setProperty("Params", params);
   rebinWorkspaceAlg->setProperty("InputWorkspace", detectorWS);
   rebinWorkspaceAlg->execute();
diff --git a/Framework/Algorithms/src/RemoveBackground.cpp b/Framework/Algorithms/src/RemoveBackground.cpp
index 605b4082932216f37bac3b05ea721bba29029748..3f2d36ea6bdae080deb178a41bcdef69bff0b76f 100644
--- a/Framework/Algorithms/src/RemoveBackground.cpp
+++ b/Framework/Algorithms/src/RemoveBackground.cpp
@@ -8,15 +8,16 @@
 #include "MantidAPI/HistogramValidator.h"
 #include "MantidAPI/WorkspaceFactory.h"
 #include "MantidAPI/WorkspaceUnitValidator.h"
+#include "MantidAPI/GeometryInfo.h"
 #include "MantidDataObjects/EventList.h"
 #include "MantidDataObjects/EventWorkspace.h"
-#include "MantidGeometry/Instrument.h"
 #include "MantidKernel/ArrayProperty.h"
 #include "MantidKernel/CompositeValidator.h"
 #include "MantidKernel/ListValidator.h"
 #include "MantidKernel/RebinParamsValidator.h"
 #include "MantidKernel/VectorHelper.h"
 #include "MantidKernel/VisibleWhenProperty.h"
+#include "MantidKernel/make_unique.h"
 
 namespace Mantid {
 namespace Algorithms {
@@ -93,16 +94,6 @@ void RemoveBackground::exec() {
   API::MatrixWorkspace_const_sptr bkgWksp = getProperty("BkgWorkspace");
   bool nullifyNegative = getProperty("NullifyNegativeValues");
 
-  // source workspace has to have full instrument defined to perform background
-  // removal using this procedure.
-  auto pInstrument = inputWS->getInstrument();
-  if (pInstrument) {
-    if (!pInstrument->getSample())
-      throw std::invalid_argument(" Workspace: " + inputWS->getName() +
-                                  " does not have properly defined instrument. "
-                                  "Can not remove background");
-  }
-
   if (!(bkgWksp->getNumberHistograms() == 1 ||
         inputWS->getNumberHistograms() == bkgWksp->getNumberHistograms())) {
     throw std::invalid_argument(" Background Workspace: " + bkgWksp->getName() +
@@ -111,7 +102,6 @@ void RemoveBackground::exec() {
                                 "workspace");
   }
 
-  //
   int eMode; // in convert units emode is still integer
   const std::string emodeStr = getProperty("EMode");
   eMode = static_cast<int>(Kernel::DeltaEMode::fromString(emodeStr));
@@ -127,7 +117,6 @@ void RemoveBackground::exec() {
     outputWS = API::WorkspaceFactory::Instance().create(inputWS);
   }
 
-  //
   int nThreads = PARALLEL_GET_MAX_THREADS;
   m_BackgroundHelper.initialize(bkgWksp, inputWS, eMode, &g_log, nThreads,
                                 inPlace, nullifyNegative);
@@ -164,7 +153,7 @@ void RemoveBackground::exec() {
 BackgroundHelper::BackgroundHelper()
     : m_WSUnit(), m_bgWs(), m_wkWS(), m_pgLog(nullptr), m_inPlace(true),
       m_singleValueBackground(false), m_NBg(0), m_dtBg(1), m_ErrSq(0),
-      m_Emode(0), m_L1(0), m_Efix(0), m_Sample(), m_nullifyNegative(false),
+      m_Emode(0), m_Efix(0), m_nullifyNegative(false),
       m_previouslyRemovedBkgMode(false) {}
 /// Destructor
 BackgroundHelper::~BackgroundHelper() { this->deleteUnitsConverters(); }
@@ -217,14 +206,7 @@ void BackgroundHelper::initialize(const API::MatrixWorkspace_const_sptr &bkgWS,
     throw std::invalid_argument(" Source Workspace: " + sourceWS->getName() +
                                 " should have units");
 
-  Geometry::IComponent_const_sptr source =
-      sourceWS->getInstrument()->getSource();
-  m_Sample = sourceWS->getInstrument()->getSample();
-  if ((!source) || (!m_Sample))
-    throw std::invalid_argument(
-        "Instrument on Source workspace:" + sourceWS->getName() +
-        "is not sufficiently defined: failed to get source and/or sample");
-  m_L1 = source->getDistance(*m_Sample);
+  m_geometryInfoFactory = Kernel::make_unique<GeometryInfoFactory>(*sourceWS);
 
   // just in case.
   this->deleteUnitsConverters();
@@ -284,10 +266,10 @@ void BackgroundHelper::removeBackground(int nHist, MantidVec &x_data,
   }
 
   try {
-    auto detector = m_wkWS->getDetector(nHist);
-    //
-    double twoTheta = m_wkWS->detectorTwoTheta(detector);
-    double L2 = detector->getDistance(*m_Sample);
+    auto geometryInfo = m_geometryInfoFactory->create(nHist);
+    double twoTheta = geometryInfo.getTwoTheta();
+    double L1 = geometryInfo.getL1();
+    double L2 = geometryInfo.getL2();
     double delta(std::numeric_limits<double>::quiet_NaN());
     // get access to source workspace in case if target is different from source
     const MantidVec &XValues = m_wkWS->readX(nHist);
@@ -296,7 +278,7 @@ void BackgroundHelper::removeBackground(int nHist, MantidVec &x_data,
 
     // use thread-specific unit conversion class to avoid multithreading issues
     Kernel::Unit *unitConv = m_WSUnit[threadNum];
-    unitConv->initialize(m_L1, L2, twoTheta, m_Emode, m_Efix, delta);
+    unitConv->initialize(L1, L2, twoTheta, m_Emode, m_Efix, delta);
 
     x_data[0] = XValues[0];
     double tof1 = unitConv->singleToTOF(x_data[0]);
diff --git a/Framework/Algorithms/src/RemoveLowResTOF.cpp b/Framework/Algorithms/src/RemoveLowResTOF.cpp
index a9a8a1202f808d4f9b0dba104ad6bf6a1864279f..1fbdcfd61198d2eec61adef2cfdb41bf972766d4 100644
--- a/Framework/Algorithms/src/RemoveLowResTOF.cpp
+++ b/Framework/Algorithms/src/RemoveLowResTOF.cpp
@@ -120,6 +120,13 @@ void RemoveLowResTOF::exec() {
   else
     m_outputLowResTOF = false;
 
+  // Only create the output workspace if it's different to the input one
+  MatrixWorkspace_sptr outputWS = getProperty("OutputWorkspace");
+  if (outputWS != m_inputWS) {
+    outputWS = MatrixWorkspace_sptr(m_inputWS->clone().release());
+    setProperty("OutputWorkspace", outputWS);
+  }
+
   // go off and do the event version if appropriate
   m_inputEvWS = boost::dynamic_pointer_cast<const EventWorkspace>(m_inputWS);
   if (m_inputEvWS != nullptr) {
@@ -129,24 +136,11 @@ void RemoveLowResTOF::exec() {
 
   // set up the progress bar
   m_progress = new Progress(this, 0.0, 1.0, m_numberOfSpectra);
-  size_t xSize = m_inputWS->dataX(0).size();
-
-  MatrixWorkspace_sptr outputWS = getProperty("OutputWorkspace");
-  if (outputWS != m_inputWS) {
-    outputWS = WorkspaceFactory::Instance().create(m_inputWS, m_numberOfSpectra,
-                                                   xSize, xSize - 1);
-    setProperty("OutputWorkspace", outputWS);
-  }
 
   this->getTminData(false);
 
   for (size_t workspaceIndex = 0; workspaceIndex < m_numberOfSpectra;
        workspaceIndex++) {
-    // copy the data from the input workspace
-    outputWS->dataX(workspaceIndex) = m_inputWS->readX(workspaceIndex);
-    outputWS->dataY(workspaceIndex) = m_inputWS->readY(workspaceIndex);
-    outputWS->dataE(workspaceIndex) = m_inputWS->readE(workspaceIndex);
-
     // calculate where to zero out to
     double tofMin = this->calcTofMin(workspaceIndex);
     const MantidVec &X = m_inputWS->readX(0);
@@ -169,38 +163,15 @@ void RemoveLowResTOF::exec() {
   */
 void RemoveLowResTOF::execEvent() {
   // set up the output workspace
-  MatrixWorkspace_sptr matrixOutW = this->getProperty("OutputWorkspace");
-  DataObjects::EventWorkspace_sptr outW;
-  if (matrixOutW == m_inputWS)
-    outW = boost::dynamic_pointer_cast<EventWorkspace>(matrixOutW);
-  else {
-    outW = boost::dynamic_pointer_cast<EventWorkspace>(
-        API::WorkspaceFactory::Instance().create("EventWorkspace",
-                                                 m_numberOfSpectra, 2, 1));
-    // Copy required stuff from it
-    API::WorkspaceFactory::Instance().initializeFromParent(m_inputWS, outW,
-                                                           false);
-    outW->copyDataFrom((*m_inputEvWS));
-
-    // cast to the matrixoutput workspace and save it
-    matrixOutW = boost::dynamic_pointer_cast<MatrixWorkspace>(outW);
-    this->setProperty("OutputWorkspace", matrixOutW);
-  }
+  MatrixWorkspace_sptr matrixOutW = getProperty("OutputWorkspace");
+  auto outW = boost::dynamic_pointer_cast<EventWorkspace>(matrixOutW);
 
   MatrixWorkspace_sptr matrixLowResW = getProperty("LowResTOFWorkspace");
-  DataObjects::EventWorkspace_sptr lowW;
   if (m_outputLowResTOF) {
-    // Duplicate input workspace to output workspace
-    lowW = boost::dynamic_pointer_cast<DataObjects::EventWorkspace>(
-        API::WorkspaceFactory::Instance().create("EventWorkspace",
-                                                 m_numberOfSpectra, 2, 1));
-    API::WorkspaceFactory::Instance().initializeFromParent(m_inputWS, lowW,
-                                                           false);
-    lowW->copyDataFrom((*m_inputEvWS));
-
-    matrixLowResW = boost::dynamic_pointer_cast<MatrixWorkspace>(lowW);
+    matrixLowResW = MatrixWorkspace_sptr(m_inputWS->clone().release());
     setProperty("LowResTOFWorkspace", matrixLowResW);
   }
+  auto lowW = boost::dynamic_pointer_cast<EventWorkspace>(matrixLowResW);
 
   g_log.debug() << "TOF range was " << m_inputEvWS->getTofMin() << " to "
                 << m_inputEvWS->getTofMax() << " microseconds\n";
diff --git a/Framework/Algorithms/src/ResampleX.cpp b/Framework/Algorithms/src/ResampleX.cpp
index 0c35ff30e2c03ea0a0470a14a4b63dbeda5ae0e2..0fa32284f8577bbe8c90d4a9273b6911ff0e6295 100644
--- a/Framework/Algorithms/src/ResampleX.cpp
+++ b/Framework/Algorithms/src/ResampleX.cpp
@@ -323,23 +323,14 @@ void ResampleX::exec() {
       boost::dynamic_pointer_cast<const EventWorkspace>(inputWS);
   if (inputEventWS != nullptr) {
     if (m_preserveEvents) {
-      EventWorkspace_sptr outputEventWS =
-          boost::dynamic_pointer_cast<EventWorkspace>(outputWS);
       if (inPlace) {
         g_log.debug() << "Rebinning event workspace in place\n";
       } else {
         g_log.debug() << "Rebinning event workspace out of place\n";
-
-        // copy the event workspace to a new EventWorkspace
-        outputEventWS = boost::dynamic_pointer_cast<EventWorkspace>(
-            API::WorkspaceFactory::Instance().create(
-                "EventWorkspace", inputWS->getNumberHistograms(), 2, 1));
-        // copy geometry over.
-        API::WorkspaceFactory::Instance().initializeFromParent(
-            inputEventWS, outputEventWS, false);
-        // copy over the data as well.
-        outputEventWS->copyDataFrom((*inputEventWS));
+        outputWS = MatrixWorkspace_sptr(inputWS->clone().release());
       }
+      auto outputEventWS =
+          boost::dynamic_pointer_cast<EventWorkspace>(outputWS);
 
       if (common_limits) {
         // get the delta from the first since they are all the same
@@ -368,10 +359,6 @@ void ResampleX::exec() {
         }
         PARALLEL_CHECK_INTERUPT_REGION
       }
-
-      this->setProperty(
-          "OutputWorkspace",
-          boost::dynamic_pointer_cast<MatrixWorkspace>(outputEventWS));
     }    // end if (m_preserveEvents)
     else // event workspace -> matrix workspace
     {
@@ -431,10 +418,9 @@ void ResampleX::exec() {
         outputWS->getAxis(i)->unit() = inputWS->getAxis(i)->unit();
       outputWS->setYUnit(inputEventWS->YUnit());
       outputWS->setYUnitLabel(inputEventWS->YUnitLabel());
-
-      // Assign it to the output workspace property
-      setProperty("OutputWorkspace", outputWS);
     }
+    // Assign it to the output workspace property
+    setProperty("OutputWorkspace", outputWS);
     return;
   } else // (inputeventWS != NULL)
   {
diff --git a/Framework/Algorithms/src/SANSDirectBeamScaling.cpp b/Framework/Algorithms/src/SANSDirectBeamScaling.cpp
index b5ed7d0c517f783e7f86727a0162d1ec98a6cdfa..6d96768ea28087146e758e9e17af4c7a38c4d83a 100644
--- a/Framework/Algorithms/src/SANSDirectBeamScaling.cpp
+++ b/Framework/Algorithms/src/SANSDirectBeamScaling.cpp
@@ -72,10 +72,9 @@ void SANSDirectBeamScaling::exec() {
 
   // Extract the required spectra into separate workspaces
   std::vector<detid_t> udet;
-  std::vector<size_t> index;
   udet.push_back(getProperty("BeamMonitor"));
   // Convert UDETs to workspace indices
-  inputWS->getIndicesFromDetectorIDs(udet, index);
+  auto index = inputWS->getIndicesFromDetectorIDs(udet);
   if (index.empty()) {
     g_log.debug() << "inputWS->getIndicesFromDetectorIDs() returned empty\n";
     throw std::invalid_argument(
diff --git a/Framework/Algorithms/src/ScaleX.cpp b/Framework/Algorithms/src/ScaleX.cpp
index 858c68bf5eff9c161a7796ffa96f7f21e843defa..62b0d0f1400d8d6911e2ea62f4c04d700a9f20ba 100644
--- a/Framework/Algorithms/src/ScaleX.cpp
+++ b/Framework/Algorithms/src/ScaleX.cpp
@@ -173,36 +173,22 @@ void ScaleX::execEvent() {
   g_log.information("Processing event workspace");
   const MatrixWorkspace_const_sptr matrixInputWS =
       this->getProperty("InputWorkspace");
-  const std::string op = getPropertyValue("Operation");
-  EventWorkspace_const_sptr inputWS =
-      boost::dynamic_pointer_cast<const EventWorkspace>(matrixInputWS);
   // generate the output workspace pointer
-  API::MatrixWorkspace_sptr matrixOutputWS =
-      this->getProperty("OutputWorkspace");
-  EventWorkspace_sptr outputWS;
-  if (matrixOutputWS == matrixInputWS)
-    outputWS = boost::dynamic_pointer_cast<EventWorkspace>(matrixOutputWS);
-  else {
-    // Make a brand new EventWorkspace
-    outputWS = boost::dynamic_pointer_cast<EventWorkspace>(
-        API::WorkspaceFactory::Instance().create(
-            "EventWorkspace", inputWS->getNumberHistograms(), 2, 1));
-    // Copy geometry over.
-    API::WorkspaceFactory::Instance().initializeFromParent(inputWS, outputWS,
-                                                           false);
-    // You need to copy over the data as well.
-    outputWS->copyDataFrom((*inputWS));
-    // Cast to the matrixOutputWS and save it
-    matrixOutputWS = boost::dynamic_pointer_cast<MatrixWorkspace>(outputWS);
-    this->setProperty("OutputWorkspace", matrixOutputWS);
+  API::MatrixWorkspace_sptr matrixOutputWS = getProperty("OutputWorkspace");
+  if (matrixOutputWS != matrixInputWS) {
+    matrixOutputWS = MatrixWorkspace_sptr(matrixInputWS->clone().release());
+    setProperty("OutputWorkspace", matrixOutputWS);
   }
-  int numHistograms = static_cast<int>(inputWS->getNumberHistograms());
+  auto outputWS = boost::dynamic_pointer_cast<EventWorkspace>(matrixOutputWS);
+
+  const std::string op = getPropertyValue("Operation");
+  int numHistograms = static_cast<int>(outputWS->getNumberHistograms());
   PARALLEL_FOR1(outputWS)
   for (int i = 0; i < numHistograms; ++i) {
     PARALLEL_START_INTERUPT_REGION
     // Do the offsetting
     if ((i >= m_wi_min) && (i <= m_wi_max)) {
-      auto factor = getScaleFactor(inputWS, i);
+      auto factor = getScaleFactor(outputWS, i);
       if (op == "Multiply") {
         outputWS->getEventList(i).scaleTof(factor);
         if (factor < 0) {
diff --git a/Framework/Algorithms/src/SmoothNeighbours.cpp b/Framework/Algorithms/src/SmoothNeighbours.cpp
index 961bd5cd497d82fed1c9d751f9f6578acdb31ebe..1df42d6021a6ae2d2fad6a1e5a834cbc523f288a 100644
--- a/Framework/Algorithms/src/SmoothNeighbours.cpp
+++ b/Framework/Algorithms/src/SmoothNeighbours.cpp
@@ -355,7 +355,7 @@ void SmoothNeighbours::findNeighboursUbiqutious() {
     // We want to skip monitors
     try {
       // Get the list of detectors in this pixel
-      const std::set<detid_t> &dets = inWS->getSpectrum(wi)->getDetectorIDs();
+      const auto &dets = inWS->getSpectrum(wi)->getDetectorIDs();
       det = inst->getDetector(*dets.begin());
       if (det->isMonitor())
         continue; // skip monitor
@@ -713,7 +713,7 @@ void SmoothNeighbours::setupNewInstrument(MatrixWorkspace_sptr outws) {
 
       const ISpectrum *inSpec = inWS->getSpectrum(inWI);
 
-      std::set<detid_t> thesedetids = inSpec->getDetectorIDs();
+      auto thesedetids = inSpec->getDetectorIDs();
       outSpec->addDetectorIDs(thesedetids);
 
     } //(each neighbour)
@@ -748,7 +748,7 @@ void SmoothNeighbours::spreadPixels(MatrixWorkspace_sptr outws) {
     ISpectrum *inSpec = inWS->getSpectrum(outWIi);
     MantidVec &inX = inSpec->dataX();
 
-    std::set<detid_t> thesedetids = inSpec->getDetectorIDs();
+    auto thesedetids = inSpec->getDetectorIDs();
     ISpectrum *outSpec2 = outws2->getSpectrum(outWIi);
     MantidVec &outX = outSpec2->dataX();
     outX = inX;
diff --git a/Framework/Algorithms/src/SpecularReflectionAlgorithm.cpp b/Framework/Algorithms/src/SpecularReflectionAlgorithm.cpp
index 532424b9cdb095c5184be3b515826cc942466082..13fda3bbc94503fb0d8a40951704e3bf5e672572 100644
--- a/Framework/Algorithms/src/SpecularReflectionAlgorithm.cpp
+++ b/Framework/Algorithms/src/SpecularReflectionAlgorithm.cpp
@@ -29,8 +29,8 @@ const std::string pointDetectorAnalysis = "PointDetectorAnalysis";
  */
 void checkSpectrumNumbers(const std::vector<int> &spectrumNumbers,
                           bool strictSpectrumChecking, Logger &logger) {
-  std::set<int> uniqueSpectrumNumbers(spectrumNumbers.begin(),
-                                      spectrumNumbers.end());
+  std::unordered_set<int> uniqueSpectrumNumbers(spectrumNumbers.begin(),
+                                                spectrumNumbers.end());
   if (uniqueSpectrumNumbers.size() != spectrumNumbers.size()) {
     throw std::invalid_argument("Spectrum numbers are not unique.");
   }
diff --git a/Framework/Algorithms/src/SumSpectra.cpp b/Framework/Algorithms/src/SumSpectra.cpp
index 713199aa9f004818990c43e9b679b7503067a905..d033e2da1551f2d207e68b3533590bab4788f511 100644
--- a/Framework/Algorithms/src/SumSpectra.cpp
+++ b/Framework/Algorithms/src/SumSpectra.cpp
@@ -239,9 +239,8 @@ void SumSpectra::doWorkspace2D(MatrixWorkspace_const_sptr localworkspace,
   numZeros = 0;
 
   // Loop over spectra
-  std::set<int>::iterator it;
   // for (int i = m_minSpec; i <= m_maxSpec; ++i)
-  for (it = this->m_indices.begin(); it != this->m_indices.end(); ++it) {
+  for (auto it = this->m_indices.begin(); it != this->m_indices.end(); ++it) {
     int i = *it;
     // Don't go outside the range.
     if ((i >= this->m_numberOfSpectra) || (i < 0)) {
@@ -354,9 +353,8 @@ void SumSpectra::doRebinnedOutput(MatrixWorkspace_sptr outputWorkspace,
   numZeros = 0;
 
   // Loop over spectra
-  std::set<int>::iterator it;
   // for (int i = m_minSpec; i <= m_maxSpec; ++i)
-  for (it = m_indices.begin(); it != m_indices.end(); ++it) {
+  for (auto it = m_indices.begin(); it != m_indices.end(); ++it) {
     int i = *it;
     // Don't go outside the range.
     if ((i >= m_numberOfSpectra) || (i < 0)) {
@@ -449,12 +447,11 @@ void SumSpectra::execEvent(EventWorkspace_const_sptr localworkspace,
   outEL.clearDetectorIDs();
 
   // Loop over spectra
-  std::set<int>::iterator it;
   size_t numSpectra(0);
   size_t numMasked(0);
   size_t numZeros(0);
   // for (int i = m_minSpec; i <= m_maxSpec; ++i)
-  for (it = indices.begin(); it != indices.end(); ++it) {
+  for (auto it = indices.begin(); it != indices.end(); ++it) {
     int i = *it;
     // Don't go outside the range.
     if ((i >= m_numberOfSpectra) || (i < 0)) {
diff --git a/Framework/Algorithms/src/UnGroupWorkspace.cpp b/Framework/Algorithms/src/UnGroupWorkspace.cpp
index 8d4b97b05c8178e895cb5ff9ca9e1572088d9aea..34317a69c7eb34ce335756eb5a4f4c073f1ed5ac 100644
--- a/Framework/Algorithms/src/UnGroupWorkspace.cpp
+++ b/Framework/Algorithms/src/UnGroupWorkspace.cpp
@@ -13,11 +13,10 @@ using namespace API;
 void UnGroupWorkspace::init() {
   const AnalysisDataServiceImpl &data_store = AnalysisDataService::Instance();
   // Get the list of workspaces in the ADS
-  std::set<std::string> workspaceList = data_store.getObjectNames();
-  std::set<std::string> groupWorkspaceList;
+  auto workspaceList = data_store.getObjectNames();
+  std::unordered_set<std::string> groupWorkspaceList;
   // Not iterate over, removing all those which are not group workspaces
-  std::set<std::string>::iterator it;
-  for (it = workspaceList.begin(); it != workspaceList.end(); ++it) {
+  for (auto it = workspaceList.begin(); it != workspaceList.end(); ++it) {
     WorkspaceGroup_const_sptr group =
         boost::dynamic_pointer_cast<const WorkspaceGroup>(
             data_store.retrieve(*it));
diff --git a/Framework/Algorithms/src/UnaryOperation.cpp b/Framework/Algorithms/src/UnaryOperation.cpp
index fe770d2220b558889e207a4a1dbf156efd69f618..ffc6e6a2e38445730ad73e288689cb8360733c9b 100644
--- a/Framework/Algorithms/src/UnaryOperation.cpp
+++ b/Framework/Algorithms/src/UnaryOperation.cpp
@@ -111,37 +111,20 @@ void UnaryOperation::exec() {
 void UnaryOperation::execEvent() {
   g_log.information("Processing event workspace");
 
-  const MatrixWorkspace_const_sptr matrixInputWS =
-      this->getProperty(inputPropName());
-  EventWorkspace_const_sptr inputWS =
-      boost::dynamic_pointer_cast<const EventWorkspace>(matrixInputWS);
+  const MatrixWorkspace_const_sptr matrixInputWS = getProperty(inputPropName());
 
   // generate the output workspace pointer
-  API::MatrixWorkspace_sptr matrixOutputWS =
-      this->getProperty(outputPropName());
-  EventWorkspace_sptr outputWS;
-  if (matrixOutputWS == matrixInputWS) {
-    outputWS = boost::dynamic_pointer_cast<EventWorkspace>(matrixOutputWS);
-  } else {
-    // Make a brand new EventWorkspace
-    outputWS = boost::dynamic_pointer_cast<EventWorkspace>(
-        API::WorkspaceFactory::Instance().create(
-            "EventWorkspace", inputWS->getNumberHistograms(), 2, 1));
-    // Copy geometry over.
-    API::WorkspaceFactory::Instance().initializeFromParent(inputWS, outputWS,
-                                                           false);
-    // You need to copy over the data as well.
-    outputWS->copyDataFrom((*inputWS));
-
-    // Cast to the matrixOutputWS and save it
-    matrixOutputWS = boost::dynamic_pointer_cast<MatrixWorkspace>(outputWS);
-    this->setProperty("OutputWorkspace", matrixOutputWS);
+  API::MatrixWorkspace_sptr matrixOutputWS = getProperty(outputPropName());
+  if (matrixOutputWS != matrixInputWS) {
+    matrixOutputWS = MatrixWorkspace_sptr(matrixInputWS->clone().release());
+    setProperty(outputPropName(), matrixOutputWS);
   }
+  auto outputWS = boost::dynamic_pointer_cast<EventWorkspace>(matrixOutputWS);
 
   // Now fetch any properties defined by concrete algorithm
   retrieveProperties();
 
-  int64_t numHistograms = static_cast<int64_t>(inputWS->getNumberHistograms());
+  int64_t numHistograms = static_cast<int64_t>(outputWS->getNumberHistograms());
   API::Progress prog = API::Progress(this, 0.0, 1.0, numHistograms);
   PARALLEL_FOR1(outputWS)
   for (int64_t i = 0; i < numHistograms; ++i) {
@@ -171,6 +154,7 @@ void UnaryOperation::execEvent() {
   PARALLEL_CHECK_INTERUPT_REGION
 
   outputWS->clearMRU();
+  auto inputWS = boost::dynamic_pointer_cast<EventWorkspace>(matrixOutputWS);
   if (inputWS->getNumberEvents() != outputWS->getNumberEvents()) {
     g_log.information() << "Number of events has changed!!!" << std::endl;
   }
diff --git a/Framework/Algorithms/src/UnwrapSNS.cpp b/Framework/Algorithms/src/UnwrapSNS.cpp
index e9e47c3fda9b6c6db016c8ea3e714d81508da766..891b0b9f8ea5ac620f8d94c1c6224bd83abde99b 100644
--- a/Framework/Algorithms/src/UnwrapSNS.cpp
+++ b/Framework/Algorithms/src/UnwrapSNS.cpp
@@ -190,22 +190,11 @@ void UnwrapSNS::exec() {
 void UnwrapSNS::execEvent() {
   // set up the output workspace
   MatrixWorkspace_sptr matrixOutW = this->getProperty("OutputWorkspace");
-  DataObjects::EventWorkspace_sptr outW;
-  if (matrixOutW == m_inputWS)
-    outW = boost::dynamic_pointer_cast<EventWorkspace>(matrixOutW);
-  else {
-    outW = boost::dynamic_pointer_cast<EventWorkspace>(
-        API::WorkspaceFactory::Instance().create("EventWorkspace",
-                                                 m_numberOfSpectra, 2, 1));
-    // Copy required stuff from it
-    API::WorkspaceFactory::Instance().initializeFromParent(m_inputWS, outW,
-                                                           false);
-    outW->copyDataFrom((*m_inputEvWS));
-
-    // cast to the matrixoutput workspace and save it
-    matrixOutW = boost::dynamic_pointer_cast<MatrixWorkspace>(outW);
-    this->setProperty("OutputWorkspace", matrixOutW);
+  if (matrixOutW != m_inputWS) {
+    matrixOutW = MatrixWorkspace_sptr(m_inputWS->clone().release());
+    setProperty("OutputWorkspace", matrixOutW);
   }
+  auto outW = boost::dynamic_pointer_cast<EventWorkspace>(matrixOutW);
 
   // set up the progress bar
   m_progress = new Progress(this, 0.0, 1.0, m_numberOfSpectra * 2);
diff --git a/Framework/Algorithms/test/CMakeLists.txt b/Framework/Algorithms/test/CMakeLists.txt
index 73b5fef2307b7b9b2e46d66078cd5d2a5625a39c..8ebd1e2abed95ba899c68f3f15522de3b5a22015 100644
--- a/Framework/Algorithms/test/CMakeLists.txt
+++ b/Framework/Algorithms/test/CMakeLists.txt
@@ -32,6 +32,7 @@ if ( CXXTEST_FOUND )
   # It will go out of scope at the end of this file so doesn't need un-setting
   set ( TESTHELPER_SRCS ../../TestHelpers/src/TearDownWorld.cpp
                         ../../TestHelpers/src/ComponentCreationHelper.cpp
+                        ../../TestHelpers/src/InstrumentCreationHelper.cpp
                         ../../TestHelpers/src/WorkspaceCreationHelper.cpp
                         ../../TestHelpers/src/SANSInstrumentCreationHelper.cpp
                         ../../TestHelpers/src/MDEventsTestHelper.cpp
diff --git a/Framework/Algorithms/test/CalMuonDetectorPhasesTest.h b/Framework/Algorithms/test/CalMuonDetectorPhasesTest.h
index bfe88c7c86739e497f7aa98d9405afa923897de2..a7ee1a49df62e5d38b273cf78cec8c423bc5299f 100644
--- a/Framework/Algorithms/test/CalMuonDetectorPhasesTest.h
+++ b/Framework/Algorithms/test/CalMuonDetectorPhasesTest.h
@@ -9,7 +9,6 @@
 #include "MantidAPI/ITableWorkspace.h"
 #include "MantidKernel/cow_ptr.h"
 #include "MantidKernel/PhysicalConstants.h"
-#include <boost/assign/list_of.hpp>
 
 using namespace Mantid::API;
 using Mantid::MantidVec;
diff --git a/Framework/Algorithms/test/CalculateTransmissionTest.h b/Framework/Algorithms/test/CalculateTransmissionTest.h
index 2a1b47b56273541d70c38217f9fd2e755ce28916..1c6b48c8b6937d6b84198b9f33907800f2d4b898 100644
--- a/Framework/Algorithms/test/CalculateTransmissionTest.h
+++ b/Framework/Algorithms/test/CalculateTransmissionTest.h
@@ -12,8 +12,6 @@
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
 #include "MantidTestHelpers/SANSInstrumentCreationHelper.h"
 
-#include <boost/assign/list_of.hpp>
-
 using namespace Mantid::DataHandling;
 using namespace Mantid::Algorithms;
 using Mantid::API::MatrixWorkspace;
diff --git a/Framework/Algorithms/test/CloneWorkspaceTest.h b/Framework/Algorithms/test/CloneWorkspaceTest.h
index 9cdccc691c0cf00bd7c2a28dfd727d313ef7ab47..73cc7f55414737caf9c18f179921d92831a60f1e 100644
--- a/Framework/Algorithms/test/CloneWorkspaceTest.h
+++ b/Framework/Algorithms/test/CloneWorkspaceTest.h
@@ -185,7 +185,7 @@ public:
   */
   void test_exec_TableWorkspace() {
     // 1. Create input table workspace
-    TableWorkspace_sptr inpWS(new TableWorkspace());
+    auto inpWS = boost::make_shared<TableWorkspace>();
 
     inpWS->addColumn("str", "Name");
     inpWS->addColumn("double", "Value");
diff --git a/Framework/Algorithms/test/CopyDetectorMappingTest.h b/Framework/Algorithms/test/CopyDetectorMappingTest.h
index b08c2fc8c8998fa672664eeda165291b5acd2d21..d652eb1244874d2f3cce0bed87d015d8a72462f9 100644
--- a/Framework/Algorithms/test/CopyDetectorMappingTest.h
+++ b/Framework/Algorithms/test/CopyDetectorMappingTest.h
@@ -52,7 +52,7 @@ public:
     TS_ASSERT_THROWS_NOTHING(
         result = boost::dynamic_pointer_cast<MatrixWorkspace>(
             AnalysisDataService::Instance().retrieve("to_remap")));
-    std::set<detid_t> resultDetIDs = result->getSpectrum(0)->getDetectorIDs();
+    auto resultDetIDs = result->getSpectrum(0)->getDetectorIDs();
     TS_ASSERT(detIDs == resultDetIDs);
 
     // Clean up workspace
diff --git a/Framework/Algorithms/test/CopyInstrumentParametersTest.h b/Framework/Algorithms/test/CopyInstrumentParametersTest.h
index c1fd30c4109f073778342cfebb879fe62bcf0425..4628beecaaa0858b0d49998903b4d4c31debebd9 100644
--- a/Framework/Algorithms/test/CopyInstrumentParametersTest.h
+++ b/Framework/Algorithms/test/CopyInstrumentParametersTest.h
@@ -103,7 +103,7 @@ public:
     TS_ASSERT_DELTA(newPos2.Y(), 0.1, 0.0001);
     TS_ASSERT_DELTA(newPos2.Z(), 0.7, 0.0001);
     auto instr2 = ws2->getInstrument();
-    std::set<std::string> param_names = instr2->getParameterNames();
+    auto param_names = instr2->getParameterNames();
     TS_ASSERT(param_names.find("Ei") != param_names.end());
     TS_ASSERT(param_names.find("some_param") != param_names.end());
 
@@ -164,7 +164,7 @@ public:
     TS_ASSERT(copyInstParam.isInstrumentDifferent());
 
     auto instr2 = ws2->getInstrument();
-    std::set<std::string> param_names = instr2->getParameterNames();
+    auto param_names = instr2->getParameterNames();
     TS_ASSERT(param_names.find("Ei") != param_names.end());
     TS_ASSERT(param_names.find("some_param") != param_names.end());
     TS_ASSERT(param_names.find("T") == param_names.end());
@@ -279,10 +279,9 @@ public:
         dataStore.retrieveWS<API::MatrixWorkspace>(m_TargetWSName);
     auto instr2 = ws2->getInstrument();
 
-    std::set<std::string> param_names = instr2->getParameterNames();
+    auto param_names = instr2->getParameterNames();
 
-    for (auto it = param_names.begin(); it != param_names.end(); it++) {
-      auto name = *it;
+    for (auto const &name : param_names) {
       double num = boost::lexical_cast<double>(name.substr(6, name.size() - 6));
       double val = instr2->getNumberParameter(name)[0];
       TS_ASSERT_DELTA(num * 10, val, 1.e-8);
diff --git a/Framework/Algorithms/test/CreateTransmissionWorkspaceAutoTest.h b/Framework/Algorithms/test/CreateTransmissionWorkspaceAutoTest.h
index 8345853b2ec62bff27b597fb7f53eecd4bb21aec..18f2c93fe7a94dd179baf1c0924ce00c0d606ef5 100644
--- a/Framework/Algorithms/test/CreateTransmissionWorkspaceAutoTest.h
+++ b/Framework/Algorithms/test/CreateTransmissionWorkspaceAutoTest.h
@@ -6,13 +6,11 @@
 #include "MantidAlgorithms/CreateTransmissionWorkspaceAuto.h"
 #include "MantidAPI/FrameworkManager.h"
 #include "MantidAPI/AlgorithmManager.h"
-#include <boost/assign/list_of.hpp>
 #include <boost/lexical_cast.hpp>
 
 using Mantid::Algorithms::CreateTransmissionWorkspaceAuto;
 using namespace Mantid::API;
 using namespace Mantid::Kernel;
-using namespace boost::assign;
 using Mantid::MantidVec;
 
 namespace {
diff --git a/Framework/Algorithms/test/CreateTransmissionWorkspaceTest.h b/Framework/Algorithms/test/CreateTransmissionWorkspaceTest.h
index 7aea590eafb746d40b0e4093e294cd9c199ad5a2..f0577504a8938706ea0af874e938cb2c6f457dcf 100644
--- a/Framework/Algorithms/test/CreateTransmissionWorkspaceTest.h
+++ b/Framework/Algorithms/test/CreateTransmissionWorkspaceTest.h
@@ -10,7 +10,6 @@
 
 #include <cxxtest/TestSuite.h>
 #include <algorithm>
-#include <boost/assign.hpp>
 #include "MantidAlgorithms/ReflectometryReductionOne.h"
 #include "MantidAPI/AlgorithmManager.h"
 #include "MantidAPI/Axis.h"
@@ -65,10 +64,8 @@ public:
     m_tinyReflWS = create2DWorkspaceWithReflectometryInstrument();
 
     FrameworkManager::Instance();
-    MantidVec xData =
-        boost::assign::list_of(0)(0)(0)(0).convert_to_container<MantidVec>();
-    MantidVec yData =
-        boost::assign::list_of(0)(0)(0).convert_to_container<MantidVec>();
+    MantidVec xData = {0, 0, 0, 0};
+    MantidVec yData = {0, 0, 0};
 
     auto createWorkspace =
         AlgorithmManager::Instance().createUnmanaged("CreateWorkspace");
@@ -106,8 +103,7 @@ public:
     auto alg = construct_standard_algorithm();
     alg->setProperty("FirstTransmissionRun", m_TOF);
     alg->setProperty("SecondTransmissionRun", m_TOF);
-    MantidVec params =
-        boost::assign::list_of(0.0)(0.1)(1.0).convert_to_container<MantidVec>();
+    MantidVec params = {0.0, 0.1, 1.0};
     alg->setProperty("Params", params);
     alg->setProperty("StartOverlap", 0.6);
     alg->setProperty("EndOverlap", 0.4);
diff --git a/Framework/Algorithms/test/DiffractionFocussing2Test.h b/Framework/Algorithms/test/DiffractionFocussing2Test.h
index 59e85081f299adef2713c427bbeb563813382774..78d717e83e79e6629e72c5048c35b37b875931ac 100644
--- a/Framework/Algorithms/test/DiffractionFocussing2Test.h
+++ b/Framework/Algorithms/test/DiffractionFocussing2Test.h
@@ -203,7 +203,7 @@ public:
     // Now let's test the grouping of detector UDETS to groups
     for (size_t wi = 0; wi < output->getNumberHistograms(); wi++) {
       // This is the list of the detectors (grouped)
-      std::set<detid_t> mylist = output->getSpectrum(wi)->getDetectorIDs();
+      auto mylist = output->getSpectrum(wi)->getDetectorIDs();
       // 1024 pixels in a bank
       TS_ASSERT_EQUALS(mylist.size(), bankWidthInPixels * bankWidthInPixels);
     }
diff --git a/Framework/Algorithms/test/EditInstrumentGeometryTest.h b/Framework/Algorithms/test/EditInstrumentGeometryTest.h
index f0ba68a4ee1ab17000994576f0c510f38bb09431..1db033238c7fcecb4b5db6d6cb1c1654d8317aa2 100644
--- a/Framework/Algorithms/test/EditInstrumentGeometryTest.h
+++ b/Framework/Algorithms/test/EditInstrumentGeometryTest.h
@@ -61,11 +61,10 @@ public:
     API::ISpectrum *spectrum1 = workspace->getSpectrum(0);
     Geometry::Instrument_const_sptr instrument = workspace->getInstrument();
 
-    std::set<detid_t> detids = spectrum1->getDetectorIDs();
+    auto detids = spectrum1->getDetectorIDs();
     TS_ASSERT_EQUALS(detids.size(), 1);
     detid_t detid = 0;
-    std::set<detid_t>::iterator it;
-    for (it = detids.begin(); it != detids.end(); ++it) {
+    for (auto it = detids.begin(); it != detids.end(); ++it) {
       detid = *it;
     }
     Geometry::IDetector_const_sptr detector = instrument->getDetector(detid);
@@ -172,11 +171,10 @@ public:
     API::ISpectrum *spectrum1 = workspace->getSpectrum(wsindex);
     Geometry::Instrument_const_sptr instrument = workspace->getInstrument();
 
-    std::set<detid_t> detids = spectrum1->getDetectorIDs();
+    auto detids = spectrum1->getDetectorIDs();
     TS_ASSERT_EQUALS(detids.size(), 1);
     detid_t detid = 0;
-    std::set<detid_t>::iterator it;
-    for (it = detids.begin(); it != detids.end(); ++it) {
+    for (auto it = detids.begin(); it != detids.end(); ++it) {
       detid = *it;
     }
     Geometry::IDetector_const_sptr detector = instrument->getDetector(detid);
@@ -195,11 +193,10 @@ public:
     API::ISpectrum *spectrum1 = workspace->getSpectrum(wsindex);
     Geometry::Instrument_const_sptr instrument = workspace->getInstrument();
 
-    std::set<detid_t> detids = spectrum1->getDetectorIDs();
+    auto detids = spectrum1->getDetectorIDs();
     TS_ASSERT_EQUALS(detids.size(), 1);
     detid_t thisdetid = 0;
-    std::set<detid_t>::iterator it;
-    for (it = detids.begin(); it != detids.end(); ++it) {
+    for (auto it = detids.begin(); it != detids.end(); ++it) {
       thisdetid = *it;
     }
 
diff --git a/Framework/Algorithms/test/ExtractMaskToTableTest.h b/Framework/Algorithms/test/ExtractMaskToTableTest.h
index 34cbda9cbfae5113fb33960c30d0ebbd835c9c9b..78b338148bc4bcebb09b6bdef335d1b83d0f1f11 100644
--- a/Framework/Algorithms/test/ExtractMaskToTableTest.h
+++ b/Framework/Algorithms/test/ExtractMaskToTableTest.h
@@ -183,7 +183,7 @@ public:
     AnalysisDataService::Instance().addOrReplace("TestWorkspace2", inputws);
 
     // Create a table workspace to append to
-    TableWorkspace_sptr existtablews(new TableWorkspace());
+    auto existtablews = boost::make_shared<TableWorkspace>();
     existtablews->addColumn("double", "XMin");
     existtablews->addColumn("double", "XMax");
     existtablews->addColumn("str", "DetectorIDsList");
@@ -289,7 +289,7 @@ public:
     AnalysisDataService::Instance().addOrReplace("TestWorkspace2", inputws);
 
     // Create a table workspace to append to
-    TableWorkspace_sptr existtablews(new TableWorkspace());
+    auto existtablews = boost::make_shared<TableWorkspace>();
     existtablews->addColumn("double", "XMin");
     existtablews->addColumn("double", "XMax");
     existtablews->addColumn("str", "DetectorIDsList");
diff --git a/Framework/Algorithms/test/ExtractSingleSpectrumTest.h b/Framework/Algorithms/test/ExtractSingleSpectrumTest.h
index b5dbbdd1a1900b3ae197ff1a2190e8449ed5475d..c760c0f5fea7a96de358637eb7512e194c7e90ad 100644
--- a/Framework/Algorithms/test/ExtractSingleSpectrumTest.h
+++ b/Framework/Algorithms/test/ExtractSingleSpectrumTest.h
@@ -113,7 +113,7 @@ private:
     TS_ASSERT_THROWS_NOTHING(spectrum = outputWS->getSpectrum(0));
     if (spectrum) {
       TS_ASSERT_EQUALS(spectrum->getSpectrumNo(), specID);
-      std::set<detid_t> detids = spectrum->getDetectorIDs();
+      auto detids = spectrum->getDetectorIDs();
       TS_ASSERT_EQUALS(detids.size(), 1);
       const detid_t id = *(detids.begin());
       TS_ASSERT_EQUALS(id, detID);
diff --git a/Framework/Algorithms/test/FFTTest.h b/Framework/Algorithms/test/FFTTest.h
index b4d752045e8b8be23a56e97321845e9aeab5109c..ee621fda082084486d62ebe46bf9e6dc031b50eb 100644
--- a/Framework/Algorithms/test/FFTTest.h
+++ b/Framework/Algorithms/test/FFTTest.h
@@ -441,6 +441,95 @@ public:
     FrameworkManager::Instance().deleteWorkspace("FFT_out");
   }
 
+  // Test that unevenly spaced X values are rejected by default
+  void testUnequalBinWidths_Throws() {
+    const int N = 100;
+    auto inputWS = createWS(N, 0, "uneven_points");
+    Mantid::MantidVec &X = inputWS->dataX(0);
+    double aveX = (X[51] + X[49]) / 2.0;
+    X[50] = aveX + 0.01;
+
+    auto fft = FrameworkManager::Instance().createAlgorithm("FFT");
+    fft->initialize();
+    fft->setProperty("InputWorkspace", inputWS);
+    fft->setPropertyValue("OutputWorkspace", "__NotUsed");
+    fft->setPropertyValue("Real", "0");
+    TS_ASSERT_THROWS(fft->execute(), std::runtime_error);
+
+    FrameworkManager::Instance().deleteWorkspace("FFT_WS_uneven_points");
+  }
+
+  // Test that unevenly spaced X values are accepted if the property is set to
+  // do so
+  void testUnequalBinWidths_acceptRoundingErrors() {
+    const int N = 100;
+    auto inputWS = createWS(N, 0, "uneven_points");
+    Mantid::MantidVec &X = inputWS->dataX(0);
+    double aveX = (X[51] + X[49]) / 2.0;
+    X[50] = aveX + 0.01;
+
+    auto fft = FrameworkManager::Instance().createAlgorithm("FFT");
+    fft->initialize();
+    fft->setProperty("InputWorkspace", inputWS);
+    fft->setPropertyValue("OutputWorkspace", "__NotUsed");
+    fft->setPropertyValue("Real", "0");
+    fft->setProperty("AcceptXRoundingErrors", true);
+    TS_ASSERT_THROWS_NOTHING(fft->execute());
+
+    FrameworkManager::Instance().deleteWorkspace("FFT_WS_uneven_points");
+  }
+
+  // Test that algorithm will not accept an empty input workspace
+  void testEmptyInputWorkspace_Throws() {
+    auto inputWS = createWS(1, 0, "empty");
+    auto fft = FrameworkManager::Instance().createAlgorithm("FFT");
+    fft->initialize();
+    fft->setProperty("InputWorkspace", inputWS);
+    fft->setPropertyValue("OutputWorkspace", "__NotUsed");
+    fft->setPropertyValue("Real", "0");
+    TS_ASSERT_THROWS(fft->execute(), std::runtime_error);
+    FrameworkManager::Instance().deleteWorkspace("FFT_WS_empty");
+  }
+
+  void testRealOutOfRange_Throws() {
+    auto inputWS = createWS(100, 0, "real_out_of_range");
+    auto fft = FrameworkManager::Instance().createAlgorithm("FFT");
+    fft->initialize();
+    fft->setProperty("InputWorkspace", inputWS);
+    fft->setPropertyValue("OutputWorkspace", "__NotUsed");
+    fft->setPropertyValue("Real", "100");
+    TS_ASSERT_THROWS(fft->execute(), std::runtime_error);
+    FrameworkManager::Instance().deleteWorkspace("FFT_WS_real_out_of_range");
+  }
+
+  void testImaginaryOutOfRange_Throws() {
+    auto inputWS = createWS(100, 0, "imaginary_out_of_range");
+    auto fft = FrameworkManager::Instance().createAlgorithm("FFT");
+    fft->initialize();
+    fft->setProperty("InputWorkspace", inputWS);
+    fft->setPropertyValue("OutputWorkspace", "__NotUsed");
+    fft->setPropertyValue("Real", "0");
+    fft->setPropertyValue("Imaginary", "100");
+    TS_ASSERT_THROWS(fft->execute(), std::runtime_error);
+    FrameworkManager::Instance().deleteWorkspace(
+        "FFT_WS_imaginary_out_of_range");
+  }
+
+  void testRealImaginarySizeMismatch_Throws() {
+    auto inputWS = createWS(100, 0, "real_mismatch");
+    auto inImagWS = createWS(99, 0, "imag_mismatch");
+    auto fft = FrameworkManager::Instance().createAlgorithm("FFT");
+    fft->initialize();
+    fft->setProperty("InputWorkspace", inputWS);
+    fft->setPropertyValue("OutputWorkspace", "__NotUsed");
+    fft->setPropertyValue("Real", "0");
+    fft->setPropertyValue("Imaginary", "0");
+    fft->setProperty("InputImagWorkspace", inImagWS);
+    TS_ASSERT_THROWS(fft->execute(), std::runtime_error);
+    FrameworkManager::Instance().deleteWorkspace("FFT_WS_real_mismatch");
+    FrameworkManager::Instance().deleteWorkspace("FFT_WS_imag_mismatch");
+  }
+
 private:
   MatrixWorkspace_sptr createWS(int n, int dn, const std::string &name) {
     FrameworkManager::Instance();
diff --git a/Framework/Algorithms/test/FilterEventsTest.h b/Framework/Algorithms/test/FilterEventsTest.h
index 7cd9bfa2d1d534e3c8de2f141dd0b54695c29e0e..016d06ae937a27467b93b5142ec7d5215e66fc76 100644
--- a/Framework/Algorithms/test/FilterEventsTest.h
+++ b/Framework/Algorithms/test/FilterEventsTest.h
@@ -964,7 +964,7 @@ public:
     */
   TableWorkspace_sptr createTimeCorrectionTable(MatrixWorkspace_sptr inpws) {
     // 1. Generate an empty table
-    TableWorkspace_sptr corrtable(new TableWorkspace());
+    auto corrtable = boost::make_shared<TableWorkspace>();
     corrtable->addColumn("int", "DetectorID");
     corrtable->addColumn("double", "Correction");
 
diff --git a/Framework/Algorithms/test/FindPeakBackgroundTest.h b/Framework/Algorithms/test/FindPeakBackgroundTest.h
index 6ca0b22bb5c9b2eefb2abb1ab71709d3a5b0bf13..47f45e6d5ae2035a67bdec6becae945ca4a2bb35 100644
--- a/Framework/Algorithms/test/FindPeakBackgroundTest.h
+++ b/Framework/Algorithms/test/FindPeakBackgroundTest.h
@@ -67,31 +67,14 @@ public:
   /** Generate a workspace for test
    */
   MatrixWorkspace_sptr generateTestWorkspace() {
-    vector<double> data;
-    data.push_back(1);
-    data.push_back(2);
-    data.push_back(1);
-    data.push_back(1);
-    data.push_back(9);
-    data.push_back(11);
-    data.push_back(13);
-    data.push_back(20);
-    data.push_back(24);
-    data.push_back(32);
-    data.push_back(28);
-    data.push_back(48);
-    data.push_back(42);
-    data.push_back(77);
-    data.push_back(67);
-    data.push_back(33);
-    data.push_back(27);
-    data.push_back(20);
-    data.push_back(9);
-    data.push_back(2);
+
+    const size_t size = 20;
+
+    std::array<double, size> data = {{1, 2, 1, 1, 9, 11, 13, 20, 24, 32, 28, 48,
+                                      42, 77, 67, 33, 27, 20, 9, 2}};
 
     MatrixWorkspace_sptr ws = boost::dynamic_pointer_cast<MatrixWorkspace>(
-        WorkspaceFactory::Instance().create("Workspace2D", 1, data.size(),
-                                            data.size()));
+        WorkspaceFactory::Instance().create("Workspace2D", 1, size, size));
 
     MantidVec &vecX = ws->dataX(0);
     MantidVec &vecY = ws->dataY(0);
diff --git a/Framework/Algorithms/test/FindPeaksTest.h b/Framework/Algorithms/test/FindPeaksTest.h
index b4aa14948cb674ca8e872eb59f3027ff426d9f75..a87022c16fcf3bb88c41121415c534acc7aa2fa1 100644
--- a/Framework/Algorithms/test/FindPeaksTest.h
+++ b/Framework/Algorithms/test/FindPeaksTest.h
@@ -221,267 +221,54 @@ public:
    * d = 1.235
     */
   MatrixWorkspace_sptr getSinglePeakData() {
-    std::vector<double> vecX, vecY, vecE;
-    vecX.push_back(1.21012);
-    vecY.push_back(1619);
-    vecE.push_back(40.2368);
-    vecX.push_back(1.2106);
-    vecY.push_back(1644);
-    vecE.push_back(40.5463);
-    vecX.push_back(1.21108);
-    vecY.push_back(1616);
-    vecE.push_back(40.1995);
-    vecX.push_back(1.21157);
-    vecY.push_back(1589);
-    vecE.push_back(39.8623);
-    vecX.push_back(1.21205);
-    vecY.push_back(1608);
-    vecE.push_back(40.0999);
-    vecX.push_back(1.21254);
-    vecY.push_back(1612);
-    vecE.push_back(40.1497);
-    vecX.push_back(1.21302);
-    vecY.push_back(1630);
-    vecE.push_back(40.3733);
-    vecX.push_back(1.21351);
-    vecY.push_back(1671);
-    vecE.push_back(40.8779);
-    vecX.push_back(1.21399);
-    vecY.push_back(1588);
-    vecE.push_back(39.8497);
-    vecX.push_back(1.21448);
-    vecY.push_back(1577);
-    vecE.push_back(39.7115);
-    vecX.push_back(1.21497);
-    vecY.push_back(1616);
-    vecE.push_back(40.1995);
-    vecX.push_back(1.21545);
-    vecY.push_back(1556);
-    vecE.push_back(39.4462);
-    vecX.push_back(1.21594);
-    vecY.push_back(1625);
-    vecE.push_back(40.3113);
-    vecX.push_back(1.21642);
-    vecY.push_back(1655);
-    vecE.push_back(40.6817);
-    vecX.push_back(1.21691);
-    vecY.push_back(1552);
-    vecE.push_back(39.3954);
-    vecX.push_back(1.2174);
-    vecY.push_back(1539);
-    vecE.push_back(39.2301);
-    vecX.push_back(1.21788);
-    vecY.push_back(1538);
-    vecE.push_back(39.2173);
-    vecX.push_back(1.21837);
-    vecY.push_back(1542);
-    vecE.push_back(39.2683);
-    vecX.push_back(1.21886);
-    vecY.push_back(1558);
-    vecE.push_back(39.4715);
-    vecX.push_back(1.21935);
-    vecY.push_back(1628);
-    vecE.push_back(40.3485);
-    vecX.push_back(1.21983);
-    vecY.push_back(1557);
-    vecE.push_back(39.4588);
-    vecX.push_back(1.22032);
-    vecY.push_back(1606);
-    vecE.push_back(40.0749);
-    vecX.push_back(1.22081);
-    vecY.push_back(1563);
-    vecE.push_back(39.5348);
-    vecX.push_back(1.2213);
-    vecY.push_back(1611);
-    vecE.push_back(40.1373);
-    vecX.push_back(1.22179);
-    vecY.push_back(1584);
-    vecE.push_back(39.7995);
-    vecX.push_back(1.22228);
-    vecY.push_back(1447);
-    vecE.push_back(38.0395);
-    vecX.push_back(1.22276);
-    vecY.push_back(1532);
-    vecE.push_back(39.1408);
-    vecX.push_back(1.22325);
-    vecY.push_back(1580);
-    vecE.push_back(39.7492);
-    vecX.push_back(1.22374);
-    vecY.push_back(1539);
-    vecE.push_back(39.2301);
-    vecX.push_back(1.22423);
-    vecY.push_back(1513);
-    vecE.push_back(38.8973);
-    vecX.push_back(1.22472);
-    vecY.push_back(1601);
-    vecE.push_back(40.0125);
-    vecX.push_back(1.22521);
-    vecY.push_back(1558);
-    vecE.push_back(39.4715);
-    vecX.push_back(1.2257);
-    vecY.push_back(1567);
-    vecE.push_back(39.5854);
-    vecX.push_back(1.22619);
-    vecY.push_back(1573);
-    vecE.push_back(39.6611);
-    vecX.push_back(1.22668);
-    vecY.push_back(1551);
-    vecE.push_back(39.3827);
-    vecX.push_back(1.22717);
-    vecY.push_back(1465);
-    vecE.push_back(38.2753);
-    vecX.push_back(1.22766);
-    vecY.push_back(1602);
-    vecE.push_back(40.025);
-    vecX.push_back(1.22816);
-    vecY.push_back(1543);
-    vecE.push_back(39.281);
-    vecX.push_back(1.22865);
-    vecY.push_back(1538);
-    vecE.push_back(39.2173);
-    vecX.push_back(1.22914);
-    vecY.push_back(1515);
-    vecE.push_back(38.923);
-    vecX.push_back(1.22963);
-    vecY.push_back(1556);
-    vecE.push_back(39.4462);
-    vecX.push_back(1.23012);
-    vecY.push_back(1574);
-    vecE.push_back(39.6737);
-    vecX.push_back(1.23061);
-    vecY.push_back(1519);
-    vecE.push_back(38.9744);
-    vecX.push_back(1.23111);
-    vecY.push_back(1452);
-    vecE.push_back(38.1051);
-    vecX.push_back(1.2316);
-    vecY.push_back(1568);
-    vecE.push_back(39.598);
-    vecX.push_back(1.23209);
-    vecY.push_back(1522);
-    vecE.push_back(39.0128);
-    vecX.push_back(1.23258);
-    vecY.push_back(1518);
-    vecE.push_back(38.9615);
-    vecX.push_back(1.23308);
-    vecY.push_back(1603);
-    vecE.push_back(40.0375);
-    vecX.push_back(1.23357);
-    vecY.push_back(1538);
-    vecE.push_back(39.2173);
-    vecX.push_back(1.23406);
-    vecY.push_back(1659);
-    vecE.push_back(40.7308);
-    vecX.push_back(1.23456);
-    vecY.push_back(1685);
-    vecE.push_back(41.0488);
-    vecX.push_back(1.23505);
-    vecY.push_back(1763);
-    vecE.push_back(41.9881);
-    vecX.push_back(1.23554);
-    vecY.push_back(1846);
-    vecE.push_back(42.9651);
-    vecX.push_back(1.23604);
-    vecY.push_back(1872);
-    vecE.push_back(43.2666);
-    vecX.push_back(1.23653);
-    vecY.push_back(2018);
-    vecE.push_back(44.9222);
-    vecX.push_back(1.23703);
-    vecY.push_back(2035);
-    vecE.push_back(45.111);
-    vecX.push_back(1.23752);
-    vecY.push_back(2113);
-    vecE.push_back(45.9674);
-    vecX.push_back(1.23802);
-    vecY.push_back(2131);
-    vecE.push_back(46.1628);
-    vecX.push_back(1.23851);
-    vecY.push_back(1921);
-    vecE.push_back(43.8292);
-    vecX.push_back(1.23901);
-    vecY.push_back(1947);
-    vecE.push_back(44.1248);
-    vecX.push_back(1.2395);
-    vecY.push_back(1756);
-    vecE.push_back(41.9047);
-    vecX.push_back(1.24);
-    vecY.push_back(1603);
-    vecE.push_back(40.0375);
-    vecX.push_back(1.2405);
-    vecY.push_back(1602);
-    vecE.push_back(40.025);
-    vecX.push_back(1.24099);
-    vecY.push_back(1552);
-    vecE.push_back(39.3954);
-    vecX.push_back(1.24149);
-    vecY.push_back(1558);
-    vecE.push_back(39.4715);
-    vecX.push_back(1.24199);
-    vecY.push_back(1518);
-    vecE.push_back(38.9615);
-    vecX.push_back(1.24248);
-    vecY.push_back(1512);
-    vecE.push_back(38.8844);
-    vecX.push_back(1.24298);
-    vecY.push_back(1511);
-    vecE.push_back(38.8716);
-    vecX.push_back(1.24348);
-    vecY.push_back(1466);
-    vecE.push_back(38.2884);
-    vecX.push_back(1.24397);
-    vecY.push_back(1474);
-    vecE.push_back(38.3927);
-    vecX.push_back(1.24447);
-    vecY.push_back(1368);
-    vecE.push_back(36.9865);
-    vecX.push_back(1.24497);
-    vecY.push_back(1463);
-    vecE.push_back(38.2492);
-    vecX.push_back(1.24547);
-    vecY.push_back(1447);
-    vecE.push_back(38.0395);
-    vecX.push_back(1.24597);
-    vecY.push_back(1409);
-    vecE.push_back(37.5366);
-    vecX.push_back(1.24646);
-    vecY.push_back(1381);
-    vecE.push_back(37.1618);
-    vecX.push_back(1.24696);
-    vecY.push_back(1478);
-    vecE.push_back(38.4448);
-    vecX.push_back(1.24746);
-    vecY.push_back(1445);
-    vecE.push_back(38.0132);
-    vecX.push_back(1.24796);
-    vecY.push_back(1429);
-    vecE.push_back(37.8021);
-    vecX.push_back(1.24846);
-    vecY.push_back(1447);
-    vecE.push_back(38.0395);
-    vecX.push_back(1.24896);
-    vecY.push_back(1354);
-    vecE.push_back(36.7967);
-    vecX.push_back(1.24946);
-    vecY.push_back(1430);
-    vecE.push_back(37.8153);
-    vecX.push_back(1.24996);
-    vecY.push_back(1440);
-    vecE.push_back(37.9473);
-    vecX.push_back(1.25046);
-    vecY.push_back(1423);
-    vecE.push_back(37.7227);
-
-    size_t sizex = vecX.size();
-    size_t sizey = vecY.size();
+
+    const size_t size = 83;
+
+    std::array<double, size> vecX = {
+        {1.210120, 1.210600, 1.211080, 1.211570, 1.212050, 1.212540, 1.213020,
+         1.213510, 1.213990, 1.214480, 1.214970, 1.215450, 1.215940, 1.216420,
+         1.216910, 1.217400, 1.217880, 1.218370, 1.218860, 1.219350, 1.219830,
+         1.220320, 1.220810, 1.221300, 1.221790, 1.222280, 1.222760, 1.223250,
+         1.223740, 1.224230, 1.224720, 1.225210, 1.225700, 1.226190, 1.226680,
+         1.227170, 1.227660, 1.228160, 1.228650, 1.229140, 1.229630, 1.230120,
+         1.230610, 1.231110, 1.231600, 1.232090, 1.232580, 1.233080, 1.233570,
+         1.234060, 1.234560, 1.235050, 1.235540, 1.236040, 1.236530, 1.237030,
+         1.237520, 1.238020, 1.238510, 1.239010, 1.239500, 1.240000, 1.240500,
+         1.240990, 1.241490, 1.241990, 1.242480, 1.242980, 1.243480, 1.243970,
+         1.244470, 1.244970, 1.245470, 1.245970, 1.246460, 1.246960, 1.247460,
+         1.247960, 1.248460, 1.248960, 1.249460, 1.249960, 1.250460}};
+    std::array<double, size> vecY = {
+        {1619.0, 1644.0, 1616.0, 1589.0, 1608.0, 1612.0, 1630.0, 1671.0, 1588.0,
+         1577.0, 1616.0, 1556.0, 1625.0, 1655.0, 1552.0, 1539.0, 1538.0, 1542.0,
+         1558.0, 1628.0, 1557.0, 1606.0, 1563.0, 1611.0, 1584.0, 1447.0, 1532.0,
+         1580.0, 1539.0, 1513.0, 1601.0, 1558.0, 1567.0, 1573.0, 1551.0, 1465.0,
+         1602.0, 1543.0, 1538.0, 1515.0, 1556.0, 1574.0, 1519.0, 1452.0, 1568.0,
+         1522.0, 1518.0, 1603.0, 1538.0, 1659.0, 1685.0, 1763.0, 1846.0, 1872.0,
+         2018.0, 2035.0, 2113.0, 2131.0, 1921.0, 1947.0, 1756.0, 1603.0, 1602.0,
+         1552.0, 1558.0, 1518.0, 1512.0, 1511.0, 1466.0, 1474.0, 1368.0, 1463.0,
+         1447.0, 1409.0, 1381.0, 1478.0, 1445.0, 1429.0, 1447.0, 1354.0, 1430.0,
+         1440.0, 1423.0}};
+    std::array<double, size> vecE = {{
+        40.236800, 40.546300, 40.199500, 39.862300, 40.099900, 40.149700,
+        40.373300, 40.877900, 39.849700, 39.711500, 40.199500, 39.446200,
+        40.311300, 40.681700, 39.395400, 39.230100, 39.217300, 39.268300,
+        39.471500, 40.348500, 39.458800, 40.074900, 39.534800, 40.137300,
+        39.799500, 38.039500, 39.140800, 39.749200, 39.230100, 38.897300,
+        40.012500, 39.471500, 39.585400, 39.661100, 39.382700, 38.275300,
+        40.025000, 39.281000, 39.217300, 38.923000, 39.446200, 39.673700,
+        38.974400, 38.105100, 39.598000, 39.012800, 38.961500, 40.037500,
+        39.217300, 40.730800, 41.048800, 41.988100, 42.965100, 43.266600,
+        44.922200, 45.111000, 45.967400, 46.162800, 43.829200, 44.124800,
+        41.904700, 40.037500, 40.025000, 39.395400, 39.471500, 38.961500,
+        38.884400, 38.871600, 38.288400, 38.392700, 36.986500, 38.249200,
+        38.039500, 37.536600, 37.161800, 38.444800, 38.013200, 37.802100,
+        38.039500, 36.796700, 37.815300, 37.947300, 37.722700, }};
 
     MatrixWorkspace_sptr dataws = boost::dynamic_pointer_cast<MatrixWorkspace>(
-        WorkspaceFactory::Instance().create("Workspace2D", 1, sizex, sizey));
+        WorkspaceFactory::Instance().create("Workspace2D", 1, size, size));
 
-    for (size_t i = 0; i < sizex; ++i)
+    for (size_t i = 0; i < size; ++i) {
       dataws->dataX(0)[i] = vecX[i];
-
-    for (size_t i = 0; i < sizex; ++i) {
       dataws->dataY(0)[i] = vecY[i];
       dataws->dataE(0)[i] = vecE[i];
     }
diff --git a/Framework/Algorithms/test/FitPeakTest.h b/Framework/Algorithms/test/FitPeakTest.h
index c7dbc0a40337d28baa98c94707e43641ac34ba0d..c6f25de561afe8d01c445f61739639f5606060ef 100644
--- a/Framework/Algorithms/test/FitPeakTest.h
+++ b/Framework/Algorithms/test/FitPeakTest.h
@@ -193,274 +193,63 @@ public:
   /** Generate a workspace contains PG3_4866 5-th peak
     */
   MatrixWorkspace_sptr gen_4866P5Data() {
-    vector<double> vecx, vecy, vece;
-    vecx.push_back(0.58512);
-    vecy.push_back(15917);
-    vece.push_back(126.163);
-    vecx.push_back(0.585354);
-    vecy.push_back(16048);
-    vece.push_back(126.681);
-    vecx.push_back(0.585588);
-    vecy.push_back(16098);
-    vece.push_back(126.878);
-    vecx.push_back(0.585822);
-    vecy.push_back(15855);
-    vece.push_back(125.917);
-    vecx.push_back(0.586057);
-    vecy.push_back(15822);
-    vece.push_back(125.786);
-    vecx.push_back(0.586291);
-    vecy.push_back(15891);
-    vece.push_back(126.06);
-    vecx.push_back(0.586526);
-    vecy.push_back(15772);
-    vece.push_back(125.587);
-    vecx.push_back(0.58676);
-    vecy.push_back(15951);
-    vece.push_back(126.297);
-    vecx.push_back(0.586995);
-    vecy.push_back(15860);
-    vece.push_back(125.936);
-    vecx.push_back(0.58723);
-    vecy.push_back(15813);
-    vece.push_back(125.75);
-    vecx.push_back(0.587465);
-    vecy.push_back(15742);
-    vece.push_back(125.467);
-    vecx.push_back(0.5877);
-    vecy.push_back(15733);
-    vece.push_back(125.431);
-    vecx.push_back(0.587935);
-    vecy.push_back(15594);
-    vece.push_back(124.876);
-    vecx.push_back(0.58817);
-    vecy.push_back(15644);
-    vece.push_back(125.076);
-    vecx.push_back(0.588405);
-    vecy.push_back(15850);
-    vece.push_back(125.897);
-    vecx.push_back(0.588641);
-    vecy.push_back(15623);
-    vece.push_back(124.992);
-    vecx.push_back(0.588876);
-    vecy.push_back(15552);
-    vece.push_back(124.708);
-    vecx.push_back(0.589112);
-    vecy.push_back(15586);
-    vece.push_back(124.844);
-    vecx.push_back(0.589347);
-    vecy.push_back(15524);
-    vece.push_back(124.595);
-    vecx.push_back(0.589583);
-    vecy.push_back(15257);
-    vece.push_back(123.519);
-    vecx.push_back(0.589819);
-    vecy.push_back(15718);
-    vece.push_back(125.371);
-    vecx.push_back(0.590055);
-    vecy.push_back(15427);
-    vece.push_back(124.205);
-    vecx.push_back(0.590291);
-    vecy.push_back(15651);
-    vece.push_back(125.104);
-    vecx.push_back(0.590527);
-    vecy.push_back(15500);
-    vece.push_back(124.499);
-    vecx.push_back(0.590763);
-    vecy.push_back(15611);
-    vece.push_back(124.944);
-    vecx.push_back(0.590999);
-    vecy.push_back(15508);
-    vece.push_back(124.531);
-    vecx.push_back(0.591236);
-    vecy.push_back(15230);
-    vece.push_back(123.41);
-    vecx.push_back(0.591472);
-    vecy.push_back(15111);
-    vece.push_back(122.927);
-    vecx.push_back(0.591709);
-    vecy.push_back(15483);
-    vece.push_back(124.431);
-    vecx.push_back(0.591946);
-    vecy.push_back(15316);
-    vece.push_back(123.758);
-    vecx.push_back(0.592182);
-    vecy.push_back(15256);
-    vece.push_back(123.515);
-    vecx.push_back(0.592419);
-    vecy.push_back(15152);
-    vece.push_back(123.093);
-    vecx.push_back(0.592656);
-    vecy.push_back(15212);
-    vece.push_back(123.337);
-    vecx.push_back(0.592893);
-    vecy.push_back(15282);
-    vece.push_back(123.62);
-    vecx.push_back(0.59313);
-    vecy.push_back(15390);
-    vece.push_back(124.056);
-    vecx.push_back(0.593368);
-    vecy.push_back(15176);
-    vece.push_back(123.191);
-    vecx.push_back(0.593605);
-    vecy.push_back(15374);
-    vece.push_back(123.992);
-    vecx.push_back(0.593842);
-    vecy.push_back(15499);
-    vece.push_back(124.495);
-    vecx.push_back(0.59408);
-    vecy.push_back(16064);
-    vece.push_back(126.744);
-    vecx.push_back(0.594318);
-    vecy.push_back(16324);
-    vece.push_back(127.765);
-    vecx.push_back(0.594555);
-    vecy.push_back(16240);
-    vece.push_back(127.436);
-    vecx.push_back(0.594793);
-    vecy.push_back(15972);
-    vece.push_back(126.38);
-    vecx.push_back(0.595031);
-    vecy.push_back(15770);
-    vece.push_back(125.579);
-    vecx.push_back(0.595269);
-    vecy.push_back(15449);
-    vece.push_back(124.294);
-    vecx.push_back(0.595507);
-    vecy.push_back(15644);
-    vece.push_back(125.076);
-    vecx.push_back(0.595745);
-    vecy.push_back(14972);
-    vece.push_back(122.36);
-    vecx.push_back(0.595984);
-    vecy.push_back(15146);
-    vece.push_back(123.069);
-    vecx.push_back(0.596222);
-    vecy.push_back(14799);
-    vece.push_back(121.651);
-    vecx.push_back(0.596461);
-    vecy.push_back(15151);
-    vece.push_back(123.089);
-    vecx.push_back(0.596699);
-    vecy.push_back(14883);
-    vece.push_back(121.996);
-    vecx.push_back(0.596938);
-    vecy.push_back(14878);
-    vece.push_back(121.975);
-    vecx.push_back(0.597177);
-    vecy.push_back(14891);
-    vece.push_back(122.029);
-    vecx.push_back(0.597415);
-    vecy.push_back(14782);
-    vece.push_back(121.581);
-    vecx.push_back(0.597654);
-    vecy.push_back(14746);
-    vece.push_back(121.433);
-    vecx.push_back(0.597893);
-    vecy.push_back(15020);
-    vece.push_back(122.556);
-    vecx.push_back(0.598133);
-    vecy.push_back(14721);
-    vece.push_back(121.33);
-    vecx.push_back(0.598372);
-    vecy.push_back(14813);
-    vece.push_back(121.709);
-    vecx.push_back(0.598611);
-    vecy.push_back(14744);
-    vece.push_back(121.425);
-    vecx.push_back(0.598851);
-    vecy.push_back(14786);
-    vece.push_back(121.598);
-    vecx.push_back(0.59909);
-    vecy.push_back(14783);
-    vece.push_back(121.585);
-    vecx.push_back(0.59933);
-    vecy.push_back(14876);
-    vece.push_back(121.967);
-    vecx.push_back(0.59957);
-    vecy.push_back(14776);
-    vece.push_back(121.557);
-    vecx.push_back(0.599809);
-    vecy.push_back(14729);
-    vece.push_back(121.363);
-    vecx.push_back(0.600049);
-    vecy.push_back(14806);
-    vece.push_back(121.68);
-    vecx.push_back(0.600289);
-    vecy.push_back(14801);
-    vece.push_back(121.659);
-    vecx.push_back(0.600529);
-    vecy.push_back(14344);
-    vece.push_back(119.766);
-    vecx.push_back(0.60077);
-    vecy.push_back(14675);
-    vece.push_back(121.14);
-    vecx.push_back(0.60101);
-    vecy.push_back(14762);
-    vece.push_back(121.499);
-    vecx.push_back(0.60125);
-    vecy.push_back(14589);
-    vece.push_back(120.785);
-    vecx.push_back(0.601491);
-    vecy.push_back(14561);
-    vece.push_back(120.669);
-    vecx.push_back(0.601731);
-    vecy.push_back(14742);
-    vece.push_back(121.417);
-    vecx.push_back(0.601972);
-    vecy.push_back(14682);
-    vece.push_back(121.169);
-    vecx.push_back(0.602213);
-    vecy.push_back(14634);
-    vece.push_back(120.971);
-    vecx.push_back(0.602454);
-    vecy.push_back(14542);
-    vece.push_back(120.59);
-    vecx.push_back(0.602695);
-    vecy.push_back(14758);
-    vece.push_back(121.483);
-    vecx.push_back(0.602936);
-    vecy.push_back(14667);
-    vece.push_back(121.107);
-    vecx.push_back(0.603177);
-    vecy.push_back(14586);
-    vece.push_back(120.773);
-    vecx.push_back(0.603418);
-    vecy.push_back(14729);
-    vece.push_back(121.363);
-    vecx.push_back(0.60366);
-    vecy.push_back(14581);
-    vece.push_back(120.752);
-    vecx.push_back(0.603901);
-    vecy.push_back(14445);
-    vece.push_back(120.187);
-    vecx.push_back(0.604143);
-    vecy.push_back(14408);
-    vece.push_back(120.033);
-    vecx.push_back(0.604384);
-    vecy.push_back(14569);
-    vece.push_back(120.702);
-    vecx.push_back(0.604626);
-    vecy.push_back(14659);
-    vece.push_back(121.074);
-    vecx.push_back(0.604868);
-    vecy.push_back(14500);
-    vece.push_back(120.416);
 
-    size_t NVectors = 1;
-    size_t sizex = vecx.size();
-    size_t sizey = vecy.size();
+    const size_t size = 84;
+
+    std::array<double, size> vecx = {
+        {0.585120, 0.585354, 0.585588, 0.585822, 0.586057, 0.586291, 0.586526,
+         0.586760, 0.586995, 0.587230, 0.587465, 0.587700, 0.587935, 0.588170,
+         0.588405, 0.588641, 0.588876, 0.589112, 0.589347, 0.589583, 0.589819,
+         0.590055, 0.590291, 0.590527, 0.590763, 0.590999, 0.591236, 0.591472,
+         0.591709, 0.591946, 0.592182, 0.592419, 0.592656, 0.592893, 0.593130,
+         0.593368, 0.593605, 0.593842, 0.594080, 0.594318, 0.594555, 0.594793,
+         0.595031, 0.595269, 0.595507, 0.595745, 0.595984, 0.596222, 0.596461,
+         0.596699, 0.596938, 0.597177, 0.597415, 0.597654, 0.597893, 0.598133,
+         0.598372, 0.598611, 0.598851, 0.599090, 0.599330, 0.599570, 0.599809,
+         0.600049, 0.600289, 0.600529, 0.600770, 0.601010, 0.601250, 0.601491,
+         0.601731, 0.601972, 0.602213, 0.602454, 0.602695, 0.602936, 0.603177,
+         0.603418, 0.603660, 0.603901, 0.604143, 0.604384, 0.604626, 0.604868}};
+    std::array<double, size> vecy = {
+        {15917.0, 16048.0, 16098.0, 15855.0, 15822.0, 15891.0, 15772.0, 15951.0,
+         15860.0, 15813.0, 15742.0, 15733.0, 15594.0, 15644.0, 15850.0, 15623.0,
+         15552.0, 15586.0, 15524.0, 15257.0, 15718.0, 15427.0, 15651.0, 15500.0,
+         15611.0, 15508.0, 15230.0, 15111.0, 15483.0, 15316.0, 15256.0, 15152.0,
+         15212.0, 15282.0, 15390.0, 15176.0, 15374.0, 15499.0, 16064.0, 16324.0,
+         16240.0, 15972.0, 15770.0, 15449.0, 15644.0, 14972.0, 15146.0, 14799.0,
+         15151.0, 14883.0, 14878.0, 14891.0, 14782.0, 14746.0, 15020.0, 14721.0,
+         14813.0, 14744.0, 14786.0, 14783.0, 14876.0, 14776.0, 14729.0, 14806.0,
+         14801.0, 14344.0, 14675.0, 14762.0, 14589.0, 14561.0, 14742.0, 14682.0,
+         14634.0, 14542.0, 14758.0, 14667.0, 14586.0, 14729.0, 14581.0, 14445.0,
+         14408.0, 14569.0, 14659.0, 14500.0}};
+    std::array<double, size> vece = {
+        {126.163000, 126.681000, 126.878000, 125.917000, 125.786000, 126.060000,
+         125.587000, 126.297000, 125.936000, 125.750000, 125.467000, 125.431000,
+         124.876000, 125.076000, 125.897000, 124.992000, 124.708000, 124.844000,
+         124.595000, 123.519000, 125.371000, 124.205000, 125.104000, 124.499000,
+         124.944000, 124.531000, 123.410000, 122.927000, 124.431000, 123.758000,
+         123.515000, 123.093000, 123.337000, 123.620000, 124.056000, 123.191000,
+         123.992000, 124.495000, 126.744000, 127.765000, 127.436000, 126.380000,
+         125.579000, 124.294000, 125.076000, 122.360000, 123.069000, 121.651000,
+         123.089000, 121.996000, 121.975000, 122.029000, 121.581000, 121.433000,
+         122.556000, 121.330000, 121.709000, 121.425000, 121.598000, 121.585000,
+         121.967000, 121.557000, 121.363000, 121.680000, 121.659000, 119.766000,
+         121.140000, 121.499000, 120.785000, 120.669000, 121.417000, 121.169000,
+         120.971000, 120.590000, 121.483000, 121.107000, 120.773000, 121.363000,
+         120.752000, 120.187000, 120.033000, 120.702000, 121.074000,
+         120.416000}};
+
+    const size_t NVectors = 1;
+
     MatrixWorkspace_sptr ws = boost::dynamic_pointer_cast<MatrixWorkspace>(
-        WorkspaceFactory::Instance().create("Workspace2D", NVectors, sizex,
-                                            sizey));
+        WorkspaceFactory::Instance().create("Workspace2D", NVectors, size,
+                                            size));
 
     MantidVec &vecX = ws->dataX(0);
     MantidVec &vecY = ws->dataY(0);
     MantidVec &vecE = ws->dataE(0);
 
-    for (size_t i = 0; i < sizex; ++i)
+    for (size_t i = 0; i < size; ++i) {
       vecX[i] = vecx[i];
-    for (size_t i = 0; i < sizey; ++i) {
       vecY[i] = vecy[i];
       vecE[i] = vece[i];
     }
diff --git a/Framework/Algorithms/test/GeneralisedSecondDifferenceTest.h b/Framework/Algorithms/test/GeneralisedSecondDifferenceTest.h
index 527d5f2dac4fce148997a250bfac557e17818043..f2437b7df29607a1e36f5c6be32be6b50e12c11b 100644
--- a/Framework/Algorithms/test/GeneralisedSecondDifferenceTest.h
+++ b/Framework/Algorithms/test/GeneralisedSecondDifferenceTest.h
@@ -7,8 +7,6 @@
 #include "MantidAPI/MatrixWorkspace.h"
 #include "MantidAPI/WorkspaceFactory.h"
 
-#include <boost/assign.hpp>
-
 using namespace Mantid::API;
 
 class GeneralisedSecondDifferenceTest : public CxxTest::TestSuite {
@@ -30,10 +28,9 @@ public:
     IAlgorithm_sptr gsd = Mantid::API::AlgorithmManager::Instance().create(
         "GeneralisedSecondDifference", 1);
 
-    std::vector<double> x =
-        boost::assign::list_of(0)(1)(2)(3)(4)(5)(6)(7)(8)(9);
-    std::vector<double> y = boost::assign::list_of(0.3)(0.3)(0.3)(0.47)(3.9)(
-        10.3)(3.9)(0.47)(0.3)(0.3);
+    std::vector<double> x = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+    std::vector<double> y = {0.3,  0.3, 0.3,  0.47, 3.9,
+                             10.3, 3.9, 0.47, 0.3,  0.3};
     MatrixWorkspace_sptr inputWs = WorkspaceFactory::Instance().create(
         "Workspace2D", 1, y.size(), y.size());
     inputWs->dataY(0) = y;
diff --git a/Framework/Algorithms/test/GenerateIPythonNotebookTest.h b/Framework/Algorithms/test/GenerateIPythonNotebookTest.h
index 6fe2a090577cade4a05eb1fc8a4a9bbe4b32ceda..d1d4bc09f9a00af289023c01d33eb02ae7104933 100644
--- a/Framework/Algorithms/test/GenerateIPythonNotebookTest.h
+++ b/Framework/Algorithms/test/GenerateIPythonNotebookTest.h
@@ -82,24 +82,21 @@ public:
     std::string filename = alg.getProperty("Filename");
     std::ifstream file(filename.c_str(), std::ifstream::in);
     std::string notebookLine;
-    int lineCount = 0;
 
+    int lineCount = 0;
+    std::vector<std::string> notebookLines;
     while (std::getline(file, notebookLine)) {
+      notebookLines.push_back(notebookLine);
       if (lineCount < 8) {
-        TS_ASSERT_EQUALS(result[lineCount], notebookLine)
-      } else if (lineCount == 88) {
-        TS_ASSERT_EQUALS("               \"input\" : "
-                         "\"Power(InputWorkspace='testGenerateIPythonNotebook',"
-                         " OutputWorkspace='testGenerateIPythonNotebook', "
-                         "Exponent=1.5)\",",
-                         notebookLine)
-      } else if (lineCount == 64) {
-        TS_ASSERT_EQUALS(
-            "               \"input\" : \"NonExistingAlgorithm()\",",
-            notebookLine)
+        TS_ASSERT_EQUALS(result[lineCount], notebookLine);
+        lineCount++;
       }
-      // else if (lineCount == )
-      lineCount++;
+    }
+
+    // Check that the expected lines do appear in the output
+    for (auto const expected_line : result) {
+      TS_ASSERT(std::find(notebookLines.cbegin(), notebookLines.cend(),
+                          expected_line) != notebookLines.cend())
     }
 
     // Verify that if we set the content of NotebookText that it is set
diff --git a/Framework/Algorithms/test/GetAllEiTest.h b/Framework/Algorithms/test/GetAllEiTest.h
index 7d56d752534754bd1459cb6a38cd6c294031b794..46610c8200068ec4c9dd94e3de0bd24be1d73faa 100644
--- a/Framework/Algorithms/test/GetAllEiTest.h
+++ b/Framework/Algorithms/test/GetAllEiTest.h
@@ -142,8 +142,8 @@ public:
     m_getAllEi.setProperty("FilterBaseLog", "proton_charge");
     m_getAllEi.setProperty("FilterWithDerivative", false);
 
-    std::unique_ptr<Kernel::TimeSeriesProperty<double>> chopSpeed(
-        new Kernel::TimeSeriesProperty<double>("Chopper_Speed"));
+    auto chopSpeed = Kernel::make_unique<Kernel::TimeSeriesProperty<double>>(
+        "Chopper_Speed");
     for (int i = 0; i < 10; i++) {
       chopSpeed->addValue(Kernel::DateAndTime(10000 + 10 * i, 0), 1.);
     }
@@ -171,10 +171,10 @@ public:
     TS_ASSERT_DELTA(val, 10., 1.e-6);
 
     // Test sort log by log.
-    std::unique_ptr<Kernel::TimeSeriesProperty<double>> chopDelay(
-        new Kernel::TimeSeriesProperty<double>("Chopper_Delay"));
-    std::unique_ptr<Kernel::TimeSeriesProperty<double>> goodFram(
-        new Kernel::TimeSeriesProperty<double>("proton_charge"));
+    auto chopDelay = Kernel::make_unique<Kernel::TimeSeriesProperty<double>>(
+        "Chopper_Delay");
+    auto goodFram = Kernel::make_unique<Kernel::TimeSeriesProperty<double>>(
+        "proton_charge");
 
     for (int i = 0; i < 10; i++) {
       auto time = Kernel::DateAndTime(200 + 10 * i, 0);
@@ -208,7 +208,8 @@ public:
     TSM_ASSERT_DELTA("Chopper delay should have special speed ",
                      (10 * 0.1 + 20) / 12., chop_delay, 1.e-6);
 
-    goodFram.reset(new Kernel::TimeSeriesProperty<double>("proton_charge"));
+    goodFram = Kernel::make_unique<Kernel::TimeSeriesProperty<double>>(
+        "proton_charge");
     for (int i = 0; i < 10; i++) {
       auto time = Kernel::DateAndTime(100 + 10 * i, 0);
       goodFram->addValue(time, 1);
@@ -237,12 +238,12 @@ public:
     m_getAllEi.setProperty("FilterWithDerivative", true);
 
     // Test select log by log derivative
-    std::unique_ptr<Kernel::TimeSeriesProperty<double>> chopDelay(
-        new Kernel::TimeSeriesProperty<double>("Chopper_Delay"));
-    std::unique_ptr<Kernel::TimeSeriesProperty<double>> chopSpeed(
-        new Kernel::TimeSeriesProperty<double>("Chopper_Speed"));
-    std::unique_ptr<Kernel::TimeSeriesProperty<double>> protCharge(
-        new Kernel::TimeSeriesProperty<double>("proton_charge"));
+    auto chopDelay = Kernel::make_unique<Kernel::TimeSeriesProperty<double>>(
+        "Chopper_Delay");
+    auto chopSpeed = Kernel::make_unique<Kernel::TimeSeriesProperty<double>>(
+        "Chopper_Speed");
+    auto protCharge = Kernel::make_unique<Kernel::TimeSeriesProperty<double>>(
+        "proton_charge");
 
     double gf(0);
     for (int i = 0; i < 50; i++) {
@@ -560,12 +561,12 @@ private:
     if (noLogs)
       return ws;
 
-    std::unique_ptr<Kernel::TimeSeriesProperty<double>> chopDelayLog(
-        new Kernel::TimeSeriesProperty<double>("Chopper_Delay"));
-    std::unique_ptr<Kernel::TimeSeriesProperty<double>> chopSpeedLog(
-        new Kernel::TimeSeriesProperty<double>("Chopper_Speed"));
-    std::unique_ptr<Kernel::TimeSeriesProperty<double>> isRunning(
-        new Kernel::TimeSeriesProperty<double>("is_running"));
+    auto chopDelayLog = Kernel::make_unique<Kernel::TimeSeriesProperty<double>>(
+        "Chopper_Delay");
+    auto chopSpeedLog = Kernel::make_unique<Kernel::TimeSeriesProperty<double>>(
+        "Chopper_Speed");
+    auto isRunning =
+        Kernel::make_unique<Kernel::TimeSeriesProperty<double>>("is_running");
 
     for (int i = 0; i < 10; i++) {
       auto time = Kernel::DateAndTime(10 * i, 0);
diff --git a/Framework/Algorithms/test/IntegrationTest.h b/Framework/Algorithms/test/IntegrationTest.h
index 02c7c918aa14c85bcc6638e76dd667415c244791..e759812bb23449e8140c6fc328a03980d7d97ba9 100644
--- a/Framework/Algorithms/test/IntegrationTest.h
+++ b/Framework/Algorithms/test/IntegrationTest.h
@@ -240,12 +240,7 @@ public:
     integ.execute();
     TS_ASSERT(integ.isExecuted());
 
-    // No longer output an EventWorkspace, Rebin should be used instead
-    // EventWorkspace_sptr output;
-    // TS_ASSERT_THROWS_NOTHING(output =
-    // boost::dynamic_pointer_cast<EventWorkspace>(
-    // AnalysisDataService::Instance().retrieve(outName) ) );
-
+    // No longer output an EventWorkspace
     Workspace_sptr output;
     TS_ASSERT_THROWS_NOTHING(
         output = AnalysisDataService::Instance().retrieve(outName));
diff --git a/Framework/Algorithms/test/InvertMaskTest.h b/Framework/Algorithms/test/InvertMaskTest.h
index 422422e53fdcd67113f75685e0eab062da2e5194..20d5f8d0532a0a166b9e4da02b9ae80027daa3f5 100644
--- a/Framework/Algorithms/test/InvertMaskTest.h
+++ b/Framework/Algorithms/test/InvertMaskTest.h
@@ -67,7 +67,7 @@ public:
 
     // 4. Check output
     for (size_t ih = 0; ih < ws4->getNumberHistograms(); ih++) {
-      std::set<detid_t> tempdetids = ws4->getDetectorIDs(ih);
+      auto tempdetids = ws4->getDetectorIDs(ih);
       detid_t tempdetid = *(tempdetids.begin());
       TS_ASSERT_EQUALS(tempdetids.size(), 1);
       TS_ASSERT_DELTA(ws4->getValue(tempdetid), ws1->getValue(tempdetid), 1);
diff --git a/Framework/Algorithms/test/MaskBinsFromTableTest.h b/Framework/Algorithms/test/MaskBinsFromTableTest.h
index 72e265cbfa7753823d58d3d0ef7efeb67295b2f9..71fb96fa7da66da2c140bec39ce26869d0aa1c26 100644
--- a/Framework/Algorithms/test/MaskBinsFromTableTest.h
+++ b/Framework/Algorithms/test/MaskBinsFromTableTest.h
@@ -279,16 +279,16 @@ public:
              << ".\n";
         return;
       } else {
-        std::set<detid_t> detidset = spec->getDetectorIDs();
-        set<detid_t>::iterator setiter;
-        for (setiter = detidset.begin(); setiter != detidset.end(); ++setiter)
+        auto detidset = spec->getDetectorIDs();
+        for (auto setiter = detidset.begin(); setiter != detidset.end();
+             ++setiter)
           cout << "WorkspaceIndex = " << i << ":  Detector ID = " << *setiter
                << ".\n";
       }
     }
 
     // Generate a TableWorksapce
-    TableWorkspace_sptr tablews(new TableWorkspace());
+    auto tablews = boost::make_shared<TableWorkspace>();
     tablews->addColumn("str", "DetectorIDsList");
     tablews->addColumn("double", "XMin");
     tablews->addColumn("double", "XMax");
diff --git a/Framework/Algorithms/test/MultipleScatteringCylinderAbsorptionTest.h b/Framework/Algorithms/test/MultipleScatteringCylinderAbsorptionTest.h
index b887acb571cbcbe851246907194a7fe063f4a009..f5c531362ae6c5422e2b43a650f92d3ebce051e4 100644
--- a/Framework/Algorithms/test/MultipleScatteringCylinderAbsorptionTest.h
+++ b/Framework/Algorithms/test/MultipleScatteringCylinderAbsorptionTest.h
@@ -109,27 +109,15 @@ public:
     TS_ASSERT(test_output_WS);
 
     // setup expected values
-    std::vector<double> y_expected;
-    y_expected.push_back(2.22389);
-    y_expected.push_back(2.2924);
-    y_expected.push_back(2.36292);
-    y_expected.push_back(2.43552);
-    y_expected.push_back(2.51024);
-    y_expected.push_back(2.58716);
-    y_expected.push_back(2.66632);
-    y_expected.push_back(2.7478);
-    y_expected.push_back(2.83166);
-    y_expected.push_back(2.91796);
-    y_expected.push_back(3.00678);
-    y_expected.push_back(3.0982);
-    y_expected.push_back(3.19228);
-    y_expected.push_back(3.28912);
-    y_expected.push_back(3.38879);
-    y_expected.push_back(3.49139);
+    const size_t size = 16;
+    std::array<double, size> y_expected = {
+        {2.22389, 2.2924, 2.36292, 2.43552, 2.51024, 2.58716, 2.66632, 2.7478,
+         2.83166, 2.91796, 3.00678, 3.0982, 3.19228, 3.28912, 3.38879,
+         3.49139}};
 
     // do the final comparison
     const MantidVec &y_actual = test_output_WS->readY(0);
-    for (size_t i = 0; i < y_expected.size(); i++)
+    for (size_t i = 0; i < size; i++)
       TS_ASSERT_DELTA(y_actual[i], y_expected[i], 0.00001);
 
     // cleanup
diff --git a/Framework/Algorithms/test/PlusMinusTest.in.h b/Framework/Algorithms/test/PlusMinusTest.in.h
index be37447afe5a6ae5eb69db1eddbc130dfd836e77..603bdc16992a7f47488388d1c5725ce792ee8564 100644
--- a/Framework/Algorithms/test/PlusMinusTest.in.h
+++ b/Framework/Algorithms/test/PlusMinusTest.in.h
@@ -583,7 +583,7 @@ public:
       //But two detector IDs in each one
       for (int i=0; i<3; i++)
       {
-        std::set<detid_t>::const_iterator detIT = work_out->getSpectrum(i)->getDetectorIDs().begin();
+        auto detIT = work_out->getSpectrum(i)->getDetectorIDs().begin();
         TS_ASSERT_EQUALS( *detIT, 0+i );
         if (DO_PLUS)
         {
diff --git a/Framework/Algorithms/test/RebinByTimeAtSampleTest.h b/Framework/Algorithms/test/RebinByTimeAtSampleTest.h
index df703fc6d5dd18bc4cbc6e617335839f08efbdb1..6c1031272778653ce186907686e792ffe245be29 100644
--- a/Framework/Algorithms/test/RebinByTimeAtSampleTest.h
+++ b/Framework/Algorithms/test/RebinByTimeAtSampleTest.h
@@ -222,8 +222,8 @@ public:
     alg.setChild(true);
     alg.initialize();
     alg.setProperty("InputWorkspace", inWS);
-    Mantid::MantidVec rebinArgs = boost::assign::list_of<double>(0)(1e-3)(
-        6e-3); // Provide rebin arguments. Arguments are in seconds.
+    Mantid::MantidVec rebinArgs = {
+        0, 1e-3, 6e-3}; // Provide rebin arguments. Arguments are in seconds.
     alg.setProperty("Params", rebinArgs);
     alg.setPropertyValue("OutputWorkspace", "outWS");
     alg.execute();
@@ -238,7 +238,8 @@ public:
      0e-3    1e-3   2e-3    3e-3    4e-3    5e-3    6e-3
      |       |      |       |       |       |       |         X array
      -----------^      ^                   ^
-     -----------|      |                   |                  TOF pulse times
+     -----------|      |                   |                  TOF pulse
+     times
      ----------5*1/3  5*1/2               5*1/1
      ----------spec3  spec2               spec1
 
diff --git a/Framework/Algorithms/test/RebinByTimeBaseTest.h b/Framework/Algorithms/test/RebinByTimeBaseTest.h
index 780e7305949fa7d4579d00ea7f92f8358d1c1dc3..b80f267668c78a59ebf9e9698aaa7bf6fc5abbe0 100644
--- a/Framework/Algorithms/test/RebinByTimeBaseTest.h
+++ b/Framework/Algorithms/test/RebinByTimeBaseTest.h
@@ -16,7 +16,6 @@
 #include "MantidDataObjects/Events.h"
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
 #include <boost/make_shared.hpp>
-#include <boost/assign/list_of.hpp>
 #include <gmock/gmock.h>
 
 using namespace Mantid::Algorithms;
@@ -135,8 +134,9 @@ private:
     alg.setRethrows(true);
     alg.initialize();
     alg.setProperty("InputWorkspace", inWS);
-    Mantid::MantidVec rebinArgs = boost::assign::list_of<double>(pulseTimeMin)(
-        step)(pulseTimeMax); // Provide rebin arguments.
+    auto rebinArgsList = {double(pulseTimeMin), double(step),
+                          double(pulseTimeMax)};
+    Mantid::MantidVec rebinArgs = rebinArgsList; // Provide rebin arguments.
     alg.setProperty("Params", rebinArgs);
     alg.setPropertyValue("OutputWorkspace", "outWS");
     alg.execute();
@@ -194,7 +194,8 @@ public:
     alg.setRethrows(true);
     alg.initialize();
     alg.setProperty("InputWorkspace", ws);
-    Mantid::MantidVec rebinArgs = boost::assign::list_of<double>(1);
+    auto rebinArgsList = {double(1)};
+    Mantid::MantidVec rebinArgs = rebinArgsList;
     alg.setProperty("Params", rebinArgs);
     alg.setPropertyValue("OutputWorkspace", "outWS");
     try {
@@ -218,8 +219,8 @@ public:
     alg.setRethrows(true);
     alg.initialize();
     alg.setProperty("InputWorkspace", ws);
-    Mantid::MantidVec rebinArgs1 =
-        boost::assign::list_of<double>(badStep); // Step is zero!.
+    auto rebinArgs1List = {double(badStep)};
+    Mantid::MantidVec rebinArgs1 = rebinArgs1List; // Step is zero!.
     alg.setProperty("Params", rebinArgs1);
     alg.setPropertyValue("OutputWorkspace", "outWS");
     try {
@@ -360,8 +361,9 @@ public:
     AlgorithmType alg;
     alg.setRethrows(true);
     alg.initialize();
-    Mantid::MantidVec rebinArgs = boost::assign::list_of<double>(pulseTimeMin)(
-        step)(pulseTimeMax); // Provide rebin arguments.
+    auto rebinArgsList = {double(pulseTimeMin), double(step),
+                          double(pulseTimeMax)};
+    Mantid::MantidVec rebinArgs = rebinArgsList; // Provide rebin arguments.
 
     try {
       alg.setProperty("Params", rebinArgs);
@@ -388,9 +390,11 @@ public:
     alg.setRethrows(true);
     alg.initialize();
     alg.setProperty("InputWorkspace", ws);
-    Mantid::MantidVec rebinArgs = boost::assign::list_of<double>(
-        step); // Provide rebin arguments. Note we are only providing the step,
-               // xmin and xmax are calculated internally!
+    auto rebinArgsList = {double(step)};
+    Mantid::MantidVec rebinArgs = rebinArgsList; // Provide rebin arguments.
+                                                 // Note we are only providing
+                                                 // the step,
+    // xmin and xmax are calculated internally!
     alg.setProperty("Params", rebinArgs);
     alg.setPropertyValue("OutputWorkspace", "outWS");
     alg.execute();
@@ -442,8 +446,9 @@ public:
     alg.setRethrows(true);
     alg.initialize();
     alg.setProperty("InputWorkspace", ws);
-    Mantid::MantidVec rebinArgs = boost::assign::list_of<double>(pulseTimeMin)(
-        step)(pulseTimeMax); // Provide rebin arguments.
+    auto rebinArgsList = {double(pulseTimeMin), double(step),
+                          double(pulseTimeMax)};
+    Mantid::MantidVec rebinArgs = rebinArgsList; // Provide rebin arguments.
     alg.setProperty("Params", rebinArgs);
     alg.setPropertyValue("OutputWorkspace", "outWS");
     alg.execute();
@@ -499,8 +504,9 @@ public:
     alg.setRethrows(true);
     alg.initialize();
     alg.setProperty("InputWorkspace", m_ws);
-    Mantid::MantidVec rebinArgs = boost::assign::list_of<double>(dPulseTimeMin)(
-        step)(dPulseTimeMax); // Provide rebin arguments.
+    auto rebinArgsList = {double(dPulseTimeMin), double(step),
+                          double(dPulseTimeMax)};
+    Mantid::MantidVec rebinArgs = rebinArgsList; // Provide rebin arguments.
     alg.setProperty("Params", rebinArgs);
     alg.setPropertyValue("OutputWorkspace", "outWS");
     TS_ASSERT_THROWS_NOTHING(alg.execute());
diff --git a/Framework/Algorithms/test/RebinTest.h b/Framework/Algorithms/test/RebinTest.h
index 4e4599c91d8cf72285bb25a1a81bb9cdec8c9ceb..867575f015166569ab8c06d37236feda31f19a64 100644
--- a/Framework/Algorithms/test/RebinTest.h
+++ b/Framework/Algorithms/test/RebinTest.h
@@ -14,8 +14,6 @@
 #include "MantidAPI/SpectraAxis.h"
 #include "MantidAPI/ScopedWorkspace.h"
 
-#include <boost/assign/list_of.hpp>
-
 using namespace Mantid;
 using namespace Mantid::Kernel;
 using namespace Mantid::DataObjects;
@@ -456,17 +454,15 @@ public:
   }
 
   void test_FullBinsOnly_Fixed() {
-    std::vector<double> xExpected = boost::assign::list_of(0.5)(2.5)(4.5)(6.5);
+    std::vector<double> xExpected = {0.5, 2.5, 4.5, 6.5};
     std::vector<double> yExpected(3, 8.0);
     std::string params = "2.0";
     do_test_FullBinsOnly(params, yExpected, xExpected);
   }
 
   void test_FullBinsOnly_Variable() {
-    std::vector<double> xExpected =
-        boost::assign::list_of(0.5)(1.5)(2.5)(3.2)(3.9)(4.6)(6.6);
-    std::vector<double> yExpected =
-        boost::assign::list_of(4.0)(4.0)(2.8)(2.8)(2.8)(8.0);
+    std::vector<double> xExpected = {0.5, 1.5, 2.5, 3.2, 3.9, 4.6, 6.6};
+    std::vector<double> yExpected = {4.0, 4.0, 2.8, 2.8, 2.8, 8.0};
     std::string params = "0.5, 1.0, 3.1, 0.7, 5.0, 2.0, 7.25";
     do_test_FullBinsOnly(params, yExpected, xExpected);
   }
diff --git a/Framework/Algorithms/test/ReflectometryReductionOneAutoTest.h b/Framework/Algorithms/test/ReflectometryReductionOneAutoTest.h
index 1abb5721cc13ba0b16e03e5fe857a79b26ada506..2da09671da9307802688b86210152da67af9d231 100644
--- a/Framework/Algorithms/test/ReflectometryReductionOneAutoTest.h
+++ b/Framework/Algorithms/test/ReflectometryReductionOneAutoTest.h
@@ -9,7 +9,6 @@
 #include "MantidAPI/FrameworkManager.h"
 #include "MantidGeometry/Instrument/ReferenceFrame.h"
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
-#include <boost/assign/list_of.hpp>
 
 using Mantid::Algorithms::ReflectometryReductionOneAuto;
 using namespace Mantid::API;
@@ -18,7 +17,6 @@ using namespace Mantid::Geometry;
 using namespace Mantid::Kernel;
 using Mantid::MantidVec;
 using Mantid::MantidVecPtr;
-using namespace boost::assign;
 
 namespace {
 class PropertyFinder {
@@ -69,10 +67,8 @@ public:
         outWSLamName("ReflectometryReductionOneAutoTest_OutputWS_Lam"),
         inWSName("ReflectometryReductionOneAutoTest_InputWS"),
         transWSName("ReflectometryReductionOneAutoTest_TransWS") {
-    MantidVec xData =
-        boost::assign::list_of(0)(0)(0)(0).convert_to_container<MantidVec>();
-    MantidVec yData =
-        boost::assign::list_of(0)(0)(0).convert_to_container<MantidVec>();
+    MantidVec xData = {0, 0, 0, 0};
+    MantidVec yData = {0, 0, 0};
 
     auto createWorkspace =
         AlgorithmManager::Instance().create("CreateWorkspace");
@@ -189,8 +185,7 @@ public:
     auto alg = construct_standard_algorithm();
     alg->setProperty("FirstTransmissionRun", m_TOF);
     alg->setProperty("SecondTransmissionRun", m_TOF);
-    MantidVec params =
-        boost::assign::list_of(0.0)(0.1)(1.0).convert_to_container<MantidVec>();
+    MantidVec params = {0.0, 0.1, 1.0};
     alg->setProperty("Params", params);
     alg->setProperty("StartOverlap", 0.6);
     alg->setProperty("EndOverlap", 0.4);
@@ -253,8 +248,7 @@ public:
   test_cannot_set_direct_beam_region_of_interest_without_multidetector_run() {
     auto alg = construct_standard_algorithm();
     alg->setProperty("AnalysisMode", "PointDetectorAnalysis");
-    std::vector<int> RegionOfDirectBeam =
-        boost::assign::list_of(1)(2).convert_to_container<std::vector<int>>();
+    std::vector<int> RegionOfDirectBeam = {1, 2};
     alg->setProperty("RegionOfDirectBeam", RegionOfDirectBeam);
     TS_ASSERT_THROWS(alg->execute(), std::invalid_argument);
   }
@@ -262,8 +256,7 @@ public:
   void test_region_of_direct_beam_indexes_cannot_be_negative_or_throws() {
     auto alg = construct_standard_algorithm();
     alg->setProperty("AnalysisMode", "MultiDetectorAnalysis");
-    std::vector<int> RegionOfDirectBeam =
-        boost::assign::list_of(0)(-1).convert_to_container<std::vector<int>>();
+    std::vector<int> RegionOfDirectBeam = {0, -1};
     alg->setProperty("RegionOfDirectBeam", RegionOfDirectBeam);
     TS_ASSERT_THROWS(alg->execute(), std::invalid_argument);
   }
@@ -272,8 +265,7 @@ public:
   test_region_of_direct_beam_indexes_must_be_provided_as_min_max_order_or_throws() {
     auto alg = construct_standard_algorithm();
     alg->setProperty("AnalysisMode", "MultiDetectorAnalysis");
-    std::vector<int> RegionOfDirectBeam =
-        boost::assign::list_of(1)(0).convert_to_container<std::vector<int>>();
+    std::vector<int> RegionOfDirectBeam = {1, 0};
     alg->setProperty("RegionOfDirectBeam", RegionOfDirectBeam);
     TS_ASSERT_THROWS(alg->execute(), std::invalid_argument);
   }
diff --git a/Framework/Algorithms/test/RemoveBackgroundTest.h b/Framework/Algorithms/test/RemoveBackgroundTest.h
index 9ec27579eb6ca0497fe17f585bc8efa06e02c09b..f9c53ab9b28801a38541fd684e7f42bc07665737 100644
--- a/Framework/Algorithms/test/RemoveBackgroundTest.h
+++ b/Framework/Algorithms/test/RemoveBackgroundTest.h
@@ -98,14 +98,10 @@ public:
                       std::invalid_argument);
 
     auto sourceWS = WorkspaceCreationHelper::Create2DWorkspace(5, 10);
-    TSM_ASSERT_THROWS("Should throw if source workspace does not have units",
-                      bgRemoval.initialize(BgWS, sourceWS, 0),
-                      std::invalid_argument);
-
     sourceWS->getAxis(0)->setUnit("TOF");
     TSM_ASSERT_THROWS(
         "Should throw if source workspace does not have proper instrument",
-        bgRemoval.initialize(BgWS, sourceWS, 0), std::invalid_argument);
+        bgRemoval.initialize(BgWS, sourceWS, 0), std::runtime_error);
   }
 
   void testBackgroundHelper() {
diff --git a/Framework/Algorithms/test/SofQWNormalisedPolygonTest.h b/Framework/Algorithms/test/SofQWNormalisedPolygonTest.h
index 72a82c6fc82820a91817cbd559f865667fa25c42..b62190484f4d91c95928aa40759006db59086a05 100644
--- a/Framework/Algorithms/test/SofQWNormalisedPolygonTest.h
+++ b/Framework/Algorithms/test/SofQWNormalisedPolygonTest.h
@@ -6,7 +6,6 @@
 #include "MantidAPI/Axis.h"
 
 #include "SofQWTest.h"
-#include <boost/assign.hpp>
 
 using namespace Mantid::Algorithms;
 using namespace Mantid::API;
@@ -61,20 +60,19 @@ public:
 
     // Spectra-detector mapping
     const size_t nspectra(6);
-    using namespace boost::assign;
     typedef std::set<int> IDSet;
     std::vector<IDSet> expectedIDs(nspectra);
-    IDSet s1 = list_of(3);
+    IDSet s1 = {3};
     expectedIDs[0] = s1;
-    IDSet s2 = list_of(13);
+    IDSet s2 = {13};
     expectedIDs[1] = s2;
-    IDSet s3 = list_of(13)(23);
+    IDSet s3 = {13, 23};
     expectedIDs[2] = s3;
-    IDSet s4 = list_of(23)(33);
+    IDSet s4 = {23, 33};
     expectedIDs[3] = s4;
-    IDSet s5 = list_of(33)(43);
+    IDSet s5 = {33, 43};
     expectedIDs[4] = s5;
-    IDSet s6 = list_of(43);
+    IDSet s6 = {43};
     expectedIDs[5] = s6;
 
     for (size_t i = 0; i < nspectra; ++i) {
diff --git a/Framework/Algorithms/test/SofQWPolygonTest.h b/Framework/Algorithms/test/SofQWPolygonTest.h
index 67f98a4c90189bd7bc09c1eae8337ca2b04e4901..6f2a12133847522031bb60789f4d40035aac7451 100644
--- a/Framework/Algorithms/test/SofQWPolygonTest.h
+++ b/Framework/Algorithms/test/SofQWPolygonTest.h
@@ -5,7 +5,6 @@
 #include "MantidAlgorithms/SofQWPolygon.h"
 
 #include "SofQWTest.h"
-#include <boost/assign.hpp>
 
 using namespace Mantid::Algorithms;
 using namespace Mantid::API;
@@ -59,20 +58,19 @@ public:
 
     // Spectra-detector mapping
     const size_t nspectra(6);
-    using namespace boost::assign;
     typedef std::set<int> IDSet;
     std::vector<IDSet> expectedIDs(nspectra);
-    IDSet s1 = list_of(3);
+    IDSet s1 = {3};
     expectedIDs[0] = s1;
-    IDSet s2 = list_of(13);
+    IDSet s2 = {13};
     expectedIDs[1] = s2;
-    IDSet s3 = list_of(23);
+    IDSet s3 = {23};
     expectedIDs[2] = s3;
-    IDSet s4 = list_of(23)(33);
+    IDSet s4 = {23, 33};
     expectedIDs[3] = s4;
-    IDSet s5 = list_of(33)(43);
+    IDSet s5 = {33, 43};
     expectedIDs[4] = s5;
-    IDSet s6 = list_of(43);
+    IDSet s6 = {43};
     expectedIDs[5] = s6;
 
     for (size_t i = 0; i < nspectra; ++i) {
diff --git a/Framework/Algorithms/test/Stitch1DTest.h b/Framework/Algorithms/test/Stitch1DTest.h
index 8ef63e41fc284bb9f3505a0d0f970af8d9d48213..e2dcc3d008bf773f4f5d4002c75b9d76863be9bf 100644
--- a/Framework/Algorithms/test/Stitch1DTest.h
+++ b/Framework/Algorithms/test/Stitch1DTest.h
@@ -8,17 +8,14 @@
 #include "MantidKernel/UnitFactory.h"
 #include "MantidDataObjects/Workspace2D.h"
 
-#include <boost/assign/list_of.hpp>
+#include <algorithm>
+#include <math.h>
 #include <boost/tuple/tuple.hpp>
 #include <boost/math/special_functions.hpp>
 #include <boost/make_shared.hpp>
 
-#include <algorithm>
-#include <math.h>
-
 using namespace Mantid::API;
 using namespace Mantid::Kernel;
-using namespace boost::assign;
 using Mantid::Algorithms::Stitch1D;
 using Mantid::MantidVec;
 using namespace Mantid::DataObjects;
@@ -144,14 +141,12 @@ public:
     LinearSequence<MantidVec::value_type> sequence(xstart, xstep);
     std::generate(x.begin(), x.end(), sequence);
 
-    MantidVec y = boost::assign::list_of(0)(0)(0)(3)(3)(3)(3)(3)(3)(3)
-                      .convert_to_container<MantidVec>();
+    MantidVec y = {0, 0, 0, 3, 3, 3, 3, 3, 3, 3};
 
     // Pre-canned workspace to stitch
     a = createWorkspace(x, y, e);
 
-    y = boost::assign::list_of(2)(2)(2)(2)(2)(2)(2)(0)(0)(0)
-            .convert_to_container<MantidVec>();
+    y = {2, 2, 2, 2, 2, 2, 2, 0, 0, 0};
     // Another pre-canned workspace to stitch
     b = createWorkspace(x, y, e);
   }
@@ -282,8 +277,7 @@ public:
   }
 
   void test_stitching_uses_suppiled_params() {
-    MantidVec params = boost::assign::list_of<double>(-0.8)(0.2)(1.0)
-                           .convert_to_container<MantidVec>();
+    MantidVec params = {-0.8, 0.2, 1.0};
     auto ret = do_stitch1D(this->b, this->a, -0.4, 0.4, params);
 
     MantidVec xValues = ret.get<0>()->readX(
@@ -297,21 +291,15 @@ public:
   }
 
   void test_stitching_determines_params() {
-    MantidVec x1 = boost::assign::list_of(-1.0)(-0.8)(-0.6)(-0.4)(-0.2)(0.0)(
-                       0.2)(0.4)(0.6)(0.8).convert_to_container<MantidVec>();
-    MantidVec x2 = boost::assign::list_of(0.4)(0.6)(0.8)(1.0)(1.2)(1.4)(1.6)
-                       .convert_to_container<MantidVec>();
-    MantidVec y1 = boost::assign::list_of(1)(1)(1)(1)(1)(1)(1)(1)(1)
-                       .convert_to_container<MantidVec>();
-    MantidVec y2 = boost::assign::list_of(1)(1)(1)(1)(1)(1)
-                       .convert_to_container<MantidVec>();
+    MantidVec x1 = {-1.0, -0.8, -0.6, -0.4, -0.2, 0.0, 0.2, 0.4, 0.6, 0.8};
+    MantidVec x2 = {0.4, 0.6, 0.8, 1.0, 1.2, 1.4, 1.6};
+    MantidVec y1 = {1, 1, 1, 1, 1, 1, 1, 1, 1};
+    MantidVec y2 = {1, 1, 1, 1, 1, 1};
 
     MatrixWorkspace_sptr ws1 = create1DWorkspace(x1, y1);
     MatrixWorkspace_sptr ws2 = create1DWorkspace(x2, y2);
     double demanded_step_size = 0.2;
-    auto ret = do_stitch1D(ws1, ws2, 0.4, 1.0,
-                           boost::assign::list_of(demanded_step_size)
-                               .convert_to_container<MantidVec>());
+    auto ret = do_stitch1D(ws1, ws2, 0.4, 1.0, {demanded_step_size});
 
     // Check the ranges on the output workspace against the param inputs.
     MantidVec out_x_values = ret.get<0>()->readX(0);
@@ -325,20 +313,15 @@ public:
   }
 
   void test_stitching_determines_start_and_end_overlap() {
-    MantidVec x1 = boost::assign::list_of(-1.0)(-0.8)(-0.6)(-0.4)(-0.2)(0.0)(
-                       0.2)(0.4).convert_to_container<MantidVec>();
-    MantidVec x2 = boost::assign::list_of(-0.4)(-0.2)(0.0)(0.2)(0.4)(0.6)(0.8)(
-                       1.0).convert_to_container<MantidVec>();
+    MantidVec x1 = {-1.0, -0.8, -0.6, -0.4, -0.2, 0.0, 0.2, 0.4};
+    MantidVec x2 = {-0.4, -0.2, 0.0, 0.2, 0.4, 0.6, 0.8, 1.0};
 
-    MantidVec y1 = boost::assign::list_of(1)(1)(1)(3)(3)(3)(3)
-                       .convert_to_container<MantidVec>();
-    MantidVec y2 = boost::assign::list_of(1)(1)(1)(1)(3)(3)(3)
-                       .convert_to_container<MantidVec>();
+    MantidVec y1 = {1, 1, 1, 3, 3, 3, 3};
+    MantidVec y2 = {1, 1, 1, 1, 3, 3, 3};
 
     MatrixWorkspace_sptr ws1 = create1DWorkspace(x1, y1);
     MatrixWorkspace_sptr ws2 = create1DWorkspace(x2, y2);
-    MantidVec params = boost::assign::list_of(-1.0)(0.2)(1.0)
-                           .convert_to_container<MantidVec>();
+    MantidVec params = {-1.0, 0.2, 1.0};
     auto ret = do_stitch1D(ws1, ws2, params);
 
     MantidVec stitched_y = ret.get<0>()->readY(0);
@@ -359,20 +342,15 @@ public:
   }
 
   void test_stitching_forces_start_overlap() {
-    MantidVec x1 = boost::assign::list_of(-1.0)(-0.8)(-0.6)(-0.4)(-0.2)(0.0)(
-                       0.2)(0.4).convert_to_container<MantidVec>();
-    MantidVec x2 = boost::assign::list_of(-0.4)(-0.2)(0.0)(0.2)(0.4)(0.6)(0.8)(
-                       1.0).convert_to_container<MantidVec>();
+    MantidVec x1 = {-1.0, -0.8, -0.6, -0.4, -0.2, 0.0, 0.2, 0.4};
+    MantidVec x2 = {-0.4, -0.2, 0.0, 0.2, 0.4, 0.6, 0.8, 1.0};
 
-    MantidVec y1 = boost::assign::list_of(1)(1)(1)(3)(3)(3)(3)
-                       .convert_to_container<MantidVec>();
-    MantidVec y2 = boost::assign::list_of(1)(1)(1)(1)(3)(3)(3)
-                       .convert_to_container<MantidVec>();
+    MantidVec y1 = {1, 1, 1, 3, 3, 3, 3};
+    MantidVec y2 = {1, 1, 1, 1, 3, 3, 3};
 
     MatrixWorkspace_sptr ws1 = create1DWorkspace(x1, y1);
     MatrixWorkspace_sptr ws2 = create1DWorkspace(x2, y2);
-    MantidVec params = boost::assign::list_of(-1.0)(0.2)(1.0)
-                           .convert_to_container<MantidVec>();
+    MantidVec params = {(-1.0), (0.2), (1.0)};
     auto ret = do_stitch1D(ws1, ws2, -0.5, params, true);
 
     MantidVec stitched_y = ret.get<0>()->readY(0);
@@ -393,20 +371,15 @@ public:
   }
 
   void test_stitching_forces_end_overlap() {
-    MantidVec x1 = boost::assign::list_of(-1.0)(-0.8)(-0.6)(-0.4)(-0.2)(0.0)(
-                       0.2)(0.4).convert_to_container<MantidVec>();
-    MantidVec x2 = boost::assign::list_of(-0.4)(-0.2)(0.0)(0.2)(0.4)(0.6)(0.8)(
-                       1.0).convert_to_container<MantidVec>();
+    MantidVec x1 = {-1.0, -0.8, -0.6, -0.4, -0.2, 0.0, 0.2, 0.4};
+    MantidVec x2 = {-0.4, -0.2, 0.0, 0.2, 0.4, 0.6, 0.8, 1.0};
 
-    MantidVec y1 = boost::assign::list_of(1)(1)(1)(3)(3)(3)(3)
-                       .convert_to_container<MantidVec>();
-    MantidVec y2 = boost::assign::list_of(1)(1)(1)(1)(3)(3)(3)
-                       .convert_to_container<MantidVec>();
+    MantidVec y1 = {1, 1, 1, 3, 3, 3, 3};
+    MantidVec y2 = {1, 1, 1, 1, 3, 3, 3};
 
     MatrixWorkspace_sptr ws1 = create1DWorkspace(x1, y1);
     MatrixWorkspace_sptr ws2 = create1DWorkspace(x2, y2);
-    MantidVec params = boost::assign::list_of(-1.0)(0.2)(1.0)
-                           .convert_to_container<MantidVec>();
+    MantidVec params = {-1.0, 0.2, 1.0};
     auto ret = do_stitch1D(ws1, ws2, 0.5, params, false);
 
     MantidVec stitched_y = ret.get<0>()->readY(0);
@@ -427,8 +400,7 @@ public:
   }
 
   void test_stitching_scale_right() {
-    MantidVec params =
-        boost::assign::list_of<double>(0.2).convert_to_container<MantidVec>();
+    MantidVec params = {0.2};
     auto ret = do_stitch1D(this->b, this->a, -0.4, 0.4, params);
 
     double scale = ret.get<1>();
@@ -460,8 +432,7 @@ public:
   }
 
   void test_stitching_scale_left() {
-    MantidVec params =
-        boost::assign::list_of<double>(0.2).convert_to_container<MantidVec>();
+    MantidVec params = {0.2};
     auto ret = do_stitch1D(this->b, this->a, -0.4, 0.4, params, false);
 
     double scale = ret.get<1>();
@@ -493,8 +464,7 @@ public:
   }
 
   void test_stitching_manual_scale_factor_scale_right() {
-    MantidVec params =
-        boost::assign::list_of<double>(0.2).convert_to_container<MantidVec>();
+    MantidVec params = {0.2};
     auto ret =
         do_stitch1D(this->b, this->a, true, true, -0.4, 0.4, params, 2.0 / 3.0);
 
@@ -527,8 +497,7 @@ public:
   }
 
   void test_stitching_manual_scale_factor_scale_left() {
-    MantidVec params =
-        boost::assign::list_of<double>(0.2).convert_to_container<MantidVec>();
+    MantidVec params = {0.2};
     auto ret = do_stitch1D(this->b, this->a, false, true, -0.4, 0.4, params,
                            3.0 / 2.0);
 
diff --git a/Framework/Algorithms/test/TOFSANSResolutionByPixelTest.h b/Framework/Algorithms/test/TOFSANSResolutionByPixelTest.h
index ba4571046189d463822e6d55220cce925e7e576b..fbc9963b3fe8fb3a04570af64d2d28c57a39705d 100644
--- a/Framework/Algorithms/test/TOFSANSResolutionByPixelTest.h
+++ b/Framework/Algorithms/test/TOFSANSResolutionByPixelTest.h
@@ -194,11 +194,6 @@ public:
   }
 
   void test_that_correct_resolution_is_calculated_without_gravity() {
-    // Arrange
-    std::vector<double> xValues;
-    xValues.push_back(1);
-    xValues.push_back(2);
-    xValues.push_back(3);
 
     double collimationLengthCorrection = -1;
     double collimationLengthIncrement = -1;
diff --git a/Framework/CMakeLists.txt b/Framework/CMakeLists.txt
index be00358523650cf1f069712ace31ec277bdb4c22..42bf261dc53af88f405443b6f274f1c7c3ff2c76 100644
--- a/Framework/CMakeLists.txt
+++ b/Framework/CMakeLists.txt
@@ -119,7 +119,6 @@ endif ()
 
 # Unit test helper packages
 if ( CXXTEST_FOUND )
-  add_subdirectory ( UserAlgorithms )
   add_subdirectory ( ../Testing/Tools ${${CMAKE_PROJECT_NAME}_BINARY_DIR}/Testing/Tools )
 endif ()
 
diff --git a/Framework/Crystal/inc/MantidCrystal/ConnectedComponentLabeling.h b/Framework/Crystal/inc/MantidCrystal/ConnectedComponentLabeling.h
index 7e7e6eac7ec0ed2bf8cc04794b451d0a406dc381..6493f796c30caf47fc80bbd70c913d9670a93b14 100644
--- a/Framework/Crystal/inc/MantidCrystal/ConnectedComponentLabeling.h
+++ b/Framework/Crystal/inc/MantidCrystal/ConnectedComponentLabeling.h
@@ -9,7 +9,7 @@
 #include <boost/tuple/tuple.hpp>
 #include <boost/optional.hpp>
 #include <map>
-#include <set>
+#include <unordered_set>
 
 namespace Mantid {
 namespace API {
@@ -27,7 +27,7 @@ typedef std::map<size_t, SignalErrorSQPair> LabelIdIntensityMap;
 typedef std::map<Mantid::Kernel::V3D, size_t> PositionToLabelIdMap;
 typedef std::vector<size_t> VecIndexes;
 typedef std::vector<DisjointElement> VecElements;
-typedef std::set<size_t> SetIds;
+typedef std::unordered_set<size_t> SetIds;
 typedef std::map<size_t, boost::shared_ptr<Mantid::Crystal::ICluster>>
     ClusterMap;
 typedef boost::tuple<Mantid::API::IMDHistoWorkspace_sptr, ClusterMap>
diff --git a/Framework/Crystal/inc/MantidCrystal/IndexSXPeaks.h b/Framework/Crystal/inc/MantidCrystal/IndexSXPeaks.h
index 0f6715c513169cfcbe9765dd909a69e5bbf4e7d7..23d86a048562f7ffb7e4fc7164d89353bdd0a5d4 100644
--- a/Framework/Crystal/inc/MantidCrystal/IndexSXPeaks.h
+++ b/Framework/Crystal/inc/MantidCrystal/IndexSXPeaks.h
@@ -90,9 +90,8 @@ public:
   }
   size_t candidateHKLSize() const { return _hkls.size(); }
   void delHKL(int h, int k, int l) {
-    std::set<index>::const_iterator it =
-        std::find(_hkls.begin(), _hkls.end(), index(h, k, l));
-    if (it != _hkls.end())
+    auto it = std::find(_hkls.cbegin(), _hkls.cend(), index(h, k, l));
+    if (it != _hkls.cend())
       _hkls.erase(it);
   }
   const Mantid::Kernel::V3D &getQ() const { return _Q; }
@@ -103,7 +102,7 @@ public:
   }
   void setFirst() {
     if (_hkls.size() > 0) {
-      std::set<index>::iterator it = _hkls.begin(); // Take the first possiblity
+      auto it = _hkls.begin(); // Take the first possiblity
       it++;
       _hkls.erase(it, _hkls.end()); // Erase all others!
     }
diff --git a/Framework/Crystal/src/AnvredCorrection.cpp b/Framework/Crystal/src/AnvredCorrection.cpp
index 88f3ada753161b22be101cea1035bfbfdf37d664..e0fa82fa7e13ae6af75ae71ef379b9eea6e5d124 100644
--- a/Framework/Crystal/src/AnvredCorrection.cpp
+++ b/Framework/Crystal/src/AnvredCorrection.cpp
@@ -13,8 +13,6 @@
 #include "MantidKernel/VectorHelper.h"
 #include "MantidGeometry/Instrument.h"
 
-#include "boost/assign.hpp"
-
 /*  Following A.J.Schultz's anvred, the weight factors should be:
  *
  *    sin^2(theta) / (lamda^4 * spec * eff * trans)
@@ -68,11 +66,19 @@ using namespace Geometry;
 using namespace API;
 using namespace DataObjects;
 using namespace Mantid::PhysicalConstants;
-using namespace boost::assign;
-std::map<int, double> detScale = map_list_of(17, 1.092114823)(18, 0.869105443)(
-    22, 1.081377685)(26, 1.055199489)(27, 1.070308725)(28, 0.886157884)(
-    36, 1.112773972)(37, 1.012894506)(38, 1.049384146)(39, 0.890313805)(
-    47, 1.068553893)(48, 0.900566426)(58, 0.911249203);
+std::map<int, double> detScale = {{17, 1.092114823},
+                                  {18, 0.869105443},
+                                  {22, 1.081377685},
+                                  {26, 1.055199489},
+                                  {27, 1.070308725},
+                                  {28, 0.886157884},
+                                  {36, 1.112773972},
+                                  {37, 1.012894506},
+                                  {38, 1.049384146},
+                                  {39, 0.890313805},
+                                  {47, 1.068553893},
+                                  {48, 0.900566426},
+                                  {58, 0.911249203}};
 
 AnvredCorrection::AnvredCorrection()
     : API::Algorithm(), m_smu(0.), m_amu(0.), m_radius(0.), m_power_th(0.),
@@ -354,10 +360,9 @@ void AnvredCorrection::execEvent() {
     }
     correctionFactors->getOrAddEventList(i) += events;
 
-    std::set<detid_t> &dets = eventW->getEventList(i).getDetectorIDs();
-    std::set<detid_t>::iterator j;
-    for (j = dets.begin(); j != dets.end(); ++j)
-      correctionFactors->getOrAddEventList(i).addDetectorID(*j);
+    auto &dets = eventW->getEventList(i).getDetectorIDs();
+    for (auto const &det : dets)
+      correctionFactors->getOrAddEventList(i).addDetectorID(det);
     // When focussing in place, you can clear out old memory from the input one!
     if (inPlace) {
       eventW->getEventList(i).clear();
diff --git a/Framework/Crystal/src/ClusterRegister.cpp b/Framework/Crystal/src/ClusterRegister.cpp
index f0765ac08e465c175ecc82d20eebe0141be7a49e..720a8300dec406e499cf959259734d092e0147b5 100644
--- a/Framework/Crystal/src/ClusterRegister.cpp
+++ b/Framework/Crystal/src/ClusterRegister.cpp
@@ -4,7 +4,7 @@
 #include <boost/make_shared.hpp>
 #include <boost/functional/hash.hpp>
 #include <list>
-#include <set>
+#include <unordered_set>
 
 namespace {
 template <typename T> std::pair<T, T> ordered_pair(const T &a, const T &b) {
@@ -26,13 +26,13 @@ public:
   ClusterRegister::MapCluster m_unique;
 
   /// Type for identifying label groups
-  typedef std::list<std::set<size_t>> GroupType;
+  typedef std::list<std::unordered_set<size_t>> GroupType;
 
   /// Groups of labels to maintain
   GroupType m_groups;
 
   /// Type for identifying labels already seen
-  typedef std::set<size_t> LabelHash;
+  typedef std::unordered_set<size_t> LabelHash;
 
   /// Hash of labels merged
   LabelHash m_labelHash;
diff --git a/Framework/Crystal/src/FindClusterFaces.cpp b/Framework/Crystal/src/FindClusterFaces.cpp
index 9a96d97b7fe833ab056b0a48d0d68ec0298b8ff9..9635f349e5207344eefea33f6cea1c2375c55929 100644
--- a/Framework/Crystal/src/FindClusterFaces.cpp
+++ b/Framework/Crystal/src/FindClusterFaces.cpp
@@ -115,9 +115,8 @@ void findFacesAtIndex(const size_t linearIndex, IMDIterator *mdIterator,
                       const int &emptyLabelId,
                       const std::vector<size_t> &imageShape,
                       ClusterFaces &localClusterFaces) {
-  std::vector<size_t> indexes;
-  Mantid::Kernel::Utils::getIndicesFromLinearIndex(linearIndex, imageShape,
-                                                   indexes);
+  auto indexes =
+      Mantid::Kernel::Utils::getIndicesFromLinearIndex(linearIndex, imageShape);
 
   const auto neighbours = mdIterator->findNeighbourIndexesFaceTouching();
   for (auto neighbourLinearIndex : neighbours) {
@@ -128,9 +127,8 @@ void findFacesAtIndex(const size_t linearIndex, IMDIterator *mdIterator,
       // We have an edge!
 
       // In which dimension is the edge?
-      std::vector<size_t> neighbourIndexes;
-      Mantid::Kernel::Utils::getIndicesFromLinearIndex(
-          neighbourLinearIndex, imageShape, neighbourIndexes);
+      auto neighbourIndexes = Mantid::Kernel::Utils::getIndicesFromLinearIndex(
+          neighbourLinearIndex, imageShape);
       for (size_t j = 0; j < imageShape.size(); ++j) {
         if (indexes[j] != neighbourIndexes[j]) {
           const bool maxEdge = neighbourLinearIndex > linearIndex;
diff --git a/Framework/Crystal/src/GoniometerAnglesFromPhiRotation.cpp b/Framework/Crystal/src/GoniometerAnglesFromPhiRotation.cpp
index f9da637558a132053575f16a58c6118f9abeff22..e8d7a0c2589c455711426e2412658dab47159eee 100644
--- a/Framework/Crystal/src/GoniometerAnglesFromPhiRotation.cpp
+++ b/Framework/Crystal/src/GoniometerAnglesFromPhiRotation.cpp
@@ -160,8 +160,8 @@ void GoniometerAnglesFromPhiRotation::exec() {
     findUB->initialize();
     findUB->setProperty<PeaksWorkspace_sptr>("PeaksWorkspace",
                                              getProperty("PeaksWorkspace1"));
-    findUB->setProperty("MIND", (double)getProperty("MIND"));
-    findUB->setProperty("MAXD", (double)getProperty("MAXD"));
+    findUB->setProperty("MIND", static_cast<double>(getProperty("MIND")));
+    findUB->setProperty("MAXD", static_cast<double>(getProperty("MAXD")));
     findUB->setProperty("Tolerance", Tolerance);
 
     findUB->executeAsChildAlg();
@@ -202,7 +202,8 @@ void GoniometerAnglesFromPhiRotation::exec() {
   if (!Run1HasOrientedLattice)
     PeaksRun1->mutableSample().setOrientedLattice(nullptr);
 
-  double dphi = (double)getProperty("Phi2") - (double)getProperty("Run1Phi");
+  double dphi = static_cast<double>(getProperty("Phi2")) -
+                static_cast<double>(getProperty("Run1Phi"));
   Kernel::Matrix<double> Gon22(3, 3, true);
 
   for (int i = 0; i < PeaksRun2->getNumberPeaks(); i++) {
@@ -213,7 +214,8 @@ void GoniometerAnglesFromPhiRotation::exec() {
   std::string RunNumStr = boost::lexical_cast<std::string>(RunNum);
   int Npeaks = PeaksRun2->getNumberPeaks();
 
-  std::vector<double> MinData(5); // n indexed, av err, phi, chi,omega
+  // n indexed, av err, phi, chi,omega
+  std::array<double, 5> MinData = {{0., 0., 0., 0., 0.}};
   MinData[0] = 0.0;
   std::vector<V3D> directionList = IndexingUtils::MakeHemisphereDirections(50);
 
@@ -349,7 +351,7 @@ void GoniometerAnglesFromPhiRotation::exec() {
     ax3 = -ax3;
   }
 
-  double phi2 = (double)getProperty("Run1Phi") + dphi;
+  double phi2 = static_cast<double>(getProperty("Run1Phi")) + dphi;
   double chi2 = acos(ax2) / M_PI * 180;
   double omega2 = atan2(ax3, -ax1) / M_PI * 180;
 
diff --git a/Framework/Crystal/src/IntegratePeakTimeSlices.cpp b/Framework/Crystal/src/IntegratePeakTimeSlices.cpp
index bee9ed38cb63b008c2e3d2f1ca47587128147ce4..cd9f4342f4b87426d9a1464f0b98c2fff7dea6ab 100644
--- a/Framework/Crystal/src/IntegratePeakTimeSlices.cpp
+++ b/Framework/Crystal/src/IntegratePeakTimeSlices.cpp
@@ -1730,12 +1730,12 @@ int IntegratePeakTimeSlices::find(Mantid::MantidVec const &X,
   if (sgn * (X[0] - time) >= 0)
     return 0;
 
-  if (sgn * (time - X[X.size() - 1]) >= 0)
+  if (sgn * (time - X[X.size() - 1u]) >= 0)
     return static_cast<int>(X.size()) - 1;
 
-  for (size_t i = 0; i < (size_t)X.size() - static_cast<size_t>(1); i++) {
-    if (sgn * (time - X[i]) >= 0 &&
-        sgn * (X[i + static_cast<size_t>(1)] - time) >= 0)
+  size_t end = X.size() - 1u;
+  for (size_t i = 0; i < end; i++) {
+    if (sgn * (time - X[i]) >= 0 && sgn * (X[i + 1u] - time) >= 0)
       return static_cast<int>(i);
   }
 
@@ -2102,12 +2102,12 @@ void IntegratePeakTimeSlices::Fit(MatrixWorkspace_sptr &Data,
   {
     done = true;
     g_log.error() << "Bivariate Error for PeakNum="
-                  << (int)getProperty("PeakIndex") << ":"
+                  << static_cast<int>(getProperty("PeakIndex")) << ":"
                   << std::string(Ex1.what()) << std::endl;
   } catch (...) {
     done = true;
     g_log.error() << "Bivariate Error A for peakNum="
-                  << (int)getProperty("PeakIndex") << std::endl;
+                  << static_cast<int>(getProperty("PeakIndex")) << std::endl;
   }
   if (!done) // Bivariate error happened
   {
diff --git a/Framework/Crystal/src/PeakHKLErrors.cpp b/Framework/Crystal/src/PeakHKLErrors.cpp
index eec8ea5538b9b96e24724032eed113ebf951268a..92314edc9afa3af099908e76ea5ee9993c4105e5 100644
--- a/Framework/Crystal/src/PeakHKLErrors.cpp
+++ b/Framework/Crystal/src/PeakHKLErrors.cpp
@@ -115,7 +115,7 @@ void PeakHKLErrors::cLone(
     return;
   if (component->isParametrized()) {
 
-    std::set<std::string> nms = pmapSv->names(component.get());
+    auto nms = pmapSv->names(component.get());
     for (const auto &nm : nms) {
 
       if (pmapSv->contains(component.get(), nm, "double")) {
diff --git a/Framework/Crystal/src/PeaksInRegion.cpp b/Framework/Crystal/src/PeaksInRegion.cpp
index 45f836cc5289a6a354d794bf8b6c32e6550a4b39..a91298c5e95b41530e417d30ebe8d460a17208e2 100644
--- a/Framework/Crystal/src/PeaksInRegion.cpp
+++ b/Framework/Crystal/src/PeaksInRegion.cpp
@@ -2,7 +2,6 @@
 #include "MantidKernel/ArrayProperty.h"
 #include "MantidKernel/MandatoryValidator.h"
 #include "MantidKernel/EnabledWhenProperty.h"
-#include <boost/assign.hpp>
 
 using namespace Mantid::Kernel;
 using namespace Mantid::API;
@@ -141,34 +140,32 @@ VecVecV3D PeaksInRegion::createFaces() const {
   V3D point7(m_extents[maxXIndex], m_extents[maxYIndex], m_extents[maxZIndex]);
   V3D point8(m_extents[maxXIndex], m_extents[minYIndex], m_extents[maxZIndex]);
 
-  using boost::assign::list_of;
   const int numberOfFaces = this->numberOfFaces();
   VecVecV3D faces(numberOfFaces);
   int faceIndex = 0;
-  faces[faceIndex++] = list_of(point1)(point5)(point6)
-                           .convert_to_container<VecV3D>(); // These define a
-                                                            // face normal to x
-                                                            // at xmin.
-  faces[faceIndex++] = list_of(point4)(point7)(point8)
-                           .convert_to_container<VecV3D>(); // These define a
-                                                            // face normal to x
-                                                            // at xmax.
-  faces[faceIndex++] = list_of(point1)(point4)(point8)
-                           .convert_to_container<VecV3D>(); // These define a
-                                                            // face normal to y
-                                                            // at ymin.
-  faces[faceIndex++] = list_of(point2)(point3)(point7)
-                           .convert_to_container<VecV3D>(); // These define a
-                                                            // face normal to y
-                                                            // at ymax.
-  faces[faceIndex++] = list_of(point1)(point2)(point3)
-                           .convert_to_container<VecV3D>(); // These define a
-                                                            // face normal to z
-                                                            // at zmin.
-  faces[faceIndex++] = list_of(point5)(point6)(point7)
-                           .convert_to_container<VecV3D>(); // These define a
-                                                            // face normal to z
-                                                            // at zmax.
+  faces[faceIndex++] = {point1, point5, point6}; // These define a
+                                                 // face normal to x
+                                                 // at xmin.
+
+  faces[faceIndex++] = {point4, point7, point8}; // These define a
+                                                 // face normal to x
+                                                 // at xmax.
+
+  faces[faceIndex++] = {point1, point4, point8}; // These define a
+                                                 // face normal to y
+                                                 // at ymin.
+
+  faces[faceIndex++] = {point2, point3, point7}; // These define a
+                                                 // face normal to y
+                                                 // at ymax.
+
+  faces[faceIndex++] = {point1, point2, point3}; // These define a
+                                                 // face normal to z
+                                                 // at zmin.
+
+  faces[faceIndex++] = {point5, point6, point7}; // These define a
+                                                 // face normal to z
+                                                 // at zmax.
   return faces;
 }
 
diff --git a/Framework/Crystal/src/PeaksOnSurface.cpp b/Framework/Crystal/src/PeaksOnSurface.cpp
index 9caae6967c6dcfb58f0992f6e45c82077f86214a..26524a8b541bf56124f55050e4045029f224badb 100644
--- a/Framework/Crystal/src/PeaksOnSurface.cpp
+++ b/Framework/Crystal/src/PeaksOnSurface.cpp
@@ -1,7 +1,6 @@
 #include "MantidCrystal/PeaksOnSurface.h"
 #include "MantidKernel/ArrayProperty.h"
 #include "MantidKernel/MandatoryValidator.h"
-#include <boost/assign.hpp>
 
 using namespace Mantid::Kernel;
 typedef std::vector<double> VecDouble;
@@ -180,12 +179,10 @@ VecVecV3D PeaksOnSurface::createFaces() const {
   // p1|---|p4
   //*
 
-  using boost::assign::list_of;
   const int numberOfFaces = this->numberOfFaces();
   VecVecV3D faces(numberOfFaces);
-  faces[0] = list_of(m_vertex1)(m_vertex2)(m_vertex3)
-                 .convert_to_container<VecV3D>(); // These define a face normal
-                                                  // to x at xmin.
+  faces[0] = {m_vertex1, m_vertex2, m_vertex3}; // These define a face normal
+                                                // to x at xmin.
   return faces;
 }
 
diff --git a/Framework/Crystal/src/SaveHKL.cpp b/Framework/Crystal/src/SaveHKL.cpp
index 14b4b5a14ea9b589ade486b57051fbee7cc3023b..15cdbee00d96bc58f397f22a8e241768a1e8454d 100644
--- a/Framework/Crystal/src/SaveHKL.cpp
+++ b/Framework/Crystal/src/SaveHKL.cpp
@@ -10,7 +10,6 @@
 #include <fstream>
 
 #include <Poco/File.h>
-#include <boost/assign.hpp>
 #include <boost/math/special_functions/fpclassify.hpp>
 
 using namespace Mantid::Geometry;
@@ -18,11 +17,19 @@ using namespace Mantid::DataObjects;
 using namespace Mantid::Kernel;
 using namespace Mantid::API;
 using namespace Mantid::PhysicalConstants;
-using namespace boost::assign;
-std::map<int, double> detScale = map_list_of(17, 1.092114823)(18, 0.869105443)(
-    22, 1.081377685)(26, 1.055199489)(27, 1.070308725)(28, 0.886157884)(
-    36, 1.112773972)(37, 1.012894506)(38, 1.049384146)(39, 0.890313805)(
-    47, 1.068553893)(48, 0.900566426)(58, 0.911249203);
+std::map<int, double> detScale = {{17, 1.092114823},
+                                  {18, 0.869105443},
+                                  {22, 1.081377685},
+                                  {26, 1.055199489},
+                                  {27, 1.070308725},
+                                  {28, 0.886157884},
+                                  {36, 1.112773972},
+                                  {37, 1.012894506},
+                                  {38, 1.049384146},
+                                  {39, 0.890313805},
+                                  {47, 1.068553893},
+                                  {48, 0.900566426},
+                                  {58, 0.911249203}};
 
 namespace Mantid {
 namespace Crystal {
diff --git a/Framework/Crystal/src/SaveIsawPeaks.cpp b/Framework/Crystal/src/SaveIsawPeaks.cpp
index af0d7775e3ede8883de66b928fb72e98431a9c78..16f83bbd5438ca6b92352fef9477002bc62ff660 100644
--- a/Framework/Crystal/src/SaveIsawPeaks.cpp
+++ b/Framework/Crystal/src/SaveIsawPeaks.cpp
@@ -76,7 +76,7 @@ void SaveIsawPeaks::exec() {
   // workspace indices of it
   typedef std::map<int, std::vector<size_t>> bankMap_t;
   typedef std::map<int, bankMap_t> runMap_t;
-  std::set<int> uniqueBanks;
+  std::unordered_set<int> uniqueBanks;
   runMap_t runMap;
   for (size_t i = 0; i < peaks.size(); ++i) {
     Peak &p = peaks[i];
@@ -165,8 +165,7 @@ void SaveIsawPeaks::exec() {
              "  CenterY   CenterZ    BaseX    BaseY    BaseZ      UpX      UpY "
              "     UpZ" << std::endl;
       // Here would save each detector...
-      std::set<int>::iterator it;
-      for (it = uniqueBanks.begin(); it != uniqueBanks.end(); ++it) {
+      for (auto it = uniqueBanks.begin(); it != uniqueBanks.end(); ++it) {
         // Build up the bank name
         int bank = *it;
         std::ostringstream mess;
diff --git a/Framework/Crystal/src/SaveLauenorm.cpp b/Framework/Crystal/src/SaveLauenorm.cpp
index 1dca4d93ad89394d17ccdfff8ba8be54a6af97ab..cc770d2f78868541be0ed5a7190d6b7904fae164 100644
--- a/Framework/Crystal/src/SaveLauenorm.cpp
+++ b/Framework/Crystal/src/SaveLauenorm.cpp
@@ -9,7 +9,6 @@
 #include <fstream>
 #include <Poco/File.h>
 #include <Poco/Path.h>
-#include "boost/assign.hpp"
 #include <boost/math/special_functions/fpclassify.hpp>
 
 using namespace Mantid::Geometry;
@@ -17,7 +16,6 @@ using namespace Mantid::DataObjects;
 using namespace Mantid::Kernel;
 using namespace Mantid::API;
 using namespace Mantid::PhysicalConstants;
-using namespace boost::assign;
 
 namespace Mantid {
 namespace Crystal {
diff --git a/Framework/Crystal/src/ShowPeakHKLOffsets.cpp b/Framework/Crystal/src/ShowPeakHKLOffsets.cpp
index 921cc6f043027fbb39ff79c78d2e05c82aae1374..5341185a7b8bbd0204d41fb61c21e41697202f9a 100644
--- a/Framework/Crystal/src/ShowPeakHKLOffsets.cpp
+++ b/Framework/Crystal/src/ShowPeakHKLOffsets.cpp
@@ -63,7 +63,6 @@ void ShowPeakHKLOffsets::exec() {
   UBinv.Invert();
   UBinv /= 2 * M_PI;
 
-  // TableWorkspace_sptr Res( new TableWorkspace());
   boost::shared_ptr<ITableWorkspace> Res =
       WorkspaceFactory::Instance().createTable("TableWorkspace");
   Res->setTitle("HKL int offsets for " + Peaks->getName());
diff --git a/Framework/Crystal/src/StatisticsOfPeaksWorkspace.cpp b/Framework/Crystal/src/StatisticsOfPeaksWorkspace.cpp
index 9192d313f6131ec69444dea10c8ae357deecfb4c..ff3d55c7bd3ef3d91820127dd38abcdd220062ee 100644
--- a/Framework/Crystal/src/StatisticsOfPeaksWorkspace.cpp
+++ b/Framework/Crystal/src/StatisticsOfPeaksWorkspace.cpp
@@ -8,14 +8,12 @@
 #include "MantidKernel/ListValidator.h"
 
 #include <fstream>
-#include "boost/assign.hpp"
 
 using namespace Mantid::Geometry;
 using namespace Mantid::DataObjects;
 using namespace Mantid::Kernel;
 using namespace Mantid::API;
 using namespace Mantid::PhysicalConstants;
-using namespace boost::assign;
 
 namespace Mantid {
 namespace Crystal {
diff --git a/Framework/Crystal/src/TransformHKL.cpp b/Framework/Crystal/src/TransformHKL.cpp
index c1c770a2eb98d8a1245cec6f30d0b432ece4ab39..1f6347321c182a6915ae6f0d77c3a31f796259fd 100644
--- a/Framework/Crystal/src/TransformHKL.cpp
+++ b/Framework/Crystal/src/TransformHKL.cpp
@@ -123,6 +123,7 @@ void TransformHKL::exec() {
   // Transform looks OK so update UB and
   // transform the hkls
   UB = UB * hkl_tran_inverse;
+  g_log.notice() << "Transformed UB = " << UB << std::endl;
   o_lattice.setUB(UB);
   std::vector<double> sigabc(6);
   SelectCellWithForm::DetermineErrors(sigabc, UB, ws, tolerance);
diff --git a/Framework/Crystal/test/CMakeLists.txt b/Framework/Crystal/test/CMakeLists.txt
index 5751dfdd1b55daa3d4cf939cfbc508df051c36cd..ce752b4b987b804a09a5bd8653e0e5c111956959 100644
--- a/Framework/Crystal/test/CMakeLists.txt
+++ b/Framework/Crystal/test/CMakeLists.txt
@@ -6,6 +6,7 @@ if ( CXXTEST_FOUND )
   # It will go out of scope at the end of this file so doesn't need un-setting
   set ( TESTHELPER_SRCS ../../TestHelpers/src/TearDownWorld.cpp
                         ../../TestHelpers/src/ComponentCreationHelper.cpp
+                        ../../TestHelpers/src/InstrumentCreationHelper.cpp
                         ../../TestHelpers/src/WorkspaceCreationHelper.cpp
                         ../../TestHelpers/src/MDEventsTestHelper.cpp )
   cxxtest_add_test ( CrystalTest ${TEST_FILES} )
diff --git a/Framework/Crystal/test/ClusterIntegrationBaseTest.h b/Framework/Crystal/test/ClusterIntegrationBaseTest.h
index d10eadb3f53157ead1fc555c3525ba2ced8cd47c..d9b6e454ef057d216a855fe8b52ddea24dce9ba7 100644
--- a/Framework/Crystal/test/ClusterIntegrationBaseTest.h
+++ b/Framework/Crystal/test/ClusterIntegrationBaseTest.h
@@ -19,7 +19,6 @@
 #include "MantidDataObjects/PeaksWorkspace.h"
 #include "MantidGeometry/MDGeometry/HKL.h"
 
-#include <boost/assign/list_of.hpp>
 #include <boost/tuple/tuple.hpp>
 #include <set>
 
@@ -75,9 +74,7 @@ protected:
     mdworkspaceAlg->setChild(true);
     mdworkspaceAlg->initialize();
     mdworkspaceAlg->setProperty("Dimensions", 3);
-    std::vector<double> extents =
-        boost::assign::list_of(min)(max)(min)(max)(min)(max)
-            .convert_to_container<std::vector<double>>();
+    std::vector<double> extents = {min, max, min, max, min, max};
     mdworkspaceAlg->setProperty("Extents", extents);
     mdworkspaceAlg->setPropertyValue("Names", "H,K,L");
     std::string units = Mantid::Kernel::Units::Symbol::RLU.ascii() + "," +
diff --git a/Framework/Crystal/test/ConnectedComponentLabelingTest.h b/Framework/Crystal/test/ConnectedComponentLabelingTest.h
index 00b21af9f988209c3a0e574801cadc6ae45b3b98..8b2e4cdb2a8861295a1b2bd463eb81578dccf62d 100644
--- a/Framework/Crystal/test/ConnectedComponentLabelingTest.h
+++ b/Framework/Crystal/test/ConnectedComponentLabelingTest.h
@@ -5,7 +5,6 @@
 #include <gmock/gmock.h>
 #include <set>
 #include <algorithm>
-#include <boost/assign/list_of.hpp>
 #include <boost/scoped_ptr.hpp>
 
 #include "MantidAPI/IMDIterator.h"
@@ -26,7 +25,7 @@ using namespace testing;
 namespace {
 // Helper function for determining if a set contains a specific value.
 template <typename T>
-bool does_set_contain(const std::set<T> &container, const T &value) {
+bool does_set_contain(const std::unordered_set<T> &container, const T &value) {
   return std::find(container.begin(), container.end(), value) !=
          container.end();
 }
@@ -40,9 +39,9 @@ bool does_vector_contain(const std::vector<size_t> &container,
 
 // Helper function for converting a IMDHistoWorkspace of labels into a set of
 // unique labels.
-std::set<size_t>
+std::unordered_set<size_t>
 connection_workspace_to_set_of_labels(IMDHistoWorkspace const *const ws) {
-  std::set<size_t> unique_values;
+  std::unordered_set<size_t> unique_values;
   for (size_t i = 0; i < ws->getNPoints(); ++i) {
     const size_t signal = static_cast<size_t>(ws->getSignalAt(i));
     unique_values.insert(signal);
@@ -171,8 +170,7 @@ public:
     ConnectedComponentLabeling ccl(labelingId, multiThreaded);
     auto outWS = ccl.execute(inWS, &mockStrategy, prog);
 
-    std::set<size_t> uniqueEntries =
-        connection_workspace_to_set_of_labels(outWS.get());
+    auto uniqueEntries = connection_workspace_to_set_of_labels(outWS.get());
     TSM_ASSERT_EQUALS("2 objects so should have 3 unique entries", 3,
                       uniqueEntries.size());
     TS_ASSERT(does_set_contain(uniqueEntries, labelingId));
@@ -210,8 +208,7 @@ public:
     Progress prog;
     auto outWS = ccl.execute(inWS, &mockStrategy, prog);
 
-    std::set<size_t> uniqueEntries =
-        connection_workspace_to_set_of_labels(outWS.get());
+    auto uniqueEntries = connection_workspace_to_set_of_labels(outWS.get());
     TSM_ASSERT_EQUALS("3 objects so should have 4 unique entries", 4,
                       uniqueEntries.size());
     TS_ASSERT(does_set_contain(uniqueEntries, labelingId));
@@ -238,8 +235,7 @@ public:
     Progress prog;
     auto outWS = ccl.execute(inWS, &mockStrategy, prog);
 
-    std::set<size_t> uniqueEntries =
-        connection_workspace_to_set_of_labels(outWS.get());
+    auto uniqueEntries = connection_workspace_to_set_of_labels(outWS.get());
     TSM_ASSERT_EQUALS("Just one object", 1, uniqueEntries.size());
     TS_ASSERT(does_set_contain(uniqueEntries, labelingId));
     TS_ASSERT(Mock::VerifyAndClearExpectations(&mockStrategy));
@@ -281,8 +277,7 @@ public:
     Progress prog;
     auto outWS = ccl.execute(inWS, &mockStrategy, prog);
 
-    std::set<size_t> uniqueEntries =
-        connection_workspace_to_set_of_labels(outWS.get());
+    auto uniqueEntries = connection_workspace_to_set_of_labels(outWS.get());
     TSM_ASSERT_EQUALS("Just one object, but we have some 'empty' entries too",
                       2, uniqueEntries.size());
     TS_ASSERT(does_set_contain(uniqueEntries, labelingId));
@@ -363,8 +358,7 @@ public:
     Progress prog;
     auto outWS = ccl.execute(inWS, &mockStrategy, prog);
 
-    std::set<size_t> uniqueEntries =
-        connection_workspace_to_set_of_labels(outWS.get());
+    auto uniqueEntries = connection_workspace_to_set_of_labels(outWS.get());
     TSM_ASSERT_EQUALS("Just one object, but we have some 'empty' entries too",
                       2, uniqueEntries.size());
     TS_ASSERT(does_set_contain(uniqueEntries, labelingId));
@@ -374,7 +368,7 @@ public:
 
   void do_test_cluster_labeling(const std::vector<size_t> &clusterIndexes,
                                 IMDHistoWorkspace const *const ws) {
-    std::set<double> valuesInCluster;
+    std::unordered_set<double> valuesInCluster;
     for (size_t i = 0; i < ws->getNPoints(); ++i) {
       if (does_vector_contain(clusterIndexes, i)) {
         valuesInCluster.insert(ws->getSignalAt(i));
@@ -395,16 +389,15 @@ public:
 
     // Now add some objects
     // First cluster amongst 3 dimensions.
-    std::vector<size_t> clusterOneIndexes =
-        boost::assign::list_of(1)(1 + 1)(1 + 5 - 1);
+    std::vector<size_t> clusterOneIndexes = {(1), (1 + 1), (1 + 5 - 1)};
 
     // Another cluster amongst 3 dimensions. Rough center of block.
-    std::vector<size_t> clusterTwoIndexes =
-        boost::assign::list_of(5 * 5 * 2)((5 * 5 * 2) + 1)((5 * 5 * 2) + 5);
+    std::vector<size_t> clusterTwoIndexes = {(5 * 5 * 2), ((5 * 5 * 2) + 1),
+                                             ((5 * 5 * 2) + 5)};
 
     // Another cluster amongst 3 dimensions. Far side of block.
-    std::vector<size_t> clusterThreeIndexes = boost::assign::list_of(
-        (5 * 5 * 5) - 1)((5 * 5 * 5) - 2)((5 * 5 * 5) - (5 * 5) - 1);
+    std::vector<size_t> clusterThreeIndexes = {
+        ((5 * 5 * 5) - 1), ((5 * 5 * 5) - 2), ((5 * 5 * 5) - (5 * 5) - 1)};
 
     // Accumulate all cluster indexes
     std::vector<size_t> allClusterIndexes;
@@ -432,8 +425,7 @@ public:
 
     // ----------- Basic cluster checks
 
-    std::set<size_t> uniqueEntries =
-        connection_workspace_to_set_of_labels(outWS.get());
+    auto uniqueEntries = connection_workspace_to_set_of_labels(outWS.get());
     TSM_ASSERT_EQUALS(
         "Should have 3 clusters, but we have some 'empty' entries too", 4,
         uniqueEntries.size());
@@ -494,8 +486,7 @@ public:
     ConnectedComponentLabeling ccl(labelingId, nThreads);
     auto outWS = ccl.execute(inWS, &backgroundStrategy, prog);
 
-    std::set<size_t> uniqueEntries =
-        connection_workspace_to_set_of_labels(outWS.get());
+    auto uniqueEntries = connection_workspace_to_set_of_labels(outWS.get());
     TSM_ASSERT_EQUALS("2 objects so should have 3 unique entries", 3,
                       uniqueEntries.size());
     TS_ASSERT(does_set_contain(uniqueEntries, labelingId));
@@ -518,8 +509,7 @@ public:
     ConnectedComponentLabeling ccl(labelingId, nThreads);
     auto outWS = ccl.execute(inWS, &backgroundStrategy, prog);
 
-    std::set<size_t> uniqueEntries =
-        connection_workspace_to_set_of_labels(outWS.get());
+    auto uniqueEntries = connection_workspace_to_set_of_labels(outWS.get());
     TSM_ASSERT_EQUALS("1 object covering entire space", 1,
                       uniqueEntries.size());
     TS_ASSERT(does_set_contain(uniqueEntries, labelingId));
@@ -542,8 +532,7 @@ public:
     ConnectedComponentLabeling ccl(labelingId, nThreads);
     auto outWS = ccl.execute(inWS, &backgroundStrategy, prog);
 
-    std::set<size_t> uniqueEntries =
-        connection_workspace_to_set_of_labels(outWS.get());
+    auto uniqueEntries = connection_workspace_to_set_of_labels(outWS.get());
     TSM_ASSERT_EQUALS("3 objects", 3, uniqueEntries.size());
     TS_ASSERT(does_set_contain(uniqueEntries, labelingId));
     TS_ASSERT(does_set_contain(uniqueEntries, m_emptyLabel));
@@ -614,8 +603,7 @@ public:
     Progress prog;
     auto outWS = ccl.execute(inWS, &backgroundStrategy, prog);
 
-    std::set<size_t> uniqueEntries =
-        connection_workspace_to_set_of_labels(outWS.get());
+    auto uniqueEntries = connection_workspace_to_set_of_labels(outWS.get());
     TSM_ASSERT_EQUALS("One unique real label (and one empty)", 2,
                       uniqueEntries.size());
     TS_ASSERT(does_set_contain(uniqueEntries, labelingId));
@@ -681,8 +669,7 @@ public:
 
     // ----------- Basic cluster checks
 
-    std::set<size_t> uniqueEntries =
-        connection_workspace_to_set_of_labels(outWS.get());
+    auto uniqueEntries = connection_workspace_to_set_of_labels(outWS.get());
     TSM_ASSERT_EQUALS("Should be chequered pattern", 2, uniqueEntries.size());
     TS_ASSERT(does_set_contain(uniqueEntries, size_t(0)));
     TS_ASSERT(does_set_contain(uniqueEntries, size_t(1)));
diff --git a/Framework/Crystal/test/FindClusterFacesTest.h b/Framework/Crystal/test/FindClusterFacesTest.h
index a17e21ccb53783f29bf3decc34dfa3ca590065f2..2c256f00a4b92ed266eee025599d66f765f676aa 100644
--- a/Framework/Crystal/test/FindClusterFacesTest.h
+++ b/Framework/Crystal/test/FindClusterFacesTest.h
@@ -14,8 +14,6 @@
 #include "MantidTestHelpers/MDEventsTestHelper.h"
 #include "MantidKernel/UnitLabelTypes.h"
 
-#include <boost/assign/list_of.hpp>
-
 using namespace Mantid::API;
 using namespace Mantid::Geometry;
 using namespace Mantid::DataObjects;
@@ -48,9 +46,7 @@ IMDHistoWorkspace_sptr create_HKL_MDWS(double min = -10, double max = 10,
   mdworkspaceAlg->setProperty("Dimensionality", dimensionality);
   std::vector<int> numbersOfBins(dimensionality, numberOfBins);
   mdworkspaceAlg->setProperty("NumberOfBins", numbersOfBins);
-  std::vector<double> extents =
-      boost::assign::list_of(min)(max)(min)(max)(min)(max)
-          .convert_to_container<std::vector<double>>();
+  std::vector<double> extents = {min, max, min, max, min, max};
   mdworkspaceAlg->setProperty("Extents", extents);
   std::vector<double> signalValues(totalBins, signalValue);
   mdworkspaceAlg->setProperty("SignalInput", signalValues);
diff --git a/Framework/Crystal/test/IntegratePeaksHybridTest.h b/Framework/Crystal/test/IntegratePeaksHybridTest.h
index 8f76baa78907fdcf7bca88fb2f261eda18e2ca4a..693cf2f8bbce0a8bedcc38c6ecdc1f9d00fa817f 100644
--- a/Framework/Crystal/test/IntegratePeaksHybridTest.h
+++ b/Framework/Crystal/test/IntegratePeaksHybridTest.h
@@ -178,7 +178,7 @@ public:
     TS_ASSERT_EQUALS(outPeaksWS->getNumberPeaks(), peaksWS->getNumberPeaks());
     TS_ASSERT_EQUALS(nBins * nBins * nBins, outClustersWS->getNPoints());
     // Check clusters by extracting unique label ids.
-    std::set<Mantid::signal_t> labelIds;
+    std::unordered_set<Mantid::signal_t> labelIds;
     for (size_t i = 0; i < outClustersWS->getNPoints(); ++i) {
       labelIds.insert(outClustersWS->getSignalAt(i));
     }
@@ -270,7 +270,7 @@ public:
     TS_ASSERT_EQUALS(nBins * nBins * nBins, outClustersWS1->getNPoints());
     TS_ASSERT_EQUALS(nBins * nBins * nBins, outClustersWS2->getNPoints());
     // Check clusters by extracting unique label ids.
-    std::set<Mantid::signal_t> labelIds1;
+    std::unordered_set<Mantid::signal_t> labelIds1;
     for (size_t i = 0; i < outClustersWS1->getNPoints(); ++i) {
       labelIds1.insert(outClustersWS1->getSignalAt(i));
     }
@@ -278,7 +278,7 @@ public:
                       "have two unique label ids",
                       2, labelIds1.size());
 
-    std::set<Mantid::signal_t> labelIds2;
+    std::unordered_set<Mantid::signal_t> labelIds2;
     for (size_t i = 0; i < outClustersWS2->getNPoints(); ++i) {
       labelIds2.insert(outClustersWS2->getSignalAt(i));
     }
@@ -347,7 +347,7 @@ public:
     TS_ASSERT_EQUALS(nBins * nBins * nBins, outClustersWS1->getNPoints());
     TS_ASSERT_EQUALS(nBins * nBins * nBins, outClustersWS2->getNPoints());
     // Check clusters by extracting unique label ids.
-    std::set<Mantid::signal_t> labelIds1;
+    std::unordered_set<Mantid::signal_t> labelIds1;
     for (size_t i = 0; i < outClustersWS1->getNPoints(); ++i) {
       labelIds1.insert(outClustersWS1->getSignalAt(i));
     }
@@ -355,7 +355,7 @@ public:
                       "have two unique label ids",
                       2, labelIds1.size());
 
-    std::set<Mantid::signal_t> labelIds2;
+    std::unordered_set<Mantid::signal_t> labelIds2;
     for (size_t i = 0; i < outClustersWS2->getNPoints(); ++i) {
       labelIds2.insert(outClustersWS2->getSignalAt(i));
     }
diff --git a/Framework/Crystal/test/IntegratePeaksUsingClustersTest.h b/Framework/Crystal/test/IntegratePeaksUsingClustersTest.h
index 9fb958cbb3bb9f6c9bc5b3eecac4a3aeb243cb88..1999f8ba3b5f94b69f727799ea3638909a6cf95b 100644
--- a/Framework/Crystal/test/IntegratePeaksUsingClustersTest.h
+++ b/Framework/Crystal/test/IntegratePeaksUsingClustersTest.h
@@ -121,7 +121,7 @@ public:
     IMDHistoWorkspace_sptr outClustersWS = integratedWorkspaces.get<0>();
     IPeaksWorkspace_sptr outPeaksWS = integratedWorkspaces.get<1>();
 
-    std::set<Mantid::signal_t> labelIds;
+    std::unordered_set<Mantid::signal_t> labelIds;
     for (size_t i = 0; i < outClustersWS->getNPoints(); ++i) {
       labelIds.insert(outClustersWS->getSignalAt(i));
     }
@@ -158,7 +158,7 @@ public:
     TS_ASSERT_EQUALS(outPeaksWS->getNumberPeaks(), peaksWS->getNumberPeaks());
     TS_ASSERT_EQUALS(mdWS->getNPoints(), outClustersWS->getNPoints());
     // Check clusters by extracting unique label ids.
-    std::set<Mantid::signal_t> labelIds;
+    std::unordered_set<Mantid::signal_t> labelIds;
     for (size_t i = 0; i < outClustersWS->getNPoints(); ++i) {
       labelIds.insert(outClustersWS->getSignalAt(i));
     }
@@ -199,7 +199,7 @@ public:
     TS_ASSERT_EQUALS(outPeaksWS->getNumberPeaks(), peaksWS->getNumberPeaks());
     TS_ASSERT_EQUALS(mdWS->getNPoints(), outClustersWS->getNPoints());
     // Check clusters by extracting unique label ids.
-    std::set<Mantid::signal_t> labelIds;
+    std::unordered_set<Mantid::signal_t> labelIds;
     for (size_t i = 0; i < outClustersWS->getNPoints(); ++i) {
       labelIds.insert(outClustersWS->getSignalAt(i));
     }
@@ -254,7 +254,7 @@ public:
     TS_ASSERT_EQUALS(outPeaksWS->getNumberPeaks(), peaksWS->getNumberPeaks());
     TS_ASSERT_EQUALS(mdWS->getNPoints(), outClustersWS->getNPoints());
     // Check clusters by extracting unique label ids.
-    std::set<Mantid::signal_t> labelIds;
+    std::unordered_set<Mantid::signal_t> labelIds;
     for (size_t i = 0; i < outClustersWS->getNPoints(); ++i) {
       labelIds.insert(outClustersWS->getSignalAt(i));
     }
diff --git a/Framework/Crystal/test/PeakClusterProjectionTest.h b/Framework/Crystal/test/PeakClusterProjectionTest.h
index 83250c9ae1645276a297833b3852e656f8924c7a..a80e7935e7af6908a4350163e94dddecf7f0378a 100644
--- a/Framework/Crystal/test/PeakClusterProjectionTest.h
+++ b/Framework/Crystal/test/PeakClusterProjectionTest.h
@@ -17,7 +17,6 @@
 #include "MantidKernel/UnitLabelTypes.h"
 
 #include <boost/math/special_functions/fpclassify.hpp>
-#include <boost/assign/list_of.hpp>
 #include <math.h>
 
 using namespace Mantid::API;
@@ -54,9 +53,7 @@ private:
     mdworkspaceAlg->setProperty("Dimensionality", dimensionality);
     std::vector<int> numbersOfBins(dimensionality, numberOfBins);
     mdworkspaceAlg->setProperty("NumberOfBins", numbersOfBins);
-    std::vector<double> extents =
-        boost::assign::list_of(min)(max)(min)(max)(min)(max)
-            .convert_to_container<std::vector<double>>();
+    std::vector<double> extents = {min, max, min, max, min, max};
     mdworkspaceAlg->setProperty("Extents", extents);
     std::vector<double> signalValues(totalBins, signalValue);
     mdworkspaceAlg->setProperty("SignalInput", signalValues);
diff --git a/Framework/Crystal/test/PeaksInRegionTest.h b/Framework/Crystal/test/PeaksInRegionTest.h
index 527700454ce41f51881f866201bd58cc0b467ced..f90191a469ddc8e5ad44fa19de0caad440b3e8e6 100644
--- a/Framework/Crystal/test/PeaksInRegionTest.h
+++ b/Framework/Crystal/test/PeaksInRegionTest.h
@@ -7,7 +7,6 @@
 #include "MantidDataObjects/PeaksWorkspace.h"
 #include "MantidCrystal/PeaksInRegion.h"
 #include <boost/tuple/tuple.hpp>
-#include <boost/assign/list_of.hpp>
 
 using namespace Mantid::Crystal;
 using namespace Mantid::API;
@@ -395,8 +394,8 @@ public:
   }
 
   void test_false_intersection_when_check_peak_extents() {
-    std::vector<double> extents = boost::assign::list_of(0)(1)(0)(1)(0)(
-        1); // Extents go from 0, 1 in each dimension.
+    std::vector<double> extents = {
+        0, 1, 0, 1, 0, 1}; // Extents go from 0, 1 in each dimension.
 
     PeaksWorkspace_sptr ws = WorkspaceCreationHelper::createPeaksWorkspace(1);
     auto detectorIds = ws->getInstrument()->getDetectorIDs();
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Functions/BivariateNormal.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/BivariateNormal.h
index 15c873463b62e86a8487d495da699a538a7e3a01..16e4f39a5a8666b964f6b83cc591bd3cb80f58c6 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/Functions/BivariateNormal.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/BivariateNormal.h
@@ -140,10 +140,7 @@ public:
   }
 
   bool hasAttribute(const std::string &attName) const override {
-    if (attName == std::string("CalcVariances"))
-      return true;
-
-    return false;
+    return attName.compare("CalcVariances") == 0;
   }
 
   bool CalcVxx, CalcVyy, CalcVxy;
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ChebfunBase.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ChebfunBase.h
index 92dd84b3ddf1deda279dc2435e33092d12c71afa..e0b875727d6530e46b7d35af212409c9defa7626 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ChebfunBase.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ChebfunBase.h
@@ -5,8 +5,8 @@
 #include "MantidCurveFitting/GSLMatrix.h"
 
 #include <boost/shared_ptr.hpp>
-#include <vector>
 #include <functional>
+#include <vector>
 
 namespace Mantid {
 
@@ -206,10 +206,14 @@ boost::shared_ptr<ChebfunBase> ChebfunBase::bestFitAnyTolerance(
     std::vector<double> &a, double maxA, double tolerance, size_t maxSize) {
   if (tolerance == 0.0)
     tolerance = g_tolerance;
-  for (double tol = tolerance; tol < 0.1; tol *= 100) {
+
+  double tol = tolerance;
+  while (tol < 0.1) {
     auto base = bestFit(start, end, f, p, a, maxA, tol, maxSize);
-    if (base)
+    if (base) {
       return base;
+    }
+    tol *= 100.0;
   }
   return ChebfunBase_sptr();
 }
diff --git a/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp b/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp
index e4799dd9447086b81aee5238f7791ca11a60a9e0..5306e2c4e118ad5ef4c32bdfb281954a3ca685fd 100644
--- a/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp
+++ b/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp
@@ -667,7 +667,7 @@ void LeBailFit::execRefineBackground() {
   }
 
   // 5. Output background to table workspace
-  TableWorkspace_sptr outtablews(new TableWorkspace());
+  auto outtablews = boost::make_shared<TableWorkspace>();
   outtablews->addColumn("str", "Name");
   outtablews->addColumn("double", "Value");
   outtablews->addColumn("double", "Error");
@@ -2365,16 +2365,8 @@ bool LeBailFit::acceptOrDeny(Rfactor currR, Rfactor newR) {
     g_log.debug() << "[TestRandom] dice " << dice << "\n";
     double bar =
         exp(-(new_goodness - cur_goodness) / (cur_goodness * m_Temperature));
-    // double bar = exp(-(newrwp-currwp)/m_bestRwp);
-    // g_log.debug() << "[DBx329] Bar = " << bar << ", Dice = " << dice << "\n";
-    if (dice < bar) {
-      // random number (dice, 0 and 1) is smaller than bar (between -infty and
-      // 0)
-      accept = true;
-    } else {
-      // Reject
-      accept = false;
-    }
+    // random number (dice, 0 and 1) is smaller than bar (between -infty andn0)
+    accept = dice < bar;
   }
 
   return accept;
diff --git a/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp b/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp
index 08460321835c8191e8d6ca48fae40af8f35315de..d4d4c0e08cc23a36cda13ff6fb0c0e014ff839aa 100644
--- a/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp
+++ b/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp
@@ -6,7 +6,7 @@
 #include <fstream>
 #include <sstream>
 #include <algorithm>
-#include <Poco/StringTokenizer.h>
+#include <MantidKernel/StringTokenizer.h>
 #include <boost/lexical_cast.hpp>
 #include <boost/algorithm/string/replace.hpp>
 
@@ -516,7 +516,7 @@ PlotPeakByLogValue::makeNames() const {
   double start = 0;
   double end = 0;
 
-  typedef Poco::StringTokenizer tokenizer;
+  typedef Mantid::Kernel::StringTokenizer tokenizer;
   tokenizer names(inputList, ";",
                   tokenizer::TOK_IGNORE_EMPTY | tokenizer::TOK_TRIM);
   for (const auto &input : names) {
diff --git a/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters3.cpp b/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters3.cpp
index e49175927086ad503e47509092d24ce419317ea8..548cfe7614b4299d440e12975d72777fb9dff017 100644
--- a/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters3.cpp
+++ b/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters3.cpp
@@ -635,17 +635,8 @@ bool RefinePowderInstrumentParameters3::acceptOrDenyChange(double curchisq,
     // Higher Rwp. Take a chance to accept
     double dice = static_cast<double>(rand()) / static_cast<double>(RAND_MAX);
     double bar = exp(-(newchisq - curchisq) / (curchisq * temperature));
-    // double bar = exp(-(newrwp-currwp)/m_bestRwp);
-    // g_log.notice() << "[DBx329] Bar = " << bar << ", Dice = " << dice <<
-    // endl;
-    if (dice < bar) {
-      // random number (dice, 0 and 1) is smaller than bar (between -infty and
-      // 0)
-      accept = true;
-    } else {
-      // Reject
-      accept = false;
-    }
+    // random number (dice, 0 and 1) is smaller than bar (between -infty and
+    accept = dice < bar;
   }
 
   return accept;
@@ -1060,7 +1051,7 @@ bool RefinePowderInstrumentParameters3::doFitFunction(
 TableWorkspace_sptr RefinePowderInstrumentParameters3::genOutputProfileTable(
     map<string, Parameter> parameters, double startchi2, double finalchi2) {
   // 1. Create TableWorkspace
-  TableWorkspace_sptr tablews(new TableWorkspace);
+  auto tablews = boost::make_shared<TableWorkspace>();
 
   tablews->addColumn("str", "Name");
   tablews->addColumn("double", "Value");
diff --git a/Framework/CurveFitting/src/Algorithms/SplineSmoothing.cpp b/Framework/CurveFitting/src/Algorithms/SplineSmoothing.cpp
index 9cc5d65aa7a0b3cd1810bed4218231eb5931fe52..94137137b586a6d524814c5456529fea1a8722a7 100644
--- a/Framework/CurveFitting/src/Algorithms/SplineSmoothing.cpp
+++ b/Framework/CurveFitting/src/Algorithms/SplineSmoothing.cpp
@@ -287,16 +287,15 @@ void SplineSmoothing::addSmoothingPoints(const std::set<int> &points,
   breakPoints.reserve(num_points);
 
   // set each of the x and y points to redefine the spline
-  std::set<int>::const_iterator pts;
-  for (pts = points.begin(); pts != points.end(); ++pts) {
-    breakPoints.push_back(xs[*pts]);
+  for (auto const &point : points) {
+    breakPoints.push_back(xs[point]);
   }
   m_cspline->setAttribute("BreakPoints",
                           API::IFunction::Attribute(breakPoints));
 
   int i = 0;
-  for (pts = points.begin(); pts != points.end(); ++pts) {
-    m_cspline->setParameter(i, ys[*pts]);
+  for (auto const &point : points) {
+    m_cspline->setParameter(i, ys[point]);
     ++i;
   }
 }
diff --git a/Framework/CurveFitting/src/AugmentedLagrangianOptimizer.cpp b/Framework/CurveFitting/src/AugmentedLagrangianOptimizer.cpp
index 0b783c3a76d58c10634fa9f46fa7060dba46ed3f..e8a014743d776d61d03c5d0f96e6d80dc0bb13ce 100644
--- a/Framework/CurveFitting/src/AugmentedLagrangianOptimizer.cpp
+++ b/Framework/CurveFitting/src/AugmentedLagrangianOptimizer.cpp
@@ -318,7 +318,7 @@ void AugmentedLagrangianOptimizer::unconstrainedOptimization(
   costFunc.f = costf;
   costFunc.df = costdf;
   costFunc.fdf = costfdf;
-  costFunc.params = (void *)&d;
+  costFunc.params = static_cast<void *>(&d);
 
   // Declare minimizer
   const gsl_multimin_fdfminimizer_type *T =
diff --git a/Framework/CurveFitting/test/CMakeLists.txt b/Framework/CurveFitting/test/CMakeLists.txt
index 556f2cc55dba65886476dc9c0cc42a7025e9256f..c9c9735697701f91031f67987b6c8f4ba4d3744c 100644
--- a/Framework/CurveFitting/test/CMakeLists.txt
+++ b/Framework/CurveFitting/test/CMakeLists.txt
@@ -5,6 +5,7 @@ if ( CXXTEST_FOUND )
   # This variable is used within the cxxtest_add_test macro to build these helper classes into the test executable.
   # It will go out of scope at the end of this file so doesn't need un-setting
   set ( TESTHELPER_SRCS ../../TestHelpers/src/TearDownWorld.cpp
+                        ../../TestHelpers/src/InstrumentCreationHelper.cpp
                         ../../TestHelpers/src/WorkspaceCreationHelper.cpp
                         ../../TestHelpers/src/ComponentCreationHelper.cpp
                         ../../TestHelpers/src/StartFrameworkManager.cpp
diff --git a/Framework/CurveFitting/test/Functions/ComptonPeakProfileTest.h b/Framework/CurveFitting/test/Functions/ComptonPeakProfileTest.h
index 1d5a8488d99c3a143fd1ed5df9d99c4d97e3a7e6..ead30e5efe56094a889f5f40069dde72aea3870a 100644
--- a/Framework/CurveFitting/test/Functions/ComptonPeakProfileTest.h
+++ b/Framework/CurveFitting/test/Functions/ComptonPeakProfileTest.h
@@ -33,8 +33,8 @@ public:
 
     // Test names as they are used in scripts
     if (profile->nAttributes() > 0) {
-      std::set<std::string> expectedAttrSet(expectedAttrs,
-                                            expectedAttrs + nattrs);
+      std::unordered_set<std::string> expectedAttrSet(expectedAttrs,
+                                                      expectedAttrs + nattrs);
       std::vector<std::string> actualNames = profile->getAttributeNames();
 
       for (size_t i = 0; i < nattrs; ++i) {
diff --git a/Framework/CurveFitting/test/Functions/ComptonProfileTest.h b/Framework/CurveFitting/test/Functions/ComptonProfileTest.h
index 2d21d6981cac2ea1c2bdd06f2e744938371e4cf7..0df3b42f0c7b947c508881076c23d11878b8a00b 100644
--- a/Framework/CurveFitting/test/Functions/ComptonProfileTest.h
+++ b/Framework/CurveFitting/test/Functions/ComptonProfileTest.h
@@ -5,6 +5,7 @@
 
 #include "MantidCurveFitting/Functions/ComptonProfile.h"
 #include <boost/make_shared.hpp>
+#include <unordered_set>
 
 using Mantid::CurveFitting::Functions::ComptonProfile;
 
@@ -30,8 +31,8 @@ public:
 
     // Test names as they are used in scripts
     if (profile->nAttributes() > 0) {
-      std::set<std::string> expectedAttrSet(expectedAttrs,
-                                            expectedAttrs + nattrs);
+      std::unordered_set<std::string> expectedAttrSet(expectedAttrs,
+                                                      expectedAttrs + nattrs);
       std::vector<std::string> actualNames = profile->getAttributeNames();
 
       for (size_t i = 0; i < nattrs; ++i) {
diff --git a/Framework/CurveFitting/test/Functions/GaussianComptonProfileTest.h b/Framework/CurveFitting/test/Functions/GaussianComptonProfileTest.h
index dfec3f0af151f71660962a523f453ec815eb1a96..9b20131892c1cacebaa046c10e65dc1712da0d4f 100644
--- a/Framework/CurveFitting/test/Functions/GaussianComptonProfileTest.h
+++ b/Framework/CurveFitting/test/Functions/GaussianComptonProfileTest.h
@@ -56,8 +56,8 @@ public:
 
     // Test names as they are used in scripts
     if (profile->nAttributes() > 0) {
-      std::set<std::string> expectedAttrSet(expectedAttrs,
-                                            expectedAttrs + nattrs);
+      std::unordered_set<std::string> expectedAttrSet(expectedAttrs,
+                                                      expectedAttrs + nattrs);
       std::vector<std::string> actualNames = profile->getAttributeNames();
 
       for (size_t i = 0; i < nattrs; ++i) {
diff --git a/Framework/CurveFitting/test/Functions/GramCharlierComptonProfileTest.h b/Framework/CurveFitting/test/Functions/GramCharlierComptonProfileTest.h
index 905278a19172c6d03ee6b237f972058c2da5d16a..9564aa969daa157fc6f9d08631d2ec33b78617df 100644
--- a/Framework/CurveFitting/test/Functions/GramCharlierComptonProfileTest.h
+++ b/Framework/CurveFitting/test/Functions/GramCharlierComptonProfileTest.h
@@ -129,7 +129,8 @@ private:
     // Test names as they are used in scripts
     if (nattrs <= profile.nAttributes()) {
       const char *attrAarr[nattrs] = {"Mass", "HermiteCoeffs"};
-      std::set<std::string> expectedAttrs(attrAarr, attrAarr + nattrs);
+      std::unordered_set<std::string> expectedAttrs(attrAarr,
+                                                    attrAarr + nattrs);
       std::vector<std::string> actualNames = profile.getAttributeNames();
 
       for (size_t i = 0; i < nattrs; ++i) {
diff --git a/Framework/CurveFitting/test/Functions/VesuvioResolutionTest.h b/Framework/CurveFitting/test/Functions/VesuvioResolutionTest.h
index 8488b55e50588cf4734bf3b03463c4c3dd374660..cb856cefc08f34e66087ed037c49f09d0de12fcb 100644
--- a/Framework/CurveFitting/test/Functions/VesuvioResolutionTest.h
+++ b/Framework/CurveFitting/test/Functions/VesuvioResolutionTest.h
@@ -67,7 +67,8 @@ private:
     // Test names as they are used in scripts
     if (nattrs <= func.nAttributes()) {
       const char *attrAarr[nattrs] = {"Mass"};
-      std::set<std::string> expectedAttrs(attrAarr, attrAarr + nattrs);
+      std::unordered_set<std::string> expectedAttrs(attrAarr,
+                                                    attrAarr + nattrs);
       std::vector<std::string> actualNames = func.getAttributeNames();
 
       for (size_t i = 0; i < nattrs; ++i) {
diff --git a/Framework/CurveFitting/test/IPeakFunctionIntensityTest.h b/Framework/CurveFitting/test/IPeakFunctionIntensityTest.h
index b90b0a561e509c1bbfc8f5779671a7834bae54ac..66c3e167245dd42f4df49c98332d38be9ac3ab1a 100644
--- a/Framework/CurveFitting/test/IPeakFunctionIntensityTest.h
+++ b/Framework/CurveFitting/test/IPeakFunctionIntensityTest.h
@@ -84,7 +84,7 @@ public:
 
 private:
   std::vector<IPeakFunction_sptr>
-  getAllPeakFunctions(const std::set<std::string> &blackList) const {
+  getAllPeakFunctions(const std::unordered_set<std::string> &blackList) const {
     std::vector<IPeakFunction_sptr> peakFunctions;
 
     std::vector<std::string> registeredFunctions =
@@ -145,7 +145,7 @@ private:
 
   std::vector<IPeakFunction_sptr> m_peakFunctions;
   std::vector<ParameterSet> m_parameterSets;
-  std::set<std::string> m_blackList;
+  std::unordered_set<std::string> m_blackList;
 };
 
 #endif // IPEAKFUNCTIONINTENSITYTEST_H
diff --git a/Framework/DataHandling/inc/MantidDataHandling/DownloadInstrument.h b/Framework/DataHandling/inc/MantidDataHandling/DownloadInstrument.h
index e9e4453764fff6176d3663efae79e7bc0d7913fa..f234f05d2a0f9bbcf50bde23dee27a69a858cbb8 100644
--- a/Framework/DataHandling/inc/MantidDataHandling/DownloadInstrument.h
+++ b/Framework/DataHandling/inc/MantidDataHandling/DownloadInstrument.h
@@ -61,9 +61,9 @@ private:
                                 const std::string &key,
                                 const std::string &defaultValue) const;
 
-  size_t
-  removeOrphanedFiles(const std::string &directoryPath,
-                      const std::set<std::string> &filenamesToKeep) const;
+  size_t removeOrphanedFiles(
+      const std::string &directoryPath,
+      const std::unordered_set<std::string> &filenamesToKeep) const;
 
   Kernel::ProxyInfo m_proxyInfo;
 };
diff --git a/Framework/DataHandling/inc/MantidDataHandling/EventWorkspaceCollection.h b/Framework/DataHandling/inc/MantidDataHandling/EventWorkspaceCollection.h
index 3ffd52e9e695c893de3ddff655b5244f0d1d33a0..6bdc328ae21d89177b5f2f0b380a129a81d52830 100644
--- a/Framework/DataHandling/inc/MantidDataHandling/EventWorkspaceCollection.h
+++ b/Framework/DataHandling/inc/MantidDataHandling/EventWorkspaceCollection.h
@@ -91,12 +91,12 @@ public:
   getEventList(const size_t workspace_index) const;
 
   DataObjects::EventList &getEventList(const std::size_t workspace_index);
-  void getSpectrumToWorkspaceIndexVector(std::vector<size_t> &out,
-                                         Mantid::specid_t &offset) const;
+  std::vector<size_t>
+  getSpectrumToWorkspaceIndexVector(Mantid::specid_t &offset) const;
 
-  void getDetectorIDToWorkspaceIndexVector(std::vector<size_t> &out,
-                                           Mantid::specid_t &offset,
-                                           bool dothrow) const;
+  std::vector<size_t>
+  getDetectorIDToWorkspaceIndexVector(Mantid::specid_t &offset,
+                                      bool dothrow) const;
   Kernel::DateAndTime getFirstPulseTime() const;
   void setAllX(Kernel::cow_ptr<MantidVec> &x);
   size_t getNumberEvents() const;
diff --git a/Framework/DataHandling/inc/MantidDataHandling/GroupDetectors2.h b/Framework/DataHandling/inc/MantidDataHandling/GroupDetectors2.h
index ea2fd7cab8acacc66cf358862518910cc606dafb..d078a652ee5329f0e2622b21b7ca2c6cf4dbf5d6 100644
--- a/Framework/DataHandling/inc/MantidDataHandling/GroupDetectors2.h
+++ b/Framework/DataHandling/inc/MantidDataHandling/GroupDetectors2.h
@@ -144,8 +144,10 @@ private:
     RangeHelper(){};
     /// give an enum from poco a better name here
     enum {
-      IGNORE_SPACES = Poco::StringTokenizer::TOK_TRIM ///< equal to
-      /// Poco::StringTokenizer::TOK_TRIM but
+      IGNORE_SPACES =
+          Mantid::Kernel::StringTokenizer::TOK_TRIM |
+          Mantid::Kernel::StringTokenizer::TOK_IGNORE_EMPTY ///< equal to
+      /// Mantid::Kernel::StringTokenizer::TOK_TRIM but
       /// saves some typing
     };
   };
@@ -239,8 +241,8 @@ private:
     /// spectrum number to the this
     EMPTY_LINE = 1001 - INT_MAX, ///< when reading from the input file this
     /// value means that we found any empty line
-    IGNORE_SPACES = Poco::StringTokenizer::TOK_TRIM ///< equal to
-    /// Poco::StringTokenizer::TOK_TRIM but
+    IGNORE_SPACES = Mantid::Kernel::StringTokenizer::TOK_TRIM ///< equal to
+    /// Mantid::Kernel::StringTokenizer::TOK_TRIM but
     /// saves some typing
   };
 
diff --git a/Framework/DataHandling/inc/MantidDataHandling/ISISRunLogs.h b/Framework/DataHandling/inc/MantidDataHandling/ISISRunLogs.h
index 090d13a28dc1fde612e2a1da631848c6f48bafe8..409cbec650fd080d5a68af47878fe89755a666b9 100644
--- a/Framework/DataHandling/inc/MantidDataHandling/ISISRunLogs.h
+++ b/Framework/DataHandling/inc/MantidDataHandling/ISISRunLogs.h
@@ -7,7 +7,7 @@
 
 #include "MantidAPI/Run.h"
 
-#include <boost/scoped_ptr.hpp>
+#include <memory>
 
 namespace Mantid {
 namespace DataHandling {
@@ -46,8 +46,7 @@ class DLLExport ISISRunLogs {
 public:
   /// Construct this object using a run that has the required ICP event log
   /// and the number of periods
-  ISISRunLogs(const API::Run &icpRun, const int totalNumPeriods);
-
+  ISISRunLogs(const API::Run &icpRun);
   /// Adds the status log to the this run
   void addStatusLog(API::Run &exptRun);
   /// Adds period related logs
@@ -56,12 +55,8 @@ public:
   void addPeriodLog(const int i, API::Run &exptRun);
 
 private:
-  DISABLE_DEFAULT_CONSTRUCT(ISISRunLogs)
-
   /// A LogParser object
-  boost::scoped_ptr<Kernel::LogParser> m_logParser;
-  /// The total number of periods in original data file
-  const int m_numOfPeriods;
+  std::unique_ptr<Kernel::LogParser> m_logParser;
 };
 
 } // namespace DataHandling
diff --git a/Framework/DataHandling/inc/MantidDataHandling/Load.h b/Framework/DataHandling/inc/MantidDataHandling/Load.h
index 8073cd338b9e69b4cc84f3b8e2f3565714b02101..faafaf643896e5ce7315dab94ccf69db535dbb3d 100644
--- a/Framework/DataHandling/inc/MantidDataHandling/Load.h
+++ b/Framework/DataHandling/inc/MantidDataHandling/Load.h
@@ -105,7 +105,7 @@ private:
   groupWsList(const std::vector<API::Workspace_sptr> &wsList);
 
   /// The base properties
-  std::set<std::string> m_baseProps;
+  std::unordered_set<std::string> m_baseProps;
   /// The actual loader
   API::IAlgorithm_sptr m_loader;
   /// The name of the property that will be passed the property from our
diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadANSTOHelper.h b/Framework/DataHandling/inc/MantidDataHandling/LoadANSTOHelper.h
index 5b2849f9f669dbbd435c89629b25d754c65839c6..24427f6d474a4a0f4a7a52cbc6edc454499d0f8a 100644
--- a/Framework/DataHandling/inc/MantidDataHandling/LoadANSTOHelper.h
+++ b/Framework/DataHandling/inc/MantidDataHandling/LoadANSTOHelper.h
@@ -88,7 +88,7 @@ protected:
   double m_tofMax;
 
   // methods
-  virtual void addEventImpl(size_t id, double tof); // override
+  void addEventImpl(size_t id, double tof) override;
 
 public:
   // construction
@@ -110,7 +110,7 @@ protected:
   std::vector<EventVector_pt> &m_eventVectors;
 
   // methods
-  virtual void addEventImpl(size_t id, double tof) override;
+  void addEventImpl(size_t id, double tof) override;
 
 public:
   // construction
@@ -139,7 +139,7 @@ public:
   // methods
   void close();
   bool read(void *buffer, uint32_t size);
-  bool seek(int64_t offset, int whence, int64_t *newPosition = NULL);
+  bool seek(int64_t offset, int whence, int64_t *newPosition = nullptr);
 };
 
 namespace Tar {
diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadBBY.h b/Framework/DataHandling/inc/MantidDataHandling/LoadBBY.h
index bab73f346e6a722f3731e9dbdf68eed378178c95..7a147a5c7de60e9697fa54570558eae74504a85b 100644
--- a/Framework/DataHandling/inc/MantidDataHandling/LoadBBY.h
+++ b/Framework/DataHandling/inc/MantidDataHandling/LoadBBY.h
@@ -78,7 +78,7 @@ public:
   // description
   int version() const override { return 1; }
   const std::string name() const override { return "LoadBBY"; }
-  virtual const std::string category() const { return "DataHandling"; }
+  const std::string category() const override { return "DataHandling"; }
   const std::string summary() const override {
     return "Loads a BilBy data file into a workspace.";
   }
diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadRKH.h b/Framework/DataHandling/inc/MantidDataHandling/LoadRKH.h
index 20bef365ca920fd6335ac6d174c7b291d8f41575..14b68523a4313a9936cee9bb7d6afc0ee6b3c3e0 100644
--- a/Framework/DataHandling/inc/MantidDataHandling/LoadRKH.h
+++ b/Framework/DataHandling/inc/MantidDataHandling/LoadRKH.h
@@ -70,9 +70,9 @@ public:
 
 private:
   /// Store the units known to the UnitFactory
-  std::set<std::string> m_unitKeys;
+  std::unordered_set<std::string> m_unitKeys;
   /// Store the units added as options for this algorithm
-  std::set<std::string> m_RKHKeys;
+  std::unordered_set<std::string> m_RKHKeys;
   /// the input stream for the file being loaded
   std::ifstream m_fileIn;
 
diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadRawHelper.h b/Framework/DataHandling/inc/MantidDataHandling/LoadRawHelper.h
index e99f195243d416024b44450fe3d7edb5ea2e3d4e..bddc6f5ab58e77e5b32e14f0de7aef964308357b 100644
--- a/Framework/DataHandling/inc/MantidDataHandling/LoadRawHelper.h
+++ b/Framework/DataHandling/inc/MantidDataHandling/LoadRawHelper.h
@@ -70,7 +70,7 @@ public:
   FILE *openRawFile(const std::string &fileName);
   /// Read in run parameters Public so that LoadRaw2 can use it
   void loadRunParameters(API::MatrixWorkspace_sptr localWorkspace,
-                         ISISRAW *const = NULL) const;
+                         ISISRAW *const = nullptr) const;
 
   /// Returns a confidence value that this algorithm can load a file
   int confidence(Kernel::FileDescriptor &descriptor) const override;
diff --git a/Framework/DataHandling/inc/MantidDataHandling/PatchBBY.h b/Framework/DataHandling/inc/MantidDataHandling/PatchBBY.h
index 272694b6d58d2e23d9b16873b2e262166523bd86..6ffed6bd56009496476dfddd3aa8c6ea863a8bba 100644
--- a/Framework/DataHandling/inc/MantidDataHandling/PatchBBY.h
+++ b/Framework/DataHandling/inc/MantidDataHandling/PatchBBY.h
@@ -45,23 +45,19 @@ Code Documentation is available at: <http://doxygen.mantidproject.org>
 
 class DLLExport PatchBBY : public API::Algorithm {
 public:
-  // construction
-  PatchBBY() {}
-  virtual ~PatchBBY() {}
-
   // description
-  virtual int version() const override { return 1; }
-  virtual const std::string name() const override { return "PatchBBY"; }
-  virtual const std::string category() const override { return "DataHandling"; }
-  virtual const std::string summary() const override {
+  int version() const override { return 1; }
+  const std::string name() const override { return "PatchBBY"; }
+  const std::string category() const override { return "DataHandling"; }
+  const std::string summary() const override {
     return "Patches a BilBy data file.";
   }
 
 protected:
   // initialisation
-  virtual void init() override;
+  void init() override;
   // execution
-  virtual void exec() override;
+  void exec() override;
 };
 
 } // DataHandling
diff --git a/Framework/DataHandling/src/CheckMantidVersion.cpp b/Framework/DataHandling/src/CheckMantidVersion.cpp
index 00efba2f97c49377d6c1d888e092a71b9154e729..80400931d2119071c8aeff50193d115ea788739a 100644
--- a/Framework/DataHandling/src/CheckMantidVersion.cpp
+++ b/Framework/DataHandling/src/CheckMantidVersion.cpp
@@ -6,7 +6,7 @@
 #include <Poco/DateTimeFormatter.h>
 #include <Poco/DateTimeFormat.h>
 #include <Poco/DateTimeParser.h>
-#include <Poco/StringTokenizer.h>
+#include <MantidKernel/StringTokenizer.h>
 
 // jsoncpp
 #include <json/json.h>
@@ -175,9 +175,10 @@ CheckMantidVersion::cleanVersionTag(const std::string &versionTag) const {
 std::vector<int>
 CheckMantidVersion::splitVersionString(const std::string &versionString) const {
   std::vector<int> retVal;
-  Poco::StringTokenizer tokenizer(versionString, ".",
-                                  Poco::StringTokenizer::TOK_TRIM |
-                                      Poco::StringTokenizer::TOK_IGNORE_EMPTY);
+  Mantid::Kernel::StringTokenizer tokenizer(
+      versionString, ".",
+      Mantid::Kernel::StringTokenizer::TOK_TRIM |
+          Mantid::Kernel::StringTokenizer::TOK_IGNORE_EMPTY);
   auto h = tokenizer.begin();
 
   for (; h != tokenizer.end(); ++h) {
diff --git a/Framework/DataHandling/src/DownloadInstrument.cpp b/Framework/DataHandling/src/DownloadInstrument.cpp
index 8df3f25d29e63809b35e5726baf9a8bdecbd7351..2ac3f74bca8f6a91d9014482fc3d410230627171 100644
--- a/Framework/DataHandling/src/DownloadInstrument.cpp
+++ b/Framework/DataHandling/src/DownloadInstrument.cpp
@@ -177,7 +177,7 @@ DownloadInstrument::StringToStringMap DownloadInstrument::processRepository() {
   }
   fileStream.close();
 
-  std::set<std::string> repoFilenames;
+  std::unordered_set<std::string> repoFilenames;
 
   for (auto &serverElement : serverContents) {
     std::string name = serverElement.get("name", "").asString();
@@ -268,7 +268,7 @@ DownloadInstrument::getFileShas(const std::string &directoryPath) {
 **/
 size_t DownloadInstrument::removeOrphanedFiles(
     const std::string &directoryPath,
-    const std::set<std::string> &filenamesToKeep) const {
+    const std::unordered_set<std::string> &filenamesToKeep) const {
   // hold files to delete in a set so we don't remove files while iterating over
   // the directory.
   std::vector<std::string> filesToDelete;
diff --git a/Framework/DataHandling/src/EventWorkspaceCollection.cpp b/Framework/DataHandling/src/EventWorkspaceCollection.cpp
index 353375c27dd34db1166b8c1a3cd507bbcbb992bb..e5a6da361dab6f43ff71a0f4acd255f2aaab5097 100644
--- a/Framework/DataHandling/src/EventWorkspaceCollection.cpp
+++ b/Framework/DataHandling/src/EventWorkspaceCollection.cpp
@@ -80,7 +80,8 @@ void EventWorkspaceCollection::setNPeriods(
   m_WsVec = std::vector<DataObjects::EventWorkspace_sptr>(nPeriods);
 
   std::vector<int> periodNumbers = periodLog->valuesAsVector();
-  std::set<int> uniquePeriods(periodNumbers.begin(), periodNumbers.end());
+  std::unordered_set<int> uniquePeriods(periodNumbers.begin(),
+                                        periodNumbers.end());
   const bool addBoolTimeSeries = (uniquePeriods.size() == nPeriods);
 
   for (size_t i = 0; i < m_WsVec.size(); ++i) {
@@ -216,13 +217,14 @@ EventWorkspaceCollection::getEventList(const std::size_t workspace_index) {
       workspace_index); // TODO need to know PERIOD number TOO
 }
 
-void EventWorkspaceCollection::getSpectrumToWorkspaceIndexVector(
-    std::vector<size_t> &out, Mantid::specid_t &offset) const {
-  return m_WsVec[0]->getSpectrumToWorkspaceIndexVector(out, offset);
+std::vector<size_t> EventWorkspaceCollection::getSpectrumToWorkspaceIndexVector(
+    Mantid::specid_t &offset) const {
+  return m_WsVec[0]->getSpectrumToWorkspaceIndexVector(offset);
 }
-void EventWorkspaceCollection::getDetectorIDToWorkspaceIndexVector(
-    std::vector<size_t> &out, Mantid::specid_t &offset, bool dothrow) const {
-  return m_WsVec[0]->getDetectorIDToWorkspaceIndexVector(out, offset, dothrow);
+std::vector<size_t>
+EventWorkspaceCollection::getDetectorIDToWorkspaceIndexVector(
+    Mantid::specid_t &offset, bool dothrow) const {
+  return m_WsVec[0]->getDetectorIDToWorkspaceIndexVector(offset, dothrow);
 }
 
 Kernel::DateAndTime EventWorkspaceCollection::getFirstPulseTime() const {
diff --git a/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp b/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp
index e46079a5b52f722999a8531e3e1626f70f4faf0c..c59ec319e9abb6dee871d7fcd1b6cd207a2addf3 100644
--- a/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp
+++ b/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp
@@ -598,9 +598,9 @@ FilterEventsByLogValuePreNexus::setupOutputEventWorkspace() {
   * (3) (Optionally) write out information
   */
 void FilterEventsByLogValuePreNexus::processEventLogs() {
-  std::set<PixelType>::iterator pit;
   std::map<PixelType, size_t>::iterator mit;
-  for (pit = this->wrongdetids.begin(); pit != this->wrongdetids.end(); ++pit) {
+  for (auto pit = this->wrongdetids.begin(); pit != this->wrongdetids.end();
+       ++pit) {
     // Convert Pixel ID to 'wrong detectors ID' map's index
     PixelType pid = *pit;
     mit = this->wrongdetidmap.find(pid);
@@ -1110,8 +1110,7 @@ void FilterEventsByLogValuePreNexus::procEvents(
                    << "Number of Wrong Detector IDs = " << wrongdetids.size()
                    << "\n";
 
-    std::set<PixelType>::iterator wit;
-    for (wit = this->wrongdetids.begin(); wit != this->wrongdetids.end();
+    for (auto wit = this->wrongdetids.begin(); wit != this->wrongdetids.end();
          ++wit) {
       g_log.notice() << "Wrong Detector ID : " << *wit << std::endl;
     }
@@ -1360,8 +1359,8 @@ void FilterEventsByLogValuePreNexus::procEventsLinear(
     this->m_numBadEvents += local_numBadEvents;
     this->m_numWrongdetidEvents += local_numWrongdetidEvents;
 
-    std::set<PixelType>::iterator it;
-    for (it = local_wrongdetids.begin(); it != local_wrongdetids.end(); ++it) {
+    for (auto it = local_wrongdetids.begin(); it != local_wrongdetids.end();
+         ++it) {
       PixelType tmpid = *it;
       this->wrongdetids.insert(*it);
 
@@ -1757,14 +1756,12 @@ void FilterEventsByLogValuePreNexus::filterEvents() {
                    << " microsec; longest TOF: " << m_longestTof << " microsec."
                    << "\n";
 
-    std::set<PixelType>::iterator wit;
-    for (wit = this->wrongdetids.begin(); wit != this->wrongdetids.end();
+    for (auto wit = this->wrongdetids.begin(); wit != this->wrongdetids.end();
          ++wit) {
       g_log.notice() << "Wrong Detector ID : " << *wit << std::endl;
     }
-    std::map<PixelType, size_t>::iterator git;
-    for (git = this->wrongdetidmap.begin(); git != this->wrongdetidmap.end();
-         ++git) {
+    for (auto git = this->wrongdetidmap.begin();
+         git != this->wrongdetidmap.end(); ++git) {
       PixelType tmpid = git->first;
       size_t vindex = git->second;
       g_log.notice() << "Pixel " << tmpid << ":  Total number of events = "
@@ -2339,7 +2336,6 @@ void FilterEventsByLogValuePreNexus::setProtonCharge(
  */
 void FilterEventsByLogValuePreNexus::loadPixelMap(const std::string &filename) {
   this->m_usingMappingFile = false;
-  this->m_pixelmap.clear();
 
   // check that there is a mapping file
   if (filename.empty()) {
@@ -2355,7 +2351,7 @@ void FilterEventsByLogValuePreNexus::loadPixelMap(const std::string &filename) {
   BinaryFile<PixelType> pixelmapFile(filename);
   PixelType max_pid = static_cast<PixelType>(pixelmapFile.getNumElements());
   // Load all the data
-  pixelmapFile.loadAllInto(this->m_pixelmap);
+  this->m_pixelmap = pixelmapFile.loadAllIntoVector();
 
   // Check for funky file
   if (std::find_if(m_pixelmap.begin(), m_pixelmap.end(),
diff --git a/Framework/DataHandling/src/GroupDetectors.cpp b/Framework/DataHandling/src/GroupDetectors.cpp
index 40a8b84271df67fddb47f6b0f62094af2297e0e3..622b1d6e189a37d52f31fd7b6f603dcff02b4c21 100644
--- a/Framework/DataHandling/src/GroupDetectors.cpp
+++ b/Framework/DataHandling/src/GroupDetectors.cpp
@@ -74,12 +74,12 @@ void GroupDetectors::exec() {
   // appropriate spectra number and adding the indices they are linked to the
   // list to be processed
   if (!spectraList.empty()) {
-    WS->getIndicesFromSpectra(spectraList, indexList);
+    indexList = WS->getIndicesFromSpectra(spectraList);
   } // End dealing with spectraList
   else if (!detectorList.empty()) {
     // Dealing with DetectorList
     // convert from detectors to workspace indices
-    WS->getIndicesFromDetectorIDs(detectorList, indexList);
+    indexList = WS->getIndicesFromDetectorIDs(detectorList);
   }
 
   if (indexList.empty()) {
diff --git a/Framework/DataHandling/src/GroupDetectors2.cpp b/Framework/DataHandling/src/GroupDetectors2.cpp
index ce2d5fc100682f81b3f83597e433e8937a2172dc..8c8395642f238db1ea29f83fe93b186636395221 100644
--- a/Framework/DataHandling/src/GroupDetectors2.cpp
+++ b/Framework/DataHandling/src/GroupDetectors2.cpp
@@ -310,7 +310,7 @@ void GroupDetectors2::getGroups(API::MatrixWorkspace_const_sptr workspace,
     const SpectraAxis *axis =
         dynamic_cast<const SpectraAxis *>(workspace->getAxis(1));
     if (axis)
-      axis->getSpectraIndexMap(specs2index);
+      specs2index = axis->getSpectraIndexMap();
 
     std::stringstream commandsSS;
     // Fill commandsSS with the contents of a map file
@@ -333,7 +333,7 @@ void GroupDetectors2::getGroups(API::MatrixWorkspace_const_sptr workspace,
 
   // only look at these other parameters if the file wasn't set
   if (!spectraList.empty()) {
-    workspace->getIndicesFromSpectra(spectraList, m_GroupSpecInds[0]);
+    m_GroupSpecInds[0] = workspace->getIndicesFromSpectra(spectraList);
     g_log.debug() << "Converted " << spectraList.size()
                   << " spectra numbers into spectra indices to be combined\n";
   } else { // go through the rest of the properties in order of decreasing
@@ -341,7 +341,7 @@ void GroupDetectors2::getGroups(API::MatrixWorkspace_const_sptr workspace,
     if (!detectorList.empty()) {
       // we are going to group on the basis of detector IDs, convert from
       // detectors to workspace indices
-      workspace->getIndicesFromDetectorIDs(detectorList, m_GroupSpecInds[0]);
+      m_GroupSpecInds[0] = workspace->getIndicesFromDetectorIDs(detectorList);
       g_log.debug() << "Found " << m_GroupSpecInds[0].size()
                     << " spectra indices from the list of "
                     << detectorList.size() << " detectors\n";
@@ -422,7 +422,7 @@ void GroupDetectors2::processFile(std::string fname,
   const SpectraAxis *axis =
       dynamic_cast<const SpectraAxis *>(workspace->getAxis(1));
   if (axis) {
-    axis->getSpectraIndexMap(specs2index);
+    specs2index = axis->getSpectraIndexMap();
   }
 
   try {
@@ -495,7 +495,7 @@ void GroupDetectors2::processXMLFile(std::string fname,
   const SpectraAxis *axis =
       dynamic_cast<const SpectraAxis *>(workspace->getAxis(1));
   if (axis) {
-    axis->getSpectraIndexMap(specs2index);
+    specs2index = axis->getSpectraIndexMap();
   }
 
   const detid2index_map detIdToWiMap =
@@ -721,10 +721,11 @@ void GroupDetectors2::processMatrixWorkspace(
 */
 int GroupDetectors2::readInt(std::string line) {
   // remove comments and white space (TOK_TRIM)
-  Poco::StringTokenizer dataComment(line, "#", Poco::StringTokenizer::TOK_TRIM);
+  Mantid::Kernel::StringTokenizer dataComment(
+      line, "#", Mantid::Kernel::StringTokenizer::TOK_TRIM);
   if (dataComment.begin() != dataComment.end()) {
-    Poco::StringTokenizer data(*(dataComment.begin()), " ",
-                               Poco::StringTokenizer::TOK_TRIM);
+    Mantid::Kernel::StringTokenizer data(
+        *(dataComment.begin()), " ", Mantid::Kernel::StringTokenizer::TOK_TRIM);
     if (data.count() == 1) {
       if (!data[0].empty()) {
         try {
@@ -844,7 +845,7 @@ void GroupDetectors2::readSpectraIndexes(std::string line,
                                          std::vector<int64_t> &unUsedSpec,
                                          std::string seperator) {
   // remove comments and white space
-  Poco::StringTokenizer dataComment(line, seperator, IGNORE_SPACES);
+  Mantid::Kernel::StringTokenizer dataComment(line, seperator, IGNORE_SPACES);
   for (const auto &itr : dataComment) {
     std::vector<size_t> specNums;
     specNums.reserve(output.capacity());
@@ -1233,12 +1234,13 @@ void GroupDetectors2::RangeHelper::getList(const std::string &line,
                       // function
     return;
   }
-  Poco::StringTokenizer ranges(line, "-");
+  Mantid::Kernel::StringTokenizer ranges(line, "-");
 
   try {
     size_t loop = 0;
     do {
-      Poco::StringTokenizer beforeHyphen(ranges[loop], " ", IGNORE_SPACES);
+      Mantid::Kernel::StringTokenizer beforeHyphen(ranges[loop], " ",
+                                                   IGNORE_SPACES);
       auto readPostion = beforeHyphen.begin();
       if (readPostion == beforeHyphen.end()) {
         throw std::invalid_argument("'-' found at the start of a list, can't "
@@ -1254,7 +1256,8 @@ void GroupDetectors2::RangeHelper::getList(const std::string &line,
         break;
       }
 
-      Poco::StringTokenizer afterHyphen(ranges[loop + 1], " ", IGNORE_SPACES);
+      Mantid::Kernel::StringTokenizer afterHyphen(ranges[loop + 1], " ",
+                                                  IGNORE_SPACES);
       readPostion = afterHyphen.begin();
       if (readPostion == afterHyphen.end()) {
         throw std::invalid_argument("A '-' follows straight after another '-', "
diff --git a/Framework/DataHandling/src/ISISDataArchive.cpp b/Framework/DataHandling/src/ISISDataArchive.cpp
index 480ac90a3d9b70f8032d0bbe2870ad5d10ba041c..1b5d49e1045493ac11ac448cf334771dd57a3756 100644
--- a/Framework/DataHandling/src/ISISDataArchive.cpp
+++ b/Framework/DataHandling/src/ISISDataArchive.cpp
@@ -8,7 +8,7 @@
 
 #include <Poco/Path.h>
 #include <Poco/File.h>
-#include <Poco/StringTokenizer.h>
+#include <MantidKernel/StringTokenizer.h>
 #include <Poco/Exception.h>
 
 #include <sstream>
diff --git a/Framework/DataHandling/src/ISISRunLogs.cpp b/Framework/DataHandling/src/ISISRunLogs.cpp
index 3a622301538306fa088ac7c14b2a033b2a3adad9..8ad9f93366aa9a07fd29a4a456ad054339334b73 100644
--- a/Framework/DataHandling/src/ISISRunLogs.cpp
+++ b/Framework/DataHandling/src/ISISRunLogs.cpp
@@ -2,6 +2,7 @@
 #include "MantidDataHandling/ISISRunLogs.h"
 
 #include "MantidKernel/LogFilter.h"
+#include "MantidKernel/make_unique.h"
 #include "MantidKernel/TimeSeriesProperty.h"
 
 namespace Mantid {
@@ -19,23 +20,20 @@ using Kernel::TimeSeriesProperty;
  * Construct using a run that has the required ICP event log
  * Throws if no icp event log exists
  * @param icpRun :: A run containing the ICP event log to parse
- * @param totalNumPeriods :: The total number of periods overall
  */
-ISISRunLogs::ISISRunLogs(const API::Run &icpRun, const int totalNumPeriods)
-    : m_logParser(), m_numOfPeriods(totalNumPeriods) {
+ISISRunLogs::ISISRunLogs(const API::Run &icpRun) {
   // ICP event either in form icp_event or icpevent
-  static const char *icpLogNames[2] = {"icp_event", "icpevent"};
-  for (auto &icpLogName : icpLogNames) {
+  for (const auto icpLogName : {"icp_event", "icpevent"}) {
     try {
       Kernel::Property *icpLog = icpRun.getLogData(icpLogName);
-      m_logParser.reset(new LogParser(icpLog));
+      m_logParser = Kernel::make_unique<LogParser>(icpLog);
       return;
     } catch (std::runtime_error &) {
     }
   }
   // If it does not exist then pass in a NULL log to indicate that period 1
   // should be assumed
-  m_logParser.reset(new LogParser(nullptr));
+  m_logParser = Kernel::make_unique<LogParser>(nullptr);
 }
 
 /**
@@ -53,12 +51,12 @@ void ISISRunLogs::addStatusLog(API::Run &exptRun) {
  */
 void ISISRunLogs::addPeriodLogs(const int period, API::Run &exptRun) {
   auto periodLog = m_logParser->createPeriodLog(period);
-  LogFilter *logFilter(nullptr);
+  auto logFilter = std::unique_ptr<LogFilter>();
   const TimeSeriesProperty<bool> *maskProp(nullptr);
   try {
     auto runningLog =
         exptRun.getTimeSeriesProperty<bool>(LogParser::statusLogName());
-    logFilter = new LogFilter(runningLog);
+    logFilter = Kernel::make_unique<LogFilter>(runningLog);
   } catch (std::exception &) {
     g_log.warning(
         "Cannot find status log. Logs will be not be filtered by run status");
@@ -75,7 +73,6 @@ void ISISRunLogs::addPeriodLogs(const int period, API::Run &exptRun) {
   // Filter logs if we have anything to filter on
   if (maskProp)
     exptRun.filterByLog(*maskProp);
-  delete logFilter;
 
   exptRun.addProperty(periodLog);
   exptRun.addProperty(m_logParser->createCurrentPeriodLog(period));
diff --git a/Framework/DataHandling/src/Load.cpp b/Framework/DataHandling/src/Load.cpp
index 012617b01a6f35defc9ea2283b2e9d8ac2e34863..d086eff29ee3961987d417371b362d011e10472c 100644
--- a/Framework/DataHandling/src/Load.cpp
+++ b/Framework/DataHandling/src/Load.cpp
@@ -726,7 +726,7 @@ API::Workspace_sptr Load::plusWs(Workspace_sptr ws1, Workspace_sptr ws2) {
  */
 API::WorkspaceGroup_sptr
 Load::groupWsList(const std::vector<API::Workspace_sptr> &wsList) {
-  WorkspaceGroup_sptr group = WorkspaceGroup_sptr(new WorkspaceGroup);
+  auto group = boost::make_shared<WorkspaceGroup>();
 
   for (const auto &ws : wsList) {
     WorkspaceGroup_sptr isGroup =
diff --git a/Framework/DataHandling/src/LoadANSTOHelper.cpp b/Framework/DataHandling/src/LoadANSTOHelper.cpp
index 9749fe7917bfac10fab72ab73fd959be6766de0c..4758fd6036bb2128c2153e16ca466047056a2889 100644
--- a/Framework/DataHandling/src/LoadANSTOHelper.cpp
+++ b/Framework/DataHandling/src/LoadANSTOHelper.cpp
@@ -388,7 +388,7 @@ bool File::append(const std::string &path, const std::string &name,
   std::unique_ptr<FILE, decltype(&fclose)> handle(fopen(path.c_str(), "rb+"),
                                                   fclose);
 
-  bool good = handle != NULL;
+  bool good = handle != nullptr;
   int64_t lastHeaderPosition = 0;
   int64_t targetPosition = -1;
 
diff --git a/Framework/DataHandling/src/LoadAscii.cpp b/Framework/DataHandling/src/LoadAscii.cpp
index 85b17194130130417a6b4194bfd2e6eec2a10688..0e1539cc6e9336a2eed35731bdb70fbb085c9559 100644
--- a/Framework/DataHandling/src/LoadAscii.cpp
+++ b/Framework/DataHandling/src/LoadAscii.cpp
@@ -11,12 +11,9 @@
 #include "MantidKernel/BoundedValidator.h"
 #include "MantidKernel/ListValidator.h"
 #include "MantidKernel/Strings.h"
-
+#include <MantidKernel/StringTokenizer.h>
 // String utilities
 #include <boost/algorithm/string.hpp>
-#include <boost/tokenizer.hpp>
-
-#include <Poco/StringTokenizer.h>
 
 #include <fstream>
 
diff --git a/Framework/DataHandling/src/LoadAscii2.cpp b/Framework/DataHandling/src/LoadAscii2.cpp
index a878e7ee6dcea63e6851610b558a2d28d81a0ca8..e36f1a09b66b4fe987d16eef6f3332ad58bebeb6 100644
--- a/Framework/DataHandling/src/LoadAscii2.cpp
+++ b/Framework/DataHandling/src/LoadAscii2.cpp
@@ -9,16 +9,15 @@
 #include "MantidAPI/WorkspaceFactory.h"
 #include "MantidKernel/BoundedValidator.h"
 #include "MantidKernel/ListValidator.h"
+#include <MantidKernel/StringTokenizer.h>
 #include "MantidKernel/UnitFactory.h"
 #include "MantidKernel/VisibleWhenProperty.h"
 
-#include <boost/tokenizer.hpp>
 // String utilities
+#include <boost/tokenizer.hpp>
 #include <boost/algorithm/string.hpp>
 #include <boost/regex.hpp>
 
-#include <Poco/StringTokenizer.h>
-
 #include <fstream>
 
 namespace Mantid {
diff --git a/Framework/DataHandling/src/LoadCalFile.cpp b/Framework/DataHandling/src/LoadCalFile.cpp
index 38793cb2faec4e8a4cecb3a021367054e7a379e7..ef43a2b6429ef3724033e0614d654b3ccf662b3c 100644
--- a/Framework/DataHandling/src/LoadCalFile.cpp
+++ b/Framework/DataHandling/src/LoadCalFile.cpp
@@ -108,7 +108,7 @@ LoadCalFile::getInstrument3Ways(Algorithm *alg) {
   } else {
     Algorithm_sptr childAlg =
         alg->createChildAlgorithm("LoadInstrument", 0.0, 0.2);
-    MatrixWorkspace_sptr tempWS(new Workspace2D());
+    MatrixWorkspace_sptr tempWS = boost::make_shared<Workspace2D>();
     childAlg->setProperty<MatrixWorkspace_sptr>("Workspace", tempWS);
     childAlg->setPropertyValue("Filename", InstrumentFilename);
     childAlg->setPropertyValue("InstrumentName", InstrumentName);
diff --git a/Framework/DataHandling/src/LoadCanSAS1D.cpp b/Framework/DataHandling/src/LoadCanSAS1D.cpp
index 43b1bc6cc337bb03db6f37a1178b0f5de1b3099d..096c1e96f7589007e781bdde2075ca2a442da332 100644
--- a/Framework/DataHandling/src/LoadCanSAS1D.cpp
+++ b/Framework/DataHandling/src/LoadCanSAS1D.cpp
@@ -129,7 +129,7 @@ void LoadCanSAS1D::exec() {
     outputWork = WS;
     break;
   default:
-    WorkspaceGroup_sptr group(new WorkspaceGroup);
+    auto group = boost::make_shared<WorkspaceGroup>();
     for (unsigned int i = 0; i < numEntries; ++i) {
       std::string runName;
       MatrixWorkspace_sptr newWork = loadEntry(entryList->item(i), runName);
diff --git a/Framework/DataHandling/src/LoadEventNexus.cpp b/Framework/DataHandling/src/LoadEventNexus.cpp
index e048c5be3f3bc21eb9229c9b366518fd0136cb60..b6a491dc257e0100f756365e7259e12e0fbceebc 100644
--- a/Framework/DataHandling/src/LoadEventNexus.cpp
+++ b/Framework/DataHandling/src/LoadEventNexus.cpp
@@ -1210,9 +1210,9 @@ void LoadEventNexus::init() {
   setPropertyGroup("FilterMonByTimeStart", grp4);
   setPropertyGroup("FilterMonByTimeStop", grp4);
 
-  declareProperty("SpectrumMin", (int32_t)EMPTY_INT(), mustBePositive,
+  declareProperty("SpectrumMin", EMPTY_INT(), mustBePositive,
                   "The number of the first spectrum to read.");
-  declareProperty("SpectrumMax", (int32_t)EMPTY_INT(), mustBePositive,
+  declareProperty("SpectrumMax", EMPTY_INT(), mustBePositive,
                   "The number of the last spectrum to read.");
   declareProperty(new ArrayProperty<int32_t>("SpectrumList"),
                   "A comma-separated list of individual spectra to read.");
@@ -1490,11 +1490,11 @@ void LoadEventNexus::createWorkspaceIndexMaps(
 
   // This map will be used to find the workspace index
   if (this->event_id_is_spec)
-    m_ws->getSpectrumToWorkspaceIndexVector(pixelID_to_wi_vector,
-                                            pixelID_to_wi_offset);
+    pixelID_to_wi_vector =
+        m_ws->getSpectrumToWorkspaceIndexVector(pixelID_to_wi_offset);
   else
-    m_ws->getDetectorIDToWorkspaceIndexVector(pixelID_to_wi_vector,
-                                              pixelID_to_wi_offset, true);
+    pixelID_to_wi_vector =
+        m_ws->getDetectorIDToWorkspaceIndexVector(pixelID_to_wi_offset, true);
 }
 
 /** Load the instrument from the nexus file
@@ -1635,8 +1635,7 @@ void LoadEventNexus::loadEvents(API::Progress *const prog,
   // Initialize the counter of bad TOFs
   bad_tofs = 0;
   int nPeriods = 1;
-  std::unique_ptr<const TimeSeriesProperty<int>> periodLog(
-      new const TimeSeriesProperty<int>("period_log"));
+  auto periodLog = make_unique<const TimeSeriesProperty<int>>("period_log");
   if (!m_logs_loaded_correctly) {
     if (loadlogs) {
       prog->doReport("Loading DAS logs");
diff --git a/Framework/DataHandling/src/LoadEventPreNexus.cpp b/Framework/DataHandling/src/LoadEventPreNexus.cpp
index 68546075f6e2f099faa1f6656f03d1d299b7b0d1..a94ac09c9abdcc378bd54bd84ca146f53da00c60 100644
--- a/Framework/DataHandling/src/LoadEventPreNexus.cpp
+++ b/Framework/DataHandling/src/LoadEventPreNexus.cpp
@@ -841,7 +841,6 @@ void LoadEventPreNexus::setProtonCharge(
  */
 void LoadEventPreNexus::loadPixelMap(const std::string &filename) {
   this->using_mapping_file = false;
-  this->pixelmap.clear();
 
   // check that there is a mapping file
   if (filename.empty()) {
@@ -856,7 +855,7 @@ void LoadEventPreNexus::loadPixelMap(const std::string &filename) {
   BinaryFile<PixelType> pixelmapFile(filename);
   PixelType max_pid = static_cast<PixelType>(pixelmapFile.getNumElements());
   // Load all the data
-  pixelmapFile.loadAllInto(this->pixelmap);
+  this->pixelmap = pixelmapFile.loadAllIntoVector();
 
   // Check for funky file
   if (std::find_if(pixelmap.begin(), pixelmap.end(),
diff --git a/Framework/DataHandling/src/LoadEventPreNexus2.cpp b/Framework/DataHandling/src/LoadEventPreNexus2.cpp
index 068211abfc7f33883e243999e553839be40acaf4..71ec3dcb2f6bea1959f3320e6e484e0b61237b45 100644
--- a/Framework/DataHandling/src/LoadEventPreNexus2.cpp
+++ b/Framework/DataHandling/src/LoadEventPreNexus2.cpp
@@ -529,9 +529,9 @@ LoadEventPreNexus2::generateEventDistribtionWorkspace() {
 /** Process imbed logs (marked by bad pixel IDs)
  */
 void LoadEventPreNexus2::processImbedLogs() {
-  std::set<PixelType>::iterator pit;
   std::map<PixelType, size_t>::iterator mit;
-  for (pit = this->wrongdetids.begin(); pit != this->wrongdetids.end(); ++pit) {
+  for (auto pit = this->wrongdetids.begin(); pit != this->wrongdetids.end();
+       ++pit) {
     // a. pixel ID -> index
     PixelType pid = *pit;
     mit = this->wrongdetidmap.find(pid);
@@ -1248,7 +1248,6 @@ void LoadEventPreNexus2::setProtonCharge(
   */
 void LoadEventPreNexus2::loadPixelMap(const std::string &filename) {
   this->using_mapping_file = false;
-  this->pixelmap.clear();
 
   // check that there is a mapping file
   if (filename.empty()) {
@@ -1263,7 +1262,7 @@ void LoadEventPreNexus2::loadPixelMap(const std::string &filename) {
   BinaryFile<PixelType> pixelmapFile(filename);
   PixelType max_pid = static_cast<PixelType>(pixelmapFile.getNumElements());
   // Load all the data
-  pixelmapFile.loadAllInto(this->pixelmap);
+  this->pixelmap = pixelmapFile.loadAllIntoVector();
 
   // Check for funky file
   if (std::find_if(pixelmap.begin(), pixelmap.end(),
diff --git a/Framework/DataHandling/src/LoadFullprofResolution.cpp b/Framework/DataHandling/src/LoadFullprofResolution.cpp
index 1accc5e43c873265370b9419ee52650f1f4ebf4d..a7c55f8d3aebfd37dc28e25c8c0a6afc86904ab1 100644
--- a/Framework/DataHandling/src/LoadFullprofResolution.cpp
+++ b/Framework/DataHandling/src/LoadFullprofResolution.cpp
@@ -717,7 +717,7 @@ TableWorkspace_sptr LoadFullprofResolution::genTableWorkspace(
                 << "\n";
 
   // Create TableWorkspace
-  TableWorkspace_sptr tablews(new TableWorkspace());
+  auto tablews = boost::make_shared<TableWorkspace>();
 
   // set columns :
   // Any 2 columns cannot have the same name.
diff --git a/Framework/DataHandling/src/LoadGSASInstrumentFile.cpp b/Framework/DataHandling/src/LoadGSASInstrumentFile.cpp
index adf274222a72fad823975ce10ca7066809b1fb76..3685d1a7f2b0680d2d78752fe2b95c7d86068899 100644
--- a/Framework/DataHandling/src/LoadGSASInstrumentFile.cpp
+++ b/Framework/DataHandling/src/LoadGSASInstrumentFile.cpp
@@ -435,7 +435,7 @@ TableWorkspace_sptr LoadGSASInstrumentFile::genTableWorkspace(
                 << "\n";
 
   // Create TableWorkspace
-  TableWorkspace_sptr tablews(new TableWorkspace());
+  auto tablews = boost::make_shared<TableWorkspace>();
 
   // set columns :
   // Any 2 columns cannot have the same name.
diff --git a/Framework/DataHandling/src/LoadHelper.cpp b/Framework/DataHandling/src/LoadHelper.cpp
index 85e7e1a04628bf8234732a1a36774094848b59bf..78d984e5268c1bb96cae6e458854b88c7ac03125 100644
--- a/Framework/DataHandling/src/LoadHelper.cpp
+++ b/Framework/DataHandling/src/LoadHelper.cpp
@@ -311,9 +311,9 @@ void LoadHelper::recurseAndAddNexusFieldsToWsRun(NXhandle nxfileID,
             int units_len = NX_MAXNAMELEN;
             int units_type = NX_CHAR;
 
-            units_status =
-                NXgetattr(nxfileID, const_cast<char *>("units"),
-                          (void *)units_sbuf, &units_len, &units_type);
+            units_status = NXgetattr(nxfileID, const_cast<char *>("units"),
+                                     static_cast<void *>(units_sbuf),
+                                     &units_len, &units_type);
             if (units_status != NX_ERROR) {
               g_log.debug() << indent_str << "[ " << property_name
                             << " has unit " << units_sbuf << " ]" << std::endl;
diff --git a/Framework/DataHandling/src/LoadIDFFromNexus.cpp b/Framework/DataHandling/src/LoadIDFFromNexus.cpp
index 27455d934aaf7a54f70e921c1dff3acbaca8f511..09cf576b54f50683168bcd00937fcb5ba05ecff8 100644
--- a/Framework/DataHandling/src/LoadIDFFromNexus.cpp
+++ b/Framework/DataHandling/src/LoadIDFFromNexus.cpp
@@ -241,13 +241,20 @@ void LoadIDFFromNexus::readParameterCorrectionFile(
       pRootElem->getElementsByTagName("correction");
   for (unsigned long i = 0; i < correctionNodeList->length(); ++i) {
     // For each correction element
-    Element *corr = (Element *)correctionNodeList->item(i);
-    DateAndTime start(corr->getAttribute("valid-from"));
-    DateAndTime end(corr->getAttribute("valid-to"));
-    if (start <= externalDate && externalDate <= end) {
-      parameter_file = corr->getAttribute("file");
-      append = (corr->getAttribute("append") == "true");
-      break;
+    Element *corr = dynamic_cast<Element *>(correctionNodeList->item(i));
+    if (corr) {
+      DateAndTime start(corr->getAttribute("valid-from"));
+      DateAndTime end(corr->getAttribute("valid-to"));
+      if (start <= externalDate && externalDate <= end) {
+        parameter_file = corr->getAttribute("file");
+        append = (corr->getAttribute("append") == "true");
+        break;
+      }
+    } else {
+      g_log.error("Parameter correction file: " + correction_file +
+                  "contains an invalid correction element.");
+      throw Kernel::Exception::InstrumentDefinitionError(
+          "Invalid element in XML parameter correction file", correction_file);
     }
   }
 }
diff --git a/Framework/DataHandling/src/LoadISISNexus2.cpp b/Framework/DataHandling/src/LoadISISNexus2.cpp
index de1931fa13c64718cd874cd9ed121203f99ded19..3afa2b3b9277de82506665a48ff10ff0c890a4ad 100644
--- a/Framework/DataHandling/src/LoadISISNexus2.cpp
+++ b/Framework/DataHandling/src/LoadISISNexus2.cpp
@@ -349,8 +349,7 @@ void LoadISISNexus2::exec() {
       loadPeriodData(firstentry, entry, monitor_workspace, true);
       local_workspace->setMonitorWorkspace(monitor_workspace);
 
-      ISISRunLogs monLogCreator(monitor_workspace->run(),
-                                m_detBlockInfo.numberOfPeriods);
+      ISISRunLogs monLogCreator(monitor_workspace->run());
       monLogCreator.addPeriodLogs(1, monitor_workspace->mutableRun());
 
       const std::string monitorPropBase = "MonitorWorkspace";
@@ -1125,8 +1124,7 @@ void LoadISISNexus2::loadLogs(DataObjects::Workspace2D_sptr &ws,
   ws->populateInstrumentParameters();
 
   // Make log creator object and add the run status log
-  m_logCreator.reset(
-      new ISISRunLogs(ws->run(), m_detBlockInfo.numberOfPeriods));
+  m_logCreator.reset(new ISISRunLogs(ws->run()));
   m_logCreator->addStatusLog(ws->mutableRun());
 }
 
diff --git a/Framework/DataHandling/src/LoadIsawDetCal.cpp b/Framework/DataHandling/src/LoadIsawDetCal.cpp
index dc4210e84fef3a9af2c8dc9f91a4210b2e65b26e..1896c1a09b3ff208861da98e7d2558ed34a15403 100644
--- a/Framework/DataHandling/src/LoadIsawDetCal.cpp
+++ b/Framework/DataHandling/src/LoadIsawDetCal.cpp
@@ -130,7 +130,7 @@ void LoadIsawDetCal::exec() {
       }
     }
   }
-  std::set<int> uniqueBanks; // for CORELLI and WISH
+  std::unordered_set<int> uniqueBanks; // for CORELLI and WISH
   std::string bankPart = "bank";
   if (instname.compare("WISH") == 0)
     bankPart = "WISHpanel";
@@ -295,8 +295,7 @@ void LoadIsawDetCal::exec() {
     }
     // Loop through tube detectors to match names with number from DetCal file
     idnum = -1;
-    std::set<int>::iterator it;
-    for (it = uniqueBanks.begin(); it != uniqueBanks.end(); ++it)
+    for (auto it = uniqueBanks.begin(); it != uniqueBanks.end(); ++it)
       if (*it == id)
         idnum = *it;
     if (idnum < 0)
diff --git a/Framework/DataHandling/src/LoadMuonNexus1.cpp b/Framework/DataHandling/src/LoadMuonNexus1.cpp
index 83cc635608ff8077d336caa1687aa523fb40beee..aae4ccfda33ed1153c317e126616be5a44d6319a 100644
--- a/Framework/DataHandling/src/LoadMuonNexus1.cpp
+++ b/Framework/DataHandling/src/LoadMuonNexus1.cpp
@@ -722,8 +722,7 @@ void LoadMuonNexus1::runLoadLog(DataObjects::Workspace2D_sptr localWorkspace) {
   }
 
   auto &run = localWorkspace->mutableRun();
-  int n = static_cast<int>(m_numberOfPeriods);
-  ISISRunLogs runLogs(run, n);
+  ISISRunLogs runLogs(run);
   runLogs.addStatusLog(run);
 }
 
@@ -735,8 +734,7 @@ void LoadMuonNexus1::runLoadLog(DataObjects::Workspace2D_sptr localWorkspace) {
 void LoadMuonNexus1::addPeriodLog(DataObjects::Workspace2D_sptr localWorkspace,
                                   int64_t period) {
   auto &run = localWorkspace->mutableRun();
-  int n = static_cast<int>(m_numberOfPeriods);
-  ISISRunLogs runLogs(run, n);
+  ISISRunLogs runLogs(run);
   if (period == 0) {
     runLogs.addPeriodLogs(1, run);
   } else {
diff --git a/Framework/DataHandling/src/LoadNexusMonitors2.cpp b/Framework/DataHandling/src/LoadNexusMonitors2.cpp
index 1d72d3e4b5f2aea831f9d71b9f1433ebc8b880d8..c309e7c8fff7e62bce872e6241bb7a7968ad6734 100644
--- a/Framework/DataHandling/src/LoadNexusMonitors2.cpp
+++ b/Framework/DataHandling/src/LoadNexusMonitors2.cpp
@@ -630,7 +630,7 @@ void LoadNexusMonitors2::splitMutiPeriodHistrogramData(
   size_t yLength = m_workspace->blocksize() / numPeriods;
   size_t xLength = yLength + 1;
   size_t numSpectra = m_workspace->getNumberHistograms();
-  ISISRunLogs monLogCreator(m_workspace->run(), static_cast<int>(numPeriods));
+  ISISRunLogs monLogCreator(m_workspace->run());
   for (size_t i = 0; i < numPeriods; i++) {
     // create the period workspace
     API::MatrixWorkspace_sptr wsPeriod =
diff --git a/Framework/DataHandling/src/LoadNexusProcessed.cpp b/Framework/DataHandling/src/LoadNexusProcessed.cpp
index 036d545ce74dac04635ba97da12ee2b2db8d30db..2d21a90fd6067343a5dee5dac02321ae4cd40c0e 100644
--- a/Framework/DataHandling/src/LoadNexusProcessed.cpp
+++ b/Framework/DataHandling/src/LoadNexusProcessed.cpp
@@ -30,9 +30,9 @@
 #include <boost/lexical_cast.hpp>
 #include <boost/shared_array.hpp>
 
-#include <nexus/NeXusException.hpp>
+#include <MantidKernel/StringTokenizer.h>
 
-#include <Poco/StringTokenizer.h>
+#include <nexus/NeXusException.hpp>
 
 namespace Mantid {
 namespace DataHandling {
@@ -436,7 +436,7 @@ void LoadNexusProcessed::exec() {
     m_list = !specListProp->isDefault();
 
     // Load all first level entries
-    WorkspaceGroup_sptr wksp_group(new WorkspaceGroup);
+    auto wksp_group = boost::make_shared<WorkspaceGroup>();
     // This forms the name of the group
     std::string base_name = getPropertyValue("OutputWorkspace");
     // First member of group should be the group itself, for some reason!
@@ -1759,7 +1759,8 @@ bool UDlesserExecCount(NXClassInfo elem1, NXClassInfo elem2) {
 void LoadNexusProcessed::getWordsInString(const std::string &words3,
                                           std::string &w1, std::string &w2,
                                           std::string &w3) {
-  Poco::StringTokenizer data(words3, " ", Poco::StringTokenizer::TOK_TRIM);
+  Mantid::Kernel::StringTokenizer data(
+      words3, " ", Mantid::Kernel::StringTokenizer::TOK_TRIM);
   if (data.count() != 3) {
     g_log.warning() << "Algorithm list line " + words3 +
                            " is not of the correct format\n";
@@ -1785,7 +1786,8 @@ void LoadNexusProcessed::getWordsInString(const std::string &words3,
 void LoadNexusProcessed::getWordsInString(const std::string &words4,
                                           std::string &w1, std::string &w2,
                                           std::string &w3, std::string &w4) {
-  Poco::StringTokenizer data(words4, " ", Poco::StringTokenizer::TOK_TRIM);
+  Mantid::Kernel::StringTokenizer data(
+      words4, " ", Mantid::Kernel::StringTokenizer::TOK_TRIM);
   if (data.count() != 4) {
     g_log.warning() << "Algorithm list line " + words4 +
                            " is not of the correct format\n";
diff --git a/Framework/DataHandling/src/LoadPreNexusMonitors.cpp b/Framework/DataHandling/src/LoadPreNexusMonitors.cpp
index 6c6e31b47f5d3d53623194f08d794e8fc69f5e8f..10c98e61cd346a8b5605588d7bde3a95a106ec3a 100644
--- a/Framework/DataHandling/src/LoadPreNexusMonitors.cpp
+++ b/Framework/DataHandling/src/LoadPreNexusMonitors.cpp
@@ -177,9 +177,6 @@ void LoadPreNexusMonitors::exec() {
   MatrixWorkspace_sptr localWorkspace = WorkspaceFactory::Instance().create(
       "Workspace2D", nMonitors, numberTimeBins, tchannels);
 
-  // temp buffer for file reading
-  std::vector<uint32_t> buffer;
-
   for (int i = 0; i < nMonitors; i++) {
     // Now lets actually read the monitor files..
     Poco::Path pMonitorFilename(dirPath, monitorFilenames[i]);
@@ -188,14 +185,15 @@ void LoadPreNexusMonitors::exec() {
                   << std::endl;
 
     Kernel::BinaryFile<uint32_t> monitorFile(pMonitorFilename.toString());
-    monitorFile.loadAllInto(buffer);
+    // temp buffer for file reading
+    std::vector<uint32_t> buffer = monitorFile.loadAllIntoVector();
 
     MantidVec intensity(buffer.begin(), buffer.end());
     // Copy the same data into the error array
     MantidVec error(buffer.begin(), buffer.end());
     // Now take the sqrt()
     std::transform(error.begin(), error.end(), error.begin(),
-                   (double (*)(double))sqrt);
+                   static_cast<double (*)(double)>(sqrt));
 
     localWorkspace->dataX(i) = time_bins;
     localWorkspace->dataY(i) = intensity;
diff --git a/Framework/DataHandling/src/LoadRKH.cpp b/Framework/DataHandling/src/LoadRKH.cpp
index 559c7070bff51272205ceb22dfd7e825b69a7934..629a7349bfa1e70a5b6faa4b9e103d05f4413912 100644
--- a/Framework/DataHandling/src/LoadRKH.cpp
+++ b/Framework/DataHandling/src/LoadRKH.cpp
@@ -17,8 +17,7 @@
 #include <boost/date_time/date_parsing.hpp>
 #include <boost/lexical_cast.hpp>
 #include <boost/algorithm/string.hpp>
-
-#include <Poco/StringTokenizer.h>
+#include <MantidKernel/StringTokenizer.h>
 
 #include <istream>
 
@@ -414,8 +413,9 @@ Progress LoadRKH::read2DHeader(const std::string &initalLine,
   if (fileLine.size() < 5) {
     std::getline(m_fileIn, fileLine);
   }
-  Poco::StringTokenizer wsDimensions(fileLine, " ",
-                                     Poco::StringTokenizer::TOK_TRIM);
+  Mantid::Kernel::StringTokenizer wsDimensions(
+      fileLine, " ", Mantid::Kernel::StringTokenizer::TOK_TRIM |
+                         Mantid::Kernel::StringTokenizer::TOK_IGNORE_EMPTY);
   if (wsDimensions.count() < 2) {
     throw Exception::NotFoundError("Input file", "dimensions");
   }
@@ -463,7 +463,9 @@ void LoadRKH::readNumEntrys(const int nEntries, MantidVec &output) {
 */
 const std::string LoadRKH::readUnit(const std::string &line) {
   // split the line into words
-  const Poco::StringTokenizer codes(line, " ", Poco::StringTokenizer::TOK_TRIM);
+  const Mantid::Kernel::StringTokenizer codes(
+      line, " ", Mantid::Kernel::StringTokenizer::TOK_TRIM |
+                     Mantid::Kernel::StringTokenizer::TOK_IGNORE_EMPTY);
   if (codes.count() < 1) {
     return "C++ no unit found";
   }
@@ -471,14 +473,13 @@ const std::string LoadRKH::readUnit(const std::string &line) {
   // the symbol for the quantity q = MomentumTransfer, etc.
   const std::string symbol(codes[0]);
   // this is units used to measure the quantity e.g. angstroms, counts, ...
-  const std::string unit(*(codes.end() - 1));
+  auto itUnitsToken = codes.cend() - 1;
+  const std::string unit(*itUnitsToken);
 
   // theQuantity will contain the name of the unit, which can be many words long
   std::string theQuantity;
-  for (auto current = codes.begin() + 1; current != codes.end(); ++current) {
-    if (current != codes.end() - 1) {
-      theQuantity += *current;
-    }
+  for (auto current = codes.cbegin() + 1; current != itUnitsToken; ++current) {
+    theQuantity += *current;
   }
 
   // this is a syntax check the line before returning its data
diff --git a/Framework/DataHandling/src/LoadRaw/isisraw.h b/Framework/DataHandling/src/LoadRaw/isisraw.h
index 21bddafbbc283d99fe355602045917d2c938cfa8..58c8a05a4f9c8f1638c679094b01b01670b7bbeb 100644
--- a/Framework/DataHandling/src/LoadRaw/isisraw.h
+++ b/Framework/DataHandling/src/LoadRaw/isisraw.h
@@ -247,7 +247,7 @@ struct LOG_LINE {
   int len;    ///< real length of data
   char *data; ///< padded to multiple of 4 bytes
   /// constructor
-  LOG_LINE() : len(0), data(0) {}
+  LOG_LINE() : len(0), data(nullptr) {}
 };
 
 /// log line entry
@@ -256,7 +256,7 @@ struct LOG_STRUCT {
   int nlines;      ///< number of lines
   LOG_LINE *lines; ///< size nlines
   /// constructor
-  LOG_STRUCT() : ver(2), nlines(0), lines(0) {}
+  LOG_STRUCT() : ver(2), nlines(0), lines(nullptr) {}
 };
 
 /// isis raw file.
diff --git a/Framework/DataHandling/src/LoadRaw/item_struct.h b/Framework/DataHandling/src/LoadRaw/item_struct.h
index e62ef1d5c219f198c179a69d2de05b8c361d8217..a14028aa556e5e6d43f9841bc85a8d45263ae4dd 100644
--- a/Framework/DataHandling/src/LoadRaw/item_struct.h
+++ b/Framework/DataHandling/src/LoadRaw/item_struct.h
@@ -20,7 +20,7 @@ public:
         : value(v), det_average(da), dim0(d0), dim1(d1) {}
   };
 
-  item_struct() : m_items(), m_spec_array(NULL), m_ndet(0){};
+  item_struct() : m_items(), m_spec_array(nullptr), m_ndet(0){};
 
 private:
   typedef std::map<std::string, item_t>
@@ -39,7 +39,7 @@ public:
   @return 0 on success, -1 if it is a duplicate
   */
   int addItem(const std::string &name, const T *value, bool det_average = false,
-              const int *dim0 = NULL, const int *dim1 = NULL) {
+              const int *dim0 = nullptr, const int *dim1 = nullptr) {
     std::pair<typename items_map_t::iterator, bool> insert_ret;
     insert_ret = m_items.insert(typename items_map_t::value_type(
         name, item_t(value, det_average, dim0, dim1)));
diff --git a/Framework/DataHandling/src/LoadRawHelper.cpp b/Framework/DataHandling/src/LoadRawHelper.cpp
index 5b578d683a32c26259978edda7d95254acb66cf6..38a1edc5eb8ad53dcceb2536979af1f5dc3a7337 100644
--- a/Framework/DataHandling/src/LoadRawHelper.cpp
+++ b/Framework/DataHandling/src/LoadRawHelper.cpp
@@ -730,7 +730,7 @@ void LoadRawHelper::runLoadLog(const std::string &fileName,
   }
   // Make log creator object and add the run status log if we have the
   // appropriate ICP log
-  m_logCreator.reset(new ISISRunLogs(localWorkspace->run(), m_numberOfPeriods));
+  m_logCreator.reset(new ISISRunLogs(localWorkspace->run()));
   m_logCreator->addStatusLog(localWorkspace->mutableRun());
 }
 
diff --git a/Framework/DataHandling/src/LoadReflTBL.cpp b/Framework/DataHandling/src/LoadReflTBL.cpp
index 709424229b6671ec2e491922d3932efc069e8b4b..13cac9743cc81ae6976e81daa04ce047e798b5c9 100644
--- a/Framework/DataHandling/src/LoadReflTBL.cpp
+++ b/Framework/DataHandling/src/LoadReflTBL.cpp
@@ -10,7 +10,7 @@
 #include <fstream>
 
 #include <boost/tokenizer.hpp>
-#include <Poco/StringTokenizer.h>
+#include <MantidKernel/StringTokenizer.h>
 // String utilities
 #include <boost/algorithm/string.hpp>
 
diff --git a/Framework/DataHandling/src/LoadSpice2D.cpp b/Framework/DataHandling/src/LoadSpice2D.cpp
index e81a0f744d3981e1966df2ec68754c89b22a9151..2f5cd95f48cd8026930bdf53ff3346def3da7547 100644
--- a/Framework/DataHandling/src/LoadSpice2D.cpp
+++ b/Framework/DataHandling/src/LoadSpice2D.cpp
@@ -18,7 +18,7 @@
 #include <boost/regex.hpp>
 #include <boost/shared_array.hpp>
 #include <Poco/Path.h>
-#include <Poco/StringTokenizer.h>
+#include <MantidKernel/StringTokenizer.h>
 #include <Poco/DOM/DOMParser.h>
 #include <Poco/DOM/Document.h>
 #include <Poco/DOM/Element.h>
diff --git a/Framework/DataHandling/src/LoadTOFRawNexus.cpp b/Framework/DataHandling/src/LoadTOFRawNexus.cpp
index a61dea1d7b8611598342ef48f4cb35d46056265a..933f64f93dad01810a65f9e7d641c399add3075e 100644
--- a/Framework/DataHandling/src/LoadTOFRawNexus.cpp
+++ b/Framework/DataHandling/src/LoadTOFRawNexus.cpp
@@ -445,8 +445,9 @@ void LoadTOFRawNexus::loadBank(const std::string &nexusfilename,
                errors.begin() + (i + 1) * m_numBins);
     } else {
       // Now take the sqrt(Y) to give E
-      E = Y;
-      std::transform(E.begin(), E.end(), E.begin(), (double (*)(double))sqrt);
+      E = MantidVec();
+      std::transform(Y.begin(), Y.end(), std::back_inserter(E),
+                     static_cast<double (*)(double)>(sqrt));
     }
   }
 
@@ -518,8 +519,8 @@ void LoadTOFRawNexus::exec() {
   g_log.debug() << "Loading DAS logs" << std::endl;
 
   int nPeriods = 1; // Unused
-  std::unique_ptr<const TimeSeriesProperty<int>> periodLog(
-      new const TimeSeriesProperty<int>("period_log")); // Unused
+  auto periodLog =
+      make_unique<const TimeSeriesProperty<int>>("period_log"); // Unused
   LoadEventNexus::runLoadNexusLogs<MatrixWorkspace_sptr>(
       filename, WS, *this, false, nPeriods, periodLog);
 
diff --git a/Framework/DataHandling/src/LoadVulcanCalFile.cpp b/Framework/DataHandling/src/LoadVulcanCalFile.cpp
index 4e0b22c9fdda8121e41eb7a9e35cb5962722b2ac..8e411fb1dfc37238078b0e387cff1c65846a6425 100644
--- a/Framework/DataHandling/src/LoadVulcanCalFile.cpp
+++ b/Framework/DataHandling/src/LoadVulcanCalFile.cpp
@@ -435,11 +435,10 @@ void LoadVulcanCalFile::processOffsets(
   }
 
   // Get the global correction
-  std::set<int>::iterator biter;
   g_log.information() << "Number of bankds to process = " << set_bankID.size()
                       << "\n";
   map<int, double> map_bankLogCorr;
-  for (biter = set_bankID.begin(); biter != set_bankID.end(); ++biter) {
+  for (auto biter = set_bankID.begin(); biter != set_bankID.end(); ++biter) {
     // Locate inter bank and inter pack correction (log)
     int bankid = *biter;
     double globalfactor = 0.;
@@ -614,7 +613,7 @@ Geometry::Instrument_const_sptr LoadVulcanCalFile::getInstrument() {
   Instrument_const_sptr inst;
 
   Algorithm_sptr childAlg = createChildAlgorithm("LoadInstrument", 0.0, 0.2);
-  MatrixWorkspace_sptr tempWS(new Workspace2D());
+  MatrixWorkspace_sptr tempWS = boost::make_shared<Workspace2D>();
   childAlg->setProperty<MatrixWorkspace_sptr>("Workspace", tempWS);
   childAlg->setPropertyValue("InstrumentName", InstrumentName);
   childAlg->setProperty("RewriteSpectraMap",
diff --git a/Framework/DataHandling/src/MaskDetectors.cpp b/Framework/DataHandling/src/MaskDetectors.cpp
index cde8d9af47d06e555f8c80b64d2a9304121163dd..e4393ad778a656ef2325ec37a18bb1c3012d461e 100644
--- a/Framework/DataHandling/src/MaskDetectors.cpp
+++ b/Framework/DataHandling/src/MaskDetectors.cpp
@@ -109,7 +109,7 @@ void MaskDetectors::exec() {
   } // End dealing with spectraList
   else if (!detectorList.empty()) {
     // Convert from detectors to workspace indexes
-    WS->getIndicesFromDetectorIDs(detectorList, indexList);
+    indexList = WS->getIndicesFromDetectorIDs(detectorList);
   }
   // If we have a workspace that could contain masking,copy that in too
 
diff --git a/Framework/DataHandling/src/SaveDetectorsGrouping.cpp b/Framework/DataHandling/src/SaveDetectorsGrouping.cpp
index 6cf919364ca236a5c0170635e2623e61800afce3..55d50ff0b166b17071e59c26350d172ac544d03b 100644
--- a/Framework/DataHandling/src/SaveDetectorsGrouping.cpp
+++ b/Framework/DataHandling/src/SaveDetectorsGrouping.cpp
@@ -109,7 +109,7 @@ void SaveDetectorsGrouping::createGroupDetectorIDMap(
                     << " has no spectrum.  Impossible!" << std::endl;
       throw;
     }
-    std::set<detid_t> detids = mspec->getDetectorIDs();
+    auto detids = mspec->getDetectorIDs();
     if (detids.size() != 1) {
       g_log.error() << "Spectrum " << mspec->getSpectrumNo() << " has "
                     << detids.size() << " detectors.  Not allowed situation!"
diff --git a/Framework/DataHandling/src/SaveMask.cpp b/Framework/DataHandling/src/SaveMask.cpp
index 6100cd482a81e4f00e1a8d4ffe72844f6079df42..091c175fc42dfeacc6b69be44cf64a038cd97342 100644
--- a/Framework/DataHandling/src/SaveMask.cpp
+++ b/Framework/DataHandling/src/SaveMask.cpp
@@ -99,16 +99,12 @@ void SaveMask::exec() {
         throw std::invalid_argument("Cannot find spectrum");
       }
 
-      const std::set<detid_t> detids = spec->getDetectorIDs();
+      const auto detids = spec->getDetectorIDs();
 
       // b) get detector id & Store
-      detid_t detid;
-      ;
-      std::set<detid_t>::const_iterator it;
-      for (it = detids.begin(); it != detids.end(); ++it) {
-        detid = *it;
+      for (const auto &det_id : detids) {
         // c) store
-        detid0s.push_back(detid);
+        detid0s.push_back(det_id);
       }
     } // if
   }   // for
diff --git a/Framework/DataHandling/src/UpdateInstrumentFromFile.cpp b/Framework/DataHandling/src/UpdateInstrumentFromFile.cpp
index 3fb67336d0915fd79fb67fc912d33f0c977cc5a3..aa7d679c8cbd94168a7833ee1d264f5094dac597 100644
--- a/Framework/DataHandling/src/UpdateInstrumentFromFile.cpp
+++ b/Framework/DataHandling/src/UpdateInstrumentFromFile.cpp
@@ -17,7 +17,7 @@
 #include <boost/scoped_ptr.hpp>
 #include <boost/algorithm/string/predicate.hpp>
 #include <nexus/NeXusException.hpp>
-#include <Poco/StringTokenizer.h>
+#include <MantidKernel/StringTokenizer.h>
 
 #include <fstream>
 
@@ -311,7 +311,8 @@ bool UpdateInstrumentFromFile::parseAsciiHeader(
                                 "property is empty, cannot interpret columns");
   }
 
-  Poco::StringTokenizer splitter(header, ",", Poco::StringTokenizer::TOK_TRIM);
+  Mantid::Kernel::StringTokenizer splitter(
+      header, ",", Mantid::Kernel::StringTokenizer::TOK_TRIM);
   headerInfo.colCount = splitter.count();
   auto it =
       splitter.begin(); // First column must be spectrum number or detector ID
diff --git a/Framework/DataHandling/test/CMakeLists.txt b/Framework/DataHandling/test/CMakeLists.txt
index 47b4dde26c2e3a658294d047f662308a1002a778..0447c97f4d9b943caae1f05778a83a77a145b117 100644
--- a/Framework/DataHandling/test/CMakeLists.txt
+++ b/Framework/DataHandling/test/CMakeLists.txt
@@ -8,6 +8,7 @@ if ( CXXTEST_FOUND )
                         ../../TestHelpers/src/ComponentCreationHelper.cpp
                         ../../TestHelpers/src/ScopedFileHelper.cpp
                         ../../TestHelpers/src/StartFrameworkManager.cpp
+                        ../../TestHelpers/src/InstrumentCreationHelper.cpp
                         ../../TestHelpers/src/WorkspaceCreationHelper.cpp
       )
 
diff --git a/Framework/DataHandling/test/EventWorkspaceCollectionTest.h b/Framework/DataHandling/test/EventWorkspaceCollectionTest.h
index 7bc020ff5169b0dbef3be7faf309778adc1aba35..61ffa21506872ccef67682e734bfb0755b0fa5f2 100644
--- a/Framework/DataHandling/test/EventWorkspaceCollectionTest.h
+++ b/Framework/DataHandling/test/EventWorkspaceCollectionTest.h
@@ -21,10 +21,9 @@ namespace {
 EventWorkspaceCollection_uptr
 makeEventWorkspaceCollection(unsigned int decoratorSize) {
 
-  EventWorkspaceCollection_uptr decorator(new EventWorkspaceCollection);
+  auto decorator = make_unique<EventWorkspaceCollection>();
 
-  std::unique_ptr<const TimeSeriesProperty<int>> periodLog(
-      new const TimeSeriesProperty<int>("period_log"));
+  auto periodLog = make_unique<const TimeSeriesProperty<int>>("period_log");
 
   decorator->setNPeriods(decoratorSize, periodLog);
 
@@ -58,8 +57,7 @@ public:
   void test_output_multiple_workspaces() {
     EventWorkspaceCollection decorator;
 
-    std::unique_ptr<const TimeSeriesProperty<int>> periodLog(
-        new const TimeSeriesProperty<int>("period_log"));
+    auto periodLog = make_unique<const TimeSeriesProperty<int>>("period_log");
     decorator.setNPeriods(3, periodLog);
 
     WorkspaceGroup_sptr outWS = boost::dynamic_pointer_cast<WorkspaceGroup>(
diff --git a/Framework/DataHandling/test/LoadEventPreNexus2Test.h b/Framework/DataHandling/test/LoadEventPreNexus2Test.h
index 82cfdcf29a8876e8d15e1010b7c39815b5797ce6..e6177dd0b453dee59561c22241068b67270f6513 100644
--- a/Framework/DataHandling/test/LoadEventPreNexus2Test.h
+++ b/Framework/DataHandling/test/LoadEventPreNexus2Test.h
@@ -254,7 +254,7 @@ public:
 
     // Are the pixel IDs ok?
     TS_ASSERT_EQUALS(ew->getSpectrum(0)->getSpectrumNo(), 46);
-    std::set<detid_t> dets = ew->getSpectrum(0)->getDetectorIDs();
+    auto dets = ew->getSpectrum(0)->getDetectorIDs();
     TS_ASSERT_EQUALS(dets.size(), 1);
     TS_ASSERT_EQUALS(*dets.begin(), 45);
 
diff --git a/Framework/DataHandling/test/LoadEventPreNexusTest.h b/Framework/DataHandling/test/LoadEventPreNexusTest.h
index 6ede4d9091d811d0e951323f1df2f771a99ba4fa..8247027bac4ceed0aaa814a9c4b183594e744b17 100644
--- a/Framework/DataHandling/test/LoadEventPreNexusTest.h
+++ b/Framework/DataHandling/test/LoadEventPreNexusTest.h
@@ -253,7 +253,7 @@ public:
 
     // Are the pixel IDs ok?
     TS_ASSERT_EQUALS(ew->getSpectrum(0)->getSpectrumNo(), 46);
-    std::set<detid_t> dets = ew->getSpectrum(0)->getDetectorIDs();
+    auto dets = ew->getSpectrum(0)->getDetectorIDs();
     TS_ASSERT_EQUALS(dets.size(), 1);
     TS_ASSERT_EQUALS(*dets.begin(), 45);
 
diff --git a/Framework/DataHandling/test/LoadIDFFromNexusTest.h b/Framework/DataHandling/test/LoadIDFFromNexusTest.h
index b3c480550d24b058311c7f6eab6fd963688fa68e..b526fbb80e684c387c0229cba0a54c128f90b231 100644
--- a/Framework/DataHandling/test/LoadIDFFromNexusTest.h
+++ b/Framework/DataHandling/test/LoadIDFFromNexusTest.h
@@ -394,20 +394,20 @@ public:
 
   void test_get_parameter_correction_file() {
 
-    // We test the function the looks for a parameter correction file
+    // We test the function that looks for a parameter correction file
     // for a given instrument.
 
-    // TEST1 file exists
-    std::string testpath1 = loader.getParameterCorrectionFile("TEST1");
+    // LET parameter correction file exists
+    std::string testpath1 = loader.getParameterCorrectionFile("LET");
     Poco::Path iPath(true);               // Absolute path
     TS_ASSERT(iPath.tryParse(testpath1)); // Result has correct syntax
     TS_ASSERT(iPath.isFile());            // Result is a file
     TS_ASSERT(iPath.getFileName() ==
-              "TEST1_Parameter_Corrections.xml"); // Correct filename
+              "LET_Parameter_Corrections.xml"); // Correct filename
     TS_ASSERT(iPath.directory(iPath.depth() - 1) ==
               "embedded_instrument_corrections"); // Correct folder
 
-    // TEST0 file does not exist
+    // TEST0 parameter correction file does not exist
     std::string testpath0 = loader.getParameterCorrectionFile("TEST0");
     TS_ASSERT(testpath0 == ""); // Nothing should be found
   }
diff --git a/Framework/DataHandling/test/LoadISISNexusTest.h b/Framework/DataHandling/test/LoadISISNexusTest.h
index 71b6f6c65595f3d5f6a684706e798d7e0bf47d40..f7dbb510f8e60fa10908fc30896b758055149ab0 100644
--- a/Framework/DataHandling/test/LoadISISNexusTest.h
+++ b/Framework/DataHandling/test/LoadISISNexusTest.h
@@ -331,9 +331,8 @@ public:
     TS_ASSERT_EQUALS(*(ws->getSpectrum(1)->getDetectorIDs().begin()), 10);
     TS_ASSERT(ws->getSpectrum(1)->hasDetectorID(10));
 
-    std::vector<size_t> spectNum2WSInd;
     Mantid::specid_t offset;
-    ws->getSpectrumToWorkspaceIndexVector(spectNum2WSInd, offset);
+    auto spectNum2WSInd = ws->getSpectrumToWorkspaceIndexVector(offset);
     TS_ASSERT_EQUALS(38 + offset + 1, spectNum2WSInd.size());
     size_t sample[] = {5,  10, 11, 12, 13, 14, 15, 16,
                        17, 18, 19, 20, 34, 35, 38};
@@ -382,9 +381,8 @@ public:
     TS_ASSERT_EQUALS(ws->readY(18 - 9)[1], 1.);
     TS_ASSERT_EQUALS(ws->getSpectrum(18 - 9)->getSpectrumNo(), 19);
 
-    std::vector<size_t> spectNum2WSInd;
     Mantid::specid_t offset;
-    ws->getSpectrumToWorkspaceIndexVector(spectNum2WSInd, offset);
+    auto spectNum2WSInd = ws->getSpectrumToWorkspaceIndexVector(offset);
     TS_ASSERT_EQUALS(20 + offset + 1, spectNum2WSInd.size());
     size_t sample[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20};
     std::vector<size_t> Sample(sample, sample + 10);
diff --git a/Framework/DataHandling/test/LoadInstrumentTest.h b/Framework/DataHandling/test/LoadInstrumentTest.h
index 416d5801b6bc415db46cd1b6fd05c87db2191b25..911edd5e7e773e32ec964d1731511a28ed334e41 100644
--- a/Framework/DataHandling/test/LoadInstrumentTest.h
+++ b/Framework/DataHandling/test/LoadInstrumentTest.h
@@ -138,7 +138,7 @@ public:
     TS_ASSERT_EQUALS(output->getAxis(1)->spectraNo(256), 257);
     TS_ASSERT_EQUALS(output->getAxis(1)->spectraNo(257), 258);
 
-    std::set<detid_t> ids_from_map = output->getSpectrum(257)->getDetectorIDs();
+    auto ids_from_map = output->getSpectrum(257)->getDetectorIDs();
     IDetector_const_sptr det_from_ws = output->getDetector(257);
     TS_ASSERT_EQUALS(ids_from_map.size(), 1);
     TS_ASSERT_EQUALS(*ids_from_map.begin(), 602);
diff --git a/Framework/DataHandling/test/LoadMaskTest.h b/Framework/DataHandling/test/LoadMaskTest.h
index a44631c89ccc8894e17885b2956c4b6cfe05ac24..3291179b3f2cdb95c445b77810c0cd23cd94f6fd 100644
--- a/Framework/DataHandling/test/LoadMaskTest.h
+++ b/Framework/DataHandling/test/LoadMaskTest.h
@@ -6,8 +6,6 @@
 #include "MantidKernel/System.h"
 #include <sstream>
 
-#include "boost/assign/list_of.hpp"
-
 #include "MantidDataHandling/LoadMask.h"
 #include "MantidDataObjects/MaskWorkspace.h"
 #include "MantidTestHelpers/ScopedFileHelper.h"
@@ -246,7 +244,7 @@ public:
     const std::string oldEmuIdf = "EMU_Definition_32detectors.xml";
     const std::string newEmuIdf = "EMU_Definition_96detectors.xml";
 
-    const std::vector<int> detIDs = boost::assign::list_of(2)(10);
+    const std::vector<int> detIDs = {2, 10};
     auto maskFile = genMaskingFile("emu_mask.xml", detIDs, std::vector<int>());
 
     auto byInstName =
diff --git a/Framework/DataHandling/test/LoadMuonNexus2Test.h b/Framework/DataHandling/test/LoadMuonNexus2Test.h
index 91b610cc310699fbf7851fa5360edfa52302456c..061e768cebac77130a1ec8031ba04a31d4744951 100644
--- a/Framework/DataHandling/test/LoadMuonNexus2Test.h
+++ b/Framework/DataHandling/test/LoadMuonNexus2Test.h
@@ -38,7 +38,7 @@ public:
     // Test one to one mapping, for example spectra 6 has only 1 pixel
     TS_ASSERT_EQUALS(output->getSpectrum(6)->getDetectorIDs().size(), 1);
 
-    std::set<detid_t> detectorgroup = output->getSpectrum(99)->getDetectorIDs();
+    auto detectorgroup = output->getSpectrum(99)->getDetectorIDs();
     TS_ASSERT_EQUALS(detectorgroup.size(), 1);
     TS_ASSERT_EQUALS(*detectorgroup.begin(), 100);
   }
diff --git a/Framework/DataHandling/test/LoadNexusLogsTest.h b/Framework/DataHandling/test/LoadNexusLogsTest.h
index ab451ae3cc2a4915658d0308d3091ef2554631ba..e341122050bfdf3f2dc751be77b81dda5e02fd07 100644
--- a/Framework/DataHandling/test/LoadNexusLogsTest.h
+++ b/Framework/DataHandling/test/LoadNexusLogsTest.h
@@ -163,7 +163,8 @@ public:
     TSM_ASSERT("Period log should be an int time series property", periodLog);
 
     std::vector<int> periodValues = periodLog->valuesAsVector();
-    std::set<int> uniquePeriods(periodValues.begin(), periodValues.end());
+    std::unordered_set<int> uniquePeriods(periodValues.begin(),
+                                          periodValues.end());
     TSM_ASSERT_EQUALS("Should have 4 periods in total", 4,
                       uniquePeriods.size());
   }
diff --git a/Framework/DataHandling/test/SaveGSASInstrumentFileTest.h b/Framework/DataHandling/test/SaveGSASInstrumentFileTest.h
index 79edc62fe4f716bdd6840467cc0b9c0c46c0c955..bea035006f4db529ebd5e576a101b2f4aa26c954 100644
--- a/Framework/DataHandling/test/SaveGSASInstrumentFileTest.h
+++ b/Framework/DataHandling/test/SaveGSASInstrumentFileTest.h
@@ -183,7 +183,7 @@ public:
   void loadProfileTable(string wsname) {
     // The data befow is from Bank1 in pg60_2011B.irf
 
-    TableWorkspace_sptr tablews(new TableWorkspace);
+    auto tablews = boost::make_shared<TableWorkspace>();
     tablews->addColumn("str", "Name");
     tablews->addColumn("double", "Value_1");
 
diff --git a/Framework/DataHandling/test/SaveParameterFileTest.h b/Framework/DataHandling/test/SaveParameterFileTest.h
index 29cd23889e57d4088a018c1abc7de8531db2fc71..6ce13bf6c081ad934ac9aed300182df64b8719b7 100644
--- a/Framework/DataHandling/test/SaveParameterFileTest.h
+++ b/Framework/DataHandling/test/SaveParameterFileTest.h
@@ -136,7 +136,7 @@ public:
         param->value<FitParameter>();
 
     // Info about fitting parameter is in string value, see FitParameter class
-    typedef Poco::StringTokenizer tokenizer;
+    typedef Mantid::Kernel::StringTokenizer tokenizer;
     tokenizer values(value, ",", tokenizer::TOK_TRIM);
     TS_ASSERT_EQUALS(fitParam.getFormula(), values[7]);
     TS_ASSERT_EQUALS(fitParam.getFunction(), values[1]);
diff --git a/Framework/DataObjects/CMakeLists.txt b/Framework/DataObjects/CMakeLists.txt
index bfbd67c9f514077055227f234a5f8f97773dd4b0..a4de7b3c9836ff18e09f42db3502eebb76dbd3c7 100644
--- a/Framework/DataObjects/CMakeLists.txt
+++ b/Framework/DataObjects/CMakeLists.txt
@@ -139,7 +139,6 @@ set ( TEST_FILES
 	FakeMDTest.h
 	GroupingWorkspaceTest.h
 	Histogram1DTest.h
-	LibraryManagerTest.h
 	MDBinTest.h
 	MDBoxBaseTest.h
 	MDBoxFlatTreeTest.h
diff --git a/Framework/DataObjects/inc/MantidDataObjects/BoxControllerNeXusIO.h b/Framework/DataObjects/inc/MantidDataObjects/BoxControllerNeXusIO.h
index e8be876159e9cdea23344b435ceca5a3dca73d5a..4b548598d989f375744991d617463a749fd0d050 100644
--- a/Framework/DataObjects/inc/MantidDataObjects/BoxControllerNeXusIO.h
+++ b/Framework/DataObjects/inc/MantidDataObjects/BoxControllerNeXusIO.h
@@ -44,7 +44,7 @@ public:
   BoxControllerNeXusIO(API::BoxController *const theBC);
 
   ///@return true if the file to write events is opened and false otherwise
-  bool isOpened() const override { return (m_File != NULL); }
+  bool isOpened() const override { return m_File != nullptr; }
   /// get the full file name of the file used for IO operations
   const std::string &getFileName() const override { return m_fileName; }
   /**Return the size of the NeXus data block used in NeXus data array*/
diff --git a/Framework/DataObjects/inc/MantidDataObjects/MDBox.h b/Framework/DataObjects/inc/MantidDataObjects/MDBox.h
index b6225cbb115eb6928ac7f5eb1377549ac49981a9..5c6648cd656177d15f674f41834a8057c68a14bd 100644
--- a/Framework/DataObjects/inc/MantidDataObjects/MDBox.h
+++ b/Framework/DataObjects/inc/MantidDataObjects/MDBox.h
@@ -160,14 +160,14 @@ public:
   void
   generalBin(MDBin<MDE, nd> &bin,
              Mantid::Geometry::MDImplicitFunction &function) const override;
-  void splitAllIfNeeded(Mantid::Kernel::ThreadScheduler * /*ts*/ = NULL)
+  void splitAllIfNeeded(Mantid::Kernel::ThreadScheduler * /*ts*/ = nullptr)
       override { /* Do nothing with a box default. */
   }
 
   //---------------------------------------------------------------------------------------------------------------------------------
   /** Recalculate signal and various averages dependent on signal and the signal
    * coordinates */
-  void refreshCache(Kernel::ThreadScheduler * /*ts*/ = NULL) override;
+  void refreshCache(Kernel::ThreadScheduler * /*ts*/ = nullptr) override;
   void calculateCentroid(coord_t *centroid) const override;
   void calculateCentroid(coord_t *centroid, const int runindex) const override;
   coord_t *getCentroid() const override;
diff --git a/Framework/DataObjects/inc/MantidDataObjects/MDBox.tcc b/Framework/DataObjects/inc/MantidDataObjects/MDBox.tcc
index 2ccb5498d195cbc4649004a50e9f444961ac2410..2fdd4adf66c73f3e092b96c3c900c555c1f2ed0f 100644
--- a/Framework/DataObjects/inc/MantidDataObjects/MDBox.tcc
+++ b/Framework/DataObjects/inc/MantidDataObjects/MDBox.tcc
@@ -7,8 +7,6 @@
 #include <boost/math/special_functions/round.hpp>
 #include <cmath>
 
-using namespace Mantid::API;
-
 namespace Mantid {
 namespace DataObjects {
 
@@ -38,7 +36,7 @@ TMDE(MDBox)::~MDBox() {
  */
 TMDE(MDBox)::MDBox(API::BoxController_sptr &splitter, const uint32_t depth,
                    const size_t nBoxEvents, const size_t boxID)
-    : MDBoxBase<MDE, nd>(splitter.get(), depth, boxID), m_Saveable(NULL),
+    : MDBoxBase<MDE, nd>(splitter.get(), depth, boxID), m_Saveable(nullptr),
       m_bIsMasked(false) {
   initMDBox(nBoxEvents);
 }
@@ -52,7 +50,7 @@ TMDE(MDBox)::MDBox(API::BoxController_sptr &splitter, const uint32_t depth,
  */
 TMDE(MDBox)::MDBox(API::BoxController *const splitter, const uint32_t depth,
                    const size_t nBoxEvents, const size_t boxID)
-    : MDBoxBase<MDE, nd>(splitter, depth, boxID), m_Saveable(NULL),
+    : MDBoxBase<MDE, nd>(splitter, depth, boxID), m_Saveable(nullptr),
       m_bIsMasked(false) {
   initMDBox(nBoxEvents);
 }
@@ -67,12 +65,12 @@ TMDE(MDBox)::MDBox(API::BoxController *const splitter, const uint32_t depth,
  * @param boxID :: id for the given box
  */
 TMDE(MDBox)::MDBox(
-    BoxController_sptr &splitter, const uint32_t depth,
+    API::BoxController_sptr &splitter, const uint32_t depth,
     const std::vector<Mantid::Geometry::MDDimensionExtents<coord_t>> &
         extentsVector,
     const size_t nBoxEvents, const size_t boxID)
     : MDBoxBase<MDE, nd>(splitter.get(), depth, boxID, extentsVector),
-      m_Saveable(NULL), m_bIsMasked(false) {
+      m_Saveable(nullptr), m_bIsMasked(false) {
   initMDBox(nBoxEvents);
 }
 //-----------------------------------------------------------------------------------------------
@@ -85,12 +83,12 @@ TMDE(MDBox)::MDBox(
  * @param boxID :: id for the given box
  */
 TMDE(MDBox)::MDBox(
-    BoxController *const splitter, const uint32_t depth,
+    API::BoxController *const splitter, const uint32_t depth,
     const std::vector<Mantid::Geometry::MDDimensionExtents<coord_t>> &
         extentsVector,
     const size_t nBoxEvents, const size_t boxID)
     : MDBoxBase<MDE, nd>(splitter, depth, boxID, extentsVector),
-      m_Saveable(NULL), m_bIsMasked(false) {
+      m_Saveable(nullptr), m_bIsMasked(false) {
   initMDBox(nBoxEvents);
 }
 /**Common part of MD box constructor */
@@ -114,7 +112,7 @@ TMDE(void MDBox)::initMDBox(const size_t nBoxEvents) {
  */
 TMDE(MDBox)::MDBox(const MDBox<MDE, nd> &other,
                    Mantid::API::BoxController *const otherBC)
-    : MDBoxBase<MDE, nd>(other, otherBC), m_Saveable(NULL), data(other.data),
+    : MDBoxBase<MDE, nd>(other, otherBC), m_Saveable(nullptr), data(other.data),
       m_bIsMasked(other.m_bIsMasked) {
   if (otherBC) // may be absent in some tests but generally have to be present
   {
@@ -706,8 +704,8 @@ TMDE(void MDBox)::transformDimensions(std::vector<double> &scaling,
 
 /// Setter for masking the box
 TMDE(void MDBox)::mask() {
-  this->setSignal(MDMaskValue);
-  this->setErrorSquared(MDMaskValue);
+  this->setSignal(API::MDMaskValue);
+  this->setErrorSquared(API::MDMaskValue);
   m_bIsMasked = true;
 }
 
@@ -918,7 +916,7 @@ TMDE(void MDBox)::clearFileBacked(bool loadDiskBackedData) {
     // tell disk buffer that there are no point of tracking this box any more.
     this->m_BoxController->getFileIO()->objectDeleted(m_Saveable);
     delete m_Saveable;
-    m_Saveable = NULL;
+    m_Saveable = nullptr;
   }
 }
 
diff --git a/Framework/DataObjects/inc/MantidDataObjects/MDBoxBase.h b/Framework/DataObjects/inc/MantidDataObjects/MDBoxBase.h
index 1fe0d1eb87887264a85ec407494b92dd52e27e76..81192c3ed2f373036b1576bedcac0498883d14d9 100644
--- a/Framework/DataObjects/inc/MantidDataObjects/MDBoxBase.h
+++ b/Framework/DataObjects/inc/MantidDataObjects/MDBoxBase.h
@@ -46,7 +46,7 @@ TMDE_CLASS
 class DLLExport MDBoxBase : public Mantid::API::IMDNode {
 public:
   //-----------------------------------------------------------------------------------------------
-  MDBoxBase(Mantid::API::BoxController *const BoxController = NULL,
+  MDBoxBase(Mantid::API::BoxController *const BoxController = nullptr,
             const uint32_t depth = 0, const size_t boxID = UNDEF_SIZET);
 
   MDBoxBase(Mantid::API::BoxController *const BoxController,
diff --git a/Framework/DataObjects/inc/MantidDataObjects/MDBoxBase.tcc b/Framework/DataObjects/inc/MantidDataObjects/MDBoxBase.tcc
index cab03529f3303015e6ed04d07e4a0e691cf69578..76609849bf5a55158d6e0738101299d8fac68b59 100644
--- a/Framework/DataObjects/inc/MantidDataObjects/MDBoxBase.tcc
+++ b/Framework/DataObjects/inc/MantidDataObjects/MDBoxBase.tcc
@@ -5,7 +5,7 @@
 #include <limits>
 #include <boost/make_shared.hpp>
 
-using NeXus::File;
+//using NeXus::File;
 
 namespace Mantid {
 namespace DataObjects {
@@ -18,7 +18,7 @@ TMDE(MDBoxBase)::MDBoxBase(Mantid::API::BoxController *const boxController,
     : m_signal(0.0), m_errorSquared(0.0), m_totalWeight(0.0),
       m_BoxController(boxController),
       m_inverseVolume(std::numeric_limits<coord_t>::quiet_NaN()),
-      m_depth(depth), m_parent(NULL), m_fileID(boxID) {
+      m_depth(depth), m_parent(nullptr), m_fileID(boxID) {
   if (boxController) {
     // Give it a fresh ID from the controller.
     if (boxID == std::numeric_limits<size_t>::max()) // Give it a fresh ID from
@@ -36,7 +36,7 @@ TMDE(MDBoxBase)::MDBoxBase(
         extentsVector)
     : m_signal(0.0), m_errorSquared(0.0), m_totalWeight(0.0),
       m_BoxController(boxController), m_inverseVolume(UNDEF_COORDT),
-      m_depth(depth), m_parent(NULL), m_fileID(boxID) {
+      m_depth(depth), m_parent(nullptr), m_fileID(boxID) {
   if (boxController) {
     // Give it a fresh ID from the controller.
     if (boxID == UNDEF_SIZET) // Give it a fresh ID from the controller.
diff --git a/Framework/DataObjects/inc/MantidDataObjects/MDBoxIterator.h b/Framework/DataObjects/inc/MantidDataObjects/MDBoxIterator.h
index a15a484ca40a29a3080201a1c396a7ebb3fbc3e9..a76277444340ca730c60f6349cf37286794f418f 100644
--- a/Framework/DataObjects/inc/MantidDataObjects/MDBoxIterator.h
+++ b/Framework/DataObjects/inc/MantidDataObjects/MDBoxIterator.h
@@ -24,10 +24,10 @@ TMDE_CLASS
 class DLLExport MDBoxIterator : public Mantid::API::IMDIterator {
 public:
   MDBoxIterator(API::IMDNode *topBox, size_t maxDepth, bool leafOnly,
-                Mantid::Geometry::MDImplicitFunction *function = NULL);
+                Mantid::Geometry::MDImplicitFunction *function = nullptr);
   MDBoxIterator(API::IMDNode *topBox, size_t maxDepth, bool leafOnly,
                 SkippingPolicy *skippingPolicy,
-                Mantid::Geometry::MDImplicitFunction *function = NULL);
+                Mantid::Geometry::MDImplicitFunction *function = nullptr);
   MDBoxIterator(std::vector<API::IMDNode *> &boxes, size_t begin, size_t end);
   void init(std::vector<API::IMDNode *> &boxes, size_t begin, size_t end);
   ~MDBoxIterator() override;
diff --git a/Framework/DataObjects/inc/MantidDataObjects/MDBoxIterator.tcc b/Framework/DataObjects/inc/MantidDataObjects/MDBoxIterator.tcc
index e475db612dec99b96b1b997ecda001addaf4ce51..d5df20e7669093ba2fdf4b1a20c52b8862f33028 100644
--- a/Framework/DataObjects/inc/MantidDataObjects/MDBoxIterator.tcc
+++ b/Framework/DataObjects/inc/MantidDataObjects/MDBoxIterator.tcc
@@ -3,10 +3,6 @@
 #include "MantidDataObjects/MDBoxBase.h"
 #include "MantidDataObjects/MDBoxIterator.h"
 
-using namespace Mantid;
-using namespace Mantid::API;
-using namespace Mantid::Geometry;
-
 namespace Mantid {
 namespace DataObjects {
 
@@ -26,7 +22,7 @@ namespace DataObjects {
 TMDE(MDBoxIterator)::MDBoxIterator(
     API::IMDNode *topBox, size_t maxDepth, bool leafOnly,
     Mantid::Geometry::MDImplicitFunction *function)
-    : m_pos(0), m_current(NULL), m_currentMDBox(NULL), m_events(NULL),
+    : m_pos(0), m_current(nullptr), m_currentMDBox(nullptr), m_events(nullptr),
       m_skippingPolicy(new SkipMaskedBins(this)) {
   commonConstruct(topBox, maxDepth, leafOnly, function);
 }
@@ -49,7 +45,7 @@ TMDE(MDBoxIterator)::MDBoxIterator(
     API::IMDNode *topBox, size_t maxDepth, bool leafOnly,
     SkippingPolicy *skippingPolicy,
     Mantid::Geometry::MDImplicitFunction *function)
-    : m_pos(0), m_current(NULL), m_currentMDBox(NULL), m_events(NULL),
+    : m_pos(0), m_current(nullptr), m_currentMDBox(nullptr), m_events(nullptr),
       m_skippingPolicy(skippingPolicy) {
   commonConstruct(topBox, maxDepth, leafOnly, function);
 }
@@ -101,7 +97,7 @@ TMDE(void MDBoxIterator)::commonConstruct(
  */
 TMDE(MDBoxIterator)::MDBoxIterator(std::vector<API::IMDNode *> &boxes,
                                    size_t begin, size_t end)
-    : m_pos(0), m_current(NULL), m_currentMDBox(NULL), m_events(NULL),
+    : m_pos(0), m_current(nullptr), m_currentMDBox(nullptr), m_events(nullptr),
       m_skippingPolicy(new SkipMaskedBins(this))
 
 {
@@ -157,7 +153,7 @@ TMDE(void MDBoxIterator)::jumpTo(size_t index) {
 
 //----------------------------------------------------------------------------------------------
 /// @return true if the iterator is currently valid
-TMDE(bool MDBoxIterator)::valid() const { return (m_current != NULL); }
+TMDE(bool MDBoxIterator)::valid() const { return m_current != nullptr; }
 
 //----------------------------------------------------------------------------------------------
 /// Advance to the next cell. If the current cell is the last one in the
@@ -215,8 +211,8 @@ TMDE(void MDBoxIterator)::getEvents() const {
 TMDE(void MDBoxIterator)::releaseEvents() const {
   if (m_events) {
     m_currentMDBox->releaseEvents();
-    m_events = NULL;
-    m_currentMDBox = NULL;
+    m_events = nullptr;
+    m_currentMDBox = nullptr;
   }
 }
 
@@ -229,11 +225,11 @@ TMDE(size_t MDBoxIterator)::getDataSize() const { return m_max; }
 TMDE(signal_t MDBoxIterator)::getNormalizedSignal() const {
   // What is our normalization factor?
   switch (m_normalization) {
-  case NoNormalization:
+  case API::NoNormalization:
     return m_current->getSignal();
-  case VolumeNormalization:
+  case API::VolumeNormalization:
     return m_current->getSignal() * m_current->getInverseVolume();
-  case NumEventsNormalization:
+  case API::NumEventsNormalization:
     return m_current->getSignal() / double(m_current->getNPoints());
   }
   return std::numeric_limits<signal_t>::quiet_NaN();
@@ -243,11 +239,11 @@ TMDE(signal_t MDBoxIterator)::getNormalizedSignal() const {
 TMDE(signal_t MDBoxIterator)::getNormalizedError() const {
   // What is our normalization factor?
   switch (m_normalization) {
-  case NoNormalization:
+  case API::NoNormalization:
     return m_current->getError();
-  case VolumeNormalization:
+  case API::VolumeNormalization:
     return m_current->getError() * m_current->getInverseVolume();
-  case NumEventsNormalization:
+  case API::NumEventsNormalization:
     return m_current->getError() / double(m_current->getNPoints());
   }
   return std::numeric_limits<signal_t>::quiet_NaN();
diff --git a/Framework/DataObjects/inc/MantidDataObjects/MDEventWorkspace.h b/Framework/DataObjects/inc/MantidDataObjects/MDEventWorkspace.h
index cdf200c45a22259f4b81c823781f858c351fb7e0..16500f76b8718e3e708e466b7a02834658693e05 100644
--- a/Framework/DataObjects/inc/MantidDataObjects/MDEventWorkspace.h
+++ b/Framework/DataObjects/inc/MantidDataObjects/MDEventWorkspace.h
@@ -69,7 +69,7 @@ public:
   /// Creates a new iterator pointing to the first cell (box) in the workspace
   std::vector<Mantid::API::IMDIterator *> createIterators(
       size_t suggestedNumCores = 1,
-      Mantid::Geometry::MDImplicitFunction *function = NULL) const override;
+      Mantid::Geometry::MDImplicitFunction *function = nullptr) const override;
 
   /// Returns the (normalized) signal at a given coordinates
   signal_t getSignalAtCoord(
@@ -88,11 +88,9 @@ public:
   getNormalizedSignal(const API::IMDNode *box,
                       const Mantid::API::MDNormalization &normalization) const;
 
-  void getLinePlot(const Mantid::Kernel::VMD &start,
-                   const Mantid::Kernel::VMD &end,
-                   API::MDNormalization normalize, std::vector<coord_t> &x,
-                   std::vector<signal_t> &y,
-                   std::vector<signal_t> &e) const override;
+  LinePlot getLinePlot(const Mantid::Kernel::VMD &start,
+                       const Mantid::Kernel::VMD &end,
+                       API::MDNormalization normalize) const override;
 
   //------------------------ (END) IMDWorkspace Methods
   //-----------------------------------------
@@ -153,7 +151,7 @@ public:
 
   /// Return true if the underlying box is a MDGridBox.
   bool isGridBox() {
-    return (dynamic_cast<MDGridBox<MDE, nd> *>(data) != NULL);
+    return dynamic_cast<MDGridBox<MDE, nd> *>(data) != nullptr;
   }
 
   /** @returns a pointer to the box (MDBox or MDGridBox) contained within, */
diff --git a/Framework/DataObjects/inc/MantidDataObjects/MDEventWorkspace.tcc b/Framework/DataObjects/inc/MantidDataObjects/MDEventWorkspace.tcc
index 138274677a9c952bc27caaae4dd30643c9245dc2..4dd30a76d2961098f95632a026de29978b5d2512 100644
--- a/Framework/DataObjects/inc/MantidDataObjects/MDEventWorkspace.tcc
+++ b/Framework/DataObjects/inc/MantidDataObjects/MDEventWorkspace.tcc
@@ -34,12 +34,6 @@ GCC_DIAG_OFF(strict-aliasing)
 // clang-format on
 #endif
 
-using namespace Mantid;
-using namespace Mantid::Kernel;
-using namespace Mantid::API;
-using namespace Mantid::Geometry;
-using namespace Mantid::DataObjects;
-
 namespace Mantid {
 namespace DataObjects {
 
@@ -50,11 +44,11 @@ namespace DataObjects {
 TMDE(MDEventWorkspace)::MDEventWorkspace(
     Mantid::API::MDNormalization preferredNormalization,
     Mantid::API::MDNormalization preferredNormalizationHisto)
-    : API::IMDEventWorkspace(), data(NULL),
-      m_BoxController(new BoxController(nd)),
+    : API::IMDEventWorkspace(), data(nullptr),
+      m_BoxController(new API::BoxController(nd)),
       m_displayNormalization(preferredNormalization),
       m_displayNormalizationHisto(preferredNormalizationHisto),
-      m_coordSystem(None) {
+      m_coordSystem(Kernel::None) {
   // First box is at depth 0, and has this default boxController
   data = new MDBox<MDE, nd>(m_BoxController.get(), 0);
 }
@@ -63,7 +57,7 @@ TMDE(MDEventWorkspace)::MDEventWorkspace(
 /** Copy constructor
  */
 TMDE(MDEventWorkspace)::MDEventWorkspace(const MDEventWorkspace<MDE, nd> &other)
-    : IMDEventWorkspace(other), data(NULL),
+    : IMDEventWorkspace(other), data(nullptr),
       m_BoxController(other.m_BoxController->clone()),
       m_displayNormalization(other.m_displayNormalization),
       m_displayNormalizationHisto(other.m_displayNormalizationHisto),
@@ -174,10 +168,10 @@ TMDE(uint64_t MDEventWorkspace)::getNPoints() const {
  * @throw std::runtime_error if there is not enough memory for the boxes.
  */
 TMDE(void MDEventWorkspace)::setMinRecursionDepth(size_t minDepth) {
-  BoxController_sptr bc = this->getBoxController();
+  API::BoxController_sptr bc = this->getBoxController();
   double numBoxes = pow(double(bc->getNumSplit()), double(minDepth));
   double memoryToUse = numBoxes * double(sizeof(MDBox<MDE, nd>)) / 1024.0;
-  MemoryStats stats;
+  Kernel::MemoryStats stats;
   if (double(stats.availMem()) < memoryToUse) {
     std::ostringstream mess;
     mess << "Not enough memory available for the given MinRecursionDepth! "
@@ -198,7 +192,7 @@ TMDE(void MDEventWorkspace)::setMinRecursionDepth(size_t minDepth) {
       if (gbox) {
         // Split ALL the contents.
         for (size_t j = 0; j < gbox->getNumChildren(); j++)
-          gbox->splitContents(j, NULL);
+          gbox->splitContents(j, nullptr);
       }
     }
   }
@@ -218,7 +212,7 @@ TMDE(std::vector<coord_t> MDEventWorkspace)::estimateResolution() const {
     size_t finestSplit = 1;
     for (size_t i = 0; i < realDepth; i++)
       finestSplit *= m_BoxController->getSplitInto(d);
-    IMDDimension_const_sptr dim = this->getDimension(d);
+    Geometry::IMDDimension_const_sptr dim = this->getDimension(d);
     // Calculate the bin size at the smallest split amount
     out.push_back((dim->getMaximum() - dim->getMinimum()) /
                   static_cast<coord_t>(finestSplit));
@@ -236,7 +230,7 @@ TMDE(std::vector<Mantid::API::IMDIterator *> MDEventWorkspace)::createIterators(
     size_t suggestedNumCores,
     Mantid::Geometry::MDImplicitFunction *function) const {
   // Get all the boxes in this workspaces
-  std::vector<IMDNode *> boxes;
+  std::vector<API::IMDNode *> boxes;
   // TODO: Should this be leaf only? Depends on most common use case
   if (function)
     this->data->getBoxes(boxes, 10000, true, function);
@@ -254,7 +248,7 @@ TMDE(std::vector<Mantid::API::IMDIterator *> MDEventWorkspace)::createIterators(
     numCores = 1;
 
   // Create one iterator per core, splitting evenly amongst spectra
-  std::vector<IMDIterator *> out;
+  std::vector<API::IMDIterator *> out;
   for (size_t i = 0; i < numCores; i++) {
     size_t begin = (i * numElements) / numCores;
     size_t end = ((i + 1) * numElements) / numCores;
@@ -290,11 +284,11 @@ TMDE(signal_t MDEventWorkspace)::getNormalizedSignal(
   if (box) {
     // What is our normalization factor?
     switch (normalization) {
-    case NoNormalization:
+    case API::NoNormalization:
       return box->getSignal();
-    case VolumeNormalization:
+    case API::VolumeNormalization:
       return box->getSignal() * box->getInverseVolume();
-    case NumEventsNormalization:
+    case API::NumEventsNormalization:
       return box->getSignal() / double(box->getNPoints());
     }
     // Should not reach here
@@ -330,9 +324,9 @@ TMDE(signal_t MDEventWorkspace)::getSignalWithMaskAtCoord(
   // Check if masked
   const API::IMDNode *box = data->getBoxAtCoord(coords);
   if (!box)
-    return MDMaskValue;
+    return API::MDMaskValue;
   if (box->getIsMasked()) {
-    return MDMaskValue;
+    return API::MDMaskValue;
   }
   return getNormalizedSignal(box, normalization);
 }
@@ -452,7 +446,7 @@ bool SortBoxesByID(const BOXTYPE &a, const BOXTYPE &b) {
 /** Create a table of data about the boxes contained */
 TMDE(Mantid::API::ITableWorkspace_sptr MDEventWorkspace)::makeBoxTable(
     size_t start, size_t num) {
-  CPUTimer tim;
+  Kernel::CPUTimer tim;
   UNUSED_ARG(start);
   UNUSED_ARG(num);
 
@@ -604,7 +598,7 @@ TMDE(void MDEventWorkspace)::splitAllIfNeeded(Kernel::ThreadScheduler *ts) {
  * @param ts :: optional ThreadScheduler * that will be used to parallelize
  *        recursive splitting.
  */
-TMDE(void MDEventWorkspace)::splitTrackedBoxes(ThreadScheduler *ts) {
+TMDE(void MDEventWorkspace)::splitTrackedBoxes(Kernel::ThreadScheduler *ts) {
   UNUSED_ARG(ts);
   throw std::runtime_error("Not implemented yet");
   //    // Get a COPY of the vector (to avoid thread-safety issues)
@@ -740,67 +734,63 @@ TMDE(void MDEventWorkspace)::refreshCache() {
  *- 1
  * @param e :: vector of errors for each bin.
  */
-TMDE(void MDEventWorkspace)::getLinePlot(const Mantid::Kernel::VMD &start,
-                                         const Mantid::Kernel::VMD &end,
-                                         Mantid::API::MDNormalization normalize,
-                                         std::vector<coord_t> &x,
-                                         std::vector<signal_t> &y,
-                                         std::vector<signal_t> &e) const {
+TMDE(API::IMDWorkspace::LinePlot MDEventWorkspace)
+::getLinePlot(const Mantid::Kernel::VMD &start, const Mantid::Kernel::VMD &end,
+              Mantid::API::MDNormalization normalize) const {
   // TODO: Don't use a fixed number of points later
   size_t numPoints = 500;
 
-  VMD step = (end - start) / double(numPoints - 1);
+  Kernel::VMD step = (end - start) / double(numPoints - 1);
   double stepLength = step.norm();
 
-  // These will be the curve as plotted
-  x.clear();
-  y.clear();
-  e.clear();
+  // This will be the curve as plotted
+  LinePlot line;
   for (size_t i = 0; i < numPoints; i++) {
     // Coordinate along the line
-    VMD coord = start + step * double(i);
+    Kernel::VMD coord = start + step * double(i);
 
     // Look for the box at this coordinate
     // const MDBoxBase<MDE,nd> * box = NULL;
-    const IMDNode *box = NULL;
+    const API::IMDNode *box = nullptr;
 
     if (isInBounds(coord.getBareArray())) {
       box = this->data->getBoxAtCoord(coord.getBareArray());
 
-      if (box != NULL) {
+      if (box) {
         if (!box->getIsMasked()) {
           // What is our normalization factor?
           signal_t normalizer = 1.0;
           switch (normalize) {
-          case NoNormalization:
+          case API::NoNormalization:
             break;
-          case VolumeNormalization:
+          case API::VolumeNormalization:
             normalizer = box->getInverseVolume();
             break;
-          case NumEventsNormalization:
+          case API::NumEventsNormalization:
             normalizer = 1.0 / double(box->getNPoints());
             break;
           }
           // Record the position along the line
-          x.push_back(static_cast<coord_t>(stepLength * double(i)));
+          line.x.push_back(static_cast<coord_t>(stepLength * double(i)));
           // And add the normalized signal/error to the list
-          y.push_back(box->getSignal() * normalizer);
-          e.push_back(box->getError() * normalizer);
+          line.y.push_back(box->getSignal() * normalizer);
+          line.e.push_back(box->getError() * normalizer);
         }
       } else {
         // Record the position along the line
-        x.push_back(static_cast<coord_t>(stepLength * double(i)));
-        y.push_back(std::numeric_limits<double>::quiet_NaN());
-        e.push_back(std::numeric_limits<double>::quiet_NaN());
+        line.x.push_back(static_cast<coord_t>(stepLength * double(i)));
+        line.y.push_back(std::numeric_limits<double>::quiet_NaN());
+        line.e.push_back(std::numeric_limits<double>::quiet_NaN());
       }
     } else {
       // Record the position along the line
-      x.push_back(static_cast<coord_t>(stepLength * double(i)));
+      line.x.push_back(static_cast<coord_t>(stepLength * double(i)));
       // Point is outside the workspace. Add NANs
-      y.push_back(std::numeric_limits<double>::quiet_NaN());
-      e.push_back(std::numeric_limits<double>::quiet_NaN());
+      line.y.push_back(std::numeric_limits<double>::quiet_NaN());
+      line.e.push_back(std::numeric_limits<double>::quiet_NaN());
     }
   }
+  return line;
 }
 
 /**
@@ -872,7 +862,7 @@ TMDE(void MDEventWorkspace)::setDisplayNormalizationHisto(
 /**
 Return the preferred normalization preference for subsequent histoworkspaces.
 */
-TMDE(MDNormalization MDEventWorkspace)::displayNormalizationHisto() const {
+TMDE(API::MDNormalization MDEventWorkspace)::displayNormalizationHisto() const {
   return m_displayNormalizationHisto;
 }
 
@@ -888,7 +878,7 @@ TMDE(void MDEventWorkspace)::setDisplayNormalization(
 /**
 Return the preferred normalization to use for visualization.
 */
-TMDE(MDNormalization MDEventWorkspace)::displayNormalization() const {
+TMDE(API::MDNormalization MDEventWorkspace)::displayNormalization() const {
   return m_displayNormalization;
 }
 
diff --git a/Framework/DataObjects/inc/MantidDataObjects/MDGridBox.h b/Framework/DataObjects/inc/MantidDataObjects/MDGridBox.h
index 2bc5a1a11a57a5a4a801baa3986fc4e8b9d40665..36f36e4ce06199801acd5e72d83517c4d74be1fa 100644
--- a/Framework/DataObjects/inc/MantidDataObjects/MDGridBox.h
+++ b/Framework/DataObjects/inc/MantidDataObjects/MDGridBox.h
@@ -56,11 +56,11 @@ public:
   /**get object responsible for saving the box to a file.
     *@return the const pointer to the object. The GridBox is not saveable at the
     *moment so it is always NULL */
-  Kernel::ISaveable *getISaveable() override { return NULL; }
+  Kernel::ISaveable *getISaveable() override { return nullptr; }
   /**get const object responsible for saving the box to a file.
     *@return the const pointer the const object. The GridBox is not saveable at
     *the moment so it is always NULL */
-  Kernel::ISaveable *getISaveable() const override { return NULL; }
+  Kernel::ISaveable *getISaveable() const override { return nullptr; }
   /**Recursively make all underlaying boxes file-backed*/
   void setFileBacked(const uint64_t /*fileLocation*/, const size_t /*fileSize*/,
                      const bool /*markSaved*/) override;
@@ -163,11 +163,11 @@ public:
                          signal_t &signal, signal_t &errorSquared,
                          std::vector<signal_t> &signal_fit) const override;
 
-  void splitContents(size_t index, Kernel::ThreadScheduler *ts = NULL);
+  void splitContents(size_t index, Kernel::ThreadScheduler *ts = nullptr);
 
-  void splitAllIfNeeded(Kernel::ThreadScheduler *ts = NULL) override;
+  void splitAllIfNeeded(Kernel::ThreadScheduler *ts = nullptr) override;
 
-  void refreshCache(Kernel::ThreadScheduler *ts = NULL) override;
+  void refreshCache(Kernel::ThreadScheduler *ts = nullptr) override;
 
   bool getIsMasked() const override;
   /// Setter for masking the box
diff --git a/Framework/DataObjects/inc/MantidDataObjects/MDGridBox.tcc b/Framework/DataObjects/inc/MantidDataObjects/MDGridBox.tcc
index daa425adfd9432cb06afeaf11a68fe896d6a83f7..6d4f0b6cb374a65c0b7b46f032fd2080bbe4f3d6 100644
--- a/Framework/DataObjects/inc/MantidDataObjects/MDGridBox.tcc
+++ b/Framework/DataObjects/inc/MantidDataObjects/MDGridBox.tcc
@@ -14,10 +14,6 @@
 #include <ostream>
 #include "MantidKernel/Strings.h"
 
-using namespace Mantid;
-using namespace Mantid::Kernel;
-using namespace Mantid::API;
-
 // These pragmas ignores the warning in the ctor where "d<nd-1" for nd=1.
 // This is okay (though would be better if it were for only that function
 #if (defined(__INTEL_COMPILER))
@@ -39,7 +35,7 @@ namespace DataObjects {
  * @param extentsVector :: size of the box
  */
 TMDE(MDGridBox)::MDGridBox(
-    BoxController *const bc, const uint32_t depth,
+    API::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),
@@ -363,7 +359,7 @@ TMDE(inline size_t MDGridBox)::getLinearIndex(size_t *indices) const {
  * @param ts :: ThreadScheduler pointer to perform the caching
  *  in parallel. If NULL, it will be performed in series.
  */
-TMDE(void MDGridBox)::refreshCache(ThreadScheduler *ts) {
+TMDE(void MDGridBox)::refreshCache(Kernel::ThreadScheduler *ts) {
   // Clear your total
   nPoints = 0;
   this->m_signal = 0;
@@ -460,7 +456,7 @@ TMDE(void MDGridBox)::getBoxes(std::vector<API::IMDNode *> &outBoxes,
 
     // The number of vertices in each dimension is the # split[d] + 1
     size_t vertices_max[nd];
-    Utils::NestedForLoop::SetUp(nd, vertices_max, 0);
+    Kernel::Utils::NestedForLoop::SetUp(nd, vertices_max, 0);
 
     // Total number of vertices for all the boxes
     size_t numVertices = 1;
@@ -477,19 +473,19 @@ TMDE(void MDGridBox)::getBoxes(std::vector<API::IMDNode *> &outBoxes,
 
     // The index to the vertex in each dimension
     size_t vertexIndex[nd];
-    Utils::NestedForLoop::SetUp(nd, vertexIndex, 0);
+    Kernel::Utils::NestedForLoop::SetUp(nd, vertexIndex, 0);
     // To get indexes in the array of vertexes
     size_t vertexIndexMaker[nd];
-    Utils::NestedForLoop::SetUpIndexMaker(nd, vertexIndexMaker, vertices_max);
+    Kernel::Utils::NestedForLoop::SetUpIndexMaker(nd, vertexIndexMaker, vertices_max);
     // To get indexes in the array of BOXES
     size_t boxIndexMaker[nd];
-    Utils::NestedForLoop::SetUpIndexMaker(nd, boxIndexMaker, split);
+    Kernel::Utils::NestedForLoop::SetUpIndexMaker(nd, boxIndexMaker, split);
 
     size_t linearVertexIndex = 0;
     for (linearVertexIndex = 0; linearVertexIndex < numVertices;
          linearVertexIndex++) {
       // Get the nd-dimensional index
-      Utils::NestedForLoop::GetIndicesFromLinearIndex(
+      Kernel::Utils::NestedForLoop::GetIndicesFromLinearIndex(
           nd, linearVertexIndex, vertexIndexMaker, vertices_max, vertexIndex);
 
       // Coordinates of this vertex
@@ -526,19 +522,19 @@ TMDE(void MDGridBox)::getBoxes(std::vector<API::IMDNode *> &outBoxes,
           vertIndex[d] = 1;
       }
       size_t linIndex =
-          Utils::NestedForLoop::GetLinearIndex(nd, vertIndex, vertexIndexMaker);
+          Kernel::Utils::NestedForLoop::GetLinearIndex(nd, vertIndex, vertexIndexMaker);
       vertexNeighborsOffsets[i] = linIndex;
     }
 
     // Go through all the boxes
     size_t boxIndex[nd];
-    Utils::NestedForLoop::SetUp(nd, boxIndex, 0);
+    Kernel::Utils::NestedForLoop::SetUp(nd, boxIndex, 0);
 
     bool allDone = false;
     while (!allDone) {
       // Find the linear index into the BOXES array.
       size_t boxLinearIndex =
-          Utils::NestedForLoop::GetLinearIndex(nd, boxIndex, boxIndexMaker);
+          Kernel::Utils::NestedForLoop::GetLinearIndex(nd, boxIndex, boxIndexMaker);
       API::IMDNode *box = m_Children[boxLinearIndex];
 
       //        std::cout << "Box at " << Strings::join(boxIndex, boxIndex+nd,
@@ -549,7 +545,7 @@ TMDE(void MDGridBox)::getBoxes(std::vector<API::IMDNode *> &outBoxes,
       // (note that we're using the VERTEX index maker to find the linear index
       // in that LARGER array)
       size_t vertLinearIndex =
-          Utils::NestedForLoop::GetLinearIndex(nd, boxIndex, vertexIndexMaker);
+          Kernel::Utils::NestedForLoop::GetLinearIndex(nd, boxIndex, vertexIndexMaker);
 
       // OK, now its time to see if the box is touching or contained or out of
       // it.
@@ -604,7 +600,7 @@ TMDE(void MDGridBox)::getBoxes(std::vector<API::IMDNode *> &outBoxes,
       }
 
       // Move on to the next box in the list
-      allDone = Utils::NestedForLoop::Increment(nd, boxIndex, split);
+      allDone = Kernel::Utils::NestedForLoop::Increment(nd, boxIndex, split);
     }
 
     // Clean up.
@@ -640,7 +636,7 @@ const API::IMDNode *MDGridBox<MDE, nd>::getBoxAtCoord(const coord_t *coords) {
   if (index < numBoxes) // avoid segfaults for floating point round-off errors.
     return m_Children[index]->getBoxAtCoord(coords);
   else
-    return NULL;
+    return nullptr;
 }
 
 //-----------------------------------------------------------------------------------------------
@@ -654,7 +650,7 @@ const API::IMDNode *MDGridBox<MDE, nd>::getBoxAtCoord(const coord_t *coords) {
  * @param ts :: optional ThreadScheduler * that will be used to parallelize
  *        recursive splitting. Set to NULL for no recursive splitting.
  */
-TMDE(void MDGridBox)::splitContents(size_t index, ThreadScheduler *ts) {
+TMDE(void MDGridBox)::splitContents(size_t index, Kernel::ThreadScheduler *ts) {
   // You can only split it if it is a MDBox (not MDGridBox).
   MDBox<MDE, nd> *box = dynamic_cast<MDBox<MDE, nd> *>(m_Children[index]);
   if (!box)
@@ -671,10 +667,10 @@ TMDE(void MDGridBox)::splitContents(size_t index, ThreadScheduler *ts) {
 
   if (ts) {
     // Create a task to split the newly created MDGridBox.
-    ts->push(new FunctionTask(
+    ts->push(new Kernel::FunctionTask(
         boost::bind(&MDGridBox<MDE, nd>::splitAllIfNeeded, &*gridbox, ts)));
   } else {
-    gridbox->splitAllIfNeeded(NULL);
+    gridbox->splitAllIfNeeded(nullptr);
   }
 }
 
@@ -700,7 +696,7 @@ TMDE(size_t MDGridBox)::getChildIndexFromID(size_t childId) const {
  * @param ts :: optional ThreadScheduler * that will be used to parallelize
  *        recursive splitting. Set to NULL to do it serially.
  */
-TMDE(void MDGridBox)::splitAllIfNeeded(ThreadScheduler *ts) {
+TMDE(void MDGridBox)::splitAllIfNeeded(Kernel::ThreadScheduler *ts) {
   for (size_t i = 0; i < numBoxes; ++i) {
     MDBox<MDE, nd> *box = dynamic_cast<MDBox<MDE, nd> *>(m_Children[i]);
     if (box) {
@@ -719,12 +715,12 @@ TMDE(void MDGridBox)::splitAllIfNeeded(ThreadScheduler *ts) {
           delete box;
           // Now recursively check if this NEW grid box's contents should be
           // split too
-          gridBox->splitAllIfNeeded(NULL);
+          gridBox->splitAllIfNeeded(nullptr);
         } else {
           // ------ Perform split in parallel (using ThreadPool) ------
           // So we create a task to split this MDBox,
           // Task is : this->splitContents(i, ts);
-          ts->push(new FunctionTask(
+          ts->push(new Kernel::FunctionTask(
               boost::bind(&MDGridBox<MDE, nd>::splitContents, &*this, i, ts)));
         }
       } else {
@@ -753,7 +749,7 @@ TMDE(void MDGridBox)::splitAllIfNeeded(ThreadScheduler *ts) {
         else
           // Go parallel if this is a big enough gridbox.
           // Task is : gridBox->splitAllIfNeeded(ts);
-          ts->push(new FunctionTask(boost::bind(
+          ts->push(new Kernel::FunctionTask(boost::bind(
               &MDGridBox<MDE, nd>::splitAllIfNeeded, &*gridBox, ts)));
       }
     }
@@ -860,7 +856,7 @@ TMDE(void MDGridBox)::centerpointBin(MDBin<MDE, nd> &bin,
     }
 
     // Increment the counter(s) in the nested for loops.
-    allDone = Utils::NestedForLoop::Increment(nd, counters, counters_max,
+    allDone = Kernel::Utils::NestedForLoop::Increment(nd, counters, counters_max,
                                               counters_min);
   }
 }
@@ -1093,7 +1089,7 @@ TMDE(void MDGridBox)::centerpointBin(MDBin<MDE, nd> &bin,
  * @param signal [out] :: set to the integrated signal
  * @param errorSquared [out] :: set to the integrated squared error.
  */
-TMDE(void MDGridBox)::integrateSphere(CoordTransform &radiusTransform,
+TMDE(void MDGridBox)::integrateSphere(API::CoordTransform &radiusTransform,
                                       const coord_t radiusSquared,
                                       signal_t &signal,
                                       signal_t &errorSquared) const {
@@ -1119,7 +1115,7 @@ TMDE(void MDGridBox)::integrateSphere(CoordTransform &radiusTransform,
 
   // The number of vertices in each dimension is the # split[d] + 1
   size_t vertices_max[nd];
-  Utils::NestedForLoop::SetUp(nd, vertices_max, 0);
+  Kernel::Utils::NestedForLoop::SetUp(nd, vertices_max, 0);
   for (size_t d = 0; d < nd; ++d) {
     vertices_max[d] = split[d] + 1;
     // cache box sizes and min box valyes for performance
@@ -1129,11 +1125,11 @@ TMDE(void MDGridBox)::integrateSphere(CoordTransform &radiusTransform,
 
   // The index to the vertex in each dimension
   size_t vertexIndex[nd];
-  Utils::NestedForLoop::SetUp(nd, vertexIndex, 0);
+  Kernel::Utils::NestedForLoop::SetUp(nd, vertexIndex, 0);
   size_t boxIndex[nd];
-  Utils::NestedForLoop::SetUp(nd, boxIndex, 0);
+  Kernel::Utils::NestedForLoop::SetUp(nd, boxIndex, 0);
   size_t indexMaker[nd];
-  Utils::NestedForLoop::SetUpIndexMaker(nd, indexMaker, split);
+  Kernel::Utils::NestedForLoop::SetUpIndexMaker(nd, indexMaker, split);
 
   bool allDone = false;
   while (!allDone) {
@@ -1174,7 +1170,7 @@ TMDE(void MDGridBox)::integrateSphere(CoordTransform &radiusTransform,
         if (!badIndex) {
           // Convert to linear index
           size_t linearIndex =
-              Utils::NestedForLoop::GetLinearIndex(nd, boxIndex, indexMaker);
+              Kernel::Utils::NestedForLoop::GetLinearIndex(nd, boxIndex, indexMaker);
           // So we have one more vertex touching this box that is contained in
           // the integration volume. Whew!
           verticesContained[linearIndex]++;
@@ -1185,7 +1181,7 @@ TMDE(void MDGridBox)::integrateSphere(CoordTransform &radiusTransform,
     }
 
     // Increment the counter(s) in the nested for loops.
-    allDone = Utils::NestedForLoop::Increment(nd, vertexIndex, vertices_max);
+    allDone = Kernel::Utils::NestedForLoop::Increment(nd, vertexIndex, vertices_max);
   }
 
   // OK, we've done all the vertices. Now we go through and check each box.
@@ -1265,7 +1261,7 @@ TMDE(void MDGridBox)::integrateSphere(CoordTransform &radiusTransform,
  * @param[out] centroid :: array of size [nd]; its centroid will be added
  * @param[out] signal :: set to the integrated signal
  */
-TMDE(void MDGridBox)::centroidSphere(CoordTransform &radiusTransform,
+TMDE(void MDGridBox)::centroidSphere(API::CoordTransform &radiusTransform,
                                      const coord_t radiusSquared,
                                      coord_t *centroid,
                                      signal_t &signal) const {
@@ -1335,7 +1331,7 @@ TMDE(void MDGridBox)::integrateCylinder(
 
   // The number of vertices in each dimension is the # split[d] + 1
   size_t vertices_max[nd];
-  Utils::NestedForLoop::SetUp(nd, vertices_max, 0);
+  Kernel::Utils::NestedForLoop::SetUp(nd, vertices_max, 0);
   for (size_t d = 0; d < nd; ++d) {
     vertices_max[d] = split[d] + 1;
     // cache box sizes and min box valyes for performance
@@ -1345,11 +1341,11 @@ TMDE(void MDGridBox)::integrateCylinder(
 
   // The index to the vertex in each dimension
   size_t vertexIndex[nd];
-  Utils::NestedForLoop::SetUp(nd, vertexIndex, 0);
+  Kernel::Utils::NestedForLoop::SetUp(nd, vertexIndex, 0);
   size_t boxIndex[nd];
-  Utils::NestedForLoop::SetUp(nd, boxIndex, 0);
+  Kernel::Utils::NestedForLoop::SetUp(nd, boxIndex, 0);
   size_t indexMaker[nd];
-  Utils::NestedForLoop::SetUpIndexMaker(nd, indexMaker, split);
+  Kernel::Utils::NestedForLoop::SetUpIndexMaker(nd, indexMaker, split);
 
   size_t numSteps = signal_fit.size();
   double deltaQ = length / static_cast<double>(numSteps - 1);
@@ -1392,7 +1388,7 @@ TMDE(void MDGridBox)::integrateCylinder(
         if (!badIndex) {
           // Convert to linear index
           size_t linearIndex =
-              Utils::NestedForLoop::GetLinearIndex(nd, boxIndex, indexMaker);
+              Kernel::Utils::NestedForLoop::GetLinearIndex(nd, boxIndex, indexMaker);
           // So we have one more vertex touching this box that is contained in
           // the integration volume. Whew!
           verticesContained[linearIndex]++;
@@ -1403,7 +1399,7 @@ TMDE(void MDGridBox)::integrateCylinder(
     }
 
     // Increment the counter(s) in the nested for loops.
-    allDone = Utils::NestedForLoop::Increment(nd, vertexIndex, vertices_max);
+    allDone = Kernel::Utils::NestedForLoop::Increment(nd, vertexIndex, vertices_max);
   }
 
   // OK, we've done all the vertices. Now we go through and check each box.
diff --git a/Framework/DataObjects/inc/MantidDataObjects/MDHistoWorkspace.h b/Framework/DataObjects/inc/MantidDataObjects/MDHistoWorkspace.h
index b9c5e792fbc103d67689d55916f4f4354042cb6a..8ae0f9388a6f04da9dda1210e5c60b0a5839f92c 100644
--- a/Framework/DataObjects/inc/MantidDataObjects/MDHistoWorkspace.h
+++ b/Framework/DataObjects/inc/MantidDataObjects/MDHistoWorkspace.h
@@ -75,19 +75,15 @@ public:
   uint64_t getNEvents() const override;
   std::vector<Mantid::API::IMDIterator *> createIterators(
       size_t suggestedNumCores = 1,
-      Mantid::Geometry::MDImplicitFunction *function = NULL) const override;
-
-  void getLinePlot(const Mantid::Kernel::VMD &start,
-                   const Mantid::Kernel::VMD &end,
-                   Mantid::API::MDNormalization normalize,
-                   std::vector<coord_t> &x, std::vector<signal_t> &y,
-                   std::vector<signal_t> &e) const override;
-
-  void getLineData(const Mantid::Kernel::VMD &start,
-                   const Mantid::Kernel::VMD &end,
-                   Mantid::API::MDNormalization normalize,
-                   std::vector<coord_t> &x, std::vector<signal_t> &y,
-                   std::vector<signal_t> &e) const override;
+      Mantid::Geometry::MDImplicitFunction *function = nullptr) const override;
+
+  LinePlot getLinePlot(const Mantid::Kernel::VMD &start,
+                       const Mantid::Kernel::VMD &end,
+                       Mantid::API::MDNormalization normalize) const override;
+
+  LinePlot getLineData(const Mantid::Kernel::VMD &start,
+                       const Mantid::Kernel::VMD &end,
+                       Mantid::API::MDNormalization normalize) const override;
 
   void checkWorkspaceSize(const MDHistoWorkspace &other, std::string operation);
 
diff --git a/Framework/DataObjects/inc/MantidDataObjects/MDHistoWorkspaceIterator.h b/Framework/DataObjects/inc/MantidDataObjects/MDHistoWorkspaceIterator.h
index dce2a6b8d463a6006a1089124a725172a07f2c16..65553962b1f2d10082558a344af29e52ba01e392 100644
--- a/Framework/DataObjects/inc/MantidDataObjects/MDHistoWorkspaceIterator.h
+++ b/Framework/DataObjects/inc/MantidDataObjects/MDHistoWorkspaceIterator.h
@@ -55,19 +55,19 @@ class DLLExport MDHistoWorkspaceIterator : public Mantid::API::IMDIterator {
 public:
   MDHistoWorkspaceIterator(
       MDHistoWorkspace_const_sptr workspace, SkippingPolicy *skippingPolicy,
-      Mantid::Geometry::MDImplicitFunction *function = NULL,
+      Mantid::Geometry::MDImplicitFunction *function = nullptr,
       size_t beginPos = 0, size_t endPos = size_t(-1));
   MDHistoWorkspaceIterator(
       const MDHistoWorkspace *workspace, SkippingPolicy *skippingPolicy,
-      Mantid::Geometry::MDImplicitFunction *function = NULL,
+      Mantid::Geometry::MDImplicitFunction *function = nullptr,
       size_t beginPos = 0, size_t endPos = size_t(-1));
   MDHistoWorkspaceIterator(
       MDHistoWorkspace_const_sptr workspace,
-      Mantid::Geometry::MDImplicitFunction *function = NULL,
+      Mantid::Geometry::MDImplicitFunction *function = nullptr,
       size_t beginPos = 0, size_t endPos = size_t(-1));
   MDHistoWorkspaceIterator(
       const MDHistoWorkspace *workspace,
-      Mantid::Geometry::MDImplicitFunction *function = NULL,
+      Mantid::Geometry::MDImplicitFunction *function = nullptr,
       size_t beginPos = 0, size_t endPos = size_t(-1));
   ~MDHistoWorkspaceIterator() override;
 
diff --git a/Framework/DataObjects/inc/MantidDataObjects/TableColumn.h b/Framework/DataObjects/inc/MantidDataObjects/TableColumn.h
index 5de4f524257bdadd08257288d2efe6ff59f0994b..760daa8ccd99fbc0fc313abb7e38e7e73e99da8c 100644
--- a/Framework/DataObjects/inc/MantidDataObjects/TableColumn.h
+++ b/Framework/DataObjects/inc/MantidDataObjects/TableColumn.h
@@ -330,7 +330,7 @@ inline void TableColumn<API::Boolean>::fromDouble(size_t i, double value) {
   m_data[i] = value != 0.0;
 }
 
-/// Shared pointer to a column with aoutomatic type cast and data type check.
+/// Shared pointer to a column with automatic type cast and data type check.
 /// Can be created with TableWorkspace::getColumn(...)
 template <class T>
 class TableColumn_ptr : public boost::shared_ptr<TableColumn<T>> {
@@ -341,7 +341,7 @@ public:
   TableColumn_ptr(boost::shared_ptr<API::Column> c)
       : boost::shared_ptr<TableColumn<T>>(
             boost::dynamic_pointer_cast<TableColumn<T>>(c)) {
-    if (this->get() == NULL) {
+    if (!this->get()) {
       std::string str = "Data type of column " + c->name() +
                         " does not match " + typeid(T).name();
       throw std::runtime_error(str);
@@ -357,7 +357,7 @@ public:
     */
   TableColumn_ptr(boost::shared_ptr<API::Column> c)
       : TableColumn_ptr<API::Boolean>(c) {
-    if (this->get() == NULL) {
+    if (!this->get()) {
       std::string str = "Data type of column " + c->name() +
                         " does not match " + typeid(API::Boolean).name();
       throw std::runtime_error(str);
diff --git a/Framework/DataObjects/inc/MantidDataObjects/TableWorkspace.h b/Framework/DataObjects/inc/MantidDataObjects/TableWorkspace.h
index 1689e64be716048583c1b5b57368f3a25eeafd28..f8b31160780a9056c2bc3660e540d4e13b915d00 100644
--- a/Framework/DataObjects/inc/MantidDataObjects/TableWorkspace.h
+++ b/Framework/DataObjects/inc/MantidDataObjects/TableWorkspace.h
@@ -187,12 +187,12 @@ public:
   template <class T> T *getColDataArray(const std::string &name) {
     auto ci = std::find_if(m_columns.begin(), m_columns.end(), FindName(name));
     if (ci == m_columns.end())
-      return NULL;
+      return nullptr;
     auto pTableCol = dynamic_cast<TableColumn<T> *>(ci->get());
     if (pTableCol)
       return pTableCol->dataArray();
     else
-      return NULL;
+      return nullptr;
   }
   /**Non-throwing const access to the pointer to the column data array for the
    * column with given name. Returns null on error or if the coulmn has not been
@@ -204,12 +204,12 @@ public:
   template <class T> T *getColDataArray(const std::string &name) const {
     auto ci = std::find_if(m_columns.begin(), m_columns.end(), FindName(name));
     if (ci == m_columns.end())
-      return NULL;
+      return nullptr;
     auto pTableCol = dynamic_cast<TableColumn<T> *>(ci->get());
     if (pTableCol)
       return pTableCol->dataArray();
     else
-      return NULL;
+      return nullptr;
   }
 
   /// Resizes the workspace.
diff --git a/Framework/DataObjects/src/EventList.cpp b/Framework/DataObjects/src/EventList.cpp
index 3f8bc02344f98d1eebfb6d6881962b5295baa0a7..2d91b5fa4516b9b305eb9ceeedd14009ff6788fb 100644
--- a/Framework/DataObjects/src/EventList.cpp
+++ b/Framework/DataObjects/src/EventList.cpp
@@ -2023,7 +2023,7 @@ void EventList::histogramForWeightsHelper(const std::vector<T> &events,
 
   // Now do the sqrt of all errors
   std::transform(E.begin(), E.end(), E.begin(),
-                 static_cast<double (*)(double)>(std::sqrt));
+                 static_cast<double (*)(double)>(sqrt));
 }
 
 // --------------------------------------------------------------------------
@@ -2370,7 +2370,7 @@ void EventList::generateErrorsHistogram(const MantidVec &Y,
 
   // windows can get confused about std::sqrt
   std::transform(Y.begin(), Y.end(), E.begin(),
-                 static_cast<double (*)(double)>(std::sqrt));
+                 static_cast<double (*)(double)>(sqrt));
 
 } //----------------------------------------------------------------------------------
   /** Integrate the events between a range of X values, or all events.
diff --git a/Framework/DataObjects/src/EventWorkspace.cpp b/Framework/DataObjects/src/EventWorkspace.cpp
index a8ed2a8f97f17a7becaac8d45ae7826b2d0ea9f8..d43f23f87dbd1acfda2cf4313f1840f4eae58b4d 100644
--- a/Framework/DataObjects/src/EventWorkspace.cpp
+++ b/Framework/DataObjects/src/EventWorkspace.cpp
@@ -798,7 +798,7 @@ void EventWorkspace::setAllX(Kernel::cow_ptr<MantidVec> &x) {
 
 //-----------------------------------------------------------------------------
 /** Task for sorting an event list */
-class EventSortingTask : public Task {
+class EventSortingTask final : public Task {
 public:
   /// ctor
   EventSortingTask(const EventWorkspace *WS, size_t wiStart, size_t wiStop,
diff --git a/Framework/DataObjects/src/FakeMD.cpp b/Framework/DataObjects/src/FakeMD.cpp
index c9c4360b77bd8919bcffb7a18fccba9541c7078b..870c8a7ec32c676f62a4f214502827a26d170691 100644
--- a/Framework/DataObjects/src/FakeMD.cpp
+++ b/Framework/DataObjects/src/FakeMD.cpp
@@ -331,12 +331,12 @@ void FakeMD::addFakeRegularData(const std::vector<double> &params,
     gridSize *= indexMax[d];
   }
   // Create all the requested events
-  std::vector<size_t> indexes;
   size_t cellCount(0);
   for (size_t i = 0; i < num; ++i) {
     coord_t centers[nd];
 
-    Kernel::Utils::getIndicesFromLinearIndex(cellCount, indexMax, indexes);
+    auto indexes =
+        Kernel::Utils::getIndicesFromLinearIndex(cellCount, indexMax);
     ++cellCount;
     if (cellCount >= gridSize)
       cellCount = 0;
diff --git a/Framework/DataObjects/src/FractionalRebinning.cpp b/Framework/DataObjects/src/FractionalRebinning.cpp
index 4140dab6155248a70c0f138bbb2bb1442265c65c..12e113b38c04a5af53f4ec1f7d24aefc596562c3 100644
--- a/Framework/DataObjects/src/FractionalRebinning.cpp
+++ b/Framework/DataObjects/src/FractionalRebinning.cpp
@@ -186,12 +186,13 @@ void rebinToFractionalOutput(const Quadrilateral &inputQ,
                              x_start, x_end))
     return;
 
+  const auto &inX = inputWS->readX(i);
   const auto &inY = inputWS->readY(i);
   const auto &inE = inputWS->readE(i);
   // Don't do the overlap removal if already RebinnedOutput.
   // This wreaks havoc on the data.
-  const bool removeOverlap(inputWS->isDistribution() &&
-                           inputWS->id() != "RebinnedOutput");
+  const bool removeBinWidth(inputWS->isDistribution() &&
+                            inputWS->id() != "RebinnedOutput");
   // It seems to be more efficient to construct this once and clear it before
   // each calculation
   // in the loop
@@ -215,9 +216,11 @@ void rebinToFractionalOutput(const Quadrilateral &inputQ,
         const double weight = intersectOverlap.area() / inputQ.area();
         yValue *= weight;
         double eValue = inE[j] * weight;
-        if (removeOverlap) {
-          const double overlapWidth =
-              intersectOverlap.maxX() - intersectOverlap.minX();
+        if (removeBinWidth) {
+          // If the input workspace was normalized by the bin width, we need to
+          // recover the original Y value, we do it by 'removing' the bin
+          // width
+          const double overlapWidth = inX[j + 1] - inX[j];
           yValue *= overlapWidth;
           eValue *= overlapWidth;
         }
diff --git a/Framework/DataObjects/src/GroupingWorkspace.cpp b/Framework/DataObjects/src/GroupingWorkspace.cpp
index d4a44681a06820954f0f8c24351d1f293dc60e3a..1d63636fd0e36987863112a851749855e051634b 100644
--- a/Framework/DataObjects/src/GroupingWorkspace.cpp
+++ b/Framework/DataObjects/src/GroupingWorkspace.cpp
@@ -58,7 +58,7 @@ void GroupingWorkspace::makeDetectorIDToGroupMap(
     int group = static_cast<int>(this->readY(wi)[0]);
     if (group == 0)
       group = -1;
-    std::set<detid_t> detIDs = this->getDetectorIDs(wi);
+    auto detIDs = this->getDetectorIDs(wi);
     for (auto detID : detIDs) {
       detIDToGroup[detID] = group;
       if (group > ngroups)
@@ -84,7 +84,7 @@ void GroupingWorkspace::makeDetectorIDToGroupVector(
     int group = static_cast<int>(this->readY(wi)[0]);
     if (group == 0)
       group = -1;
-    std::set<detid_t> detIDs = this->getDetectorIDs(wi);
+    auto detIDs = this->getDetectorIDs(wi);
     for (auto detID : detIDs) {
       if (detID <
           0) // if you need negative detector ids, use the other function
diff --git a/Framework/DataObjects/src/MDHistoWorkspace.cpp b/Framework/DataObjects/src/MDHistoWorkspace.cpp
index e102d464094d0c25b092497b5b058bf45ad61498..09a8910e41dac4f746cff928093a2bbac740cc34 100644
--- a/Framework/DataObjects/src/MDHistoWorkspace.cpp
+++ b/Framework/DataObjects/src/MDHistoWorkspace.cpp
@@ -502,27 +502,22 @@ bool pointInWorkspace(const MDHistoWorkspace *ws, const VMD &point) {
  * @param start :: coordinates of the start point of the line
  * @param end :: coordinates of the end point of the line
  * @param normalize :: how to normalize the signal
- * @param x :: linearly spaced points along the line between start and end.
- * @param y :: is set to the normalized signal for each bin. Length = length(x)
- *- 1
- * @param e :: error vector for each bin.
+ * @returns :: LinePlot with x as linearly spaced points along the line
+ * between start and end, y set to the normalized signal for each bin with
+ * Length = length(x) - 1 and e as the error vector for each bin.
  */
-void MDHistoWorkspace::getLinePlot(const Mantid::Kernel::VMD &start,
-                                   const Mantid::Kernel::VMD &end,
-                                   Mantid::API::MDNormalization normalize,
-                                   std::vector<coord_t> &x,
-                                   std::vector<signal_t> &y,
-                                   std::vector<signal_t> &e) const {
+IMDWorkspace::LinePlot
+MDHistoWorkspace::getLinePlot(const Mantid::Kernel::VMD &start,
+                              const Mantid::Kernel::VMD &end,
+                              Mantid::API::MDNormalization normalize) const {
   // TODO: Don't use a fixed number of points later
   const size_t numPoints = 500;
 
   const VMD step = (end - start) / double(numPoints - 1);
   const auto stepLength = step.norm();
 
-  // These will be the curve as plotted
-  x.clear();
-  y.clear();
-  e.clear();
+  // This will be the curve as plotted
+  LinePlot line;
   for (size_t i = 0; i < numPoints; i++) {
     // Coordinate along the line
     VMD coord = start + step * double(i);
@@ -533,7 +528,7 @@ void MDHistoWorkspace::getLinePlot(const Mantid::Kernel::VMD &start,
 
       if (!this->getIsMaskedAt(linearIndex)) {
         // Record the position along the line
-        x.push_back(static_cast<coord_t>(stepLength * double(i)));
+        line.x.push_back(static_cast<coord_t>(stepLength * double(i)));
 
         signal_t normalizer = getNormalizationFactor(normalize, linearIndex);
         // And add the normalized signal/error to the list too
@@ -542,18 +537,19 @@ void MDHistoWorkspace::getLinePlot(const Mantid::Kernel::VMD &start,
           // The plotting library (qwt) doesn't like infs.
           signal = std::numeric_limits<signal_t>::quiet_NaN();
         }
-        y.push_back(signal);
-        e.push_back(this->getErrorAt(linearIndex) * normalizer);
+        line.y.push_back(signal);
+        line.e.push_back(this->getErrorAt(linearIndex) * normalizer);
       }
 
     } else {
       // Record the position along the line
-      x.push_back(static_cast<coord_t>(stepLength * double(i)));
+      line.x.push_back(static_cast<coord_t>(stepLength * double(i)));
       // Point is outside the workspace. Add NANs
-      y.push_back(std::numeric_limits<signal_t>::quiet_NaN());
-      e.push_back(std::numeric_limits<signal_t>::quiet_NaN());
+      line.y.push_back(std::numeric_limits<signal_t>::quiet_NaN());
+      line.e.push_back(std::numeric_limits<signal_t>::quiet_NaN());
     }
   }
+  return line;
 }
 
 //----------------------------------------------------------------------------------------------
@@ -565,18 +561,14 @@ void MDHistoWorkspace::getLinePlot(const Mantid::Kernel::VMD &start,
  * @param start :: coordinates of the start point of the line
  * @param end :: coordinates of the end point of the line
  * @param normalize :: how to normalize the signal
- * @param x :: is set to the boundaries of the bins, relative to start of the
- *line.
- * @param y :: is set to the normalized signal for each bin. Length = length(x)
- *- 1
- * @param e :: error vector for each bin.
+ * @returns :: LinePlot with x as the boundaries of the bins, relative
+ * to start of the line, y set to the normalized signal for each bin with
+ * Length = length(x) - 1 and e as the error vector for each bin.
  */
-void MDHistoWorkspace::getLineData(const Mantid::Kernel::VMD &start,
-                                   const Mantid::Kernel::VMD &end,
-                                   Mantid::API::MDNormalization normalize,
-                                   std::vector<coord_t> &x,
-                                   std::vector<signal_t> &y,
-                                   std::vector<signal_t> &e) const {
+IMDWorkspace::LinePlot
+MDHistoWorkspace::getLineData(const Mantid::Kernel::VMD &start,
+                              const Mantid::Kernel::VMD &end,
+                              Mantid::API::MDNormalization normalize) const {
 
   size_t nd = this->getNumDims();
   if (start.getNumDims() != nd)
@@ -585,10 +577,7 @@ void MDHistoWorkspace::getLineData(const Mantid::Kernel::VMD &start,
   if (end.getNumDims() != nd)
     throw std::runtime_error(
         "End point must have the same number of dimensions as the workspace.");
-  x.clear();
-  y.clear();
-  e.clear();
-
+  LinePlot line;
   // Unit-vector of the direction
   VMD dir = end - start;
   const auto length = dir.normalize();
@@ -616,11 +605,11 @@ void MDHistoWorkspace::getLineData(const Mantid::Kernel::VMD &start,
   if (boundaries.empty()) {
     // Nothing at all!
     // Make a single bin with NAN
-    x.push_back(0);
-    x.push_back(length);
-    y.push_back(std::numeric_limits<signal_t>::quiet_NaN());
-    e.push_back(std::numeric_limits<signal_t>::quiet_NaN());
-    return;
+    line.x.push_back(0);
+    line.x.push_back(length);
+    line.y.push_back(std::numeric_limits<signal_t>::quiet_NaN());
+    line.e.push_back(std::numeric_limits<signal_t>::quiet_NaN());
+    return line;
   } else {
     // Get the first point
     std::set<coord_t>::iterator it;
@@ -628,14 +617,14 @@ void MDHistoWorkspace::getLineData(const Mantid::Kernel::VMD &start,
 
     coord_t lastLinePos = *it;
     VMD lastPos = start + (dir * lastLinePos);
-    x.push_back(lastLinePos);
+    line.x.push_back(lastLinePos);
 
     ++it;
 
     for (; it != boundaries.cend(); ++it) {
       // This is our current position along the line
       coord_t linePos = *it;
-      x.push_back(linePos);
+      line.x.push_back(linePos);
 
       // This is the full position at this boundary
       VMD pos = start + (dir * linePos);
@@ -650,8 +639,8 @@ void MDHistoWorkspace::getLineData(const Mantid::Kernel::VMD &start,
 
         // Is the signal here masked?
         if (this->getIsMaskedAt(linearIndex)) {
-          y.push_back(MDMaskValue);
-          e.push_back(MDMaskValue);
+          line.y.push_back(MDMaskValue);
+          line.e.push_back(MDMaskValue);
         } else {
           auto normalizer = getNormalizationFactor(normalize, linearIndex);
           // And add the normalized signal/error to the list too
@@ -660,18 +649,19 @@ void MDHistoWorkspace::getLineData(const Mantid::Kernel::VMD &start,
             // The plotting library (qwt) doesn't like infs.
             signal = std::numeric_limits<signal_t>::quiet_NaN();
           }
-          y.push_back(signal);
-          e.push_back(this->getErrorAt(linearIndex) * normalizer);
+          line.y.push_back(signal);
+          line.e.push_back(this->getErrorAt(linearIndex) * normalizer);
         }
         // Save the position for next bin
         lastPos = pos;
       } else {
         // Invalid index. This shouldn't happen
-        y.push_back(std::numeric_limits<signal_t>::quiet_NaN());
-        e.push_back(std::numeric_limits<signal_t>::quiet_NaN());
+        line.y.push_back(std::numeric_limits<signal_t>::quiet_NaN());
+        line.e.push_back(std::numeric_limits<signal_t>::quiet_NaN());
       }
     } // for each unique boundary
   }   // if there is at least one point
+  return line;
 }
 
 //----------------------------------------------------------------------------------------------
diff --git a/Framework/DataObjects/src/PeakColumn.cpp b/Framework/DataObjects/src/PeakColumn.cpp
index eadb912c98b888dcb8628865adc92382e161c1ee..a5202f189848dbc9a7150b2ed3e9f2443f651e6e 100644
--- a/Framework/DataObjects/src/PeakColumn.cpp
+++ b/Framework/DataObjects/src/PeakColumn.cpp
@@ -204,12 +204,8 @@ void PeakColumn::read(size_t index, const std::string &text) {
 //-------------------------------------------------------------------------------------
 /** @return true if the column is read-only */
 bool PeakColumn::getReadOnly() const {
-  if ((m_name == "h") || (m_name == "k") || (m_name == "l") ||
-      (m_name == "RunNumber"))
-    return false;
-  else
-    // Default to true for most columns
-    return true;
+  return !((m_name == "h") || (m_name == "k") || (m_name == "l") ||
+           (m_name == "RunNumber"));
 }
 
 //-------------------------------------------------------------------------------------
diff --git a/Framework/DataObjects/src/ReflectometryTransform.cpp b/Framework/DataObjects/src/ReflectometryTransform.cpp
index 576364d0c3e79eb76ac30ad0c5d2e5f1960ca85c..7510e09a15e6448921b34845a7226a9bfc1f7256 100644
--- a/Framework/DataObjects/src/ReflectometryTransform.cpp
+++ b/Framework/DataObjects/src/ReflectometryTransform.cpp
@@ -18,7 +18,6 @@
 #include "MantidKernel/V2D.h"
 #include "MantidKernel/VectorHelper.h"
 
-#include <boost/assign.hpp>
 #include <boost/shared_ptr.hpp>
 
 using namespace Mantid::API;
@@ -286,12 +285,12 @@ Mantid::API::IMDEventWorkspace_sptr ReflectometryTransform::executeMD(
     Mantid::API::MatrixWorkspace_const_sptr inputWs,
     BoxController_sptr boxController,
     Mantid::Geometry::MDFrame_uptr frame) const {
-  MDHistoDimension_sptr dim0 = MDHistoDimension_sptr(new MDHistoDimension(
+  auto dim0 = boost::make_shared<MDHistoDimension>(
       m_d0Label, m_d0ID, *frame, static_cast<Mantid::coord_t>(m_d0Min),
-      static_cast<Mantid::coord_t>(m_d0Max), m_d0NumBins));
-  MDHistoDimension_sptr dim1 = MDHistoDimension_sptr(new MDHistoDimension(
+      static_cast<Mantid::coord_t>(m_d0Max), m_d0NumBins);
+  auto dim1 = boost::make_shared<MDHistoDimension>(
       m_d1Label, m_d1ID, *frame, static_cast<Mantid::coord_t>(m_d1Min),
-      static_cast<Mantid::coord_t>(m_d1Max), m_d1NumBins));
+      static_cast<Mantid::coord_t>(m_d1Max), m_d1NumBins);
 
   auto ws = createMDWorkspace(dim0, dim1, boxController);
 
@@ -441,10 +440,10 @@ MatrixWorkspace_sptr ReflectometryTransform::executeNormPoly(
 
   std::vector<double> xBinsVec;
   std::vector<double> zBinsVec;
-  VectorHelper::createAxisFromRebinParams(
-      boost::assign::list_of(m_d1Min)(widthD1)(m_d1Max), zBinsVec);
-  VectorHelper::createAxisFromRebinParams(
-      boost::assign::list_of(m_d0Min)(widthD0)(m_d0Max), xBinsVec);
+  VectorHelper::createAxisFromRebinParams({m_d1Min, widthD1, m_d1Max},
+                                          zBinsVec);
+  VectorHelper::createAxisFromRebinParams({m_d0Min, widthD0, m_d0Max},
+                                          xBinsVec);
 
   // Put the correct bin boundaries into the workspace
   auto verticalAxis = new BinEdgeAxis(zBinsVec);
diff --git a/Framework/DataObjects/test/CMakeLists.txt b/Framework/DataObjects/test/CMakeLists.txt
index b6209a9fe7f7def52116c9ac66c582be1ab3d4b8..2d5ed8ad12ee5f9e76777ce5d3d7db982fda6ecf 100644
--- a/Framework/DataObjects/test/CMakeLists.txt
+++ b/Framework/DataObjects/test/CMakeLists.txt
@@ -6,6 +6,7 @@ if ( CXXTEST_FOUND )
   # It will go out of scope at the end of this file so doesn't need un-setting
   set ( TESTHELPER_SRCS ../../TestHelpers/src/TearDownWorld.cpp
                         ../../TestHelpers/src/ComponentCreationHelper.cpp
+                        ../../TestHelpers/src/InstrumentCreationHelper.cpp
                         ../../TestHelpers/src/WorkspaceCreationHelper.cpp
                         ../../TestHelpers/src/NexusTestHelper.cpp
                         ../../TestHelpers/src/MDEventsTestHelper.cpp 
@@ -26,7 +27,6 @@ if ( CXXTEST_FOUND )
             ${GMOCK_LIBRARIES}
             ${GTEST_LIBRARIES})
   # Specify implicit dependency, but don't link to it
-  add_dependencies ( DataObjectsTest UserAlgorithms )
   add_dependencies ( FrameworkTests DataObjectsTest )
   # Add to the 'FrameworkTests' group in VS
   set_property ( TARGET DataObjectsTest PROPERTY FOLDER "UnitTests" )
diff --git a/Framework/DataObjects/test/FakeMDTest.h b/Framework/DataObjects/test/FakeMDTest.h
index 2d409dc5dff41d9feb9cc85db095123b99ef22cf..88c0e6e6eff3e5d02bb131587380ba24dcf8fb0a 100644
--- a/Framework/DataObjects/test/FakeMDTest.h
+++ b/Framework/DataObjects/test/FakeMDTest.h
@@ -8,7 +8,6 @@
 #include "MantidTestHelpers/ComponentCreationHelper.h"
 #include "MantidTestHelpers/MDEventsTestHelper.h"
 
-#include <boost/assign/list_of.hpp>
 #include <cxxtest/TestSuite.h>
 
 class FakeMDTest : public CxxTest::TestSuite {
@@ -41,15 +40,14 @@ public:
   void test_no_randomize() {
     using Mantid::DataObjects::FakeMD;
     using Mantid::DataObjects::MDEventsTestHelper::makeMDEW;
-    using namespace boost::assign;
 
     // Destination workspace
     auto fakeData = makeMDEW<3>(10, 0.0, 10.0, 1);
     // 1000 boxes with 1 event each
     TS_ASSERT_EQUALS(fakeData->getNPoints(), 1000);
 
-    const std::vector<double> peakParams = list_of(1000.0)(5.0)(5.0)(5.0)(1.0);
-    const std::vector<double> uniformParams = list_of(10000.0);
+    const std::vector<double> peakParams = {1000.0, 5.0, 5.0, 5.0, 1.0};
+    const std::vector<double> uniformParams = {10000.0};
     const int randomSeed(0);
     const bool randomizeSignal(false);
 
@@ -62,14 +60,13 @@ public:
   void test_exec_randomizeSignal() {
     using Mantid::DataObjects::FakeMD;
     using Mantid::DataObjects::MDEventsTestHelper::makeMDEW;
-    using namespace boost::assign;
 
     auto fakeData = makeMDEW<3>(10, 0.0, 10.0, 0);
     TS_ASSERT_EQUALS(fakeData->getNPoints(), 0);
     TS_ASSERT_DELTA(fakeData->getBox()->getSignal(), 0.0, 1e-5);
 
-    const std::vector<double> peakParams = list_of(100.0)(5.0)(5.0)(5.0)(1.0);
-    const std::vector<double> uniformParams = list_of(100.0);
+    const std::vector<double> peakParams = {100.0, 5.0, 5.0, 5.0, 1.0};
+    const std::vector<double> uniformParams = {100.0};
     const int randomSeed(0);
     const bool randomizeSignal(true);
 
@@ -92,7 +89,6 @@ public:
   void testExecRegularSignal() {
     using Mantid::DataObjects::FakeMD;
     using Mantid::DataObjects::MDEventsTestHelper::makeMDEW;
-    using namespace boost::assign;
 
     auto fakeData = makeMDEW<3>(10, 0.0, 10.0, 0);
 
@@ -101,7 +97,7 @@ public:
     TS_ASSERT_DELTA(fakeData->getBox()->getSignal(), 0.0, 1e-5);
 
     const std::vector<double> peakParams;
-    const std::vector<double> uniformParams = list_of(-1000.0);
+    const std::vector<double> uniformParams = {-1000.0};
     const int randomSeed(0);
     const bool randomizeSignal(false);
 
@@ -122,7 +118,6 @@ public:
     using Mantid::DataObjects::MDEvent;
     using Mantid::DataObjects::MDEventsTestHelper::makeAnyMDEW;
     using Mantid::Kernel::PropertyWithValue;
-    using namespace boost::assign;
 
     auto fakeData = makeAnyMDEW<MDEvent<3>, 3>(10, 0.0, 10.0, 0);
     // Give it an instrument
@@ -135,7 +130,7 @@ public:
         new PropertyWithValue<std::string>("run_number", "12345"), true);
 
     const std::vector<double> peakParams;
-    const std::vector<double> uniformParams = list_of(-1000.0);
+    const std::vector<double> uniformParams = {-1000.0};
     const int randomSeed(0);
     const bool randomizeSignal(false);
 
diff --git a/Framework/DataObjects/test/GroupingWorkspaceTest.h b/Framework/DataObjects/test/GroupingWorkspaceTest.h
index f9227b6a36f6f1023336996a5db592d1470a389f..6576262247655a23de169fde520c2bff3756488d 100644
--- a/Framework/DataObjects/test/GroupingWorkspaceTest.h
+++ b/Framework/DataObjects/test/GroupingWorkspaceTest.h
@@ -38,7 +38,7 @@ public:
     TS_ASSERT_EQUALS(ws->blocksize(), 1);
     TS_ASSERT_EQUALS(ws->getInstrument()->getName(),
                      "basic"); // Name of the test instrument
-    std::set<detid_t> dets = ws->getSpectrum(0)->getDetectorIDs();
+    auto dets = ws->getSpectrum(0)->getDetectorIDs();
     TS_ASSERT_EQUALS(dets.size(), 1);
 
     // Set the group numbers
@@ -72,7 +72,7 @@ public:
     TS_ASSERT_EQUALS(cloned->blocksize(), 1);
     TS_ASSERT_EQUALS(cloned->getInstrument()->getName(),
                      "basic"); // Name of the test instrument
-    std::set<detid_t> dets = cloned->getSpectrum(0)->getDetectorIDs();
+    auto dets = cloned->getSpectrum(0)->getDetectorIDs();
     TS_ASSERT_EQUALS(dets.size(), 1);
 
     // Set the group numbers
diff --git a/Framework/DataObjects/test/LibraryManagerTest.h b/Framework/DataObjects/test/LibraryManagerTest.h
deleted file mode 100644
index efa1e032508e8b0b0ce7801bcf7c703d5c4f04e9..0000000000000000000000000000000000000000
--- a/Framework/DataObjects/test/LibraryManagerTest.h
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifndef MANTID_LIBRARYMANAGERTEST_H_
-#define MANTID_LIBRARYMANAGERTEST_H_
-
-#include <cxxtest/TestSuite.h>
-
-#include "MantidAPI/FrameworkManager.h"
-#include "MantidKernel/LibraryManager.h"
-#include "MantidKernel/ConfigService.h"
-
-class LibraryManagerTest : public CxxTest::TestSuite {
-public:
-  void testOpenLibrary() {
-    using namespace Mantid::Kernel;
-    // This first line can go once scons does
-    int libsOpened = LibraryManager::Instance().OpenAllLibraries(
-        "../../Build/Plugins/", false);
-    std::string exeDir = ConfigService::Instance().getDirectoryOfExecutable();
-    libsOpened += LibraryManager::Instance().OpenAllLibraries(exeDir, false);
-
-    TSM_ASSERT("No shared libraries could be loaded", libsOpened);
-  }
-
-  void testLoadedAlgorithm() {
-    try {
-      Mantid::API::FrameworkManager::Instance().createAlgorithm(
-          "HelloWorldAlgorithm");
-
-      TS_ASSERT_THROWS_NOTHING(Mantid::API::FrameworkManager::Instance().exec(
-          "HelloWorldAlgorithm", ""));
-    } catch (...) {
-      // Probably failed because testOpenLibrary failed!
-      TS_FAIL("Could not create HelloWorldAlgorithm");
-    }
-  }
-};
-
-#endif /*MANTID_LIBRARYMANAGERTEST_H_*/
diff --git a/Framework/DataObjects/test/MDEventWorkspaceTest.h b/Framework/DataObjects/test/MDEventWorkspaceTest.h
index c0d8fb16ad0165cda502bac944d77574c214fb22..d0174d3d20241bec9aa162e6666343398ed88439 100644
--- a/Framework/DataObjects/test/MDEventWorkspaceTest.h
+++ b/Framework/DataObjects/test/MDEventWorkspaceTest.h
@@ -551,21 +551,19 @@ public:
 
     Mantid::Kernel::VMD start(0, 0, 0);
     Mantid::Kernel::VMD end(2, 0, 0);
-    std::vector<coord_t> x;
-    std::vector<signal_t> y, e;
-    ew->getLinePlot(start, end, NoNormalization, x, y, e);
-    TS_ASSERT_EQUALS(y.size(), 500);
-    TS_ASSERT_EQUALS(x.size(), 500);
-    for (size_t i = 0; i < y.size(); i += 10) {
-      TS_ASSERT_EQUALS(y[i], signal);
+    auto line = ew->getLinePlot(start, end, NoNormalization);
+    TS_ASSERT_EQUALS(line.y.size(), 500);
+    TS_ASSERT_EQUALS(line.x.size(), 500);
+    for (size_t i = 0; i < line.y.size(); i += 10) {
+      TS_ASSERT_EQUALS(line.y[i], signal);
     }
-    ew->getLinePlot(start, end, VolumeNormalization, x, y, e);
-    for (size_t i = 0; i < y.size(); i += 10) {
-      TS_ASSERT_DELTA(y[i], signal / volume, 1e-7);
+    line = ew->getLinePlot(start, end, VolumeNormalization);
+    for (size_t i = 0; i < line.y.size(); i += 10) {
+      TS_ASSERT_DELTA(line.y[i], signal / volume, 1e-7);
     }
-    ew->getLinePlot(start, end, NumEventsNormalization, x, y, e);
-    for (size_t i = 0; i < y.size(); i += 10) {
-      TS_ASSERT_EQUALS(y[i], 1.0);
+    line = ew->getLinePlot(start, end, NumEventsNormalization);
+    for (size_t i = 0; i < line.y.size(); i += 10) {
+      TS_ASSERT_EQUALS(line.y[i], 1.0);
     }
   }
 
@@ -584,14 +582,12 @@ public:
 
     Mantid::Kernel::VMD start(0, 0, 0);
     Mantid::Kernel::VMD end(5, 0, 0);
-    std::vector<coord_t> x;
-    std::vector<signal_t> y, e;
-    ew->getLinePlot(start, end, NoNormalization, x, y, e);
+    auto line = ew->getLinePlot(start, end, NoNormalization);
     // Masked data is omitted from line
-    TS_ASSERT_EQUALS(y.size(), 325);
-    TS_ASSERT_EQUALS(x.size(), 325);
+    TS_ASSERT_EQUALS(line.y.size(), 325);
+    TS_ASSERT_EQUALS(line.x.size(), 325);
     // Unmasked data
-    TS_ASSERT_EQUALS(y[300], 3.0);
+    TS_ASSERT_EQUALS(line.y[300], 3.0);
   }
 
   void test_that_sets_default_normalization_flags_to_volume_normalization() {
diff --git a/Framework/DataObjects/test/MDHistoWorkspaceIteratorTest.h b/Framework/DataObjects/test/MDHistoWorkspaceIteratorTest.h
index 8ece796f936b93688de8189b7176122a3947c187..8d391bb91f46ade938920288494e4a2f7682e779 100644
--- a/Framework/DataObjects/test/MDHistoWorkspaceIteratorTest.h
+++ b/Framework/DataObjects/test/MDHistoWorkspaceIteratorTest.h
@@ -11,7 +11,6 @@
 #include "MantidKernel/VMD.h"
 #include "MantidGeometry/MDGeometry/MDImplicitFunction.h"
 #include "MantidGeometry/MDGeometry/MDPlane.h"
-#include <boost/assign/list_of.hpp>
 #include <boost/function.hpp>
 #include <boost/bind.hpp>
 #include <boost/scoped_ptr.hpp>
@@ -681,9 +680,7 @@ public:
     it->jumpTo(1);
     neighbourIndexes = it->findNeighbourIndexesFaceTouching();
     TS_ASSERT_EQUALS(4, neighbourIndexes.size());
-    std::vector<size_t> expected_neighbours =
-        boost::assign::list_of(0)(2)(5)(17)
-            .convert_to_container<std::vector<size_t>>();
+    std::vector<size_t> expected_neighbours = {0, 2, 5, 17};
     for (auto i = expected_neighbours.begin(); i != expected_neighbours.end();
          ++i) {
       TS_ASSERT(doesContainIndex(neighbourIndexes, *i));
@@ -695,8 +692,7 @@ public:
     TSM_ASSERT_EQUALS("Should have 2*n neighbours here", 6,
                       neighbourIndexes.size());
     // Is completely enclosed
-    expected_neighbours = boost::assign::list_of(17)(20)(22)(25)(5)(37)
-                              .convert_to_container<std::vector<size_t>>();
+    expected_neighbours = {17, 20, 22, 25, 5, 37};
 
     for (auto i = expected_neighbours.begin(); i != expected_neighbours.end();
          ++i) {
@@ -708,8 +704,7 @@ public:
     neighbourIndexes = it->findNeighbourIndexesFaceTouching();
     TS_ASSERT_EQUALS(3, neighbourIndexes.size());
     // Is on edge
-    expected_neighbours = boost::assign::list_of(47)(59)(62)
-                              .convert_to_container<std::vector<size_t>>();
+    expected_neighbours = {47, 59, 62};
 
     for (auto i = expected_neighbours.begin(); i != expected_neighbours.end();
          ++i) {
@@ -765,9 +760,8 @@ public:
     it->jumpTo(1);
     neighbourIndexes = it->findNeighbourIndexes();
     TS_ASSERT_EQUALS(11, neighbourIndexes.size());
-    std::vector<size_t> expected_neighbours =
-        boost::assign::list_of(0)(2)(4)(5)(6)(16)(17)(18)(20)(21)(22)(22)
-            .convert_to_container<std::vector<size_t>>();
+    std::vector<size_t> expected_neighbours = {0,  2,  4,  5,  6,  16,
+                                               17, 18, 20, 21, 22, 22};
     for (auto i = expected_neighbours.begin(); i != expected_neighbours.end();
          ++i) {
       TS_ASSERT(doesContainIndex(neighbourIndexes, *i));
@@ -779,10 +773,8 @@ public:
     TSM_ASSERT_EQUALS("Should have 3^n-1 neighbours here", 26,
                       neighbourIndexes.size());
     // Is completely enclosed
-    expected_neighbours =
-        boost::assign::list_of(0)(1)(2)(4)(5)(6)(8)(9)(10)(16)(17)(18)(22)(20)(
-            24)(25)(26)(32)(33)(34)(37)(38)(36)(41)(40)(42)
-            .convert_to_container<std::vector<size_t>>();
+    expected_neighbours = {0,  1,  2,  4,  5,  6,  8,  9,  10, 16, 17, 18, 22,
+                           20, 24, 25, 26, 32, 33, 34, 37, 38, 36, 41, 40, 42};
 
     for (auto i = expected_neighbours.begin(); i != expected_neighbours.end();
          ++i) {
@@ -794,8 +786,7 @@ public:
     neighbourIndexes = it->findNeighbourIndexes();
     TS_ASSERT_EQUALS(7, neighbourIndexes.size());
     // Is on edge
-    expected_neighbours = boost::assign::list_of(42)(43)(46)(47)(58)(59)(62)
-                              .convert_to_container<std::vector<size_t>>();
+    expected_neighbours = {42, 43, 46, 47, 58, 59, 62};
 
     for (auto i = expected_neighbours.begin(); i != expected_neighbours.end();
          ++i) {
diff --git a/Framework/DataObjects/test/MDHistoWorkspaceTest.h b/Framework/DataObjects/test/MDHistoWorkspaceTest.h
index 4d4b583375101f3f7417ba7580f5f838d940cddc..8945b878f20d6e92f5bc99cf19293948324003de 100644
--- a/Framework/DataObjects/test/MDHistoWorkspaceTest.h
+++ b/Framework/DataObjects/test/MDHistoWorkspaceTest.h
@@ -556,20 +556,17 @@ public:
       ws->setSignalAt(i, double(i));
     VMD start(0.5, 0.5);
     VMD end(9.5, 0.5);
-    std::vector<coord_t> x;
-    std::vector<signal_t> y;
-    std::vector<signal_t> e;
-    ws->getLinePlot(start, end, NoNormalization, x, y, e);
-    TS_ASSERT_EQUALS(x.size(), 500);
-    TS_ASSERT_DELTA(x[0], 0.0, 1e-5);
-    TS_ASSERT_DELTA(x[50], 0.9018, 1e-5);
-    TS_ASSERT_DELTA(x[100], 1.8036, 1e-5);
-    TS_ASSERT_DELTA(x[499], 9.0, 1e-5);
-
-    TS_ASSERT_EQUALS(y.size(), 500);
-    TS_ASSERT_DELTA(y[0], 0.0, 1e-5);
-    TS_ASSERT_DELTA(y[50], 1.0, 1e-5);
-    TS_ASSERT_DELTA(y[100], 2.0, 1e-5);
+    auto line = ws->getLinePlot(start, end, NoNormalization);
+    TS_ASSERT_EQUALS(line.x.size(), 500);
+    TS_ASSERT_DELTA(line.x[0], 0.0, 1e-5);
+    TS_ASSERT_DELTA(line.x[50], 0.9018, 1e-5);
+    TS_ASSERT_DELTA(line.x[100], 1.8036, 1e-5);
+    TS_ASSERT_DELTA(line.x[499], 9.0, 1e-5);
+
+    TS_ASSERT_EQUALS(line.y.size(), 500);
+    TS_ASSERT_DELTA(line.y[0], 0.0, 1e-5);
+    TS_ASSERT_DELTA(line.y[50], 1.0, 1e-5);
+    TS_ASSERT_DELTA(line.y[100], 2.0, 1e-5);
   }
 
   void test_getLinePlotWithMaskedData() {
@@ -587,15 +584,12 @@ public:
 
     VMD start(0.5, 0.5);
     VMD end(9.5, 0.5);
-    std::vector<coord_t> x;
-    std::vector<signal_t> y;
-    std::vector<signal_t> e;
-    ws->getLinePlot(start, end, NoNormalization, x, y, e);
+    auto line = ws->getLinePlot(start, end, NoNormalization);
 
     // Masked points omitted
-    TS_ASSERT_EQUALS(y.size(), 250);
+    TS_ASSERT_EQUALS(line.y.size(), 250);
     // Unmasked value
-    TS_ASSERT_DELTA(y[200], 8.0, 1e-5);
+    TS_ASSERT_DELTA(line.y[200], 8.0, 1e-5);
   }
 
   //---------------------------------------------------------------------------------------------------
@@ -610,17 +604,17 @@ public:
     std::vector<coord_t> x;
     std::vector<signal_t> y;
     std::vector<signal_t> e;
-    ws->getLineData(start, end, NoNormalization, x, y, e);
-    TS_ASSERT_EQUALS(x.size(), 11);
-    TS_ASSERT_DELTA(x[0], 0.0, 1e-5);
-    TS_ASSERT_DELTA(x[1], 0.5, 1e-5);
-    TS_ASSERT_DELTA(x[2], 1.5, 1e-5);
-    TS_ASSERT_DELTA(x[10], 9.0, 1e-5);
-
-    TS_ASSERT_EQUALS(y.size(), 10);
-    TS_ASSERT_DELTA(y[0], 0.0, 1e-5);
-    TS_ASSERT_DELTA(y[1], 1.0, 1e-5);
-    TS_ASSERT_DELTA(y[2], 2.0, 1e-5);
+    auto line = ws->getLineData(start, end, NoNormalization);
+    TS_ASSERT_EQUALS(line.x.size(), 11);
+    TS_ASSERT_DELTA(line.x[0], 0.0, 1e-5);
+    TS_ASSERT_DELTA(line.x[1], 0.5, 1e-5);
+    TS_ASSERT_DELTA(line.x[2], 1.5, 1e-5);
+    TS_ASSERT_DELTA(line.x[10], 9.0, 1e-5);
+
+    TS_ASSERT_EQUALS(line.y.size(), 10);
+    TS_ASSERT_DELTA(line.y[0], 0.0, 1e-5);
+    TS_ASSERT_DELTA(line.y[1], 1.0, 1e-5);
+    TS_ASSERT_DELTA(line.y[2], 2.0, 1e-5);
   }
 
   //---------------------------------------------------------------------------------------------------
@@ -640,16 +634,13 @@ public:
 
     VMD start(0.5, 0.5);
     VMD end(9.5, 0.5);
-    std::vector<coord_t> x;
-    std::vector<signal_t> y;
-    std::vector<signal_t> e;
-    ws->getLineData(start, end, NoNormalization, x, y, e);
+    auto line = ws->getLineData(start, end, NoNormalization);
 
-    TS_ASSERT_EQUALS(y.size(), 10);
+    TS_ASSERT_EQUALS(line.y.size(), 10);
     // Masked value should be zero
-    TS_ASSERT(boost::math::isnan(y[2]));
+    TS_ASSERT(boost::math::isnan(line.y[2]));
     // Unmasked value
-    TS_ASSERT_DELTA(y[9], 9.0, 1e-5);
+    TS_ASSERT_DELTA(line.y[9], 9.0, 1e-5);
   }
 
   //---------------------------------------------------------------------------------------------------
@@ -661,20 +652,17 @@ public:
       ws->setSignalAt(i, double(i));
     VMD start(0.5, 0.5, 0.5);
     VMD end(9.5, 0.5, 0.5);
-    std::vector<coord_t> x;
-    std::vector<signal_t> y;
-    std::vector<signal_t> e;
-    ws->getLineData(start, end, NoNormalization, x, y, e);
-    TS_ASSERT_EQUALS(x.size(), 11);
-    TS_ASSERT_DELTA(x[0], 0.0, 1e-5);
-    TS_ASSERT_DELTA(x[1], 0.5, 1e-5);
-    TS_ASSERT_DELTA(x[2], 1.5, 1e-5);
-    TS_ASSERT_DELTA(x[10], 9.0, 1e-5);
-
-    TS_ASSERT_EQUALS(y.size(), 10);
-    TS_ASSERT_DELTA(y[0], 0.0, 1e-5);
-    TS_ASSERT_DELTA(y[1], 1.0, 1e-5);
-    TS_ASSERT_DELTA(y[2], 2.0, 1e-5);
+    auto line = ws->getLineData(start, end, NoNormalization);
+    TS_ASSERT_EQUALS(line.x.size(), 11);
+    TS_ASSERT_DELTA(line.x[0], 0.0, 1e-5);
+    TS_ASSERT_DELTA(line.x[1], 0.5, 1e-5);
+    TS_ASSERT_DELTA(line.x[2], 1.5, 1e-5);
+    TS_ASSERT_DELTA(line.x[10], 9.0, 1e-5);
+
+    TS_ASSERT_EQUALS(line.y.size(), 10);
+    TS_ASSERT_DELTA(line.y[0], 0.0, 1e-5);
+    TS_ASSERT_DELTA(line.y[1], 1.0, 1e-5);
+    TS_ASSERT_DELTA(line.y[2], 2.0, 1e-5);
   }
 
   //---------------------------------------------------------------------------------------------------
@@ -686,20 +674,17 @@ public:
       ws->setSignalAt(i, double(i));
     VMD start(9.5, 0.5);
     VMD end(0.5, 0.5);
-    std::vector<coord_t> x;
-    std::vector<signal_t> y;
-    std::vector<signal_t> e;
-    ws->getLineData(start, end, NoNormalization, x, y, e);
-    TS_ASSERT_EQUALS(x.size(), 11);
-    TS_ASSERT_DELTA(x[0], 0.0, 1e-5);
-    TS_ASSERT_DELTA(x[1], 0.5, 1e-5);
-    TS_ASSERT_DELTA(x[2], 1.5, 1e-5);
-    TS_ASSERT_DELTA(x[10], 9.0, 1e-5);
-
-    TS_ASSERT_EQUALS(y.size(), 10);
-    TS_ASSERT_DELTA(y[0], 9.0, 1e-5);
-    TS_ASSERT_DELTA(y[1], 8.0, 1e-5);
-    TS_ASSERT_DELTA(y[2], 7.0, 1e-5);
+    auto line = ws->getLineData(start, end, NoNormalization);
+    TS_ASSERT_EQUALS(line.x.size(), 11);
+    TS_ASSERT_DELTA(line.x[0], 0.0, 1e-5);
+    TS_ASSERT_DELTA(line.x[1], 0.5, 1e-5);
+    TS_ASSERT_DELTA(line.x[2], 1.5, 1e-5);
+    TS_ASSERT_DELTA(line.x[10], 9.0, 1e-5);
+
+    TS_ASSERT_EQUALS(line.y.size(), 10);
+    TS_ASSERT_DELTA(line.y[0], 9.0, 1e-5);
+    TS_ASSERT_DELTA(line.y[1], 8.0, 1e-5);
+    TS_ASSERT_DELTA(line.y[2], 7.0, 1e-5);
   }
 
   //---------------------------------------------------------------------------------------------------
@@ -711,23 +696,22 @@ public:
       ws->setSignalAt(i, double(i));
     VMD start(0.9, 0.5);
     VMD end(1.9, 1.5);
-    std::vector<coord_t> x;
-    std::vector<signal_t> y;
-    std::vector<signal_t> e;
-    ws->getLineData(start, end, NoNormalization, x, y, e);
-    std::cout << "X\n" << Strings::join(x.begin(), x.end(), ",") << std::endl;
-    std::cout << "Y\n" << Strings::join(y.begin(), y.end(), ",") << std::endl;
-
-    TS_ASSERT_EQUALS(x.size(), 4);
-    TS_ASSERT_DELTA(x[0], 0.0, 1e-5);
-    TS_ASSERT_DELTA(x[1], 0.1 * sqrt(2.0), 1e-5);
-    TS_ASSERT_DELTA(x[2], 0.5 * sqrt(2.0), 1e-5);
-    TS_ASSERT_DELTA(x[3], 1.0 * sqrt(2.0), 1e-5);
-
-    TS_ASSERT_EQUALS(y.size(), 3);
-    TS_ASSERT_DELTA(y[0], 0.0, 1e-5);
-    TS_ASSERT_DELTA(y[1], 1.0, 1e-5);
-    TS_ASSERT_DELTA(y[2], 11.0, 1e-5);
+    auto line = ws->getLineData(start, end, NoNormalization);
+    std::cout << "X\n" << Strings::join(line.x.begin(), line.x.end(), ",")
+              << std::endl;
+    std::cout << "Y\n" << Strings::join(line.y.begin(), line.y.end(), ",")
+              << std::endl;
+
+    TS_ASSERT_EQUALS(line.x.size(), 4);
+    TS_ASSERT_DELTA(line.x[0], 0.0, 1e-5);
+    TS_ASSERT_DELTA(line.x[1], 0.1 * sqrt(2.0), 1e-5);
+    TS_ASSERT_DELTA(line.x[2], 0.5 * sqrt(2.0), 1e-5);
+    TS_ASSERT_DELTA(line.x[3], 1.0 * sqrt(2.0), 1e-5);
+
+    TS_ASSERT_EQUALS(line.y.size(), 3);
+    TS_ASSERT_DELTA(line.y[0], 0.0, 1e-5);
+    TS_ASSERT_DELTA(line.y[1], 1.0, 1e-5);
+    TS_ASSERT_DELTA(line.y[2], 11.0, 1e-5);
   }
 
   //---------------------------------------------------------------------------------------------------
@@ -739,20 +723,17 @@ public:
       ws->setSignalAt(i, double(i));
     VMD start(-0.5, 0.5);
     VMD end(10.5, 0.5);
-    std::vector<coord_t> x;
-    std::vector<signal_t> y;
-    std::vector<signal_t> e;
-    ws->getLineData(start, end, NoNormalization, x, y, e);
-    TS_ASSERT_EQUALS(x.size(), 11);
-    TS_ASSERT_DELTA(x[0], 0.5, 1e-5);
-    TS_ASSERT_DELTA(x[1], 1.5, 1e-5);
-    TS_ASSERT_DELTA(x[2], 2.5, 1e-5);
-    TS_ASSERT_DELTA(x[10], 10.5, 1e-5);
-
-    TS_ASSERT_EQUALS(y.size(), 10);
-    TS_ASSERT_DELTA(y[0], 0.0, 1e-5);
-    TS_ASSERT_DELTA(y[1], 1.0, 1e-5);
-    TS_ASSERT_DELTA(y[2], 2.0, 1e-5);
+    auto line = ws->getLineData(start, end, NoNormalization);
+    TS_ASSERT_EQUALS(line.x.size(), 11);
+    TS_ASSERT_DELTA(line.x[0], 0.5, 1e-5);
+    TS_ASSERT_DELTA(line.x[1], 1.5, 1e-5);
+    TS_ASSERT_DELTA(line.x[2], 2.5, 1e-5);
+    TS_ASSERT_DELTA(line.x[10], 10.5, 1e-5);
+
+    TS_ASSERT_EQUALS(line.y.size(), 10);
+    TS_ASSERT_DELTA(line.y[0], 0.0, 1e-5);
+    TS_ASSERT_DELTA(line.y[1], 1.0, 1e-5);
+    TS_ASSERT_DELTA(line.y[2], 2.0, 1e-5);
   }
 
   //---------------------------------------------------------------------------------------------------
@@ -764,15 +745,12 @@ public:
       ws->setSignalAt(i, double(i));
     VMD start(-5, 5);
     VMD end(1, 20.5);
-    std::vector<coord_t> x;
-    std::vector<signal_t> y;
-    std::vector<signal_t> e;
-    ws->getLineData(start, end, NoNormalization, x, y, e);
-    TS_ASSERT_EQUALS(x.size(), 2);
-    TS_ASSERT_DELTA(x[0], 0, 1e-5);
+    auto line = ws->getLineData(start, end, NoNormalization);
+    TS_ASSERT_EQUALS(line.x.size(), 2);
+    TS_ASSERT_DELTA(line.x[0], 0, 1e-5);
     // NAN for Y
-    TS_ASSERT_EQUALS(y.size(), 1);
-    TS_ASSERT(y[0] != y[0]);
+    TS_ASSERT_EQUALS(line.y.size(), 1);
+    TS_ASSERT(line.y[0] != line.y[0]);
   }
 
   //--------------------------------------------------------------------------------------
diff --git a/Framework/DataObjects/test/PeakShapeEllipsoidFactoryTest.h b/Framework/DataObjects/test/PeakShapeEllipsoidFactoryTest.h
index bb539c5095d585cc31d85d994e9b9f6e4580f63d..a1ae4658f8d18c67574f5f6a92b6c081d25159a3 100644
--- a/Framework/DataObjects/test/PeakShapeEllipsoidFactoryTest.h
+++ b/Framework/DataObjects/test/PeakShapeEllipsoidFactoryTest.h
@@ -13,7 +13,6 @@
 #include <cxxtest/TestSuite.h>
 #include <gmock/gmock.h>
 #include <json/json.h>
-#include <boost/assign/list_of.hpp>
 
 #include "MantidDataObjects/PeakShapeEllipsoid.h"
 #include "MantidKernel/VMD.h"
@@ -26,7 +25,6 @@
 using namespace Mantid;
 using namespace Mantid::DataObjects;
 using namespace Mantid::Kernel;
-using namespace boost::assign;
 using Mantid::Kernel::SpecialCoordinateSystem;
 
 class PeakShapeEllipsoidFactoryTest : public CxxTest::TestSuite {
@@ -69,11 +67,10 @@ public:
 
   void test_create() {
 
-    auto directions = list_of(V3D(1, 0, 0))(V3D(0, 1, 0))(V3D(0, 0, 1))
-                          .convert_to_container<std::vector<V3D>>();
-    const MantidVec abcRadii = list_of(2)(3)(4);
-    const MantidVec abcInnerRadii = list_of(5)(6)(7);
-    const MantidVec abcOuterRadii = list_of(8)(9)(10);
+    auto directions = {V3D(1, 0, 0), V3D(0, 1, 0), V3D(0, 0, 1)};
+    const MantidVec abcRadii = {2, 3, 4};
+    const MantidVec abcInnerRadii = {5, 6, 7};
+    const MantidVec abcOuterRadii = {8, 9, 10};
     const SpecialCoordinateSystem frame = Mantid::Kernel::HKL;
     const std::string algorithmName = "foo";
     const int algorithmVersion = 3;
diff --git a/Framework/DataObjects/test/PeakShapeEllipsoidTest.h b/Framework/DataObjects/test/PeakShapeEllipsoidTest.h
index 525a49ba151785e9d5c2af53c6cebbba29fc1d4d..ed8e857c8bec519fb9eeb7023331d5a1005594fd 100644
--- a/Framework/DataObjects/test/PeakShapeEllipsoidTest.h
+++ b/Framework/DataObjects/test/PeakShapeEllipsoidTest.h
@@ -8,14 +8,12 @@
 #include "MantidKernel/V3D.h"
 #include "MantidKernel/Matrix.h"
 #include <vector>
-#include <boost/assign/list_of.hpp>
 #include <json/json.h>
 
 using Mantid::DataObjects::PeakShapeEllipsoid;
 using Mantid::Kernel::SpecialCoordinateSystem;
 using namespace Mantid;
 using namespace Mantid::Kernel;
-using namespace boost::assign;
 
 class PeakShapeEllipsoidTest : public CxxTest::TestSuite {
 public:
@@ -27,11 +25,10 @@ public:
   static void destroySuite(PeakShapeEllipsoidTest *suite) { delete suite; }
 
   void test_constructor() {
-    auto directions = list_of(V3D(1, 0, 0))(V3D(0, 1, 0))(V3D(0, 0, 1))
-                          .convert_to_container<std::vector<V3D>>();
-    const MantidVec abcRadii = list_of(2)(3)(4);
-    const MantidVec abcInnerRadii = list_of(5)(6)(7);
-    const MantidVec abcOuterRadii = list_of(8)(9)(10);
+    auto directions = {(V3D(1, 0, 0)), (V3D(0, 1, 0)), (V3D(0, 0, 1))};
+    const MantidVec abcRadii = {2, 3, 4};
+    const MantidVec abcInnerRadii = {5, 6, 7};
+    const MantidVec abcOuterRadii = {8, 9, 10};
     const SpecialCoordinateSystem frame = Mantid::Kernel::HKL;
     const std::string algorithmName = "foo";
     const int algorithmVersion = 3;
@@ -50,16 +47,14 @@ public:
   }
 
   void test_constructor_throws() {
-    auto directions = list_of(V3D(1, 0, 0))(V3D(0, 1, 0))(V3D(0, 0, 1))
-                          .convert_to_container<std::vector<V3D>>();
-    auto bad_directions =
-        list_of(V3D(1, 0, 0)).convert_to_container<std::vector<V3D>>();
-    const MantidVec abcRadii = list_of(2)(3)(4);
-    const MantidVec bad_abcRadii = list_of(2)(3)(4)(5);
-    const MantidVec abcInnerRadii = list_of(5)(6)(7);
-    const MantidVec bad_abcInnerRadii = list_of(5)(6);
-    const MantidVec abcOuterRadii = list_of(8)(9)(10);
-    const MantidVec bad_abcOuterRadii = list_of(8)(9)(10)(11);
+    auto directions = {V3D(1, 0, 0), V3D(0, 1, 0), V3D(0, 0, 1)};
+    auto bad_directions = {V3D(1, 0, 0)};
+    const MantidVec abcRadii = {2, 3, 4};
+    const MantidVec bad_abcRadii = {2, 3, 4, 5};
+    const MantidVec abcInnerRadii = {5, 6, 7};
+    const MantidVec bad_abcInnerRadii = {5, 6};
+    const MantidVec abcOuterRadii = {8, 9, 10};
+    const MantidVec bad_abcOuterRadii = {8, 9, 10, 11};
     const SpecialCoordinateSystem frame = Mantid::Kernel::HKL;
 
     TSM_ASSERT_THROWS("Should throw, bad directions",
@@ -82,11 +77,10 @@ public:
   }
 
   void test_copy_constructor() {
-    auto directions = list_of(V3D(1, 0, 0))(V3D(0, 1, 0))(V3D(0, 0, 1))
-                          .convert_to_container<std::vector<V3D>>();
-    const MantidVec abcRadii = list_of(2)(3)(4);
-    const MantidVec abcInnerRadii = list_of(5)(6)(7);
-    const MantidVec abcOuterRadii = list_of(8)(9)(10);
+    auto directions = {V3D(1, 0, 0), V3D(0, 1, 0), V3D(0, 0, 1)};
+    const MantidVec abcRadii = {2, 3, 4};
+    const MantidVec abcInnerRadii = {5, 6, 7};
+    const MantidVec abcOuterRadii = {8, 9, 10};
     const SpecialCoordinateSystem frame = Mantid::Kernel::HKL;
     const std::string algorithmName = "foo";
     const int algorithmVersion = 3;
@@ -106,15 +100,11 @@ public:
   }
 
   void test_assignment() {
-    PeakShapeEllipsoid a(list_of(V3D(1, 0, 0))(V3D(0, 1, 0))(V3D(0, 0, 1))
-                             .convert_to_container<std::vector<V3D>>(),
-                         list_of(2)(3)(4), list_of(5)(6)(7), list_of(8)(9)(10),
-                         Mantid::Kernel::HKL, "foo", 1);
+    PeakShapeEllipsoid a({V3D(1, 0, 0), V3D(0, 1, 0), V3D(0, 0, 1)}, {2, 3, 4},
+                         {5, 6, 7}, {8, 9, 10}, Mantid::Kernel::HKL, "foo", 1);
 
-    PeakShapeEllipsoid b(list_of(V3D(0, 0, 0))(V3D(0, 1, 0))(V3D(0, 0, 1))
-                             .convert_to_container<std::vector<V3D>>(),
-                         list_of(1)(3)(4), list_of(1)(6)(7), list_of(8)(9)(10),
-                         QLab, "bar", 2);
+    PeakShapeEllipsoid b({V3D(0, 0, 0), V3D(0, 1, 0), V3D(0, 0, 1)}, {1, 3, 4},
+                         {1, 6, 7}, {8, 9, 10}, QLab, "bar", 2);
 
     b = a;
 
@@ -129,11 +119,10 @@ public:
 
   void test_radius() {
 
-    std::vector<double> radius = list_of(1)(2)(3);
+    std::vector<double> radius = {1, 2, 3};
 
-    PeakShapeEllipsoid shape(list_of(V3D(1, 0, 0))(V3D(0, 1, 0))(V3D(0, 0, 1))
-                                 .convert_to_container<std::vector<V3D>>(),
-                             radius, radius, radius, Mantid::Kernel::HKL);
+    PeakShapeEllipsoid shape({V3D(1, 0, 0), V3D(0, 1, 0), V3D(0, 0, 1)}, radius,
+                             radius, radius, Mantid::Kernel::HKL);
 
     TSM_ASSERT_EQUALS("Radius should be taken to be the max of the ABC radii",
                       3.0, shape.radius());
@@ -142,21 +131,19 @@ public:
   void test_shape_name() {
 
     // Construct it.
-    PeakShapeEllipsoid shape(list_of(V3D(1, 0, 0))(V3D(0, 1, 0))(V3D(0, 0, 1))
-                                 .convert_to_container<std::vector<V3D>>(),
-                             list_of(2)(3)(4), list_of(5)(6)(7),
-                             list_of(8)(9)(10), Mantid::Kernel::HKL, "foo", 1);
+    PeakShapeEllipsoid shape({V3D(1, 0, 0), V3D(0, 1, 0), V3D(0, 0, 1)},
+                             {2, 3, 4}, {5, 6, 7}, {8, 9, 10},
+                             Mantid::Kernel::HKL, "foo", 1);
 
     TS_ASSERT_EQUALS("ellipsoid", shape.shapeName());
   }
 
   void test_toJSON() {
 
-    auto directions = list_of(V3D(1, 0, 0))(V3D(0, 1, 0))(V3D(0, 0, 1))
-                          .convert_to_container<std::vector<V3D>>();
-    const MantidVec abcRadii = list_of(2)(3)(4);
-    const MantidVec abcInnerRadii = list_of(5)(6)(7);
-    const MantidVec abcOuterRadii = list_of(8)(9)(10);
+    std::vector<V3D> directions = {V3D(1, 0, 0), V3D(0, 1, 0), V3D(0, 0, 1)};
+    const MantidVec abcRadii = {2, 3, 4};
+    const MantidVec abcInnerRadii = {5, 6, 7};
+    const MantidVec abcOuterRadii = {8, 9, 10};
     const SpecialCoordinateSystem frame = Mantid::Kernel::HKL;
     const std::string algorithmName = "foo";
     const int algorithmVersion = 3;
@@ -189,11 +176,10 @@ public:
   }
 
   void test_directionsInSpecificFrameThrowsForMatrixWithInvalidDimensions() {
-    auto directions = list_of(V3D(1, 0, 0))(V3D(0, 1, 0))(V3D(0, 0, 1))
-                          .convert_to_container<std::vector<V3D>>();
-    const MantidVec abcRadii = list_of(2)(3)(4);
-    const MantidVec abcInnerRadii = list_of(5)(6)(7);
-    const MantidVec abcOuterRadii = list_of(8)(9)(10);
+    auto directions = {V3D(1, 0, 0), V3D(0, 1, 0), V3D(0, 0, 1)};
+    const MantidVec abcRadii = {2, 3, 4};
+    const MantidVec abcInnerRadii = {5, 6, 7};
+    const MantidVec abcOuterRadii = {8, 9, 10};
     const SpecialCoordinateSystem frame = Mantid::Kernel::QLab;
     const std::string algorithmName = "foo";
     const int algorithmVersion = 3;
@@ -220,11 +206,10 @@ public:
   }
 
   void test_directionsInSepcificFrame() {
-    auto directions = list_of(V3D(1, 0, 0))(V3D(0, 1, 0))(V3D(0, 0, 1))
-                          .convert_to_container<std::vector<V3D>>();
-    const MantidVec abcRadii = list_of(2)(3)(4);
-    const MantidVec abcInnerRadii = list_of(5)(6)(7);
-    const MantidVec abcOuterRadii = list_of(8)(9)(10);
+    auto directions = {V3D(1, 0, 0), V3D(0, 1, 0), V3D(0, 0, 1)};
+    const MantidVec abcRadii = {2, 3, 4};
+    const MantidVec abcInnerRadii = {5, 6, 7};
+    const MantidVec abcOuterRadii = {8, 9, 10};
     const SpecialCoordinateSystem frame = Mantid::Kernel::QLab;
     const std::string algorithmName = "foo";
     const int algorithmVersion = 3;
diff --git a/Framework/DataObjects/test/SpecialWorkspace2DTest.h b/Framework/DataObjects/test/SpecialWorkspace2DTest.h
index a9ee4305c129b0f02700adec3bf3c4baafeb3081..5124ceea1f5c361d72ca731cd454566d54ef81c5 100644
--- a/Framework/DataObjects/test/SpecialWorkspace2DTest.h
+++ b/Framework/DataObjects/test/SpecialWorkspace2DTest.h
@@ -65,7 +65,7 @@ public:
     TS_ASSERT_EQUALS(ws->blocksize(), 1);
     TS_ASSERT_EQUALS(ws->getInstrument()->getName(),
                      "basic"); // Name of the test instrument
-    const std::set<detid_t> &dets = ws->getSpectrum(0)->getDetectorIDs();
+    const auto &dets = ws->getSpectrum(0)->getDetectorIDs();
     TS_ASSERT_EQUALS(dets.size(), 1);
 
     TS_ASSERT_EQUALS(*(ws->getDetectorIDs(0).begin()), 1);
diff --git a/Framework/DataObjects/test/TableWorkspaceTest.h b/Framework/DataObjects/test/TableWorkspaceTest.h
index e9d99a80826ee460eab5f320973c1020f35ed462..692533cbaf0822af116e99094d5f507e349f06bf 100644
--- a/Framework/DataObjects/test/TableWorkspaceTest.h
+++ b/Framework/DataObjects/test/TableWorkspaceTest.h
@@ -649,7 +649,7 @@ public:
   */
   void testGetProperty_const_sptr() {
     const std::string wsName = "InputWorkspace";
-    TableWorkspace_sptr wsInput(new TableWorkspace());
+    auto wsInput = boost::make_shared<TableWorkspace>();
     PropertyManagerHelper manager;
     manager.declareProperty(wsName, wsInput, Mantid::Kernel::Direction::Input);
 
@@ -681,7 +681,7 @@ public:
   */
   void testGetProperty_ITableWS_const_sptr() {
     const std::string wsName = "InputWorkspace";
-    ITableWorkspace_sptr wsInput(new TableWorkspace());
+    ITableWorkspace_sptr wsInput = boost::make_shared<TableWorkspace>();
     PropertyManagerHelper manager;
     manager.declareProperty(wsName, wsInput, Mantid::Kernel::Direction::Input);
 
diff --git a/Framework/DataObjects/test/Workspace2DTest.h b/Framework/DataObjects/test/Workspace2DTest.h
index f83d5c4aa8d2bf8adb136254276aef5c0ab6a9ce..40a15223b5ba715f46a7b668776e7e7f5510f6dc 100644
--- a/Framework/DataObjects/test/Workspace2DTest.h
+++ b/Framework/DataObjects/test/Workspace2DTest.h
@@ -301,7 +301,7 @@ public:
     CPUTimer tim;
     for (size_t i = 0; i < ws1->getNumberHistograms(); i++) {
       const ISpectrum *spec = ws1->getSpectrum(i);
-      const std::set<detid_t> &detIDs = spec->getDetectorIDs();
+      const auto &detIDs = spec->getDetectorIDs();
       detid_t oneDetId = *detIDs.begin();
       UNUSED_ARG(oneDetId)
     }
diff --git a/Framework/UserAlgorithms/HelloWorldAlgorithm.cpp b/Framework/Examples/HelloWorldAlgorithm.cpp
similarity index 100%
rename from Framework/UserAlgorithms/HelloWorldAlgorithm.cpp
rename to Framework/Examples/HelloWorldAlgorithm.cpp
diff --git a/Framework/UserAlgorithms/HelloWorldAlgorithm.h b/Framework/Examples/HelloWorldAlgorithm.h
similarity index 100%
rename from Framework/UserAlgorithms/HelloWorldAlgorithm.h
rename to Framework/Examples/HelloWorldAlgorithm.h
diff --git a/Framework/UserAlgorithms/LorentzianTest.cpp b/Framework/Examples/LorentzianTest.cpp
similarity index 100%
rename from Framework/UserAlgorithms/LorentzianTest.cpp
rename to Framework/Examples/LorentzianTest.cpp
diff --git a/Framework/UserAlgorithms/LorentzianTest.h b/Framework/Examples/LorentzianTest.h
similarity index 100%
rename from Framework/UserAlgorithms/LorentzianTest.h
rename to Framework/Examples/LorentzianTest.h
diff --git a/Framework/UserAlgorithms/ModifyData.cpp b/Framework/Examples/ModifyData.cpp
similarity index 100%
rename from Framework/UserAlgorithms/ModifyData.cpp
rename to Framework/Examples/ModifyData.cpp
diff --git a/Framework/UserAlgorithms/ModifyData.h b/Framework/Examples/ModifyData.h
similarity index 100%
rename from Framework/UserAlgorithms/ModifyData.h
rename to Framework/Examples/ModifyData.h
diff --git a/Framework/UserAlgorithms/Muon_ExpDecayOscTest.cpp b/Framework/Examples/Muon_ExpDecayOscTest.cpp
similarity index 100%
rename from Framework/UserAlgorithms/Muon_ExpDecayOscTest.cpp
rename to Framework/Examples/Muon_ExpDecayOscTest.cpp
diff --git a/Framework/UserAlgorithms/Muon_ExpDecayOscTest.h b/Framework/Examples/Muon_ExpDecayOscTest.h
similarity index 100%
rename from Framework/UserAlgorithms/Muon_ExpDecayOscTest.h
rename to Framework/Examples/Muon_ExpDecayOscTest.h
diff --git a/Framework/UserAlgorithms/PropertyAlgorithm.cpp b/Framework/Examples/PropertyAlgorithm.cpp
similarity index 100%
rename from Framework/UserAlgorithms/PropertyAlgorithm.cpp
rename to Framework/Examples/PropertyAlgorithm.cpp
diff --git a/Framework/UserAlgorithms/PropertyAlgorithm.h b/Framework/Examples/PropertyAlgorithm.h
similarity index 100%
rename from Framework/UserAlgorithms/PropertyAlgorithm.h
rename to Framework/Examples/PropertyAlgorithm.h
diff --git a/Framework/UserAlgorithms/WorkspaceAlgorithm.cpp b/Framework/Examples/WorkspaceAlgorithm.cpp
similarity index 100%
rename from Framework/UserAlgorithms/WorkspaceAlgorithm.cpp
rename to Framework/Examples/WorkspaceAlgorithm.cpp
diff --git a/Framework/UserAlgorithms/WorkspaceAlgorithm.h b/Framework/Examples/WorkspaceAlgorithm.h
similarity index 100%
rename from Framework/UserAlgorithms/WorkspaceAlgorithm.h
rename to Framework/Examples/WorkspaceAlgorithm.h
diff --git a/Framework/Geometry/inc/MantidGeometry/Crystal/SymmetryElementFactory.h b/Framework/Geometry/inc/MantidGeometry/Crystal/SymmetryElementFactory.h
index 172642a9dff47403d8292ce2480724f18a74095a..7be58070cdadfcdc560abbde28197352e18f90c7 100644
--- a/Framework/Geometry/inc/MantidGeometry/Crystal/SymmetryElementFactory.h
+++ b/Framework/Geometry/inc/MantidGeometry/Crystal/SymmetryElementFactory.h
@@ -8,7 +8,7 @@
 #include "MantidKernel/RegistrationHelper.h"
 
 #include <boost/make_shared.hpp>
-#include <set>
+#include <unordered_set>
 
 namespace Mantid {
 namespace Geometry {
@@ -270,7 +270,7 @@ protected:
                        const SymmetryElement_sptr &prototype);
 
   std::vector<AbstractSymmetryElementGenerator_sptr> m_generators;
-  std::set<std::string> m_generatorNames;
+  std::unordered_set<std::string> m_generatorNames;
   std::map<std::string, SymmetryElement_sptr> m_prototypes;
 
 private:
diff --git a/Framework/Geometry/inc/MantidGeometry/Instrument/CompAssembly.h b/Framework/Geometry/inc/MantidGeometry/Instrument/CompAssembly.h
index 84ade0f5cb92816a0f847d6bd72daf6d5b34ddb7..1f9dfa527e46c7e615c49a4ee5a757374908fa1a 100644
--- a/Framework/Geometry/inc/MantidGeometry/Instrument/CompAssembly.h
+++ b/Framework/Geometry/inc/MantidGeometry/Instrument/CompAssembly.h
@@ -59,7 +59,7 @@ public:
   /// Constructor for parametrized version
   CompAssembly(const IComponent *base, const ParameterMap *map);
   //! Constructor with a name and parent reference
-  CompAssembly(const std::string &, IComponent *reference = 0);
+  CompAssembly(const std::string &, IComponent *reference = nullptr);
   //! Copy constructor
   CompAssembly(const CompAssembly &);
   ~CompAssembly() override;
diff --git a/Framework/Geometry/inc/MantidGeometry/Instrument/Component.h b/Framework/Geometry/inc/MantidGeometry/Instrument/Component.h
index b07f896a0f5c59f96dcfce1b46d0e3c219f25341..3932ce779236e3385004f97133ce5952834fb47e 100644
--- a/Framework/Geometry/inc/MantidGeometry/Instrument/Component.h
+++ b/Framework/Geometry/inc/MantidGeometry/Instrument/Component.h
@@ -79,15 +79,15 @@ public:
   //! Create Empty Component at Origin, with no orientation and null parent
   Component();
   //! Create a named component with a parent component (optional)
-  explicit Component(const std::string &name, IComponent *parent = 0);
+  explicit Component(const std::string &name, IComponent *parent = nullptr);
   //! Create a named component with positioning vector, and parent component
   //(optional)
   Component(const std::string &name, const Kernel::V3D &position,
-            IComponent *parent = 0);
+            IComponent *parent = nullptr);
   //! Create a named component with positioning vector, orientation and parent
   // component
   Component(const std::string &name, const Kernel::V3D &position,
-            const Kernel::Quat &rotation, IComponent *parent = 0);
+            const Kernel::Quat &rotation, IComponent *parent = nullptr);
 
   ///  destructor
   ~Component() override;
diff --git a/Framework/Geometry/inc/MantidGeometry/Instrument/DetectorGroup.h b/Framework/Geometry/inc/MantidGeometry/Instrument/DetectorGroup.h
index aff2e348c5a9d861435a44c39be2e64777492663..12381efeb8c747119c4a67561fb8e84f93a59503 100644
--- a/Framework/Geometry/inc/MantidGeometry/Instrument/DetectorGroup.h
+++ b/Framework/Geometry/inc/MantidGeometry/Instrument/DetectorGroup.h
@@ -202,12 +202,12 @@ protected:
   mutable Kernel::V3D groupCentre;
 
   // functions inherited from IComponent
-  Component *clone() const override { return NULL; }
-  ComponentID getComponentID(void) const override { return NULL; }
+  Component *clone() const override { return nullptr; }
+  ComponentID getComponentID(void) const override { return nullptr; }
   boost::shared_ptr<const IComponent> getParent() const override {
     return boost::shared_ptr<const IComponent>();
   }
-  const IComponent *getBareParent() const override { return NULL; }
+  const IComponent *getBareParent() const override { return nullptr; }
   std::vector<boost::shared_ptr<const IComponent>>
   getAncestors() const override {
     return std::vector<boost::shared_ptr<const IComponent>>();
diff --git a/Framework/Geometry/inc/MantidGeometry/Instrument/InstrumentDefinitionParser.h b/Framework/Geometry/inc/MantidGeometry/Instrument/InstrumentDefinitionParser.h
index de005837c0b6ec7482c614802180ef4de2890123..1dd909e313e3619ec37a98633374d5a4ab638344 100644
--- a/Framework/Geometry/inc/MantidGeometry/Instrument/InstrumentDefinitionParser.h
+++ b/Framework/Geometry/inc/MantidGeometry/Instrument/InstrumentDefinitionParser.h
@@ -83,7 +83,7 @@ public:
   /// specified in <component-link> XML elements
   void setComponentLinks(boost::shared_ptr<Geometry::Instrument> &instrument,
                          Poco::XML::Element *pElem,
-                         Kernel::ProgressBase *progress = NULL);
+                         Kernel::ProgressBase *progress = nullptr);
 
   std::string getMangledName();
 
diff --git a/Framework/Geometry/inc/MantidGeometry/Instrument/ObjCompAssembly.h b/Framework/Geometry/inc/MantidGeometry/Instrument/ObjCompAssembly.h
index 8a2d74912a2464590993eace38e82fdf808f47e4..ffbd230f8b9fa17029942306876a7fc432ecd799 100644
--- a/Framework/Geometry/inc/MantidGeometry/Instrument/ObjCompAssembly.h
+++ b/Framework/Geometry/inc/MantidGeometry/Instrument/ObjCompAssembly.h
@@ -57,7 +57,7 @@ public:
   ObjCompAssembly(const IComponent *base, const ParameterMap *map);
 
   //! Constructor with a name and parent reference
-  ObjCompAssembly(const std::string &, IComponent *reference = 0);
+  ObjCompAssembly(const std::string &, IComponent *reference = nullptr);
   //! Copy constructor
   ObjCompAssembly(const ObjCompAssembly &);
   ~ObjCompAssembly() override;
diff --git a/Framework/Geometry/inc/MantidGeometry/Instrument/ObjComponent.h b/Framework/Geometry/inc/MantidGeometry/Instrument/ObjComponent.h
index bde9d99adc13812a2328a55a1bf0fafc803d2144..4cfd87ab5956c59bdb1fa2e7f314392a76aedabe 100644
--- a/Framework/Geometry/inc/MantidGeometry/Instrument/ObjComponent.h
+++ b/Framework/Geometry/inc/MantidGeometry/Instrument/ObjComponent.h
@@ -61,9 +61,10 @@ public:
   ObjComponent(const IComponent *base, const ParameterMap *map);
   // Looking to get rid of the first of these constructors in due course (and
   // probably add others)
-  explicit ObjComponent(const std::string &name, IComponent *parent = 0);
+  explicit ObjComponent(const std::string &name, IComponent *parent = nullptr);
   explicit ObjComponent(
-      const std::string &name, Object_const_sptr shape, IComponent *parent = 0,
+      const std::string &name, Object_const_sptr shape,
+      IComponent *parent = nullptr,
       Kernel::Material_sptr material = Kernel::Material_sptr());
   ~ObjComponent() override;
 
diff --git a/Framework/Geometry/inc/MantidGeometry/Instrument/ParameterMap.h b/Framework/Geometry/inc/MantidGeometry/Instrument/ParameterMap.h
index 2e556a6e7a6ca83d78fddacb2e5b7e5e29796d49..7c6b6ad9516493b1344fb7608d9fbaa6466a1b6d 100644
--- a/Framework/Geometry/inc/MantidGeometry/Instrument/ParameterMap.h
+++ b/Framework/Geometry/inc/MantidGeometry/Instrument/ParameterMap.h
@@ -121,7 +121,7 @@ public:
   /// Method for adding a parameter providing its value as a string
   void add(const std::string &type, const IComponent *comp,
            const std::string &name, const std::string &value,
-           const std::string *const pDescription = NULL);
+           const std::string *const pDescription = nullptr);
 
   /**
    * Method for adding a parameter providing its value of a particular type.
@@ -139,7 +139,7 @@ public:
   template <class T>
   void add(const std::string &type, const IComponent *comp,
            const std::string &name, const T &value,
-           const std::string *const pDescription = NULL) {
+           const std::string *const pDescription = nullptr) {
     auto param = ParameterFactory::create(type, name);
     auto typedParam = boost::dynamic_pointer_cast<ParameterType<T>>(param);
     assert(typedParam); // If not true the factory has created the wrong type
@@ -150,54 +150,54 @@ public:
   /// Method for adding a parameter providing shared pointer to it. The class
   /// stores share pointer and increment ref count to it
   void add(const IComponent *comp, const boost::shared_ptr<Parameter> &param,
-           const std::string *const pDescription = NULL);
+           const std::string *const pDescription = nullptr);
 
   /** @name Helper methods for adding and updating parameter types  */
   /// Create or adjust "pos" parameter for a component
   void addPositionCoordinate(const IComponent *comp, const std::string &name,
                              const double value,
-                             const std::string *const pDescription = NULL);
+                             const std::string *const pDescription = nullptr);
   /// Create or adjust "rot" parameter for a component
   void addRotationParam(const IComponent *comp, const std::string &name,
                         const double deg,
-                        const std::string *const pDescription = NULL);
+                        const std::string *const pDescription = nullptr);
   /// Adds a double value to the parameter map.
   void addDouble(const IComponent *comp, const std::string &name,
                  const std::string &value,
-                 const std::string *const pDescription = NULL);
+                 const std::string *const pDescription = nullptr);
   /// Adds a double value to the parameter map.
   void addDouble(const IComponent *comp, const std::string &name, double value,
-                 const std::string *const pDescription = NULL);
+                 const std::string *const pDescription = nullptr);
   /// Adds an int value to the parameter map.
   void addInt(const IComponent *comp, const std::string &name,
               const std::string &value,
-              const std::string *const pDescription = NULL);
+              const std::string *const pDescription = nullptr);
   /// Adds an int value to the parameter map.
   void addInt(const IComponent *comp, const std::string &name, int value,
-              const std::string *const pDescription = NULL);
+              const std::string *const pDescription = nullptr);
   /// Adds a bool value to the parameter map.
   void addBool(const IComponent *comp, const std::string &name,
                const std::string &value,
-               const std::string *const pDescription = NULL);
+               const std::string *const pDescription = nullptr);
   /// Adds a bool value to the parameter map.
   void addBool(const IComponent *comp, const std::string &name, bool value,
-               const std::string *const pDescription = NULL);
+               const std::string *const pDescription = nullptr);
   /// Adds a std::string value to the parameter map.
   void addString(const IComponent *comp, const std::string &name,
                  const std::string &value,
-                 const std::string *const pDescription = NULL);
+                 const std::string *const pDescription = nullptr);
   /// Adds a Kernel::V3D value to the parameter map.
   void addV3D(const IComponent *comp, const std::string &name,
               const std::string &value,
-              const std::string *const pDescription = NULL);
+              const std::string *const pDescription = nullptr);
   /// @param value :: Parameter value as a Kernel::V3D
   void addV3D(const IComponent *comp, const std::string &name,
               const Kernel::V3D &value,
-              const std::string *const pDescription = NULL);
+              const std::string *const pDescription = nullptr);
   /// Adds a Kernel::Quat value to the parameter map.
   void addQuat(const IComponent *comp, const std::string &name,
                const Kernel::Quat &value,
-               const std::string *const pDescription = NULL);
+               const std::string *const pDescription = nullptr);
   //@}
 
   /// Does the named parameter exist for the given component and type
diff --git a/Framework/Geometry/inc/MantidGeometry/Instrument/RectangularDetector.h b/Framework/Geometry/inc/MantidGeometry/Instrument/RectangularDetector.h
index 1e7fbdeba6d4eb6209fdba84b968a6d32f7c07a7..fd5edbac1cfb525a6e339ca99c71b74b537ae785 100644
--- a/Framework/Geometry/inc/MantidGeometry/Instrument/RectangularDetector.h
+++ b/Framework/Geometry/inc/MantidGeometry/Instrument/RectangularDetector.h
@@ -54,7 +54,7 @@ public:
   RectangularDetector();
 
   //! Constructor with a name and parent reference
-  RectangularDetector(const std::string &, IComponent *reference = 0);
+  RectangularDetector(const std::string &, IComponent *reference = nullptr);
 
   //! Parametrized constructor
   RectangularDetector(const RectangularDetector *base, const ParameterMap *map);
diff --git a/Framework/Geometry/inc/MantidGeometry/Objects/BoundingBox.h b/Framework/Geometry/inc/MantidGeometry/Objects/BoundingBox.h
index 1f58ae7cc5aa2a2caa7daa69cf3d8e5b469bae0f..1e5d22d1395d8d52fdebca3cd913b28c67b1457c 100644
--- a/Framework/Geometry/inc/MantidGeometry/Objects/BoundingBox.h
+++ b/Framework/Geometry/inc/MantidGeometry/Objects/BoundingBox.h
@@ -190,7 +190,7 @@ public:
   void nullify();
   /// reallign the BB according to new coordinate system, provided earlier or
   /// specified as parameter;
-  void realign(std::vector<Kernel::V3D> const *const pCS = NULL);
+  void realign(std::vector<Kernel::V3D> const *const pCS = nullptr);
   /// move the BB by a vector
   void moveBy(const Kernel::V3D &v) {
     m_minPoint += v;
diff --git a/Framework/Geometry/inc/MantidGeometry/Objects/Rules.h b/Framework/Geometry/inc/MantidGeometry/Objects/Rules.h
index 9a927f8d293bec3c3ebc93c66c0e6bb0b7620699..72589652a369edb541e856ddd3ac6fa50c9bc72d 100644
--- a/Framework/Geometry/inc/MantidGeometry/Objects/Rules.h
+++ b/Framework/Geometry/inc/MantidGeometry/Objects/Rules.h
@@ -76,7 +76,7 @@ public:
   } ///< Returns class name as string
 
   /// No leaf for a base rule
-  virtual Rule *leaf(const int = 0) const { return 0; }
+  virtual Rule *leaf(const int = 0) const { return nullptr; }
   void setParent(Rule *);
   Rule *getParent() const;
   void makeParents();
@@ -257,7 +257,7 @@ public:
   } ///< Returns class name as string
   std::unique_ptr<SurfPoint> clone() const;
 
-  Rule *leaf(const int = 0) const override { return 0; } ///< No Leaves
+  Rule *leaf(const int = 0) const override { return nullptr; } ///< No Leaves
   void setLeaves(std::unique_ptr<Rule>, std::unique_ptr<Rule>) override;
   void setLeaf(std::unique_ptr<Rule>, const int = 0) override;
   int findLeaf(const Rule *) const override;
@@ -422,11 +422,11 @@ public:
     return "BoolValue";
   } ///< Returns class name as string
 
-  Rule *leaf(const int = 0) const override { return 0; } ///< No leaves
+  Rule *leaf(const int = 0) const override { return nullptr; } ///< No leaves
   void setLeaves(std::unique_ptr<Rule>, std::unique_ptr<Rule>) override;
   void setLeaf(std::unique_ptr<Rule>, const int = 0) override;
   int findLeaf(const Rule *) const override;
-  Rule *findKey(const int) override { return 0; }
+  Rule *findKey(const int) override { return nullptr; }
 
   int type() const override { return 0; } // effective name
 
diff --git a/Framework/Geometry/inc/MantidGeometry/Objects/Track.h b/Framework/Geometry/inc/MantidGeometry/Objects/Track.h
index 3cf5c30aef3b5b34ea9eac9a651228acf6d749f5..a322338c03771b62a1e2c92e59439634bd4151e5 100644
--- a/Framework/Geometry/inc/MantidGeometry/Objects/Track.h
+++ b/Framework/Geometry/inc/MantidGeometry/Objects/Track.h
@@ -59,7 +59,7 @@ struct MANTID_GEOMETRY_DLL Link {
   */
   inline Link(const Kernel::V3D &entry, const Kernel::V3D &exit,
               const double totalDistance, const Object &obj,
-              const ComponentID compID = NULL)
+              const ComponentID compID = nullptr)
       : entryPoint(entry), exitPoint(exit), distFromStart(totalDistance),
         distInsideObject(entryPoint.distance(exitPoint)), object(&obj),
         componentID(compID) {}
@@ -105,7 +105,7 @@ struct IntersectionPoint {
   */
   inline IntersectionPoint(const int flag, const Kernel::V3D &end,
                            const double distFromStartOfTrack, const Object &obj,
-                           const ComponentID compID = NULL)
+                           const ComponentID compID = nullptr)
       : directionFlag(flag), endPoint(end), distFromStart(distFromStartOfTrack),
         object(&obj), componentID(compID) {}
 
@@ -159,11 +159,11 @@ public:
   ~Track();
   /// Adds a point of intersection to the track
   void addPoint(const int directionFlag, const Kernel::V3D &endPoint,
-                const Object &obj, const ComponentID compID = NULL);
+                const Object &obj, const ComponentID compID = nullptr);
   /// Adds a link to the track
   int addLink(const Kernel::V3D &firstPoint, const Kernel::V3D &secondPoint,
               const double distanceAlongTrack, const Object &obj,
-              const ComponentID compID = NULL);
+              const ComponentID compID = nullptr);
   /// Remove touching Links that have identical components
   void removeCojoins();
   /// Construct links between added points
diff --git a/Framework/Geometry/inc/MantidGeometry/Rendering/BitmapGeometryHandler.h b/Framework/Geometry/inc/MantidGeometry/Rendering/BitmapGeometryHandler.h
index 0581e8d2cd2708a9a2e2d03897073e87e13b531d..b28730751415e7678ae33066bafafb374897be34 100644
--- a/Framework/Geometry/inc/MantidGeometry/Rendering/BitmapGeometryHandler.h
+++ b/Framework/Geometry/inc/MantidGeometry/Rendering/BitmapGeometryHandler.h
@@ -87,9 +87,9 @@ public:
   /// get the number of points or vertices
   int NumberOfPoints() override { return 0; }
   /// Extract the vertices of the triangles
-  double *getTriangleVertices() override { return NULL; }
+  double *getTriangleVertices() override { return nullptr; }
   /// Extract the Faces of the triangles
-  int *getTriangleFaces() override { return NULL; }
+  int *getTriangleFaces() override { return nullptr; }
   /// Sets the geometry cache using the triangulation information provided
   void setGeometryCache(int noPts, int noFaces, double *pts,
                         int *faces) override {
diff --git a/Framework/Geometry/inc/MantidGeometry/Rendering/GeometryHandler.h b/Framework/Geometry/inc/MantidGeometry/Rendering/GeometryHandler.h
index 5bce05d901c6cb1ad9d91840fcff1164d9995247..d6b9b843c9f0512f9ac40d8690b1ff10b0d574b1 100644
--- a/Framework/Geometry/inc/MantidGeometry/Rendering/GeometryHandler.h
+++ b/Framework/Geometry/inc/MantidGeometry/Rendering/GeometryHandler.h
@@ -84,9 +84,9 @@ public:
   /// get the number of points or vertices
   virtual int NumberOfPoints() { return 0; }
   /// Extract the vertices of the triangles
-  virtual double *getTriangleVertices() { return NULL; }
+  virtual double *getTriangleVertices() { return nullptr; }
   /// Extract the Faces of the triangles
-  virtual int *getTriangleFaces() { return NULL; }
+  virtual int *getTriangleFaces() { return nullptr; }
   /// Sets the geometry cache using the triangulation information provided
   virtual void setGeometryCache(int noPts, int noFaces, double *pts,
                                 int *faces) {
diff --git a/Framework/Geometry/src/Crystal/CenteringGroup.cpp b/Framework/Geometry/src/Crystal/CenteringGroup.cpp
index c58cb3c5de66182ddd950f91f6028b49269b7abf..06fe02bb509a313e5951ce45d86818eba009cae2 100644
--- a/Framework/Geometry/src/Crystal/CenteringGroup.cpp
+++ b/Framework/Geometry/src/Crystal/CenteringGroup.cpp
@@ -1,8 +1,6 @@
 #include "MantidGeometry/Crystal/CenteringGroup.h"
 #include "MantidGeometry/Crystal/SymmetryOperationFactory.h"
 
-#include <boost/assign.hpp>
-
 namespace Mantid {
 namespace Geometry {
 
diff --git a/Framework/Geometry/src/Crystal/IndexingUtils.cpp b/Framework/Geometry/src/Crystal/IndexingUtils.cpp
index b3dd290a83ce00f304cbe471cd38b87578c4580b..b78ecb7e03e862e8255e122959793d10d4894a6b 100644
--- a/Framework/Geometry/src/Crystal/IndexingUtils.cpp
+++ b/Framework/Geometry/src/Crystal/IndexingUtils.cpp
@@ -1959,12 +1959,7 @@ bool IndexingUtils::CheckUB(const DblMatrix &UB) {
   double det = UB.determinant();
 
   double abs_det = fabs(det);
-  if (abs_det > 10 || abs_det < 1e-12) // UB not found correctly
-  {
-    return false;
-  }
-
-  return true;
+  return !(abs_det > 10 || abs_det < 1e-12); // UB not found correctly
 }
 
 /**
diff --git a/Framework/Geometry/src/Crystal/IsotropicAtomBraggScatterer.cpp b/Framework/Geometry/src/Crystal/IsotropicAtomBraggScatterer.cpp
index 8ba53224f7560feadf9ebc16c6b26b2991d4d177..4fe3b32af5009f823bbe73af52f2c6f1de7bf0e3 100644
--- a/Framework/Geometry/src/Crystal/IsotropicAtomBraggScatterer.cpp
+++ b/Framework/Geometry/src/Crystal/IsotropicAtomBraggScatterer.cpp
@@ -9,7 +9,6 @@
 
 #include <boost/tokenizer.hpp>
 #include <boost/algorithm/string.hpp>
-#include <boost/assign.hpp>
 
 #include <json/json.h>
 
@@ -177,9 +176,8 @@ BraggScatterer_sptr IsotropicAtomBraggScattererParser::getScatterer(
 
   std::vector<std::string> cleanScattererTokens =
       getCleanScattererTokens(tokens);
-  std::vector<std::string> properties =
-      boost::assign::list_of("Element")("Position")("Occupancy")("U")
-          .convert_to_container<std::vector<std::string>>();
+  std::vector<std::string> properties = {"Element", "Position", "Occupancy",
+                                         "U"};
 
   ::Json::Value root;
   for (size_t i = 0; i < cleanScattererTokens.size(); ++i) {
diff --git a/Framework/Geometry/src/Crystal/SymmetryElementFactory.cpp b/Framework/Geometry/src/Crystal/SymmetryElementFactory.cpp
index a3a37ef0477a2e4ae95a859e7fb7a2d74971b6ce..acf34a2b42f681718db3f7faefb274b382cc558d 100644
--- a/Framework/Geometry/src/Crystal/SymmetryElementFactory.cpp
+++ b/Framework/Geometry/src/Crystal/SymmetryElementFactory.cpp
@@ -1,5 +1,4 @@
 #include "MantidGeometry/Crystal/SymmetryElementFactory.h"
-#include <boost/assign.hpp>
 #include <boost/lexical_cast.hpp>
 #include <gsl/gsl_eigen.h>
 #include <gsl/gsl_complex_math.h>
@@ -261,12 +260,19 @@ std::string SymmetryElementRotationGenerator::determineSymbol(
   return symbol;
 }
 
-std::map<V3R, std::string> SymmetryElementMirrorGenerator::g_glideSymbolMap =
-    boost::assign::map_list_of(V3R(0, 0, 0), "m")(V3R(1, 0, 0) / 2,
-                                                  "a")(V3R(0, 1, 0) / 2, "b")(
-        V3R(0, 0, 1) / 2, "c")(V3R(1, 1, 0) / 2, "n")(V3R(1, 0, 1) / 2, "n")(
-        V3R(0, 1, 1) / 2, "n")(V3R(1, 1, 1) / 2, "n")(V3R(1, 1, 0) / 4, "d")(
-        V3R(1, 0, 1) / 4, "d")(V3R(0, 1, 1) / 4, "d")(V3R(1, 1, 1) / 4, "d");
+std::map<V3R, std::string> SymmetryElementMirrorGenerator::g_glideSymbolMap = {
+    {V3R(0, 0, 0), "m"},
+    {V3R(1, 0, 0) / 2, "a"},
+    {V3R(0, 1, 0) / 2, "b"},
+    {V3R(0, 0, 1) / 2, "c"},
+    {V3R(1, 1, 0) / 2, "n"},
+    {V3R(1, 0, 1) / 2, "n"},
+    {V3R(0, 1, 1) / 2, "n"},
+    {V3R(1, 1, 1) / 2, "n"},
+    {V3R(1, 1, 0) / 4, "d"},
+    {V3R(1, 0, 1) / 4, "d"},
+    {V3R(0, 1, 1) / 4, "d"},
+    {V3R(1, 1, 1) / 4, "d"}};
 
 /// Generates an instance of SymmetryElementMirror with the corresponding
 /// symbol, axis and translation vector.
diff --git a/Framework/Geometry/src/Instrument.cpp b/Framework/Geometry/src/Instrument.cpp
index 26195d56a445bc47c54a3eab916bff108c283472..4043d56317dcbfc0235aa51b6956ef4c70c4e510 100644
--- a/Framework/Geometry/src/Instrument.cpp
+++ b/Framework/Geometry/src/Instrument.cpp
@@ -396,7 +396,7 @@ Kernel::V3D Instrument::getBeamDirection() const {
 */
 boost::shared_ptr<const IComponent>
 Instrument::getComponentByID(ComponentID id) const {
-  const IComponent *base = (const IComponent *)(id);
+  const IComponent *base = static_cast<const IComponent *>(id);
   if (m_map)
     return ParComponentFactory::create(
         boost::shared_ptr<const IComponent>(base, NoDeleting()), m_map);
@@ -861,8 +861,7 @@ Instrument::getPlottable() const {
 
   } else {
     // Base instrument
-    boost::shared_ptr<std::vector<IObjComponent_const_sptr>> res(
-        new std::vector<IObjComponent_const_sptr>);
+    auto res = boost::make_shared<std::vector<IObjComponent_const_sptr>>();
     res->reserve(m_detectorCache.size() + 10);
     appendPlottable(*this, *res);
     return res;
diff --git a/Framework/Geometry/src/Instrument/Component.cpp b/Framework/Geometry/src/Instrument/Component.cpp
index 0a60284bdd6683f27f559290d9216fdaad2cfad5..f089dd4ad8bc66df5aaf9f21792d389285091783 100644
--- a/Framework/Geometry/src/Instrument/Component.cpp
+++ b/Framework/Geometry/src/Instrument/Component.cpp
@@ -447,7 +447,7 @@ Component::getParameterNamesByComponent() const {
   if (!m_map)
     return retVal;
 
-  std::set<std::string> names = m_map->names(this);
+  auto names = m_map->names(this);
   for (const auto &name : names) {
     retVal.insert(
         std::pair<std::string, ComponentID>(name, this->getComponentID()));
diff --git a/Framework/Geometry/src/Instrument/FitParameter.cpp b/Framework/Geometry/src/Instrument/FitParameter.cpp
index b19de3141a8f7aea90b19931be181d93a6ad30ec..38a5c2da6723d4fa4e50c5d572c1944dd7a854fd 100644
--- a/Framework/Geometry/src/Instrument/FitParameter.cpp
+++ b/Framework/Geometry/src/Instrument/FitParameter.cpp
@@ -4,7 +4,7 @@
 #include "MantidGeometry/Instrument/FitParameter.h"
 #include "MantidGeometry/Instrument/Parameter.h"
 #include "MantidGeometry/Instrument/ParameterFactory.h"
-#include <Poco/StringTokenizer.h>
+#include <MantidKernel/StringTokenizer.h>
 #include "MantidGeometry/muParser_Silent.h"
 
 namespace Mantid {
@@ -162,13 +162,16 @@ std::ostream &operator<<(std::ostream &os, const FitParameter &f) {
 */
 std::istream &operator>>(std::istream &in, FitParameter &f) {
 
-  typedef Poco::StringTokenizer tokenizer;
+  typedef Mantid::Kernel::StringTokenizer tokenizer;
   std::string str;
   getline(in, str);
-  tokenizer tokens(str, ",", tokenizer::TOK_TRIM);
-  std::vector<std::string> values(tokens.begin(), tokens.end());
 
-  if (values.size() <= 2) {
+  // allow a comma in the final position.
+  tokenizer tokens(str, ",", tokenizer::TOK_TRIM |
+                                 tokenizer::TOK_IGNORE_FINAL_EMPTY_TOKEN);
+  auto values = tokens.asVector();
+
+  if (values.size() < 3) {
     g_log.warning()
         << "Expecting a comma separated list of at each three entries"
         << " (any of which may be empty strings) to set information about a "
@@ -182,7 +185,7 @@ std::istream &operator>>(std::istream &in, FitParameter &f) {
   } catch (boost::bad_lexical_cast &) {
     f.setValue(0.0);
 
-    if (!values[0].empty()) {
+    if (!values.at(0).empty()) {
       g_log.warning() << "Could not read " << values[0] << " as double for "
                       << " fitting parameter: " << values[1] << ":" << values[2]
                       << std::endl;
@@ -216,6 +219,5 @@ std::istream &operator>>(std::istream &in, FitParameter &f) {
 
   return in;
 }
-
 } // namespace Geometry
 } // namespace Mantid
diff --git a/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp b/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp
index dc78a1bff4290fb48fa068a8d8fe4be825e59b1c..4136d9d8f5179fc70b21ba8a247426a9f4f617c0 100644
--- a/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp
+++ b/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp
@@ -29,7 +29,7 @@
 #include <Poco/SAX/AttributesImpl.h>
 
 #include <boost/make_shared.hpp>
-#include <boost/assign/list_of.hpp>
+#include <unordered_set>
 
 using namespace Mantid;
 using namespace Mantid::Kernel;
@@ -2291,7 +2291,7 @@ InstrumentDefinitionParser::getAppliedCachingOption() const {
 
 void InstrumentDefinitionParser::createNeutronicInstrument() {
   // Create a copy of the instrument
-  Instrument_sptr physical(new Instrument(*m_instrument));
+  auto physical = boost::make_shared<Instrument>(*m_instrument);
   // Store the physical instrument 'inside' the neutronic instrument
   m_instrument->setPhysicalInstrument(physical);
 
@@ -2399,7 +2399,8 @@ void InstrumentDefinitionParser::adjust(
   // added
   // to pElem, and these <component>'s are deleted after loop
 
-  std::set<Element *> allComponentInType;   // used to hold <component>'s found
+  std::unordered_set<Element *>
+      allComponentInType;                   // used to hold <component>'s found
   std::vector<std::string> allLocationName; // used to check if loc names unique
   for (unsigned long i = 0; i < numLocation; i++) {
     Element *pLoc = static_cast<Element *>(pNL->item(i));
@@ -2472,8 +2473,8 @@ void InstrumentDefinitionParser::adjust(
   }
 
   // delete all <component> found in pElem
-  std::set<Element *>::iterator it;
-  for (it = allComponentInType.begin(); it != allComponentInType.end(); ++it)
+  for (auto it = allComponentInType.begin(); it != allComponentInType.end();
+       ++it)
     pElem->removeChild(*it);
 }
 
@@ -2614,13 +2615,11 @@ InstrumentDefinitionParser::convertLocationsElement(
   }
 
   // A list of numeric attributes which are allowed to have corresponding -end
-  std::set<std::string> rangeAttrs =
-      boost::assign::list_of("x")("y")("z")("r")("t")("p")("rot");
+  std::set<std::string> rangeAttrs = {"x", "y", "z", "r", "t", "p", "rot"};
 
   // Numeric attributes related to rotation. Doesn't make sense to have -end for
   // those
-  std::set<std::string> rotAttrs =
-      boost::assign::list_of("axis-x")("axis-y")("axis-z");
+  std::set<std::string> rotAttrs = {"axis-x", "axis-y", "axis-z"};
 
   // A set of all numeric attributes for convenience
   std::set<std::string> allAttrs;
diff --git a/Framework/Geometry/src/Instrument/ParameterMap.cpp b/Framework/Geometry/src/Instrument/ParameterMap.cpp
index b8bb9a01eb377ce40c6796e0486b6700d8ec4360..3bab8f20c1669249d3d0e26bfd5de9c50f631503 100644
--- a/Framework/Geometry/src/Instrument/ParameterMap.cpp
+++ b/Framework/Geometry/src/Instrument/ParameterMap.cpp
@@ -1045,7 +1045,7 @@ void ParameterMap::copyFromParameterMap(const IComponent *oldComp,
                                         const IComponent *newComp,
                                         const ParameterMap *oldPMap) {
 
-  std::set<std::string> oldParameterNames = oldPMap->names(oldComp);
+  auto oldParameterNames = oldPMap->names(oldComp);
   for (const auto &oldParameterName : oldParameterNames) {
     Parameter_sptr thisParameter = oldPMap->get(oldComp, oldParameterName);
     // Insert the fetched parameter in the m_map
diff --git a/Framework/Geometry/src/MDGeometry/MDFrameFactory.cpp b/Framework/Geometry/src/MDGeometry/MDFrameFactory.cpp
index bf558f0d064ea7dddb30f2fc6ba3a391b7f196ec..185bfe21eb4bce2eb86121fcdf60cb3dcb84dac0 100644
--- a/Framework/Geometry/src/MDGeometry/MDFrameFactory.cpp
+++ b/Framework/Geometry/src/MDGeometry/MDFrameFactory.cpp
@@ -1,4 +1,5 @@
 #include "MantidGeometry/MDGeometry/MDFrameFactory.h"
+#include "MantidKernel/make_unique.h"
 #include "MantidKernel/MDUnitFactory.h"
 #include "MantidKernel/MDUnit.h"
 #include "MantidKernel/UnitLabelTypes.h"
@@ -86,14 +87,13 @@ bool UnknownFrameFactory::canInterpret(const MDFrameArgument &) const {
 }
 
 MDFrameFactory_uptr makeMDFrameFactoryChain() {
-  typedef MDFrameFactory_uptr FactoryType;
-  auto first = FactoryType(new QLabFrameFactory);
-  first->setSuccessor(FactoryType(new QSampleFrameFactory))
-      .setSuccessor(FactoryType(new HKLFrameFactory))
+  MDFrameFactory_uptr first = Kernel::make_unique<QLabFrameFactory>();
+  first->setSuccessor(Kernel::make_unique<QSampleFrameFactory>())
+      .setSuccessor(Kernel::make_unique<HKLFrameFactory>())
       // Make sure that GeneralFrameFactory is the last in the chain to give a
       // fall-through option
-      .setSuccessor(FactoryType(new GeneralFrameFactory))
-      .setSuccessor(FactoryType(new UnknownFrameFactory));
+      .setSuccessor(Kernel::make_unique<GeneralFrameFactory>())
+      .setSuccessor(Kernel::make_unique<UnknownFrameFactory>());
   return first;
 }
 
diff --git a/Framework/Geometry/src/Math/Quadrilateral.cpp b/Framework/Geometry/src/Math/Quadrilateral.cpp
index dcce8e049fc45766f36f60c6399ff303f5a605e3..0e50af232a3ec8a78d0f37b7b868608006f117fc 100644
--- a/Framework/Geometry/src/Math/Quadrilateral.cpp
+++ b/Framework/Geometry/src/Math/Quadrilateral.cpp
@@ -85,16 +85,16 @@ const Kernel::V2D &Quadrilateral::at(const size_t index) const {
  * @return True if the point is inside the polygon or on the edge
  */
 bool Quadrilateral::contains(const Kernel::V2D &point) const {
-  return (minX() <= point.X() && point.X() <= maxX() && minY() <= point.Y() &&
-          point.Y() <= maxY());
+  ConvexPolygon quadAsPoly = this->toPoly();
+  return quadAsPoly.contains(point);
 }
 
 /**
  * @return True if the given polygon is completely encosed by this one
  */
 bool Quadrilateral::contains(const ConvexPolygon &poly) const {
-  return (minX() <= poly.minX() && poly.maxX() <= maxX() &&
-          minY() <= poly.minY() && poly.maxY() <= maxY());
+  ConvexPolygon quadAsPoly = this->toPoly();
+  return quadAsPoly.contains(poly);
 }
 
 /**
diff --git a/Framework/Geometry/src/Rendering/BitmapGeometryHandler.cpp b/Framework/Geometry/src/Rendering/BitmapGeometryHandler.cpp
index 4313db9912e2baec17ff2f8405569fb545276700..ec1c8b88cb30b4374600e6713c6561d30e525088 100644
--- a/Framework/Geometry/src/Rendering/BitmapGeometryHandler.cpp
+++ b/Framework/Geometry/src/Rendering/BitmapGeometryHandler.cpp
@@ -25,7 +25,7 @@ BitmapGeometryHandler::BitmapGeometryHandler(RectangularDetector *comp)
 }
 
 BitmapGeometryHandler::BitmapGeometryHandler()
-    : GeometryHandler((Object *)nullptr), m_rectDet(nullptr) {}
+    : GeometryHandler(static_cast<Object *>(nullptr)), m_rectDet(nullptr) {}
 
 /// Destructor
 BitmapGeometryHandler::~BitmapGeometryHandler() {}
diff --git a/Framework/Geometry/test/GeneralFrameTest.h b/Framework/Geometry/test/GeneralFrameTest.h
index 32ed87bbe73e8ef9e266de26f1bbbe07786e3b44..8915e31303c075ead7c6e8fe19ec5527d06ad407 100644
--- a/Framework/Geometry/test/GeneralFrameTest.h
+++ b/Framework/Geometry/test/GeneralFrameTest.h
@@ -5,6 +5,7 @@
 
 #include "MantidKernel/UnitLabel.h"
 #include "MantidKernel/UnitLabelTypes.h"
+#include "MantidKernel/make_unique.h"
 #include "MantidGeometry/MDGeometry/GeneralFrame.h"
 
 using Mantid::Geometry::GeneralFrame;
@@ -27,7 +28,7 @@ public:
   }
 
   void test_string_unit_construction() {
-    std::unique_ptr<LabelUnit> unit(new LabelUnit(Units::Symbol::Metre));
+    auto unit = make_unique<LabelUnit>(Units::Symbol::Metre);
     GeneralFrame frame("Distance", std::move(unit) /*sink transfer ownership*/);
     TS_ASSERT(unit.get() == NULL);
     TS_ASSERT_EQUALS(Units::Symbol::Metre, frame.getUnitLabel());
diff --git a/Framework/Geometry/test/GroupTransformationTest.h b/Framework/Geometry/test/GroupTransformationTest.h
index 19140461a04e3816990afb6fc1bbbe6213020166..e583286acb052eadbc62e08dbb1767e9090624d0 100644
--- a/Framework/Geometry/test/GroupTransformationTest.h
+++ b/Framework/Geometry/test/GroupTransformationTest.h
@@ -8,6 +8,8 @@
 #include "MantidGeometry/Crystal/SpaceGroupFactory.h"
 #include "MantidGeometry/Crystal/ProductOfCyclicGroups.h"
 
+#include <unordered_set>
+
 using namespace Mantid::Geometry;
 using namespace Mantid::Kernel;
 
@@ -47,7 +49,7 @@ public:
      *  3. 2-fold rotation || z
      *  4. Mirror plane perpendicular to z.
      */
-    std::set<std::string> elements;
+    std::unordered_set<std::string> elements;
     std::vector<SymmetryOperation> ops = transformed.getSymmetryOperations();
     for (auto op = ops.begin(); op != ops.end(); ++op) {
       SymmetryElement_sptr el =
diff --git a/Framework/Geometry/test/HKLTest.h b/Framework/Geometry/test/HKLTest.h
index bb0c6dd6560a5b3dfbfd27aa79734b9d9af34162..697e39a3e577d67d1b5a348eadb4c2bd2dd34f48 100644
--- a/Framework/Geometry/test/HKLTest.h
+++ b/Framework/Geometry/test/HKLTest.h
@@ -4,6 +4,7 @@
 #include <cxxtest/TestSuite.h>
 #include <memory>
 #include "MantidKernel/MDUnit.h"
+#include "MantidKernel/make_unique.h"
 #include "MantidGeometry/MDGeometry/HKL.h"
 
 using Mantid::Geometry::HKL;
@@ -23,8 +24,8 @@ public:
   }
 
   void test_check_unit_compatibility_unique_ptr() {
-    std::unique_ptr<Mantid::Kernel::MDUnit> badUnit(
-        new Mantid::Kernel::LabelUnit("MeV"));
+    std::unique_ptr<Mantid::Kernel::MDUnit> badUnit =
+        Mantid::Kernel::make_unique<Mantid::Kernel::LabelUnit>("MeV");
 
     HKL *testHKL = NULL;
     TSM_ASSERT_THROWS("Input unit for this frame must be a QUnit",
diff --git a/Framework/Geometry/test/ParametrizedComponentTest.h b/Framework/Geometry/test/ParametrizedComponentTest.h
index b9120c7a335946ab2dc947f69dc8e1ae9bfb73d8..288b31caf89a78c4ff01d5a853e8ff1093aa2720 100644
--- a/Framework/Geometry/test/ParametrizedComponentTest.h
+++ b/Framework/Geometry/test/ParametrizedComponentTest.h
@@ -126,7 +126,7 @@ public:
 
   void testThatCorrectParametersAreListed() {
     Component *paramComp = createSingleParameterizedComponent();
-    std::set<std::string> paramNames = paramComp->getParameterNames();
+    auto paramNames = paramComp->getParameterNames();
 
     TS_ASSERT_EQUALS(paramNames.size(), 4);
     checkBaseParameterNamesExist(paramNames);
@@ -141,7 +141,7 @@ public:
     Component *grandchild = new Component(m_childTwoComp, m_paramMap.get());
 
     // Parent
-    std::set<std::string> paramNames = parent->getParameterNames();
+    auto paramNames = parent->getParameterNames();
     TS_ASSERT_EQUALS(paramNames.size(), 4);
     checkBaseParameterNamesExist(paramNames);
     // Child
@@ -165,7 +165,7 @@ public:
   void testThatNonRecursiveParameterSearchReturnsOnlyComponentParameters() {
     createParameterizedTree();
     Component *child = new Component(m_childOneComp, m_paramMap.get());
-    std::set<std::string> paramNames = child->getParameterNames(false);
+    auto paramNames = child->getParameterNames(false);
     TS_ASSERT_EQUALS(paramNames.size(), 1);
     TS_ASSERT_DIFFERS(paramNames.find(m_strName + "_child1"), paramNames.end());
 
diff --git a/Framework/Geometry/test/QuadrilateralTest.h b/Framework/Geometry/test/QuadrilateralTest.h
index 1dba116c7ce780c01d91f59df30fab9c1ab5bfb4..c4564022a4cc1791f6cf68e637228e40526d63e1 100644
--- a/Framework/Geometry/test/QuadrilateralTest.h
+++ b/Framework/Geometry/test/QuadrilateralTest.h
@@ -85,6 +85,46 @@ public:
     TS_ASSERT(!smallRectangle.contains(largeRectangle));
   }
 
+  void test_point_outside_quadrilateral() {
+    // Quadrilateral with vertexes at:
+    // Lower left: (5, 0)
+    // Upper left: (0, 10)
+    // Upper right: (10, 10)
+    // Lower right: (10, 0)
+    Quadrilateral quad(V2D(5, 0), V2D(10, 0), V2D(10, 10), V2D(0, 10));
+
+    // Single point at (2,2)
+    TS_ASSERT(!quad.contains(V2D(1, 1)));
+    // Single point at (5, -1)
+    TS_ASSERT(!quad.contains(V2D(5, -1)));
+    // Single point at (11, 5)
+    TS_ASSERT(!quad.contains(V2D(11, 5)));
+    // Single point at (5, 11)
+    TS_ASSERT(!quad.contains(V2D(5, 11)));
+  }
+
+  void test_polygon_outside_quadrilateral() {
+
+    // Quadrilateral with vertexes at:
+    // Lower left: (5, 0)
+    // Upper left: (0, 10)
+    // Upper right: (10, 10)
+    // Lower right: (10, 0)
+    Quadrilateral quad(V2D(5, 0), V2D(10, 0), V2D(10, 10), V2D(0, 10));
+
+    // Polygon with vertexes at:
+    // Lower left: (1, 1)
+    // Lower right: (2, 1)
+    // Upper right: (2, 2)
+    // Upper left: (1, 2)
+    Quadrilateral smallQuad(V2D(1, 1), V2D(2, 1), V2D(2, 2), V2D(1, 2));
+    // Create a polygon from smallQuad so we
+    // can test Quadrilateral::contains
+    ConvexPolygon poly = smallQuad.toPoly();
+    // poly should not be inside quad
+    TS_ASSERT(!quad.contains(poly));
+  }
+
   void test_clockwise_rotation() {
     Quadrilateral quad(V2D(0.0, 0.0), V2D(1.0, 3.0), V2D(4.0, 4.0),
                        V2D(4.0, 1.0));
diff --git a/Framework/Geometry/test/ReflectionConditionTest.h b/Framework/Geometry/test/ReflectionConditionTest.h
index ba8a2582881d160185ea962ae026cc953743472b..58875720487a3e13c50dd7a87cd2d7e6722f9e97 100644
--- a/Framework/Geometry/test/ReflectionConditionTest.h
+++ b/Framework/Geometry/test/ReflectionConditionTest.h
@@ -5,7 +5,7 @@
 #include "MantidKernel/System.h"
 #include "MantidKernel/Timer.h"
 #include <cxxtest/TestSuite.h>
-#include <set>
+#include <unordered_set>
 
 using namespace Mantid::Geometry;
 
@@ -46,7 +46,7 @@ public:
   }
 
   void test_ReflectionConditionSymbols() {
-    std::set<std::string> centeringSymbols;
+    std::unordered_set<std::string> centeringSymbols;
     centeringSymbols.insert("P");
     centeringSymbols.insert("A");
     centeringSymbols.insert("B");
diff --git a/Framework/ICat/inc/MantidICat/GSoap/soapserializersH.h b/Framework/ICat/inc/MantidICat/GSoap/soapserializersH.h
index 04a7eb92e27ac7d8df6048e7fbb237e5307c9659..f61b6f2d5aed3746cd00f54ffd824a16816582d3 100644
--- a/Framework/ICat/inc/MantidICat/GSoap/soapserializersH.h
+++ b/Framework/ICat/inc/MantidICat/GSoap/soapserializersH.h
@@ -154,12 +154,12 @@ soap_instantiate_SOAP_ENV__Fault(struct soap *, int, const char *, const char *,
 
 inline struct SOAP_ENV__Fault *soap_new_SOAP_ENV__Fault(struct soap *soap,
                                                         int n = -1) {
-  return soap_instantiate_SOAP_ENV__Fault(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_SOAP_ENV__Fault(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline struct SOAP_ENV__Fault *soap_new_req_SOAP_ENV__Fault(struct soap *soap) {
   struct SOAP_ENV__Fault *_p =
-      soap_instantiate_SOAP_ENV__Fault(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_SOAP_ENV__Fault(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default_SOAP_ENV__Fault(soap, _p);
   }
@@ -172,7 +172,7 @@ inline struct SOAP_ENV__Fault *soap_new_set_SOAP_ENV__Fault(
     struct SOAP_ENV__Reason *SOAP_ENV__Reason, char *SOAP_ENV__Node,
     char *SOAP_ENV__Role, struct SOAP_ENV__Detail *SOAP_ENV__Detail) {
   struct SOAP_ENV__Fault *_p =
-      soap_instantiate_SOAP_ENV__Fault(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_SOAP_ENV__Fault(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default_SOAP_ENV__Fault(soap, _p);
     _p->faultcode = faultcode;
@@ -246,13 +246,13 @@ soap_instantiate_SOAP_ENV__Reason(struct soap *, int, const char *,
 
 inline struct SOAP_ENV__Reason *soap_new_SOAP_ENV__Reason(struct soap *soap,
                                                           int n = -1) {
-  return soap_instantiate_SOAP_ENV__Reason(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_SOAP_ENV__Reason(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline struct SOAP_ENV__Reason *
 soap_new_req_SOAP_ENV__Reason(struct soap *soap) {
   struct SOAP_ENV__Reason *_p =
-      soap_instantiate_SOAP_ENV__Reason(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_SOAP_ENV__Reason(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default_SOAP_ENV__Reason(soap, _p);
   }
@@ -262,7 +262,7 @@ soap_new_req_SOAP_ENV__Reason(struct soap *soap) {
 inline struct SOAP_ENV__Reason *
 soap_new_set_SOAP_ENV__Reason(struct soap *soap, char *SOAP_ENV__Text) {
   struct SOAP_ENV__Reason *_p =
-      soap_instantiate_SOAP_ENV__Reason(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_SOAP_ENV__Reason(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default_SOAP_ENV__Reason(soap, _p);
     _p->SOAP_ENV__Text = SOAP_ENV__Text;
@@ -328,13 +328,13 @@ soap_instantiate_SOAP_ENV__Detail(struct soap *, int, const char *,
 
 inline struct SOAP_ENV__Detail *soap_new_SOAP_ENV__Detail(struct soap *soap,
                                                           int n = -1) {
-  return soap_instantiate_SOAP_ENV__Detail(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_SOAP_ENV__Detail(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline struct SOAP_ENV__Detail *
 soap_new_req_SOAP_ENV__Detail(struct soap *soap, int __type, void *fault) {
   struct SOAP_ENV__Detail *_p =
-      soap_instantiate_SOAP_ENV__Detail(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_SOAP_ENV__Detail(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default_SOAP_ENV__Detail(soap, _p);
     _p->__type = __type;
@@ -348,7 +348,7 @@ inline struct SOAP_ENV__Detail *soap_new_set_SOAP_ENV__Detail(struct soap *soap,
                                                               int __type,
                                                               void *fault) {
   struct SOAP_ENV__Detail *_p =
-      soap_instantiate_SOAP_ENV__Detail(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_SOAP_ENV__Detail(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default_SOAP_ENV__Detail(soap, _p);
     _p->__any = __any;
@@ -416,12 +416,12 @@ soap_instantiate_SOAP_ENV__Code(struct soap *, int, const char *, const char *,
 
 inline struct SOAP_ENV__Code *soap_new_SOAP_ENV__Code(struct soap *soap,
                                                       int n = -1) {
-  return soap_instantiate_SOAP_ENV__Code(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_SOAP_ENV__Code(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline struct SOAP_ENV__Code *soap_new_req_SOAP_ENV__Code(struct soap *soap) {
   struct SOAP_ENV__Code *_p =
-      soap_instantiate_SOAP_ENV__Code(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_SOAP_ENV__Code(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default_SOAP_ENV__Code(soap, _p);
   }
@@ -432,7 +432,7 @@ inline struct SOAP_ENV__Code *
 soap_new_set_SOAP_ENV__Code(struct soap *soap, char *SOAP_ENV__Value,
                             struct SOAP_ENV__Code *SOAP_ENV__Subcode) {
   struct SOAP_ENV__Code *_p =
-      soap_instantiate_SOAP_ENV__Code(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_SOAP_ENV__Code(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default_SOAP_ENV__Code(soap, _p);
     _p->SOAP_ENV__Value = SOAP_ENV__Value;
@@ -499,13 +499,13 @@ soap_instantiate_SOAP_ENV__Header(struct soap *, int, const char *,
 
 inline struct SOAP_ENV__Header *soap_new_SOAP_ENV__Header(struct soap *soap,
                                                           int n = -1) {
-  return soap_instantiate_SOAP_ENV__Header(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_SOAP_ENV__Header(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline struct SOAP_ENV__Header *
 soap_new_req_SOAP_ENV__Header(struct soap *soap) {
   struct SOAP_ENV__Header *_p =
-      soap_instantiate_SOAP_ENV__Header(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_SOAP_ENV__Header(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default_SOAP_ENV__Header(soap, _p);
   }
@@ -515,7 +515,7 @@ soap_new_req_SOAP_ENV__Header(struct soap *soap) {
 inline struct SOAP_ENV__Header *
 soap_new_set_SOAP_ENV__Header(struct soap *soap) {
   struct SOAP_ENV__Header *_p =
-      soap_instantiate_SOAP_ENV__Header(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_SOAP_ENV__Header(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default_SOAP_ENV__Header(soap, _p);
   }
diff --git a/Framework/ICat/inc/MantidICat/GSoap/stdsoap2.h b/Framework/ICat/inc/MantidICat/GSoap/stdsoap2.h
index e80b4e0c43ffab7ddf841a67d471edd142b5e435..72893e8f0dc14c2197cae00a617c030998358907 100644
--- a/Framework/ICat/inc/MantidICat/GSoap/stdsoap2.h
+++ b/Framework/ICat/inc/MantidICat/GSoap/stdsoap2.h
@@ -1745,7 +1745,7 @@ public:
     content = soap_next_multipart(content);
     return *this;
   }
-  soap_multipart_iterator() : content(NULL) {}
+  soap_multipart_iterator() : content(nullptr) {}
   soap_multipart_iterator(struct soap_multipart *p) : content(p) {}
 };
 #endif
@@ -1769,7 +1769,7 @@ struct soap_dime {
     return iter;
   };
   soap_multipart_iterator end() {
-    soap_multipart_iterator iter(NULL);
+    soap_multipart_iterator iter(nullptr);
     return iter;
   };
 #endif
@@ -1788,7 +1788,7 @@ struct soap_mime {
     return iter;
   };
   soap_multipart_iterator end() {
-    soap_multipart_iterator iter(NULL);
+    soap_multipart_iterator iter(nullptr);
     return iter;
   };
 #endif
diff --git a/Framework/ICat/inc/MantidICat/ICat4/GSoapGenerated/ICat4H.h b/Framework/ICat/inc/MantidICat/ICat4/GSoapGenerated/ICat4H.h
index adeebe54e003bcd69d12687cd1ba76c71bec0e7d..50850d5e1bf40ae9dd6604bad85961fba3c71992 100644
--- a/Framework/ICat/inc/MantidICat/ICat4/GSoapGenerated/ICat4H.h
+++ b/Framework/ICat/inc/MantidICat/ICat4/GSoapGenerated/ICat4H.h
@@ -493,15 +493,15 @@ soap_instantiate__ns1__login_credentials_entry(struct soap *, int, const char *,
 
 inline _ns1__login_credentials_entry *
 soap_new__ns1__login_credentials_entry(struct soap *soap, int n = -1) {
-  return soap_instantiate__ns1__login_credentials_entry(soap, n, NULL, NULL,
-                                                        NULL);
+  return soap_instantiate__ns1__login_credentials_entry(soap, n, nullptr,
+                                                        nullptr, nullptr);
 }
 
 inline _ns1__login_credentials_entry *
 soap_new_req__ns1__login_credentials_entry(struct soap *soap) {
   _ns1__login_credentials_entry *_p =
-      soap_instantiate__ns1__login_credentials_entry(soap, -1, NULL, NULL,
-                                                     NULL);
+      soap_instantiate__ns1__login_credentials_entry(soap, -1, nullptr, nullptr,
+                                                     nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -512,8 +512,8 @@ inline _ns1__login_credentials_entry *
 soap_new_set__ns1__login_credentials_entry(struct soap *soap, std::string *key,
                                            std::string *value) {
   _ns1__login_credentials_entry *_p =
-      soap_instantiate__ns1__login_credentials_entry(soap, -1, NULL, NULL,
-                                                     NULL);
+      soap_instantiate__ns1__login_credentials_entry(soap, -1, nullptr, nullptr,
+                                                     nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->_ns1__login_credentials_entry::key = key;
@@ -570,13 +570,14 @@ soap_instantiate__ns1__login_credentials(struct soap *, int, const char *,
 
 inline _ns1__login_credentials *
 soap_new__ns1__login_credentials(struct soap *soap, int n = -1) {
-  return soap_instantiate__ns1__login_credentials(soap, n, NULL, NULL, NULL);
+  return soap_instantiate__ns1__login_credentials(soap, n, nullptr, nullptr,
+                                                  nullptr);
 }
 
 inline _ns1__login_credentials *
 soap_new_req__ns1__login_credentials(struct soap *soap) {
-  _ns1__login_credentials *_p =
-      soap_instantiate__ns1__login_credentials(soap, -1, NULL, NULL, NULL);
+  _ns1__login_credentials *_p = soap_instantiate__ns1__login_credentials(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -585,8 +586,8 @@ soap_new_req__ns1__login_credentials(struct soap *soap) {
 
 inline _ns1__login_credentials *soap_new_set__ns1__login_credentials(
     struct soap *soap, std::vector<_ns1__login_credentials_entry> *entry) {
-  _ns1__login_credentials *_p =
-      soap_instantiate__ns1__login_credentials(soap, -1, NULL, NULL, NULL);
+  _ns1__login_credentials *_p = soap_instantiate__ns1__login_credentials(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->_ns1__login_credentials::entry = entry;
@@ -640,13 +641,13 @@ soap_instantiate_ns1__accessType_(struct soap *, int, const char *,
 
 inline ns1__accessType_ *soap_new_ns1__accessType_(struct soap *soap,
                                                    int n = -1) {
-  return soap_instantiate_ns1__accessType_(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__accessType_(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline ns1__accessType_ *
 soap_new_req_ns1__accessType_(struct soap *soap, enum ns1__accessType __item) {
   ns1__accessType_ *_p =
-      soap_instantiate_ns1__accessType_(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__accessType_(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__accessType_::__item = __item;
@@ -658,7 +659,7 @@ inline ns1__accessType_ *
 soap_new_set_ns1__accessType_(struct soap *soap, enum ns1__accessType __item,
                               char *__item1) {
   ns1__accessType_ *_p =
-      soap_instantiate_ns1__accessType_(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__accessType_(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__accessType_::__item = __item;
@@ -712,13 +713,13 @@ soap_instantiate_ns1__relType_(struct soap *, int, const char *, const char *,
                                size_t *);
 
 inline ns1__relType_ *soap_new_ns1__relType_(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__relType_(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__relType_(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline ns1__relType_ *soap_new_req_ns1__relType_(struct soap *soap,
                                                  enum ns1__relType __item) {
   ns1__relType_ *_p =
-      soap_instantiate_ns1__relType_(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__relType_(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__relType_::__item = __item;
@@ -730,7 +731,7 @@ inline ns1__relType_ *soap_new_set_ns1__relType_(struct soap *soap,
                                                  enum ns1__relType __item,
                                                  char *__item1) {
   ns1__relType_ *_p =
-      soap_instantiate_ns1__relType_(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__relType_(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__relType_::__item = __item;
@@ -786,14 +787,15 @@ soap_instantiate_ns1__parameterValueType_(struct soap *, int, const char *,
 
 inline ns1__parameterValueType_ *
 soap_new_ns1__parameterValueType_(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__parameterValueType_(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__parameterValueType_(soap, n, nullptr, nullptr,
+                                                   nullptr);
 }
 
 inline ns1__parameterValueType_ *
 soap_new_req_ns1__parameterValueType_(struct soap *soap,
                                       enum ns1__parameterValueType __item) {
-  ns1__parameterValueType_ *_p =
-      soap_instantiate_ns1__parameterValueType_(soap, -1, NULL, NULL, NULL);
+  ns1__parameterValueType_ *_p = soap_instantiate_ns1__parameterValueType_(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__parameterValueType_::__item = __item;
@@ -803,8 +805,8 @@ soap_new_req_ns1__parameterValueType_(struct soap *soap,
 
 inline ns1__parameterValueType_ *soap_new_set_ns1__parameterValueType_(
     struct soap *soap, enum ns1__parameterValueType __item, char *__item1) {
-  ns1__parameterValueType_ *_p =
-      soap_instantiate_ns1__parameterValueType_(soap, -1, NULL, NULL, NULL);
+  ns1__parameterValueType_ *_p = soap_instantiate_ns1__parameterValueType_(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__parameterValueType_::__item = __item;
@@ -859,14 +861,14 @@ soap_instantiate_ns1__studyStatus_(struct soap *, int, const char *,
 
 inline ns1__studyStatus_ *soap_new_ns1__studyStatus_(struct soap *soap,
                                                      int n = -1) {
-  return soap_instantiate_ns1__studyStatus_(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__studyStatus_(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline ns1__studyStatus_ *
 soap_new_req_ns1__studyStatus_(struct soap *soap,
                                enum ns1__studyStatus __item) {
   ns1__studyStatus_ *_p =
-      soap_instantiate_ns1__studyStatus_(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__studyStatus_(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__studyStatus_::__item = __item;
@@ -878,7 +880,7 @@ inline ns1__studyStatus_ *
 soap_new_set_ns1__studyStatus_(struct soap *soap, enum ns1__studyStatus __item,
                                char *__item1) {
   ns1__studyStatus_ *_p =
-      soap_instantiate_ns1__studyStatus_(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__studyStatus_(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__studyStatus_::__item = __item;
@@ -934,14 +936,15 @@ soap_instantiate_ns1__icatExceptionType_(struct soap *, int, const char *,
 
 inline ns1__icatExceptionType_ *
 soap_new_ns1__icatExceptionType_(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__icatExceptionType_(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__icatExceptionType_(soap, n, nullptr, nullptr,
+                                                  nullptr);
 }
 
 inline ns1__icatExceptionType_ *
 soap_new_req_ns1__icatExceptionType_(struct soap *soap,
                                      enum ns1__icatExceptionType __item) {
-  ns1__icatExceptionType_ *_p =
-      soap_instantiate_ns1__icatExceptionType_(soap, -1, NULL, NULL, NULL);
+  ns1__icatExceptionType_ *_p = soap_instantiate_ns1__icatExceptionType_(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__icatExceptionType_::__item = __item;
@@ -951,8 +954,8 @@ soap_new_req_ns1__icatExceptionType_(struct soap *soap,
 
 inline ns1__icatExceptionType_ *soap_new_set_ns1__icatExceptionType_(
     struct soap *soap, enum ns1__icatExceptionType __item, char *__item1) {
-  ns1__icatExceptionType_ *_p =
-      soap_instantiate_ns1__icatExceptionType_(soap, -1, NULL, NULL, NULL);
+  ns1__icatExceptionType_ *_p = soap_instantiate_ns1__icatExceptionType_(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__icatExceptionType_::__item = __item;
@@ -1012,16 +1015,16 @@ soap_instantiate_ns1__getRemainingMinutesResponse(struct soap *, int,
 
 inline ns1__getRemainingMinutesResponse *
 soap_new_ns1__getRemainingMinutesResponse(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__getRemainingMinutesResponse(soap, n, NULL, NULL,
-                                                           NULL);
+  return soap_instantiate_ns1__getRemainingMinutesResponse(soap, n, nullptr,
+                                                           nullptr, nullptr);
 }
 
 inline ns1__getRemainingMinutesResponse *
 soap_new_req_ns1__getRemainingMinutesResponse(struct soap *soap,
                                               double return_) {
   ns1__getRemainingMinutesResponse *_p =
-      soap_instantiate_ns1__getRemainingMinutesResponse(soap, -1, NULL, NULL,
-                                                        NULL);
+      soap_instantiate_ns1__getRemainingMinutesResponse(soap, -1, nullptr,
+                                                        nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__getRemainingMinutesResponse::return_ = return_;
@@ -1033,8 +1036,8 @@ inline ns1__getRemainingMinutesResponse *
 soap_new_set_ns1__getRemainingMinutesResponse(struct soap *soap, double return_,
                                               char *__item1) {
   ns1__getRemainingMinutesResponse *_p =
-      soap_instantiate_ns1__getRemainingMinutesResponse(soap, -1, NULL, NULL,
-                                                        NULL);
+      soap_instantiate_ns1__getRemainingMinutesResponse(soap, -1, nullptr,
+                                                        nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__getRemainingMinutesResponse::return_ = return_;
@@ -1091,13 +1094,14 @@ soap_instantiate_ns1__getRemainingMinutes(struct soap *, int, const char *,
 
 inline ns1__getRemainingMinutes *
 soap_new_ns1__getRemainingMinutes(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__getRemainingMinutes(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__getRemainingMinutes(soap, n, nullptr, nullptr,
+                                                   nullptr);
 }
 
 inline ns1__getRemainingMinutes *
 soap_new_req_ns1__getRemainingMinutes(struct soap *soap) {
-  ns1__getRemainingMinutes *_p =
-      soap_instantiate_ns1__getRemainingMinutes(soap, -1, NULL, NULL, NULL);
+  ns1__getRemainingMinutes *_p = soap_instantiate_ns1__getRemainingMinutes(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -1107,8 +1111,8 @@ soap_new_req_ns1__getRemainingMinutes(struct soap *soap) {
 inline ns1__getRemainingMinutes *
 soap_new_set_ns1__getRemainingMinutes(struct soap *soap, std::string *sessionId,
                                       char *__item1) {
-  ns1__getRemainingMinutes *_p =
-      soap_instantiate_ns1__getRemainingMinutes(soap, -1, NULL, NULL, NULL);
+  ns1__getRemainingMinutes *_p = soap_instantiate_ns1__getRemainingMinutes(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__getRemainingMinutes::sessionId = sessionId;
@@ -1164,13 +1168,14 @@ soap_instantiate_ns1__logoutResponse(struct soap *, int, const char *,
 
 inline ns1__logoutResponse *soap_new_ns1__logoutResponse(struct soap *soap,
                                                          int n = -1) {
-  return soap_instantiate_ns1__logoutResponse(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__logoutResponse(soap, n, nullptr, nullptr,
+                                              nullptr);
 }
 
 inline ns1__logoutResponse *
 soap_new_req_ns1__logoutResponse(struct soap *soap) {
   ns1__logoutResponse *_p =
-      soap_instantiate_ns1__logoutResponse(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__logoutResponse(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -1180,7 +1185,7 @@ soap_new_req_ns1__logoutResponse(struct soap *soap) {
 inline ns1__logoutResponse *soap_new_set_ns1__logoutResponse(struct soap *soap,
                                                              char *__item1) {
   ns1__logoutResponse *_p =
-      soap_instantiate_ns1__logoutResponse(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__logoutResponse(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->xsd__anyType::__item = __item1;
@@ -1231,11 +1236,12 @@ soap_instantiate_ns1__logout(struct soap *, int, const char *, const char *,
                              size_t *);
 
 inline ns1__logout *soap_new_ns1__logout(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__logout(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__logout(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline ns1__logout *soap_new_req_ns1__logout(struct soap *soap) {
-  ns1__logout *_p = soap_instantiate_ns1__logout(soap, -1, NULL, NULL, NULL);
+  ns1__logout *_p =
+      soap_instantiate_ns1__logout(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -1245,7 +1251,8 @@ inline ns1__logout *soap_new_req_ns1__logout(struct soap *soap) {
 inline ns1__logout *soap_new_set_ns1__logout(struct soap *soap,
                                              std::string *sessionId,
                                              char *__item1) {
-  ns1__logout *_p = soap_instantiate_ns1__logout(soap, -1, NULL, NULL, NULL);
+  ns1__logout *_p =
+      soap_instantiate_ns1__logout(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__logout::sessionId = sessionId;
@@ -1300,13 +1307,14 @@ soap_instantiate_ns1__searchResponse(struct soap *, int, const char *,
 
 inline ns1__searchResponse *soap_new_ns1__searchResponse(struct soap *soap,
                                                          int n = -1) {
-  return soap_instantiate_ns1__searchResponse(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__searchResponse(soap, n, nullptr, nullptr,
+                                              nullptr);
 }
 
 inline ns1__searchResponse *
 soap_new_req_ns1__searchResponse(struct soap *soap) {
   ns1__searchResponse *_p =
-      soap_instantiate_ns1__searchResponse(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__searchResponse(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -1316,7 +1324,7 @@ soap_new_req_ns1__searchResponse(struct soap *soap) {
 inline ns1__searchResponse *soap_new_set_ns1__searchResponse(
     struct soap *soap, std::vector<xsd__anyType *> &return_, char *__item1) {
   ns1__searchResponse *_p =
-      soap_instantiate_ns1__searchResponse(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__searchResponse(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__searchResponse::return_ = return_;
@@ -1368,11 +1376,12 @@ soap_instantiate_ns1__search(struct soap *, int, const char *, const char *,
                              size_t *);
 
 inline ns1__search *soap_new_ns1__search(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__search(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__search(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline ns1__search *soap_new_req_ns1__search(struct soap *soap) {
-  ns1__search *_p = soap_instantiate_ns1__search(soap, -1, NULL, NULL, NULL);
+  ns1__search *_p =
+      soap_instantiate_ns1__search(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -1383,7 +1392,8 @@ inline ns1__search *soap_new_set_ns1__search(struct soap *soap,
                                              std::string *sessionId,
                                              std::string *query,
                                              char *__item1) {
-  ns1__search *_p = soap_instantiate_ns1__search(soap, -1, NULL, NULL, NULL);
+  ns1__search *_p =
+      soap_instantiate_ns1__search(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__search::sessionId = sessionId;
@@ -1443,14 +1453,15 @@ soap_instantiate_ns1__isAccessAllowedResponse(struct soap *, int, const char *,
 
 inline ns1__isAccessAllowedResponse *
 soap_new_ns1__isAccessAllowedResponse(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__isAccessAllowedResponse(soap, n, NULL, NULL,
-                                                       NULL);
+  return soap_instantiate_ns1__isAccessAllowedResponse(soap, n, nullptr,
+                                                       nullptr, nullptr);
 }
 
 inline ns1__isAccessAllowedResponse *
 soap_new_req_ns1__isAccessAllowedResponse(struct soap *soap, bool return_) {
   ns1__isAccessAllowedResponse *_p =
-      soap_instantiate_ns1__isAccessAllowedResponse(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__isAccessAllowedResponse(soap, -1, nullptr, nullptr,
+                                                    nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__isAccessAllowedResponse::return_ = return_;
@@ -1462,7 +1473,8 @@ inline ns1__isAccessAllowedResponse *
 soap_new_set_ns1__isAccessAllowedResponse(struct soap *soap, bool return_,
                                           char *__item1) {
   ns1__isAccessAllowedResponse *_p =
-      soap_instantiate_ns1__isAccessAllowedResponse(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__isAccessAllowedResponse(soap, -1, nullptr, nullptr,
+                                                    nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__isAccessAllowedResponse::return_ = return_;
@@ -1519,13 +1531,14 @@ soap_instantiate_ns1__isAccessAllowed(struct soap *, int, const char *,
 
 inline ns1__isAccessAllowed *soap_new_ns1__isAccessAllowed(struct soap *soap,
                                                            int n = -1) {
-  return soap_instantiate_ns1__isAccessAllowed(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__isAccessAllowed(soap, n, nullptr, nullptr,
+                                               nullptr);
 }
 
 inline ns1__isAccessAllowed *
 soap_new_req_ns1__isAccessAllowed(struct soap *soap) {
-  ns1__isAccessAllowed *_p =
-      soap_instantiate_ns1__isAccessAllowed(soap, -1, NULL, NULL, NULL);
+  ns1__isAccessAllowed *_p = soap_instantiate_ns1__isAccessAllowed(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -1535,8 +1548,8 @@ soap_new_req_ns1__isAccessAllowed(struct soap *soap) {
 inline ns1__isAccessAllowed *soap_new_set_ns1__isAccessAllowed(
     struct soap *soap, std::string *sessionId, ns1__entityBaseBean *bean,
     enum ns1__accessType *accessType, char *__item1) {
-  ns1__isAccessAllowed *_p =
-      soap_instantiate_ns1__isAccessAllowed(soap, -1, NULL, NULL, NULL);
+  ns1__isAccessAllowed *_p = soap_instantiate_ns1__isAccessAllowed(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__isAccessAllowed::sessionId = sessionId;
@@ -1594,13 +1607,14 @@ soap_instantiate_ns1__deleteResponse(struct soap *, int, const char *,
 
 inline ns1__deleteResponse *soap_new_ns1__deleteResponse(struct soap *soap,
                                                          int n = -1) {
-  return soap_instantiate_ns1__deleteResponse(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__deleteResponse(soap, n, nullptr, nullptr,
+                                              nullptr);
 }
 
 inline ns1__deleteResponse *
 soap_new_req_ns1__deleteResponse(struct soap *soap) {
   ns1__deleteResponse *_p =
-      soap_instantiate_ns1__deleteResponse(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__deleteResponse(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -1610,7 +1624,7 @@ soap_new_req_ns1__deleteResponse(struct soap *soap) {
 inline ns1__deleteResponse *soap_new_set_ns1__deleteResponse(struct soap *soap,
                                                              char *__item1) {
   ns1__deleteResponse *_p =
-      soap_instantiate_ns1__deleteResponse(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__deleteResponse(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->xsd__anyType::__item = __item1;
@@ -1661,11 +1675,12 @@ soap_instantiate_ns1__delete(struct soap *, int, const char *, const char *,
                              size_t *);
 
 inline ns1__delete *soap_new_ns1__delete(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__delete(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__delete(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline ns1__delete *soap_new_req_ns1__delete(struct soap *soap) {
-  ns1__delete *_p = soap_instantiate_ns1__delete(soap, -1, NULL, NULL, NULL);
+  ns1__delete *_p =
+      soap_instantiate_ns1__delete(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -1676,7 +1691,8 @@ inline ns1__delete *soap_new_set_ns1__delete(struct soap *soap,
                                              std::string *sessionId,
                                              ns1__entityBaseBean *bean,
                                              char *__item1) {
-  ns1__delete *_p = soap_instantiate_ns1__delete(soap, -1, NULL, NULL, NULL);
+  ns1__delete *_p =
+      soap_instantiate_ns1__delete(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__delete::sessionId = sessionId;
@@ -1732,13 +1748,14 @@ soap_instantiate_ns1__searchTextResponse(struct soap *, int, const char *,
 
 inline ns1__searchTextResponse *
 soap_new_ns1__searchTextResponse(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__searchTextResponse(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__searchTextResponse(soap, n, nullptr, nullptr,
+                                                  nullptr);
 }
 
 inline ns1__searchTextResponse *
 soap_new_req_ns1__searchTextResponse(struct soap *soap) {
-  ns1__searchTextResponse *_p =
-      soap_instantiate_ns1__searchTextResponse(soap, -1, NULL, NULL, NULL);
+  ns1__searchTextResponse *_p = soap_instantiate_ns1__searchTextResponse(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -1747,8 +1764,8 @@ soap_new_req_ns1__searchTextResponse(struct soap *soap) {
 
 inline ns1__searchTextResponse *soap_new_set_ns1__searchTextResponse(
     struct soap *soap, std::vector<xsd__anyType *> &return_, char *__item1) {
-  ns1__searchTextResponse *_p =
-      soap_instantiate_ns1__searchTextResponse(soap, -1, NULL, NULL, NULL);
+  ns1__searchTextResponse *_p = soap_instantiate_ns1__searchTextResponse(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__searchTextResponse::return_ = return_;
@@ -1803,13 +1820,13 @@ soap_instantiate_ns1__searchText(struct soap *, int, const char *, const char *,
 
 inline ns1__searchText *soap_new_ns1__searchText(struct soap *soap,
                                                  int n = -1) {
-  return soap_instantiate_ns1__searchText(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__searchText(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline ns1__searchText *soap_new_req_ns1__searchText(struct soap *soap,
                                                      int maxCount) {
   ns1__searchText *_p =
-      soap_instantiate_ns1__searchText(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__searchText(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__searchText::maxCount = maxCount;
@@ -1822,7 +1839,7 @@ soap_new_set_ns1__searchText(struct soap *soap, std::string *sessionId,
                              std::string *query, int maxCount,
                              std::string *entityName, char *__item1) {
   ns1__searchText *_p =
-      soap_instantiate_ns1__searchText(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__searchText(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__searchText::sessionId = sessionId;
@@ -1881,13 +1898,14 @@ soap_instantiate_ns1__luceneCommitResponse(struct soap *, int, const char *,
 
 inline ns1__luceneCommitResponse *
 soap_new_ns1__luceneCommitResponse(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__luceneCommitResponse(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__luceneCommitResponse(soap, n, nullptr, nullptr,
+                                                    nullptr);
 }
 
 inline ns1__luceneCommitResponse *
 soap_new_req_ns1__luceneCommitResponse(struct soap *soap) {
-  ns1__luceneCommitResponse *_p =
-      soap_instantiate_ns1__luceneCommitResponse(soap, -1, NULL, NULL, NULL);
+  ns1__luceneCommitResponse *_p = soap_instantiate_ns1__luceneCommitResponse(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -1896,8 +1914,8 @@ soap_new_req_ns1__luceneCommitResponse(struct soap *soap) {
 
 inline ns1__luceneCommitResponse *
 soap_new_set_ns1__luceneCommitResponse(struct soap *soap, char *__item1) {
-  ns1__luceneCommitResponse *_p =
-      soap_instantiate_ns1__luceneCommitResponse(soap, -1, NULL, NULL, NULL);
+  ns1__luceneCommitResponse *_p = soap_instantiate_ns1__luceneCommitResponse(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->xsd__anyType::__item = __item1;
@@ -1953,12 +1971,12 @@ soap_instantiate_ns1__luceneCommit(struct soap *, int, const char *,
 
 inline ns1__luceneCommit *soap_new_ns1__luceneCommit(struct soap *soap,
                                                      int n = -1) {
-  return soap_instantiate_ns1__luceneCommit(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__luceneCommit(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline ns1__luceneCommit *soap_new_req_ns1__luceneCommit(struct soap *soap) {
   ns1__luceneCommit *_p =
-      soap_instantiate_ns1__luceneCommit(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__luceneCommit(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -1969,7 +1987,7 @@ inline ns1__luceneCommit *soap_new_set_ns1__luceneCommit(struct soap *soap,
                                                          std::string *sessionId,
                                                          char *__item1) {
   ns1__luceneCommit *_p =
-      soap_instantiate_ns1__luceneCommit(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__luceneCommit(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__luceneCommit::sessionId = sessionId;
@@ -2024,13 +2042,13 @@ soap_instantiate_ns1__entityField(struct soap *, int, const char *,
 
 inline ns1__entityField *soap_new_ns1__entityField(struct soap *soap,
                                                    int n = -1) {
-  return soap_instantiate_ns1__entityField(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__entityField(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline ns1__entityField *soap_new_req_ns1__entityField(struct soap *soap,
                                                        bool notNullable) {
   ns1__entityField *_p =
-      soap_instantiate_ns1__entityField(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__entityField(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__entityField::notNullable = notNullable;
@@ -2044,7 +2062,7 @@ soap_new_set_ns1__entityField(struct soap *soap, std::string *comment,
                               enum ns1__relType *relType, int *stringLength,
                               std::string *type, char *__item1) {
   ns1__entityField *_p =
-      soap_instantiate_ns1__entityField(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__entityField(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__entityField::comment = comment;
@@ -2104,12 +2122,12 @@ soap_instantiate_ns1__constraint(struct soap *, int, const char *, const char *,
 
 inline ns1__constraint *soap_new_ns1__constraint(struct soap *soap,
                                                  int n = -1) {
-  return soap_instantiate_ns1__constraint(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__constraint(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline ns1__constraint *soap_new_req_ns1__constraint(struct soap *soap) {
   ns1__constraint *_p =
-      soap_instantiate_ns1__constraint(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__constraint(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -2119,7 +2137,7 @@ inline ns1__constraint *soap_new_req_ns1__constraint(struct soap *soap) {
 inline ns1__constraint *soap_new_set_ns1__constraint(
     struct soap *soap, std::vector<std::string> &fieldNames, char *__item1) {
   ns1__constraint *_p =
-      soap_instantiate_ns1__constraint(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__constraint(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__constraint::fieldNames = fieldNames;
@@ -2173,12 +2191,12 @@ soap_instantiate_ns1__entityInfo(struct soap *, int, const char *, const char *,
 
 inline ns1__entityInfo *soap_new_ns1__entityInfo(struct soap *soap,
                                                  int n = -1) {
-  return soap_instantiate_ns1__entityInfo(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__entityInfo(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline ns1__entityInfo *soap_new_req_ns1__entityInfo(struct soap *soap) {
   ns1__entityInfo *_p =
-      soap_instantiate_ns1__entityInfo(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__entityInfo(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -2191,7 +2209,7 @@ soap_new_set_ns1__entityInfo(struct soap *soap, std::string *classComment,
                              std::vector<ns1__entityField *> &fields,
                              char *__item1) {
   ns1__entityInfo *_p =
-      soap_instantiate_ns1__entityInfo(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__entityInfo(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__entityInfo::classComment = classComment;
@@ -2249,13 +2267,14 @@ soap_instantiate_ns1__getEntityInfoResponse(struct soap *, int, const char *,
 
 inline ns1__getEntityInfoResponse *
 soap_new_ns1__getEntityInfoResponse(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__getEntityInfoResponse(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__getEntityInfoResponse(soap, n, nullptr, nullptr,
+                                                     nullptr);
 }
 
 inline ns1__getEntityInfoResponse *
 soap_new_req_ns1__getEntityInfoResponse(struct soap *soap) {
-  ns1__getEntityInfoResponse *_p =
-      soap_instantiate_ns1__getEntityInfoResponse(soap, -1, NULL, NULL, NULL);
+  ns1__getEntityInfoResponse *_p = soap_instantiate_ns1__getEntityInfoResponse(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -2264,8 +2283,8 @@ soap_new_req_ns1__getEntityInfoResponse(struct soap *soap) {
 
 inline ns1__getEntityInfoResponse *soap_new_set_ns1__getEntityInfoResponse(
     struct soap *soap, ns1__entityInfo *return_, char *__item1) {
-  ns1__getEntityInfoResponse *_p =
-      soap_instantiate_ns1__getEntityInfoResponse(soap, -1, NULL, NULL, NULL);
+  ns1__getEntityInfoResponse *_p = soap_instantiate_ns1__getEntityInfoResponse(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__getEntityInfoResponse::return_ = return_;
@@ -2322,12 +2341,13 @@ soap_instantiate_ns1__getEntityInfo(struct soap *, int, const char *,
 
 inline ns1__getEntityInfo *soap_new_ns1__getEntityInfo(struct soap *soap,
                                                        int n = -1) {
-  return soap_instantiate_ns1__getEntityInfo(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__getEntityInfo(soap, n, nullptr, nullptr,
+                                             nullptr);
 }
 
 inline ns1__getEntityInfo *soap_new_req_ns1__getEntityInfo(struct soap *soap) {
   ns1__getEntityInfo *_p =
-      soap_instantiate_ns1__getEntityInfo(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__getEntityInfo(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -2338,7 +2358,7 @@ inline ns1__getEntityInfo *
 soap_new_set_ns1__getEntityInfo(struct soap *soap, std::string *beanName,
                                 char *__item1) {
   ns1__getEntityInfo *_p =
-      soap_instantiate_ns1__getEntityInfo(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__getEntityInfo(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__getEntityInfo::beanName = beanName;
@@ -2394,12 +2414,13 @@ soap_instantiate_ns1__dummyResponse(struct soap *, int, const char *,
 
 inline ns1__dummyResponse *soap_new_ns1__dummyResponse(struct soap *soap,
                                                        int n = -1) {
-  return soap_instantiate_ns1__dummyResponse(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__dummyResponse(soap, n, nullptr, nullptr,
+                                             nullptr);
 }
 
 inline ns1__dummyResponse *soap_new_req_ns1__dummyResponse(struct soap *soap) {
   ns1__dummyResponse *_p =
-      soap_instantiate_ns1__dummyResponse(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__dummyResponse(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -2409,7 +2430,7 @@ inline ns1__dummyResponse *soap_new_req_ns1__dummyResponse(struct soap *soap) {
 inline ns1__dummyResponse *soap_new_set_ns1__dummyResponse(struct soap *soap,
                                                            char *__item1) {
   ns1__dummyResponse *_p =
-      soap_instantiate_ns1__dummyResponse(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__dummyResponse(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->xsd__anyType::__item = __item1;
@@ -2463,12 +2484,12 @@ soap_instantiate_ns1__publicStep(struct soap *, int, const char *, const char *,
 
 inline ns1__publicStep *soap_new_ns1__publicStep(struct soap *soap,
                                                  int n = -1) {
-  return soap_instantiate_ns1__publicStep(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__publicStep(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline ns1__publicStep *soap_new_req_ns1__publicStep(struct soap *soap) {
   ns1__publicStep *_p =
-      soap_instantiate_ns1__publicStep(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__publicStep(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -2481,7 +2502,7 @@ soap_new_set_ns1__publicStep(struct soap *soap, std::string *field,
                              time_t *createTime1, time_t *modTime1, LONG64 *id1,
                              std::string *modId1, char *__item2) {
   ns1__publicStep *_p =
-      soap_instantiate_ns1__publicStep(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__publicStep(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__publicStep::field = field;
@@ -2537,11 +2558,11 @@ soap_instantiate_ns1__log(struct soap *, int, const char *, const char *,
                           size_t *);
 
 inline ns1__log *soap_new_ns1__log(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__log(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__log(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline ns1__log *soap_new_req_ns1__log(struct soap *soap, LONG64 duration) {
-  ns1__log *_p = soap_instantiate_ns1__log(soap, -1, NULL, NULL, NULL);
+  ns1__log *_p = soap_instantiate_ns1__log(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__log::duration = duration;
@@ -2555,7 +2576,7 @@ soap_new_set_ns1__log(struct soap *soap, LONG64 duration, LONG64 *entityId,
                       std::string *query, std::string *createId1,
                       time_t *createTime1, time_t *modTime1, LONG64 *id1,
                       std::string *modId1, char *__item2) {
-  ns1__log *_p = soap_instantiate_ns1__log(soap, -1, NULL, NULL, NULL);
+  ns1__log *_p = soap_instantiate_ns1__log(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__log::duration = duration;
@@ -2618,13 +2639,14 @@ soap_instantiate_ns1__relatedDatafile(struct soap *, int, const char *,
 
 inline ns1__relatedDatafile *soap_new_ns1__relatedDatafile(struct soap *soap,
                                                            int n = -1) {
-  return soap_instantiate_ns1__relatedDatafile(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__relatedDatafile(soap, n, nullptr, nullptr,
+                                               nullptr);
 }
 
 inline ns1__relatedDatafile *
 soap_new_req_ns1__relatedDatafile(struct soap *soap) {
-  ns1__relatedDatafile *_p =
-      soap_instantiate_ns1__relatedDatafile(soap, -1, NULL, NULL, NULL);
+  ns1__relatedDatafile *_p = soap_instantiate_ns1__relatedDatafile(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -2635,8 +2657,8 @@ inline ns1__relatedDatafile *soap_new_set_ns1__relatedDatafile(
     struct soap *soap, ns1__datafile *destDatafile, std::string *relation,
     ns1__datafile *sourceDatafile, std::string *createId1, time_t *createTime1,
     time_t *modTime1, LONG64 *id1, std::string *modId1, char *__item2) {
-  ns1__relatedDatafile *_p =
-      soap_instantiate_ns1__relatedDatafile(soap, -1, NULL, NULL, NULL);
+  ns1__relatedDatafile *_p = soap_instantiate_ns1__relatedDatafile(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__relatedDatafile::destDatafile = destDatafile;
@@ -2694,11 +2716,12 @@ soap_instantiate_ns1__shift(struct soap *, int, const char *, const char *,
                             size_t *);
 
 inline ns1__shift *soap_new_ns1__shift(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__shift(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__shift(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline ns1__shift *soap_new_req_ns1__shift(struct soap *soap) {
-  ns1__shift *_p = soap_instantiate_ns1__shift(soap, -1, NULL, NULL, NULL);
+  ns1__shift *_p =
+      soap_instantiate_ns1__shift(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -2711,7 +2734,8 @@ soap_new_set_ns1__shift(struct soap *soap, std::string *comment,
                         time_t *startDate, std::string *createId1,
                         time_t *createTime1, time_t *modTime1, LONG64 *id1,
                         std::string *modId1, char *__item2) {
-  ns1__shift *_p = soap_instantiate_ns1__shift(soap, -1, NULL, NULL, NULL);
+  ns1__shift *_p =
+      soap_instantiate_ns1__shift(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__shift::comment = comment;
@@ -2772,12 +2796,12 @@ soap_instantiate_ns1__publication(struct soap *, int, const char *,
 
 inline ns1__publication *soap_new_ns1__publication(struct soap *soap,
                                                    int n = -1) {
-  return soap_instantiate_ns1__publication(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__publication(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline ns1__publication *soap_new_req_ns1__publication(struct soap *soap) {
   ns1__publication *_p =
-      soap_instantiate_ns1__publication(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__publication(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -2791,7 +2815,7 @@ inline ns1__publication *soap_new_set_ns1__publication(
     time_t *createTime1, time_t *modTime1, LONG64 *id1, std::string *modId1,
     char *__item2) {
   ns1__publication *_p =
-      soap_instantiate_ns1__publication(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__publication(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__publication::doi = doi;
@@ -2854,11 +2878,12 @@ soap_instantiate_ns1__keyword(struct soap *, int, const char *, const char *,
                               size_t *);
 
 inline ns1__keyword *soap_new_ns1__keyword(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__keyword(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__keyword(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline ns1__keyword *soap_new_req_ns1__keyword(struct soap *soap) {
-  ns1__keyword *_p = soap_instantiate_ns1__keyword(soap, -1, NULL, NULL, NULL);
+  ns1__keyword *_p =
+      soap_instantiate_ns1__keyword(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -2870,7 +2895,8 @@ soap_new_set_ns1__keyword(struct soap *soap, ns1__investigation *investigation,
                           std::string *name, std::string *createId1,
                           time_t *createTime1, time_t *modTime1, LONG64 *id1,
                           std::string *modId1, char *__item2) {
-  ns1__keyword *_p = soap_instantiate_ns1__keyword(soap, -1, NULL, NULL, NULL);
+  ns1__keyword *_p =
+      soap_instantiate_ns1__keyword(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__keyword::investigation = investigation;
@@ -2930,12 +2956,12 @@ soap_instantiate_ns1__sampleType(struct soap *, int, const char *, const char *,
 
 inline ns1__sampleType *soap_new_ns1__sampleType(struct soap *soap,
                                                  int n = -1) {
-  return soap_instantiate_ns1__sampleType(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__sampleType(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline ns1__sampleType *soap_new_req_ns1__sampleType(struct soap *soap) {
   ns1__sampleType *_p =
-      soap_instantiate_ns1__sampleType(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__sampleType(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -2949,7 +2975,7 @@ inline ns1__sampleType *soap_new_set_ns1__sampleType(
     time_t *createTime1, time_t *modTime1, LONG64 *id1, std::string *modId1,
     char *__item2) {
   ns1__sampleType *_p =
-      soap_instantiate_ns1__sampleType(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__sampleType(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__sampleType::facility = facility;
@@ -3009,11 +3035,12 @@ soap_instantiate_ns1__sample(struct soap *, int, const char *, const char *,
                              size_t *);
 
 inline ns1__sample *soap_new_ns1__sample(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__sample(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__sample(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline ns1__sample *soap_new_req_ns1__sample(struct soap *soap) {
-  ns1__sample *_p = soap_instantiate_ns1__sample(soap, -1, NULL, NULL, NULL);
+  ns1__sample *_p =
+      soap_instantiate_ns1__sample(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -3026,7 +3053,8 @@ inline ns1__sample *soap_new_set_ns1__sample(
     std::vector<ns1__sampleParameter *> &parameters, ns1__sampleType *type,
     std::string *createId1, time_t *createTime1, time_t *modTime1, LONG64 *id1,
     std::string *modId1, char *__item2) {
-  ns1__sample *_p = soap_instantiate_ns1__sample(soap, -1, NULL, NULL, NULL);
+  ns1__sample *_p =
+      soap_instantiate_ns1__sample(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__sample::datasets = datasets;
@@ -3090,13 +3118,14 @@ soap_instantiate_ns1__sampleParameter(struct soap *, int, const char *,
 
 inline ns1__sampleParameter *soap_new_ns1__sampleParameter(struct soap *soap,
                                                            int n = -1) {
-  return soap_instantiate_ns1__sampleParameter(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__sampleParameter(soap, n, nullptr, nullptr,
+                                               nullptr);
 }
 
 inline ns1__sampleParameter *
 soap_new_req_ns1__sampleParameter(struct soap *soap) {
-  ns1__sampleParameter *_p =
-      soap_instantiate_ns1__sampleParameter(soap, -1, NULL, NULL, NULL);
+  ns1__sampleParameter *_p = soap_instantiate_ns1__sampleParameter(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -3109,8 +3138,8 @@ inline ns1__sampleParameter *soap_new_set_ns1__sampleParameter(
     double *rangeTop1, std::string *stringValue1, ns1__parameterType *type1,
     std::string *createId2, time_t *createTime2, time_t *modTime2, LONG64 *id2,
     std::string *modId2, char *__item3) {
-  ns1__sampleParameter *_p =
-      soap_instantiate_ns1__sampleParameter(soap, -1, NULL, NULL, NULL);
+  ns1__sampleParameter *_p = soap_instantiate_ns1__sampleParameter(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__sampleParameter::sample = sample;
@@ -3181,14 +3210,15 @@ soap_instantiate_ns1__permissibleStringValue(struct soap *, int, const char *,
 
 inline ns1__permissibleStringValue *
 soap_new_ns1__permissibleStringValue(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__permissibleStringValue(soap, n, NULL, NULL,
-                                                      NULL);
+  return soap_instantiate_ns1__permissibleStringValue(soap, n, nullptr, nullptr,
+                                                      nullptr);
 }
 
 inline ns1__permissibleStringValue *
 soap_new_req_ns1__permissibleStringValue(struct soap *soap) {
   ns1__permissibleStringValue *_p =
-      soap_instantiate_ns1__permissibleStringValue(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__permissibleStringValue(soap, -1, nullptr, nullptr,
+                                                   nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -3200,7 +3230,8 @@ inline ns1__permissibleStringValue *soap_new_set_ns1__permissibleStringValue(
     std::string *createId1, time_t *createTime1, time_t *modTime1, LONG64 *id1,
     std::string *modId1, char *__item2) {
   ns1__permissibleStringValue *_p =
-      soap_instantiate_ns1__permissibleStringValue(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__permissibleStringValue(soap, -1, nullptr, nullptr,
+                                                   nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__permissibleStringValue::type = type;
@@ -3266,14 +3297,15 @@ soap_instantiate_ns1__investigationParameter(struct soap *, int, const char *,
 
 inline ns1__investigationParameter *
 soap_new_ns1__investigationParameter(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__investigationParameter(soap, n, NULL, NULL,
-                                                      NULL);
+  return soap_instantiate_ns1__investigationParameter(soap, n, nullptr, nullptr,
+                                                      nullptr);
 }
 
 inline ns1__investigationParameter *
 soap_new_req_ns1__investigationParameter(struct soap *soap) {
   ns1__investigationParameter *_p =
-      soap_instantiate_ns1__investigationParameter(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__investigationParameter(soap, -1, nullptr, nullptr,
+                                                   nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -3287,7 +3319,8 @@ inline ns1__investigationParameter *soap_new_set_ns1__investigationParameter(
     ns1__parameterType *type1, std::string *createId2, time_t *createTime2,
     time_t *modTime2, LONG64 *id2, std::string *modId2, char *__item3) {
   ns1__investigationParameter *_p =
-      soap_instantiate_ns1__investigationParameter(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__investigationParameter(soap, -1, nullptr, nullptr,
+                                                   nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__investigationParameter::investigation = investigation;
@@ -3356,13 +3389,14 @@ soap_instantiate_ns1__datasetParameter(struct soap *, int, const char *,
 
 inline ns1__datasetParameter *soap_new_ns1__datasetParameter(struct soap *soap,
                                                              int n = -1) {
-  return soap_instantiate_ns1__datasetParameter(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__datasetParameter(soap, n, nullptr, nullptr,
+                                                nullptr);
 }
 
 inline ns1__datasetParameter *
 soap_new_req_ns1__datasetParameter(struct soap *soap) {
-  ns1__datasetParameter *_p =
-      soap_instantiate_ns1__datasetParameter(soap, -1, NULL, NULL, NULL);
+  ns1__datasetParameter *_p = soap_instantiate_ns1__datasetParameter(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -3375,8 +3409,8 @@ inline ns1__datasetParameter *soap_new_set_ns1__datasetParameter(
     double *rangeTop1, std::string *stringValue1, ns1__parameterType *type1,
     std::string *createId2, time_t *createTime2, time_t *modTime2, LONG64 *id2,
     std::string *modId2, char *__item3) {
-  ns1__datasetParameter *_p =
-      soap_instantiate_ns1__datasetParameter(soap, -1, NULL, NULL, NULL);
+  ns1__datasetParameter *_p = soap_instantiate_ns1__datasetParameter(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__datasetParameter::dataset = dataset;
@@ -3444,13 +3478,14 @@ soap_instantiate_ns1__datafileParameter(struct soap *, int, const char *,
 
 inline ns1__datafileParameter *
 soap_new_ns1__datafileParameter(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__datafileParameter(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__datafileParameter(soap, n, nullptr, nullptr,
+                                                 nullptr);
 }
 
 inline ns1__datafileParameter *
 soap_new_req_ns1__datafileParameter(struct soap *soap) {
-  ns1__datafileParameter *_p =
-      soap_instantiate_ns1__datafileParameter(soap, -1, NULL, NULL, NULL);
+  ns1__datafileParameter *_p = soap_instantiate_ns1__datafileParameter(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -3463,8 +3498,8 @@ inline ns1__datafileParameter *soap_new_set_ns1__datafileParameter(
     double *rangeTop1, std::string *stringValue1, ns1__parameterType *type1,
     std::string *createId2, time_t *createTime2, time_t *modTime2, LONG64 *id2,
     std::string *modId2, char *__item3) {
-  ns1__datafileParameter *_p =
-      soap_instantiate_ns1__datafileParameter(soap, -1, NULL, NULL, NULL);
+  ns1__datafileParameter *_p = soap_instantiate_ns1__datafileParameter(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__datafileParameter::datafile = datafile;
@@ -3530,12 +3565,12 @@ soap_instantiate_ns1__parameter(struct soap *, int, const char *, const char *,
                                 size_t *);
 
 inline ns1__parameter *soap_new_ns1__parameter(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__parameter(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__parameter(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline ns1__parameter *soap_new_req_ns1__parameter(struct soap *soap) {
   ns1__parameter *_p =
-      soap_instantiate_ns1__parameter(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__parameter(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -3549,7 +3584,7 @@ inline ns1__parameter *soap_new_set_ns1__parameter(
     time_t *createTime1, time_t *modTime1, LONG64 *id1, std::string *modId1,
     char *__item2) {
   ns1__parameter *_p =
-      soap_instantiate_ns1__parameter(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__parameter(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__parameter::dateTimeValue = dateTimeValue;
@@ -3619,14 +3654,15 @@ soap_instantiate_ns1__dataCollectionParameter(struct soap *, int, const char *,
 
 inline ns1__dataCollectionParameter *
 soap_new_ns1__dataCollectionParameter(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__dataCollectionParameter(soap, n, NULL, NULL,
-                                                       NULL);
+  return soap_instantiate_ns1__dataCollectionParameter(soap, n, nullptr,
+                                                       nullptr, nullptr);
 }
 
 inline ns1__dataCollectionParameter *
 soap_new_req_ns1__dataCollectionParameter(struct soap *soap) {
   ns1__dataCollectionParameter *_p =
-      soap_instantiate_ns1__dataCollectionParameter(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__dataCollectionParameter(soap, -1, nullptr, nullptr,
+                                                    nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -3640,7 +3676,8 @@ inline ns1__dataCollectionParameter *soap_new_set_ns1__dataCollectionParameter(
     ns1__parameterType *type1, std::string *createId2, time_t *createTime2,
     time_t *modTime2, LONG64 *id2, std::string *modId2, char *__item3) {
   ns1__dataCollectionParameter *_p =
-      soap_instantiate_ns1__dataCollectionParameter(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__dataCollectionParameter(soap, -1, nullptr, nullptr,
+                                                    nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__dataCollectionParameter::dataCollection = dataCollection;
@@ -3709,7 +3746,8 @@ soap_instantiate_ns1__parameterType(struct soap *, int, const char *,
 
 inline ns1__parameterType *soap_new_ns1__parameterType(struct soap *soap,
                                                        int n = -1) {
-  return soap_instantiate_ns1__parameterType(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__parameterType(soap, n, nullptr, nullptr,
+                                             nullptr);
 }
 
 inline ns1__parameterType *soap_new_req_ns1__parameterType(
@@ -3718,7 +3756,7 @@ inline ns1__parameterType *soap_new_req_ns1__parameterType(
     bool applicableToInvestigation, bool applicableToSample, bool enforced,
     bool verified) {
   ns1__parameterType *_p =
-      soap_instantiate_ns1__parameterType(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__parameterType(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__parameterType::applicableToDataCollection =
@@ -3750,7 +3788,7 @@ inline ns1__parameterType *soap_new_set_ns1__parameterType(
     bool verified, std::string *createId1, time_t *createTime1,
     time_t *modTime1, LONG64 *id1, std::string *modId1, char *__item2) {
   ns1__parameterType *_p =
-      soap_instantiate_ns1__parameterType(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__parameterType(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__parameterType::applicableToDataCollection =
@@ -3833,13 +3871,14 @@ soap_instantiate_ns1__investigationType(struct soap *, int, const char *,
 
 inline ns1__investigationType *
 soap_new_ns1__investigationType(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__investigationType(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__investigationType(soap, n, nullptr, nullptr,
+                                                 nullptr);
 }
 
 inline ns1__investigationType *
 soap_new_req_ns1__investigationType(struct soap *soap) {
-  ns1__investigationType *_p =
-      soap_instantiate_ns1__investigationType(soap, -1, NULL, NULL, NULL);
+  ns1__investigationType *_p = soap_instantiate_ns1__investigationType(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -3851,8 +3890,8 @@ inline ns1__investigationType *soap_new_set_ns1__investigationType(
     std::vector<ns1__investigation *> &investigations, std::string *name,
     std::string *createId1, time_t *createTime1, time_t *modTime1, LONG64 *id1,
     std::string *modId1, char *__item2) {
-  ns1__investigationType *_p =
-      soap_instantiate_ns1__investigationType(soap, -1, NULL, NULL, NULL);
+  ns1__investigationType *_p = soap_instantiate_ns1__investigationType(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__investigationType::description = description;
@@ -3920,14 +3959,15 @@ soap_instantiate_ns1__investigationInstrument(struct soap *, int, const char *,
 
 inline ns1__investigationInstrument *
 soap_new_ns1__investigationInstrument(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__investigationInstrument(soap, n, NULL, NULL,
-                                                       NULL);
+  return soap_instantiate_ns1__investigationInstrument(soap, n, nullptr,
+                                                       nullptr, nullptr);
 }
 
 inline ns1__investigationInstrument *
 soap_new_req_ns1__investigationInstrument(struct soap *soap) {
   ns1__investigationInstrument *_p =
-      soap_instantiate_ns1__investigationInstrument(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__investigationInstrument(soap, -1, nullptr, nullptr,
+                                                    nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -3940,7 +3980,8 @@ inline ns1__investigationInstrument *soap_new_set_ns1__investigationInstrument(
     time_t *createTime1, time_t *modTime1, LONG64 *id1, std::string *modId1,
     char *__item2) {
   ns1__investigationInstrument *_p =
-      soap_instantiate_ns1__investigationInstrument(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__investigationInstrument(soap, -1, nullptr, nullptr,
+                                                    nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__investigationInstrument::instrument = instrument;
@@ -3998,11 +4039,12 @@ soap_instantiate_ns1__rule(struct soap *, int, const char *, const char *,
                            size_t *);
 
 inline ns1__rule *soap_new_ns1__rule(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__rule(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__rule(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline ns1__rule *soap_new_req_ns1__rule(struct soap *soap) {
-  ns1__rule *_p = soap_instantiate_ns1__rule(soap, -1, NULL, NULL, NULL);
+  ns1__rule *_p =
+      soap_instantiate_ns1__rule(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -4013,7 +4055,8 @@ inline ns1__rule *soap_new_set_ns1__rule(
     struct soap *soap, std::string *crudFlags, ns1__grouping *grouping,
     std::string *what, std::string *createId1, time_t *createTime1,
     time_t *modTime1, LONG64 *id1, std::string *modId1, char *__item2) {
-  ns1__rule *_p = soap_instantiate_ns1__rule(soap, -1, NULL, NULL, NULL);
+  ns1__rule *_p =
+      soap_instantiate_ns1__rule(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__rule::crudFlags = crudFlags;
@@ -4072,12 +4115,12 @@ soap_instantiate_ns1__grouping(struct soap *, int, const char *, const char *,
                                size_t *);
 
 inline ns1__grouping *soap_new_ns1__grouping(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__grouping(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__grouping(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline ns1__grouping *soap_new_req_ns1__grouping(struct soap *soap) {
   ns1__grouping *_p =
-      soap_instantiate_ns1__grouping(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__grouping(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -4090,7 +4133,7 @@ inline ns1__grouping *soap_new_set_ns1__grouping(
     time_t *createTime1, time_t *modTime1, LONG64 *id1, std::string *modId1,
     char *__item2) {
   ns1__grouping *_p =
-      soap_instantiate_ns1__grouping(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__grouping(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__grouping::name = name;
@@ -4150,12 +4193,12 @@ soap_instantiate_ns1__userGroup(struct soap *, int, const char *, const char *,
                                 size_t *);
 
 inline ns1__userGroup *soap_new_ns1__userGroup(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__userGroup(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__userGroup(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline ns1__userGroup *soap_new_req_ns1__userGroup(struct soap *soap) {
   ns1__userGroup *_p =
-      soap_instantiate_ns1__userGroup(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__userGroup(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -4168,7 +4211,7 @@ soap_new_set_ns1__userGroup(struct soap *soap, ns1__grouping *grouping,
                             time_t *createTime1, time_t *modTime1, LONG64 *id1,
                             std::string *modId1, char *__item2) {
   ns1__userGroup *_p =
-      soap_instantiate_ns1__userGroup(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__userGroup(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__userGroup::grouping = grouping;
@@ -4229,13 +4272,14 @@ soap_instantiate_ns1__studyInvestigation(struct soap *, int, const char *,
 
 inline ns1__studyInvestigation *
 soap_new_ns1__studyInvestigation(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__studyInvestigation(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__studyInvestigation(soap, n, nullptr, nullptr,
+                                                  nullptr);
 }
 
 inline ns1__studyInvestigation *
 soap_new_req_ns1__studyInvestigation(struct soap *soap) {
-  ns1__studyInvestigation *_p =
-      soap_instantiate_ns1__studyInvestigation(soap, -1, NULL, NULL, NULL);
+  ns1__studyInvestigation *_p = soap_instantiate_ns1__studyInvestigation(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -4246,8 +4290,8 @@ inline ns1__studyInvestigation *soap_new_set_ns1__studyInvestigation(
     struct soap *soap, ns1__investigation *investigation, ns1__study *study,
     std::string *createId1, time_t *createTime1, time_t *modTime1, LONG64 *id1,
     std::string *modId1, char *__item2) {
-  ns1__studyInvestigation *_p =
-      soap_instantiate_ns1__studyInvestigation(soap, -1, NULL, NULL, NULL);
+  ns1__studyInvestigation *_p = soap_instantiate_ns1__studyInvestigation(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__studyInvestigation::investigation = investigation;
@@ -4304,11 +4348,12 @@ soap_instantiate_ns1__study(struct soap *, int, const char *, const char *,
                             size_t *);
 
 inline ns1__study *soap_new_ns1__study(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__study(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__study(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline ns1__study *soap_new_req_ns1__study(struct soap *soap) {
-  ns1__study *_p = soap_instantiate_ns1__study(soap, -1, NULL, NULL, NULL);
+  ns1__study *_p =
+      soap_instantiate_ns1__study(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -4321,7 +4366,8 @@ inline ns1__study *soap_new_set_ns1__study(
     std::vector<ns1__studyInvestigation *> &studyInvestigations,
     ns1__user *user, std::string *createId1, time_t *createTime1,
     time_t *modTime1, LONG64 *id1, std::string *modId1, char *__item2) {
-  ns1__study *_p = soap_instantiate_ns1__study(soap, -1, NULL, NULL, NULL);
+  ns1__study *_p =
+      soap_instantiate_ns1__study(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__study::description = description;
@@ -4385,13 +4431,14 @@ soap_instantiate_ns1__investigationUser(struct soap *, int, const char *,
 
 inline ns1__investigationUser *
 soap_new_ns1__investigationUser(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__investigationUser(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__investigationUser(soap, n, nullptr, nullptr,
+                                                 nullptr);
 }
 
 inline ns1__investigationUser *
 soap_new_req_ns1__investigationUser(struct soap *soap) {
-  ns1__investigationUser *_p =
-      soap_instantiate_ns1__investigationUser(soap, -1, NULL, NULL, NULL);
+  ns1__investigationUser *_p = soap_instantiate_ns1__investigationUser(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -4402,8 +4449,8 @@ inline ns1__investigationUser *soap_new_set_ns1__investigationUser(
     struct soap *soap, ns1__investigation *investigation, std::string *role,
     ns1__user *user, std::string *createId1, time_t *createTime1,
     time_t *modTime1, LONG64 *id1, std::string *modId1, char *__item2) {
-  ns1__investigationUser *_p =
-      soap_instantiate_ns1__investigationUser(soap, -1, NULL, NULL, NULL);
+  ns1__investigationUser *_p = soap_instantiate_ns1__investigationUser(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__investigationUser::investigation = investigation;
@@ -4461,11 +4508,12 @@ soap_instantiate_ns1__user(struct soap *, int, const char *, const char *,
                            size_t *);
 
 inline ns1__user *soap_new_ns1__user(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__user(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__user(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline ns1__user *soap_new_req_ns1__user(struct soap *soap) {
-  ns1__user *_p = soap_instantiate_ns1__user(soap, -1, NULL, NULL, NULL);
+  ns1__user *_p =
+      soap_instantiate_ns1__user(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -4480,7 +4528,8 @@ inline ns1__user *soap_new_set_ns1__user(
     std::vector<ns1__userGroup *> &userGroups, std::string *createId1,
     time_t *createTime1, time_t *modTime1, LONG64 *id1, std::string *modId1,
     char *__item2) {
-  ns1__user *_p = soap_instantiate_ns1__user(soap, -1, NULL, NULL, NULL);
+  ns1__user *_p =
+      soap_instantiate_ns1__user(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__user::fullName = fullName;
@@ -4545,13 +4594,14 @@ soap_instantiate_ns1__instrumentScientist(struct soap *, int, const char *,
 
 inline ns1__instrumentScientist *
 soap_new_ns1__instrumentScientist(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__instrumentScientist(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__instrumentScientist(soap, n, nullptr, nullptr,
+                                                   nullptr);
 }
 
 inline ns1__instrumentScientist *
 soap_new_req_ns1__instrumentScientist(struct soap *soap) {
-  ns1__instrumentScientist *_p =
-      soap_instantiate_ns1__instrumentScientist(soap, -1, NULL, NULL, NULL);
+  ns1__instrumentScientist *_p = soap_instantiate_ns1__instrumentScientist(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -4562,8 +4612,8 @@ inline ns1__instrumentScientist *soap_new_set_ns1__instrumentScientist(
     struct soap *soap, ns1__instrument *instrument, ns1__user *user,
     std::string *createId1, time_t *createTime1, time_t *modTime1, LONG64 *id1,
     std::string *modId1, char *__item2) {
-  ns1__instrumentScientist *_p =
-      soap_instantiate_ns1__instrumentScientist(soap, -1, NULL, NULL, NULL);
+  ns1__instrumentScientist *_p = soap_instantiate_ns1__instrumentScientist(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__instrumentScientist::instrument = instrument;
@@ -4624,12 +4674,12 @@ soap_instantiate_ns1__instrument(struct soap *, int, const char *, const char *,
 
 inline ns1__instrument *soap_new_ns1__instrument(struct soap *soap,
                                                  int n = -1) {
-  return soap_instantiate_ns1__instrument(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__instrument(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline ns1__instrument *soap_new_req_ns1__instrument(struct soap *soap) {
   ns1__instrument *_p =
-      soap_instantiate_ns1__instrument(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__instrument(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -4645,7 +4695,7 @@ inline ns1__instrument *soap_new_set_ns1__instrument(
     std::string *createId1, time_t *createTime1, time_t *modTime1, LONG64 *id1,
     std::string *modId1, char *__item2) {
   ns1__instrument *_p =
-      soap_instantiate_ns1__instrument(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__instrument(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__instrument::description = description;
@@ -4712,12 +4762,13 @@ soap_instantiate_ns1__facilityCycle(struct soap *, int, const char *,
 
 inline ns1__facilityCycle *soap_new_ns1__facilityCycle(struct soap *soap,
                                                        int n = -1) {
-  return soap_instantiate_ns1__facilityCycle(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__facilityCycle(soap, n, nullptr, nullptr,
+                                             nullptr);
 }
 
 inline ns1__facilityCycle *soap_new_req_ns1__facilityCycle(struct soap *soap) {
   ns1__facilityCycle *_p =
-      soap_instantiate_ns1__facilityCycle(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__facilityCycle(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -4730,7 +4781,7 @@ inline ns1__facilityCycle *soap_new_set_ns1__facilityCycle(
     std::string *createId1, time_t *createTime1, time_t *modTime1, LONG64 *id1,
     std::string *modId1, char *__item2) {
   ns1__facilityCycle *_p =
-      soap_instantiate_ns1__facilityCycle(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__facilityCycle(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__facilityCycle::description = description;
@@ -4794,12 +4845,12 @@ soap_instantiate_ns1__datasetType(struct soap *, int, const char *,
 
 inline ns1__datasetType *soap_new_ns1__datasetType(struct soap *soap,
                                                    int n = -1) {
-  return soap_instantiate_ns1__datasetType(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__datasetType(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline ns1__datasetType *soap_new_req_ns1__datasetType(struct soap *soap) {
   ns1__datasetType *_p =
-      soap_instantiate_ns1__datasetType(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__datasetType(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -4812,7 +4863,7 @@ inline ns1__datasetType *soap_new_set_ns1__datasetType(
     std::string *createId1, time_t *createTime1, time_t *modTime1, LONG64 *id1,
     std::string *modId1, char *__item2) {
   ns1__datasetType *_p =
-      soap_instantiate_ns1__datasetType(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__datasetType(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__datasetType::datasets = datasets;
@@ -4876,13 +4927,14 @@ soap_instantiate_ns1__datafileFormat(struct soap *, int, const char *,
 
 inline ns1__datafileFormat *soap_new_ns1__datafileFormat(struct soap *soap,
                                                          int n = -1) {
-  return soap_instantiate_ns1__datafileFormat(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__datafileFormat(soap, n, nullptr, nullptr,
+                                              nullptr);
 }
 
 inline ns1__datafileFormat *
 soap_new_req_ns1__datafileFormat(struct soap *soap) {
   ns1__datafileFormat *_p =
-      soap_instantiate_ns1__datafileFormat(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__datafileFormat(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -4896,7 +4948,7 @@ inline ns1__datafileFormat *soap_new_set_ns1__datafileFormat(
     time_t *createTime1, time_t *modTime1, LONG64 *id1, std::string *modId1,
     char *__item2) {
   ns1__datafileFormat *_p =
-      soap_instantiate_ns1__datafileFormat(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__datafileFormat(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__datafileFormat::datafiles = datafiles;
@@ -4957,11 +5009,11 @@ soap_instantiate_ns1__job(struct soap *, int, const char *, const char *,
                           size_t *);
 
 inline ns1__job *soap_new_ns1__job(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__job(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__job(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline ns1__job *soap_new_req_ns1__job(struct soap *soap) {
-  ns1__job *_p = soap_instantiate_ns1__job(soap, -1, NULL, NULL, NULL);
+  ns1__job *_p = soap_instantiate_ns1__job(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -4974,7 +5026,7 @@ inline ns1__job *soap_new_set_ns1__job(
     ns1__dataCollection *outputDataCollection, std::string *createId1,
     time_t *createTime1, time_t *modTime1, LONG64 *id1, std::string *modId1,
     char *__item2) {
-  ns1__job *_p = soap_instantiate_ns1__job(soap, -1, NULL, NULL, NULL);
+  ns1__job *_p = soap_instantiate_ns1__job(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__job::application = application;
@@ -5035,12 +5087,12 @@ soap_instantiate_ns1__application(struct soap *, int, const char *,
 
 inline ns1__application *soap_new_ns1__application(struct soap *soap,
                                                    int n = -1) {
-  return soap_instantiate_ns1__application(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__application(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline ns1__application *soap_new_req_ns1__application(struct soap *soap) {
   ns1__application *_p =
-      soap_instantiate_ns1__application(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__application(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -5054,7 +5106,7 @@ soap_new_set_ns1__application(struct soap *soap, ns1__facility *facility,
                               time_t *createTime1, time_t *modTime1,
                               LONG64 *id1, std::string *modId1, char *__item2) {
   ns1__application *_p =
-      soap_instantiate_ns1__application(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__application(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__application::facility = facility;
@@ -5116,12 +5168,12 @@ soap_instantiate_ns1__facility(struct soap *, int, const char *, const char *,
                                size_t *);
 
 inline ns1__facility *soap_new_ns1__facility(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__facility(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__facility(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline ns1__facility *soap_new_req_ns1__facility(struct soap *soap) {
   ns1__facility *_p =
-      soap_instantiate_ns1__facility(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__facility(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -5141,7 +5193,7 @@ inline ns1__facility *soap_new_set_ns1__facility(
     std::string *createId1, time_t *createTime1, time_t *modTime1, LONG64 *id1,
     std::string *modId1, char *__item2) {
   ns1__facility *_p =
-      soap_instantiate_ns1__facility(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__facility(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__facility::applications = applications;
@@ -5214,12 +5266,13 @@ soap_instantiate_ns1__investigation(struct soap *, int, const char *,
 
 inline ns1__investigation *soap_new_ns1__investigation(struct soap *soap,
                                                        int n = -1) {
-  return soap_instantiate_ns1__investigation(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__investigation(soap, n, nullptr, nullptr,
+                                             nullptr);
 }
 
 inline ns1__investigation *soap_new_req_ns1__investigation(struct soap *soap) {
   ns1__investigation *_p =
-      soap_instantiate_ns1__investigation(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__investigation(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -5241,7 +5294,7 @@ inline ns1__investigation *soap_new_set_ns1__investigation(
     std::string *visitId, std::string *createId1, time_t *createTime1,
     time_t *modTime1, LONG64 *id1, std::string *modId1, char *__item2) {
   ns1__investigation *_p =
-      soap_instantiate_ns1__investigation(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__investigation(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__investigation::datasets = datasets;
@@ -5317,12 +5370,13 @@ soap_instantiate_ns1__dataset(struct soap *, int, const char *, const char *,
                               size_t *);
 
 inline ns1__dataset *soap_new_ns1__dataset(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__dataset(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__dataset(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline ns1__dataset *soap_new_req_ns1__dataset(struct soap *soap,
                                                bool complete) {
-  ns1__dataset *_p = soap_instantiate_ns1__dataset(soap, -1, NULL, NULL, NULL);
+  ns1__dataset *_p =
+      soap_instantiate_ns1__dataset(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__dataset::complete = complete;
@@ -5340,7 +5394,8 @@ inline ns1__dataset *soap_new_set_ns1__dataset(
     time_t *startDate, ns1__datasetType *type, std::string *createId1,
     time_t *createTime1, time_t *modTime1, LONG64 *id1, std::string *modId1,
     char *__item2) {
-  ns1__dataset *_p = soap_instantiate_ns1__dataset(soap, -1, NULL, NULL, NULL);
+  ns1__dataset *_p =
+      soap_instantiate_ns1__dataset(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__dataset::complete = complete;
@@ -5413,13 +5468,14 @@ soap_instantiate_ns1__dataCollectionDataset(struct soap *, int, const char *,
 
 inline ns1__dataCollectionDataset *
 soap_new_ns1__dataCollectionDataset(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__dataCollectionDataset(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__dataCollectionDataset(soap, n, nullptr, nullptr,
+                                                     nullptr);
 }
 
 inline ns1__dataCollectionDataset *
 soap_new_req_ns1__dataCollectionDataset(struct soap *soap) {
-  ns1__dataCollectionDataset *_p =
-      soap_instantiate_ns1__dataCollectionDataset(soap, -1, NULL, NULL, NULL);
+  ns1__dataCollectionDataset *_p = soap_instantiate_ns1__dataCollectionDataset(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -5430,8 +5486,8 @@ inline ns1__dataCollectionDataset *soap_new_set_ns1__dataCollectionDataset(
     struct soap *soap, ns1__dataCollection *dataCollection,
     ns1__dataset *dataset, std::string *createId1, time_t *createTime1,
     time_t *modTime1, LONG64 *id1, std::string *modId1, char *__item2) {
-  ns1__dataCollectionDataset *_p =
-      soap_instantiate_ns1__dataCollectionDataset(soap, -1, NULL, NULL, NULL);
+  ns1__dataCollectionDataset *_p = soap_instantiate_ns1__dataCollectionDataset(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__dataCollectionDataset::dataCollection = dataCollection;
@@ -5494,13 +5550,14 @@ soap_instantiate_ns1__dataCollection(struct soap *, int, const char *,
 
 inline ns1__dataCollection *soap_new_ns1__dataCollection(struct soap *soap,
                                                          int n = -1) {
-  return soap_instantiate_ns1__dataCollection(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__dataCollection(soap, n, nullptr, nullptr,
+                                              nullptr);
 }
 
 inline ns1__dataCollection *
 soap_new_req_ns1__dataCollection(struct soap *soap) {
   ns1__dataCollection *_p =
-      soap_instantiate_ns1__dataCollection(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__dataCollection(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -5516,7 +5573,7 @@ inline ns1__dataCollection *soap_new_set_ns1__dataCollection(
     std::string *createId1, time_t *createTime1, time_t *modTime1, LONG64 *id1,
     std::string *modId1, char *__item2) {
   ns1__dataCollection *_p =
-      soap_instantiate_ns1__dataCollection(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__dataCollection(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__dataCollection::dataCollectionDatafiles = dataCollectionDatafiles;
@@ -5584,14 +5641,15 @@ soap_instantiate_ns1__dataCollectionDatafile(struct soap *, int, const char *,
 
 inline ns1__dataCollectionDatafile *
 soap_new_ns1__dataCollectionDatafile(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__dataCollectionDatafile(soap, n, NULL, NULL,
-                                                      NULL);
+  return soap_instantiate_ns1__dataCollectionDatafile(soap, n, nullptr, nullptr,
+                                                      nullptr);
 }
 
 inline ns1__dataCollectionDatafile *
 soap_new_req_ns1__dataCollectionDatafile(struct soap *soap) {
   ns1__dataCollectionDatafile *_p =
-      soap_instantiate_ns1__dataCollectionDatafile(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__dataCollectionDatafile(soap, -1, nullptr, nullptr,
+                                                   nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -5603,7 +5661,8 @@ inline ns1__dataCollectionDatafile *soap_new_set_ns1__dataCollectionDatafile(
     ns1__datafile *datafile, std::string *createId1, time_t *createTime1,
     time_t *modTime1, LONG64 *id1, std::string *modId1, char *__item2) {
   ns1__dataCollectionDatafile *_p =
-      soap_instantiate_ns1__dataCollectionDatafile(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__dataCollectionDatafile(soap, -1, nullptr, nullptr,
+                                                   nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__dataCollectionDatafile::dataCollection = dataCollection;
@@ -5664,12 +5723,12 @@ soap_instantiate_ns1__datafile(struct soap *, int, const char *, const char *,
                                size_t *);
 
 inline ns1__datafile *soap_new_ns1__datafile(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__datafile(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__datafile(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline ns1__datafile *soap_new_req_ns1__datafile(struct soap *soap) {
   ns1__datafile *_p =
-      soap_instantiate_ns1__datafile(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__datafile(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -5688,7 +5747,7 @@ inline ns1__datafile *soap_new_set_ns1__datafile(
     std::string *createId1, time_t *createTime1, time_t *modTime1, LONG64 *id1,
     std::string *modId1, char *__item2) {
   ns1__datafile *_p =
-      soap_instantiate_ns1__datafile(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__datafile(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__datafile::checksum = checksum;
@@ -5756,11 +5815,12 @@ soap_instantiate_ns1__dummy(struct soap *, int, const char *, const char *,
                             size_t *);
 
 inline ns1__dummy *soap_new_ns1__dummy(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__dummy(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__dummy(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline ns1__dummy *soap_new_req_ns1__dummy(struct soap *soap) {
-  ns1__dummy *_p = soap_instantiate_ns1__dummy(soap, -1, NULL, NULL, NULL);
+  ns1__dummy *_p =
+      soap_instantiate_ns1__dummy(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -5783,7 +5843,8 @@ inline ns1__dummy *soap_new_set_ns1__dummy(
     ns1__dataCollectionDatafile *arg29, ns1__grouping *arg30,
     ns1__userGroup *arg31, ns1__log *arg32, ns1__publicStep *arg33,
     char *__item1) {
-  ns1__dummy *_p = soap_instantiate_ns1__dummy(soap, -1, NULL, NULL, NULL);
+  ns1__dummy *_p =
+      soap_instantiate_ns1__dummy(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__dummy::arg0 = arg0;
@@ -5870,12 +5931,13 @@ soap_instantiate_ns1__loginResponse(struct soap *, int, const char *,
 
 inline ns1__loginResponse *soap_new_ns1__loginResponse(struct soap *soap,
                                                        int n = -1) {
-  return soap_instantiate_ns1__loginResponse(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__loginResponse(soap, n, nullptr, nullptr,
+                                             nullptr);
 }
 
 inline ns1__loginResponse *soap_new_req_ns1__loginResponse(struct soap *soap) {
   ns1__loginResponse *_p =
-      soap_instantiate_ns1__loginResponse(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__loginResponse(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -5886,7 +5948,7 @@ inline ns1__loginResponse *soap_new_set_ns1__loginResponse(struct soap *soap,
                                                            std::string *return_,
                                                            char *__item1) {
   ns1__loginResponse *_p =
-      soap_instantiate_ns1__loginResponse(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__loginResponse(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__loginResponse::return_ = return_;
@@ -5937,13 +5999,14 @@ soap_instantiate_ns1__login(struct soap *, int, const char *, const char *,
                             size_t *);
 
 inline ns1__login *soap_new_ns1__login(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__login(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__login(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline ns1__login *
 soap_new_req_ns1__login(struct soap *soap,
                         _ns1__login_credentials &credentials) {
-  ns1__login *_p = soap_instantiate_ns1__login(soap, -1, NULL, NULL, NULL);
+  ns1__login *_p =
+      soap_instantiate_ns1__login(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__login::credentials = credentials;
@@ -5955,7 +6018,8 @@ inline ns1__login *soap_new_set_ns1__login(struct soap *soap,
                                            std::string *plugin,
                                            _ns1__login_credentials &credentials,
                                            char *__item1) {
-  ns1__login *_p = soap_instantiate_ns1__login(soap, -1, NULL, NULL, NULL);
+  ns1__login *_p =
+      soap_instantiate_ns1__login(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__login::plugin = plugin;
@@ -6010,13 +6074,14 @@ soap_instantiate_ns1__refreshResponse(struct soap *, int, const char *,
 
 inline ns1__refreshResponse *soap_new_ns1__refreshResponse(struct soap *soap,
                                                            int n = -1) {
-  return soap_instantiate_ns1__refreshResponse(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__refreshResponse(soap, n, nullptr, nullptr,
+                                               nullptr);
 }
 
 inline ns1__refreshResponse *
 soap_new_req_ns1__refreshResponse(struct soap *soap) {
-  ns1__refreshResponse *_p =
-      soap_instantiate_ns1__refreshResponse(soap, -1, NULL, NULL, NULL);
+  ns1__refreshResponse *_p = soap_instantiate_ns1__refreshResponse(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -6025,8 +6090,8 @@ soap_new_req_ns1__refreshResponse(struct soap *soap) {
 
 inline ns1__refreshResponse *
 soap_new_set_ns1__refreshResponse(struct soap *soap, char *__item1) {
-  ns1__refreshResponse *_p =
-      soap_instantiate_ns1__refreshResponse(soap, -1, NULL, NULL, NULL);
+  ns1__refreshResponse *_p = soap_instantiate_ns1__refreshResponse(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->xsd__anyType::__item = __item1;
@@ -6078,11 +6143,12 @@ soap_instantiate_ns1__refresh(struct soap *, int, const char *, const char *,
                               size_t *);
 
 inline ns1__refresh *soap_new_ns1__refresh(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__refresh(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__refresh(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline ns1__refresh *soap_new_req_ns1__refresh(struct soap *soap) {
-  ns1__refresh *_p = soap_instantiate_ns1__refresh(soap, -1, NULL, NULL, NULL);
+  ns1__refresh *_p =
+      soap_instantiate_ns1__refresh(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -6092,7 +6158,8 @@ inline ns1__refresh *soap_new_req_ns1__refresh(struct soap *soap) {
 inline ns1__refresh *soap_new_set_ns1__refresh(struct soap *soap,
                                                std::string *sessionId,
                                                char *__item1) {
-  ns1__refresh *_p = soap_instantiate_ns1__refresh(soap, -1, NULL, NULL, NULL);
+  ns1__refresh *_p =
+      soap_instantiate_ns1__refresh(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__refresh::sessionId = sessionId;
@@ -6148,13 +6215,14 @@ soap_instantiate_ns1__getUserNameResponse(struct soap *, int, const char *,
 
 inline ns1__getUserNameResponse *
 soap_new_ns1__getUserNameResponse(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__getUserNameResponse(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__getUserNameResponse(soap, n, nullptr, nullptr,
+                                                   nullptr);
 }
 
 inline ns1__getUserNameResponse *
 soap_new_req_ns1__getUserNameResponse(struct soap *soap) {
-  ns1__getUserNameResponse *_p =
-      soap_instantiate_ns1__getUserNameResponse(soap, -1, NULL, NULL, NULL);
+  ns1__getUserNameResponse *_p = soap_instantiate_ns1__getUserNameResponse(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -6164,8 +6232,8 @@ soap_new_req_ns1__getUserNameResponse(struct soap *soap) {
 inline ns1__getUserNameResponse *
 soap_new_set_ns1__getUserNameResponse(struct soap *soap, std::string *return_,
                                       char *__item1) {
-  ns1__getUserNameResponse *_p =
-      soap_instantiate_ns1__getUserNameResponse(soap, -1, NULL, NULL, NULL);
+  ns1__getUserNameResponse *_p = soap_instantiate_ns1__getUserNameResponse(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__getUserNameResponse::return_ = return_;
@@ -6220,12 +6288,12 @@ soap_instantiate_ns1__getUserName(struct soap *, int, const char *,
 
 inline ns1__getUserName *soap_new_ns1__getUserName(struct soap *soap,
                                                    int n = -1) {
-  return soap_instantiate_ns1__getUserName(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__getUserName(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline ns1__getUserName *soap_new_req_ns1__getUserName(struct soap *soap) {
   ns1__getUserName *_p =
-      soap_instantiate_ns1__getUserName(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__getUserName(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -6236,7 +6304,7 @@ inline ns1__getUserName *soap_new_set_ns1__getUserName(struct soap *soap,
                                                        std::string *sessionId,
                                                        char *__item1) {
   ns1__getUserName *_p =
-      soap_instantiate_ns1__getUserName(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__getUserName(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__getUserName::sessionId = sessionId;
@@ -6292,13 +6360,14 @@ soap_instantiate_ns1__deleteManyResponse(struct soap *, int, const char *,
 
 inline ns1__deleteManyResponse *
 soap_new_ns1__deleteManyResponse(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__deleteManyResponse(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__deleteManyResponse(soap, n, nullptr, nullptr,
+                                                  nullptr);
 }
 
 inline ns1__deleteManyResponse *
 soap_new_req_ns1__deleteManyResponse(struct soap *soap) {
-  ns1__deleteManyResponse *_p =
-      soap_instantiate_ns1__deleteManyResponse(soap, -1, NULL, NULL, NULL);
+  ns1__deleteManyResponse *_p = soap_instantiate_ns1__deleteManyResponse(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -6307,8 +6376,8 @@ soap_new_req_ns1__deleteManyResponse(struct soap *soap) {
 
 inline ns1__deleteManyResponse *
 soap_new_set_ns1__deleteManyResponse(struct soap *soap, char *__item1) {
-  ns1__deleteManyResponse *_p =
-      soap_instantiate_ns1__deleteManyResponse(soap, -1, NULL, NULL, NULL);
+  ns1__deleteManyResponse *_p = soap_instantiate_ns1__deleteManyResponse(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->xsd__anyType::__item = __item1;
@@ -6362,12 +6431,12 @@ soap_instantiate_ns1__deleteMany(struct soap *, int, const char *, const char *,
 
 inline ns1__deleteMany *soap_new_ns1__deleteMany(struct soap *soap,
                                                  int n = -1) {
-  return soap_instantiate_ns1__deleteMany(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__deleteMany(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline ns1__deleteMany *soap_new_req_ns1__deleteMany(struct soap *soap) {
   ns1__deleteMany *_p =
-      soap_instantiate_ns1__deleteMany(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__deleteMany(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -6379,7 +6448,7 @@ soap_new_set_ns1__deleteMany(struct soap *soap, std::string *sessionId,
                              std::vector<ns1__entityBaseBean *> &beans,
                              char *__item1) {
   ns1__deleteMany *_p =
-      soap_instantiate_ns1__deleteMany(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__deleteMany(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__deleteMany::sessionId = sessionId;
@@ -6435,13 +6504,14 @@ soap_instantiate_ns1__updateResponse(struct soap *, int, const char *,
 
 inline ns1__updateResponse *soap_new_ns1__updateResponse(struct soap *soap,
                                                          int n = -1) {
-  return soap_instantiate_ns1__updateResponse(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__updateResponse(soap, n, nullptr, nullptr,
+                                              nullptr);
 }
 
 inline ns1__updateResponse *
 soap_new_req_ns1__updateResponse(struct soap *soap) {
   ns1__updateResponse *_p =
-      soap_instantiate_ns1__updateResponse(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__updateResponse(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -6451,7 +6521,7 @@ soap_new_req_ns1__updateResponse(struct soap *soap) {
 inline ns1__updateResponse *soap_new_set_ns1__updateResponse(struct soap *soap,
                                                              char *__item1) {
   ns1__updateResponse *_p =
-      soap_instantiate_ns1__updateResponse(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__updateResponse(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->xsd__anyType::__item = __item1;
@@ -6502,11 +6572,12 @@ soap_instantiate_ns1__update(struct soap *, int, const char *, const char *,
                              size_t *);
 
 inline ns1__update *soap_new_ns1__update(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__update(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__update(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline ns1__update *soap_new_req_ns1__update(struct soap *soap) {
-  ns1__update *_p = soap_instantiate_ns1__update(soap, -1, NULL, NULL, NULL);
+  ns1__update *_p =
+      soap_instantiate_ns1__update(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -6517,7 +6588,8 @@ inline ns1__update *soap_new_set_ns1__update(struct soap *soap,
                                              std::string *sessionId,
                                              ns1__entityBaseBean *bean,
                                              char *__item1) {
-  ns1__update *_p = soap_instantiate_ns1__update(soap, -1, NULL, NULL, NULL);
+  ns1__update *_p =
+      soap_instantiate_ns1__update(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__update::sessionId = sessionId;
@@ -6577,15 +6649,15 @@ soap_instantiate_ns1__luceneGetPopulatingResponse(struct soap *, int,
 
 inline ns1__luceneGetPopulatingResponse *
 soap_new_ns1__luceneGetPopulatingResponse(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__luceneGetPopulatingResponse(soap, n, NULL, NULL,
-                                                           NULL);
+  return soap_instantiate_ns1__luceneGetPopulatingResponse(soap, n, nullptr,
+                                                           nullptr, nullptr);
 }
 
 inline ns1__luceneGetPopulatingResponse *
 soap_new_req_ns1__luceneGetPopulatingResponse(struct soap *soap) {
   ns1__luceneGetPopulatingResponse *_p =
-      soap_instantiate_ns1__luceneGetPopulatingResponse(soap, -1, NULL, NULL,
-                                                        NULL);
+      soap_instantiate_ns1__luceneGetPopulatingResponse(soap, -1, nullptr,
+                                                        nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -6597,8 +6669,8 @@ soap_new_set_ns1__luceneGetPopulatingResponse(struct soap *soap,
                                               std::vector<std::string> &return_,
                                               char *__item1) {
   ns1__luceneGetPopulatingResponse *_p =
-      soap_instantiate_ns1__luceneGetPopulatingResponse(soap, -1, NULL, NULL,
-                                                        NULL);
+      soap_instantiate_ns1__luceneGetPopulatingResponse(soap, -1, nullptr,
+                                                        nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__luceneGetPopulatingResponse::return_ = return_;
@@ -6655,13 +6727,14 @@ soap_instantiate_ns1__luceneGetPopulating(struct soap *, int, const char *,
 
 inline ns1__luceneGetPopulating *
 soap_new_ns1__luceneGetPopulating(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__luceneGetPopulating(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__luceneGetPopulating(soap, n, nullptr, nullptr,
+                                                   nullptr);
 }
 
 inline ns1__luceneGetPopulating *
 soap_new_req_ns1__luceneGetPopulating(struct soap *soap) {
-  ns1__luceneGetPopulating *_p =
-      soap_instantiate_ns1__luceneGetPopulating(soap, -1, NULL, NULL, NULL);
+  ns1__luceneGetPopulating *_p = soap_instantiate_ns1__luceneGetPopulating(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -6671,8 +6744,8 @@ soap_new_req_ns1__luceneGetPopulating(struct soap *soap) {
 inline ns1__luceneGetPopulating *
 soap_new_set_ns1__luceneGetPopulating(struct soap *soap, std::string *sessionId,
                                       char *__item1) {
-  ns1__luceneGetPopulating *_p =
-      soap_instantiate_ns1__luceneGetPopulating(soap, -1, NULL, NULL, NULL);
+  ns1__luceneGetPopulating *_p = soap_instantiate_ns1__luceneGetPopulating(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__luceneGetPopulating::sessionId = sessionId;
@@ -6729,13 +6802,14 @@ soap_instantiate_ns1__getApiVersionResponse(struct soap *, int, const char *,
 
 inline ns1__getApiVersionResponse *
 soap_new_ns1__getApiVersionResponse(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__getApiVersionResponse(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__getApiVersionResponse(soap, n, nullptr, nullptr,
+                                                     nullptr);
 }
 
 inline ns1__getApiVersionResponse *
 soap_new_req_ns1__getApiVersionResponse(struct soap *soap) {
-  ns1__getApiVersionResponse *_p =
-      soap_instantiate_ns1__getApiVersionResponse(soap, -1, NULL, NULL, NULL);
+  ns1__getApiVersionResponse *_p = soap_instantiate_ns1__getApiVersionResponse(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -6745,8 +6819,8 @@ soap_new_req_ns1__getApiVersionResponse(struct soap *soap) {
 inline ns1__getApiVersionResponse *
 soap_new_set_ns1__getApiVersionResponse(struct soap *soap, std::string *return_,
                                         char *__item1) {
-  ns1__getApiVersionResponse *_p =
-      soap_instantiate_ns1__getApiVersionResponse(soap, -1, NULL, NULL, NULL);
+  ns1__getApiVersionResponse *_p = soap_instantiate_ns1__getApiVersionResponse(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__getApiVersionResponse::return_ = return_;
@@ -6803,12 +6877,13 @@ soap_instantiate_ns1__getApiVersion(struct soap *, int, const char *,
 
 inline ns1__getApiVersion *soap_new_ns1__getApiVersion(struct soap *soap,
                                                        int n = -1) {
-  return soap_instantiate_ns1__getApiVersion(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__getApiVersion(soap, n, nullptr, nullptr,
+                                             nullptr);
 }
 
 inline ns1__getApiVersion *soap_new_req_ns1__getApiVersion(struct soap *soap) {
   ns1__getApiVersion *_p =
-      soap_instantiate_ns1__getApiVersion(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__getApiVersion(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -6818,7 +6893,7 @@ inline ns1__getApiVersion *soap_new_req_ns1__getApiVersion(struct soap *soap) {
 inline ns1__getApiVersion *soap_new_set_ns1__getApiVersion(struct soap *soap,
                                                            char *__item1) {
   ns1__getApiVersion *_p =
-      soap_instantiate_ns1__getApiVersion(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__getApiVersion(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->xsd__anyType::__item = __item1;
@@ -6876,14 +6951,15 @@ soap_instantiate_ns1__getEntityNamesResponse(struct soap *, int, const char *,
 
 inline ns1__getEntityNamesResponse *
 soap_new_ns1__getEntityNamesResponse(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__getEntityNamesResponse(soap, n, NULL, NULL,
-                                                      NULL);
+  return soap_instantiate_ns1__getEntityNamesResponse(soap, n, nullptr, nullptr,
+                                                      nullptr);
 }
 
 inline ns1__getEntityNamesResponse *
 soap_new_req_ns1__getEntityNamesResponse(struct soap *soap) {
   ns1__getEntityNamesResponse *_p =
-      soap_instantiate_ns1__getEntityNamesResponse(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__getEntityNamesResponse(soap, -1, nullptr, nullptr,
+                                                   nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -6893,7 +6969,8 @@ soap_new_req_ns1__getEntityNamesResponse(struct soap *soap) {
 inline ns1__getEntityNamesResponse *soap_new_set_ns1__getEntityNamesResponse(
     struct soap *soap, std::vector<std::string> &return_, char *__item1) {
   ns1__getEntityNamesResponse *_p =
-      soap_instantiate_ns1__getEntityNamesResponse(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__getEntityNamesResponse(soap, -1, nullptr, nullptr,
+                                                   nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__getEntityNamesResponse::return_ = return_;
@@ -6950,13 +7027,14 @@ soap_instantiate_ns1__getEntityNames(struct soap *, int, const char *,
 
 inline ns1__getEntityNames *soap_new_ns1__getEntityNames(struct soap *soap,
                                                          int n = -1) {
-  return soap_instantiate_ns1__getEntityNames(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__getEntityNames(soap, n, nullptr, nullptr,
+                                              nullptr);
 }
 
 inline ns1__getEntityNames *
 soap_new_req_ns1__getEntityNames(struct soap *soap) {
   ns1__getEntityNames *_p =
-      soap_instantiate_ns1__getEntityNames(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__getEntityNames(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -6966,7 +7044,7 @@ soap_new_req_ns1__getEntityNames(struct soap *soap) {
 inline ns1__getEntityNames *soap_new_set_ns1__getEntityNames(struct soap *soap,
                                                              char *__item1) {
   ns1__getEntityNames *_p =
-      soap_instantiate_ns1__getEntityNames(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__getEntityNames(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->xsd__anyType::__item = __item1;
@@ -7020,12 +7098,12 @@ soap_instantiate_ns1__getResponse(struct soap *, int, const char *,
 
 inline ns1__getResponse *soap_new_ns1__getResponse(struct soap *soap,
                                                    int n = -1) {
-  return soap_instantiate_ns1__getResponse(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__getResponse(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline ns1__getResponse *soap_new_req_ns1__getResponse(struct soap *soap) {
   ns1__getResponse *_p =
-      soap_instantiate_ns1__getResponse(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__getResponse(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -7036,7 +7114,7 @@ inline ns1__getResponse *
 soap_new_set_ns1__getResponse(struct soap *soap, ns1__entityBaseBean *return_,
                               char *__item1) {
   ns1__getResponse *_p =
-      soap_instantiate_ns1__getResponse(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__getResponse(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__getResponse::return_ = return_;
@@ -7087,11 +7165,11 @@ soap_instantiate_ns1__get(struct soap *, int, const char *, const char *,
                           size_t *);
 
 inline ns1__get *soap_new_ns1__get(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__get(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__get(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline ns1__get *soap_new_req_ns1__get(struct soap *soap, LONG64 primaryKey) {
-  ns1__get *_p = soap_instantiate_ns1__get(soap, -1, NULL, NULL, NULL);
+  ns1__get *_p = soap_instantiate_ns1__get(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__get::primaryKey = primaryKey;
@@ -7103,7 +7181,7 @@ inline ns1__get *soap_new_set_ns1__get(struct soap *soap,
                                        std::string *sessionId,
                                        std::string *query, LONG64 primaryKey,
                                        char *__item1) {
-  ns1__get *_p = soap_instantiate_ns1__get(soap, -1, NULL, NULL, NULL);
+  ns1__get *_p = soap_instantiate_ns1__get(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__get::sessionId = sessionId;
@@ -7162,14 +7240,15 @@ soap_instantiate_ns1__lucenePopulateResponse(struct soap *, int, const char *,
 
 inline ns1__lucenePopulateResponse *
 soap_new_ns1__lucenePopulateResponse(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__lucenePopulateResponse(soap, n, NULL, NULL,
-                                                      NULL);
+  return soap_instantiate_ns1__lucenePopulateResponse(soap, n, nullptr, nullptr,
+                                                      nullptr);
 }
 
 inline ns1__lucenePopulateResponse *
 soap_new_req_ns1__lucenePopulateResponse(struct soap *soap) {
   ns1__lucenePopulateResponse *_p =
-      soap_instantiate_ns1__lucenePopulateResponse(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__lucenePopulateResponse(soap, -1, nullptr, nullptr,
+                                                   nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -7179,7 +7258,8 @@ soap_new_req_ns1__lucenePopulateResponse(struct soap *soap) {
 inline ns1__lucenePopulateResponse *
 soap_new_set_ns1__lucenePopulateResponse(struct soap *soap, char *__item1) {
   ns1__lucenePopulateResponse *_p =
-      soap_instantiate_ns1__lucenePopulateResponse(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__lucenePopulateResponse(soap, -1, nullptr, nullptr,
+                                                   nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->xsd__anyType::__item = __item1;
@@ -7235,13 +7315,14 @@ soap_instantiate_ns1__lucenePopulate(struct soap *, int, const char *,
 
 inline ns1__lucenePopulate *soap_new_ns1__lucenePopulate(struct soap *soap,
                                                          int n = -1) {
-  return soap_instantiate_ns1__lucenePopulate(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__lucenePopulate(soap, n, nullptr, nullptr,
+                                              nullptr);
 }
 
 inline ns1__lucenePopulate *
 soap_new_req_ns1__lucenePopulate(struct soap *soap) {
   ns1__lucenePopulate *_p =
-      soap_instantiate_ns1__lucenePopulate(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__lucenePopulate(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -7252,7 +7333,7 @@ inline ns1__lucenePopulate *
 soap_new_set_ns1__lucenePopulate(struct soap *soap, std::string *sessionId,
                                  std::string *entityName, char *__item1) {
   ns1__lucenePopulate *_p =
-      soap_instantiate_ns1__lucenePopulate(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__lucenePopulate(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__lucenePopulate::sessionId = sessionId;
@@ -7310,13 +7391,14 @@ soap_instantiate_ns1__luceneSearchResponse(struct soap *, int, const char *,
 
 inline ns1__luceneSearchResponse *
 soap_new_ns1__luceneSearchResponse(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__luceneSearchResponse(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__luceneSearchResponse(soap, n, nullptr, nullptr,
+                                                    nullptr);
 }
 
 inline ns1__luceneSearchResponse *
 soap_new_req_ns1__luceneSearchResponse(struct soap *soap) {
-  ns1__luceneSearchResponse *_p =
-      soap_instantiate_ns1__luceneSearchResponse(soap, -1, NULL, NULL, NULL);
+  ns1__luceneSearchResponse *_p = soap_instantiate_ns1__luceneSearchResponse(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -7325,8 +7407,8 @@ soap_new_req_ns1__luceneSearchResponse(struct soap *soap) {
 
 inline ns1__luceneSearchResponse *soap_new_set_ns1__luceneSearchResponse(
     struct soap *soap, std::vector<std::string> &return_, char *__item1) {
-  ns1__luceneSearchResponse *_p =
-      soap_instantiate_ns1__luceneSearchResponse(soap, -1, NULL, NULL, NULL);
+  ns1__luceneSearchResponse *_p = soap_instantiate_ns1__luceneSearchResponse(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__luceneSearchResponse::return_ = return_;
@@ -7383,13 +7465,13 @@ soap_instantiate_ns1__luceneSearch(struct soap *, int, const char *,
 
 inline ns1__luceneSearch *soap_new_ns1__luceneSearch(struct soap *soap,
                                                      int n = -1) {
-  return soap_instantiate_ns1__luceneSearch(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__luceneSearch(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline ns1__luceneSearch *soap_new_req_ns1__luceneSearch(struct soap *soap,
                                                          int maxCount) {
   ns1__luceneSearch *_p =
-      soap_instantiate_ns1__luceneSearch(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__luceneSearch(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__luceneSearch::maxCount = maxCount;
@@ -7402,7 +7484,7 @@ soap_new_set_ns1__luceneSearch(struct soap *soap, std::string *sessionId,
                                std::string *query, int maxCount,
                                std::string *entityName, char *__item1) {
   ns1__luceneSearch *_p =
-      soap_instantiate_ns1__luceneSearch(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__luceneSearch(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__luceneSearch::sessionId = sessionId;
@@ -7462,13 +7544,14 @@ soap_instantiate_ns1__getPropertiesResponse(struct soap *, int, const char *,
 
 inline ns1__getPropertiesResponse *
 soap_new_ns1__getPropertiesResponse(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__getPropertiesResponse(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__getPropertiesResponse(soap, n, nullptr, nullptr,
+                                                     nullptr);
 }
 
 inline ns1__getPropertiesResponse *
 soap_new_req_ns1__getPropertiesResponse(struct soap *soap) {
-  ns1__getPropertiesResponse *_p =
-      soap_instantiate_ns1__getPropertiesResponse(soap, -1, NULL, NULL, NULL);
+  ns1__getPropertiesResponse *_p = soap_instantiate_ns1__getPropertiesResponse(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -7477,8 +7560,8 @@ soap_new_req_ns1__getPropertiesResponse(struct soap *soap) {
 
 inline ns1__getPropertiesResponse *soap_new_set_ns1__getPropertiesResponse(
     struct soap *soap, std::vector<std::string> &return_, char *__item1) {
-  ns1__getPropertiesResponse *_p =
-      soap_instantiate_ns1__getPropertiesResponse(soap, -1, NULL, NULL, NULL);
+  ns1__getPropertiesResponse *_p = soap_instantiate_ns1__getPropertiesResponse(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__getPropertiesResponse::return_ = return_;
@@ -7535,12 +7618,13 @@ soap_instantiate_ns1__getProperties(struct soap *, int, const char *,
 
 inline ns1__getProperties *soap_new_ns1__getProperties(struct soap *soap,
                                                        int n = -1) {
-  return soap_instantiate_ns1__getProperties(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__getProperties(soap, n, nullptr, nullptr,
+                                             nullptr);
 }
 
 inline ns1__getProperties *soap_new_req_ns1__getProperties(struct soap *soap) {
   ns1__getProperties *_p =
-      soap_instantiate_ns1__getProperties(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__getProperties(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -7551,7 +7635,7 @@ inline ns1__getProperties *
 soap_new_set_ns1__getProperties(struct soap *soap, std::string *sessionId,
                                 char *__item1) {
   ns1__getProperties *_p =
-      soap_instantiate_ns1__getProperties(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__getProperties(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__getProperties::sessionId = sessionId;
@@ -7607,13 +7691,14 @@ soap_instantiate_ns1__createResponse(struct soap *, int, const char *,
 
 inline ns1__createResponse *soap_new_ns1__createResponse(struct soap *soap,
                                                          int n = -1) {
-  return soap_instantiate_ns1__createResponse(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__createResponse(soap, n, nullptr, nullptr,
+                                              nullptr);
 }
 
 inline ns1__createResponse *soap_new_req_ns1__createResponse(struct soap *soap,
                                                              LONG64 return_) {
   ns1__createResponse *_p =
-      soap_instantiate_ns1__createResponse(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__createResponse(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__createResponse::return_ = return_;
@@ -7625,7 +7710,7 @@ inline ns1__createResponse *soap_new_set_ns1__createResponse(struct soap *soap,
                                                              LONG64 return_,
                                                              char *__item1) {
   ns1__createResponse *_p =
-      soap_instantiate_ns1__createResponse(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__createResponse(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__createResponse::return_ = return_;
@@ -7677,11 +7762,12 @@ soap_instantiate_ns1__create(struct soap *, int, const char *, const char *,
                              size_t *);
 
 inline ns1__create *soap_new_ns1__create(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__create(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__create(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline ns1__create *soap_new_req_ns1__create(struct soap *soap) {
-  ns1__create *_p = soap_instantiate_ns1__create(soap, -1, NULL, NULL, NULL);
+  ns1__create *_p =
+      soap_instantiate_ns1__create(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -7692,7 +7778,8 @@ inline ns1__create *soap_new_set_ns1__create(struct soap *soap,
                                              std::string *sessionId,
                                              ns1__entityBaseBean *bean,
                                              char *__item1) {
-  ns1__create *_p = soap_instantiate_ns1__create(soap, -1, NULL, NULL, NULL);
+  ns1__create *_p =
+      soap_instantiate_ns1__create(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__create::sessionId = sessionId;
@@ -7748,13 +7835,14 @@ soap_instantiate_ns1__createManyResponse(struct soap *, int, const char *,
 
 inline ns1__createManyResponse *
 soap_new_ns1__createManyResponse(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__createManyResponse(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__createManyResponse(soap, n, nullptr, nullptr,
+                                                  nullptr);
 }
 
 inline ns1__createManyResponse *
 soap_new_req_ns1__createManyResponse(struct soap *soap) {
-  ns1__createManyResponse *_p =
-      soap_instantiate_ns1__createManyResponse(soap, -1, NULL, NULL, NULL);
+  ns1__createManyResponse *_p = soap_instantiate_ns1__createManyResponse(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -7763,8 +7851,8 @@ soap_new_req_ns1__createManyResponse(struct soap *soap) {
 
 inline ns1__createManyResponse *soap_new_set_ns1__createManyResponse(
     struct soap *soap, std::vector<LONG64> &return_, char *__item1) {
-  ns1__createManyResponse *_p =
-      soap_instantiate_ns1__createManyResponse(soap, -1, NULL, NULL, NULL);
+  ns1__createManyResponse *_p = soap_instantiate_ns1__createManyResponse(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__createManyResponse::return_ = return_;
@@ -7820,13 +7908,14 @@ soap_instantiate_ns1__entityBaseBean(struct soap *, int, const char *,
 
 inline ns1__entityBaseBean *soap_new_ns1__entityBaseBean(struct soap *soap,
                                                          int n = -1) {
-  return soap_instantiate_ns1__entityBaseBean(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__entityBaseBean(soap, n, nullptr, nullptr,
+                                              nullptr);
 }
 
 inline ns1__entityBaseBean *
 soap_new_req_ns1__entityBaseBean(struct soap *soap) {
   ns1__entityBaseBean *_p =
-      soap_instantiate_ns1__entityBaseBean(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__entityBaseBean(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -7837,7 +7926,7 @@ inline ns1__entityBaseBean *soap_new_set_ns1__entityBaseBean(
     struct soap *soap, std::string *createId, time_t *createTime,
     time_t *modTime, LONG64 *id, std::string *modId, char *__item1) {
   ns1__entityBaseBean *_p =
-      soap_instantiate_ns1__entityBaseBean(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__entityBaseBean(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__entityBaseBean::createId = createId;
@@ -7896,12 +7985,12 @@ soap_instantiate_ns1__createMany(struct soap *, int, const char *, const char *,
 
 inline ns1__createMany *soap_new_ns1__createMany(struct soap *soap,
                                                  int n = -1) {
-  return soap_instantiate_ns1__createMany(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__createMany(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline ns1__createMany *soap_new_req_ns1__createMany(struct soap *soap) {
   ns1__createMany *_p =
-      soap_instantiate_ns1__createMany(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__createMany(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -7913,7 +8002,7 @@ soap_new_set_ns1__createMany(struct soap *soap, std::string *sessionId,
                              std::vector<ns1__entityBaseBean *> &beans,
                              char *__item1) {
   ns1__createMany *_p =
-      soap_instantiate_ns1__createMany(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__createMany(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__createMany::sessionId = sessionId;
@@ -7969,13 +8058,14 @@ soap_instantiate_ns1__IcatException(struct soap *, int, const char *,
 
 inline ns1__IcatException *soap_new_ns1__IcatException(struct soap *soap,
                                                        int n = -1) {
-  return soap_instantiate_ns1__IcatException(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__IcatException(soap, n, nullptr, nullptr,
+                                             nullptr);
 }
 
 inline ns1__IcatException *soap_new_req_ns1__IcatException(struct soap *soap,
                                                            int offset) {
   ns1__IcatException *_p =
-      soap_instantiate_ns1__IcatException(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__IcatException(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__IcatException::offset = offset;
@@ -7988,7 +8078,7 @@ soap_new_set_ns1__IcatException(struct soap *soap, std::string *message,
                                 int offset, enum ns1__icatExceptionType *type,
                                 char *__item1) {
   ns1__IcatException *_p =
-      soap_instantiate_ns1__IcatException(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__IcatException(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__IcatException::message = message;
@@ -8047,13 +8137,14 @@ soap_instantiate_ns1__luceneClearResponse(struct soap *, int, const char *,
 
 inline ns1__luceneClearResponse *
 soap_new_ns1__luceneClearResponse(struct soap *soap, int n = -1) {
-  return soap_instantiate_ns1__luceneClearResponse(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__luceneClearResponse(soap, n, nullptr, nullptr,
+                                                   nullptr);
 }
 
 inline ns1__luceneClearResponse *
 soap_new_req_ns1__luceneClearResponse(struct soap *soap) {
-  ns1__luceneClearResponse *_p =
-      soap_instantiate_ns1__luceneClearResponse(soap, -1, NULL, NULL, NULL);
+  ns1__luceneClearResponse *_p = soap_instantiate_ns1__luceneClearResponse(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -8062,8 +8153,8 @@ soap_new_req_ns1__luceneClearResponse(struct soap *soap) {
 
 inline ns1__luceneClearResponse *
 soap_new_set_ns1__luceneClearResponse(struct soap *soap, char *__item1) {
-  ns1__luceneClearResponse *_p =
-      soap_instantiate_ns1__luceneClearResponse(soap, -1, NULL, NULL, NULL);
+  ns1__luceneClearResponse *_p = soap_instantiate_ns1__luceneClearResponse(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->xsd__anyType::__item = __item1;
@@ -8117,12 +8208,12 @@ soap_instantiate_ns1__luceneClear(struct soap *, int, const char *,
 
 inline ns1__luceneClear *soap_new_ns1__luceneClear(struct soap *soap,
                                                    int n = -1) {
-  return soap_instantiate_ns1__luceneClear(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_ns1__luceneClear(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline ns1__luceneClear *soap_new_req_ns1__luceneClear(struct soap *soap) {
   ns1__luceneClear *_p =
-      soap_instantiate_ns1__luceneClear(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__luceneClear(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -8133,7 +8224,7 @@ inline ns1__luceneClear *soap_new_set_ns1__luceneClear(struct soap *soap,
                                                        std::string *sessionId,
                                                        char *__item1) {
   ns1__luceneClear *_p =
-      soap_instantiate_ns1__luceneClear(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_ns1__luceneClear(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->ns1__luceneClear::sessionId = sessionId;
@@ -8192,11 +8283,12 @@ soap_instantiate_std__string(struct soap *, int, const char *, const char *,
                              size_t *);
 
 inline std::string *soap_new_std__string(struct soap *soap, int n = -1) {
-  return soap_instantiate_std__string(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_std__string(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline std::string *soap_new_req_std__string(struct soap *soap) {
-  std::string *_p = soap_instantiate_std__string(soap, -1, NULL, NULL, NULL);
+  std::string *_p =
+      soap_instantiate_std__string(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default_std__string(soap, _p);
   }
@@ -8204,7 +8296,8 @@ inline std::string *soap_new_req_std__string(struct soap *soap) {
 }
 
 inline std::string *soap_new_set_std__string(struct soap *soap) {
-  std::string *_p = soap_instantiate_std__string(soap, -1, NULL, NULL, NULL);
+  std::string *_p =
+      soap_instantiate_std__string(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default_std__string(soap, _p);
   }
@@ -8253,12 +8346,13 @@ soap_instantiate_xsd__string(struct soap *, int, const char *, const char *,
                              size_t *);
 
 inline xsd__string *soap_new_xsd__string(struct soap *soap, int n = -1) {
-  return soap_instantiate_xsd__string(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_xsd__string(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline xsd__string *soap_new_req_xsd__string(struct soap *soap,
                                              std::string &__item) {
-  xsd__string *_p = soap_instantiate_xsd__string(soap, -1, NULL, NULL, NULL);
+  xsd__string *_p =
+      soap_instantiate_xsd__string(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->xsd__string::__item = __item;
@@ -8269,7 +8363,8 @@ inline xsd__string *soap_new_req_xsd__string(struct soap *soap,
 inline xsd__string *soap_new_set_xsd__string(struct soap *soap,
                                              std::string &__item,
                                              char *__item1) {
-  xsd__string *_p = soap_instantiate_xsd__string(soap, -1, NULL, NULL, NULL);
+  xsd__string *_p =
+      soap_instantiate_xsd__string(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->xsd__string::__item = __item;
@@ -8319,11 +8414,12 @@ soap_instantiate_xsd__long(struct soap *, int, const char *, const char *,
                            size_t *);
 
 inline xsd__long *soap_new_xsd__long(struct soap *soap, int n = -1) {
-  return soap_instantiate_xsd__long(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_xsd__long(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline xsd__long *soap_new_req_xsd__long(struct soap *soap, LONG64 __item) {
-  xsd__long *_p = soap_instantiate_xsd__long(soap, -1, NULL, NULL, NULL);
+  xsd__long *_p =
+      soap_instantiate_xsd__long(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->xsd__long::__item = __item;
@@ -8333,7 +8429,8 @@ inline xsd__long *soap_new_req_xsd__long(struct soap *soap, LONG64 __item) {
 
 inline xsd__long *soap_new_set_xsd__long(struct soap *soap, LONG64 __item,
                                          char *__item1) {
-  xsd__long *_p = soap_instantiate_xsd__long(soap, -1, NULL, NULL, NULL);
+  xsd__long *_p =
+      soap_instantiate_xsd__long(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->xsd__long::__item = __item;
@@ -8382,11 +8479,11 @@ soap_instantiate_xsd__int(struct soap *, int, const char *, const char *,
                           size_t *);
 
 inline xsd__int *soap_new_xsd__int(struct soap *soap, int n = -1) {
-  return soap_instantiate_xsd__int(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_xsd__int(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline xsd__int *soap_new_req_xsd__int(struct soap *soap, int __item) {
-  xsd__int *_p = soap_instantiate_xsd__int(soap, -1, NULL, NULL, NULL);
+  xsd__int *_p = soap_instantiate_xsd__int(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->xsd__int::__item = __item;
@@ -8396,7 +8493,7 @@ inline xsd__int *soap_new_req_xsd__int(struct soap *soap, int __item) {
 
 inline xsd__int *soap_new_set_xsd__int(struct soap *soap, int __item,
                                        char *__item1) {
-  xsd__int *_p = soap_instantiate_xsd__int(soap, -1, NULL, NULL, NULL);
+  xsd__int *_p = soap_instantiate_xsd__int(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->xsd__int::__item = __item;
@@ -8446,11 +8543,12 @@ soap_instantiate_xsd__double(struct soap *, int, const char *, const char *,
                              size_t *);
 
 inline xsd__double *soap_new_xsd__double(struct soap *soap, int n = -1) {
-  return soap_instantiate_xsd__double(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_xsd__double(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline xsd__double *soap_new_req_xsd__double(struct soap *soap, double __item) {
-  xsd__double *_p = soap_instantiate_xsd__double(soap, -1, NULL, NULL, NULL);
+  xsd__double *_p =
+      soap_instantiate_xsd__double(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->xsd__double::__item = __item;
@@ -8460,7 +8558,8 @@ inline xsd__double *soap_new_req_xsd__double(struct soap *soap, double __item) {
 
 inline xsd__double *soap_new_set_xsd__double(struct soap *soap, double __item,
                                              char *__item1) {
-  xsd__double *_p = soap_instantiate_xsd__double(soap, -1, NULL, NULL, NULL);
+  xsd__double *_p =
+      soap_instantiate_xsd__double(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->xsd__double::__item = __item;
@@ -8513,13 +8612,13 @@ soap_instantiate_xsd__dateTime(struct soap *, int, const char *, const char *,
                                size_t *);
 
 inline xsd__dateTime *soap_new_xsd__dateTime(struct soap *soap, int n = -1) {
-  return soap_instantiate_xsd__dateTime(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_xsd__dateTime(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline xsd__dateTime *soap_new_req_xsd__dateTime(struct soap *soap,
                                                  time_t __item) {
   xsd__dateTime *_p =
-      soap_instantiate_xsd__dateTime(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_xsd__dateTime(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->xsd__dateTime::__item = __item;
@@ -8530,7 +8629,7 @@ inline xsd__dateTime *soap_new_req_xsd__dateTime(struct soap *soap,
 inline xsd__dateTime *soap_new_set_xsd__dateTime(struct soap *soap,
                                                  time_t __item, char *__item1) {
   xsd__dateTime *_p =
-      soap_instantiate_xsd__dateTime(soap, -1, NULL, NULL, NULL);
+      soap_instantiate_xsd__dateTime(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->xsd__dateTime::__item = __item;
@@ -8582,11 +8681,12 @@ soap_instantiate_xsd__boolean(struct soap *, int, const char *, const char *,
                               size_t *);
 
 inline xsd__boolean *soap_new_xsd__boolean(struct soap *soap, int n = -1) {
-  return soap_instantiate_xsd__boolean(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_xsd__boolean(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline xsd__boolean *soap_new_req_xsd__boolean(struct soap *soap, bool __item) {
-  xsd__boolean *_p = soap_instantiate_xsd__boolean(soap, -1, NULL, NULL, NULL);
+  xsd__boolean *_p =
+      soap_instantiate_xsd__boolean(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->xsd__boolean::__item = __item;
@@ -8596,7 +8696,8 @@ inline xsd__boolean *soap_new_req_xsd__boolean(struct soap *soap, bool __item) {
 
 inline xsd__boolean *soap_new_set_xsd__boolean(struct soap *soap, bool __item,
                                                char *__item1) {
-  xsd__boolean *_p = soap_instantiate_xsd__boolean(soap, -1, NULL, NULL, NULL);
+  xsd__boolean *_p =
+      soap_instantiate_xsd__boolean(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->xsd__boolean::__item = __item;
@@ -8648,11 +8749,12 @@ soap_instantiate_xsd__anyType(struct soap *, int, const char *, const char *,
                               size_t *);
 
 inline xsd__anyType *soap_new_xsd__anyType(struct soap *soap, int n = -1) {
-  return soap_instantiate_xsd__anyType(soap, n, NULL, NULL, NULL);
+  return soap_instantiate_xsd__anyType(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline xsd__anyType *soap_new_req_xsd__anyType(struct soap *soap) {
-  xsd__anyType *_p = soap_instantiate_xsd__anyType(soap, -1, NULL, NULL, NULL);
+  xsd__anyType *_p =
+      soap_instantiate_xsd__anyType(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
   }
@@ -8661,7 +8763,8 @@ inline xsd__anyType *soap_new_req_xsd__anyType(struct soap *soap) {
 
 inline xsd__anyType *soap_new_set_xsd__anyType(struct soap *soap,
                                                char *__item) {
-  xsd__anyType *_p = soap_instantiate_xsd__anyType(soap, -1, NULL, NULL, NULL);
+  xsd__anyType *_p =
+      soap_instantiate_xsd__anyType(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     _p->soap_default(soap);
     _p->xsd__anyType::__item = __item;
@@ -9063,13 +9166,14 @@ soap_instantiate___ns1__getEntityInfo(struct soap *, int, const char *,
 
 inline struct __ns1__getEntityInfo *
 soap_new___ns1__getEntityInfo(struct soap *soap, int n = -1) {
-  return soap_instantiate___ns1__getEntityInfo(soap, n, NULL, NULL, NULL);
+  return soap_instantiate___ns1__getEntityInfo(soap, n, nullptr, nullptr,
+                                               nullptr);
 }
 
 inline struct __ns1__getEntityInfo *
 soap_new_req___ns1__getEntityInfo(struct soap *soap) {
-  struct __ns1__getEntityInfo *_p =
-      soap_instantiate___ns1__getEntityInfo(soap, -1, NULL, NULL, NULL);
+  struct __ns1__getEntityInfo *_p = soap_instantiate___ns1__getEntityInfo(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__getEntityInfo(soap, _p);
   }
@@ -9079,8 +9183,8 @@ soap_new_req___ns1__getEntityInfo(struct soap *soap) {
 inline struct __ns1__getEntityInfo *
 soap_new_set___ns1__getEntityInfo(struct soap *soap,
                                   ns1__getEntityInfo *ns1__getEntityInfo_) {
-  struct __ns1__getEntityInfo *_p =
-      soap_instantiate___ns1__getEntityInfo(soap, -1, NULL, NULL, NULL);
+  struct __ns1__getEntityInfo *_p = soap_instantiate___ns1__getEntityInfo(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__getEntityInfo(soap, _p);
     _p->ns1__getEntityInfo_ = ns1__getEntityInfo_;
@@ -9143,13 +9247,13 @@ soap_instantiate___ns1__deleteMany(struct soap *, int, const char *,
 
 inline struct __ns1__deleteMany *soap_new___ns1__deleteMany(struct soap *soap,
                                                             int n = -1) {
-  return soap_instantiate___ns1__deleteMany(soap, n, NULL, NULL, NULL);
+  return soap_instantiate___ns1__deleteMany(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline struct __ns1__deleteMany *
 soap_new_req___ns1__deleteMany(struct soap *soap) {
   struct __ns1__deleteMany *_p =
-      soap_instantiate___ns1__deleteMany(soap, -1, NULL, NULL, NULL);
+      soap_instantiate___ns1__deleteMany(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__deleteMany(soap, _p);
   }
@@ -9160,7 +9264,7 @@ inline struct __ns1__deleteMany *
 soap_new_set___ns1__deleteMany(struct soap *soap,
                                ns1__deleteMany *ns1__deleteMany_) {
   struct __ns1__deleteMany *_p =
-      soap_instantiate___ns1__deleteMany(soap, -1, NULL, NULL, NULL);
+      soap_instantiate___ns1__deleteMany(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__deleteMany(soap, _p);
     _p->ns1__deleteMany_ = ns1__deleteMany_;
@@ -9228,13 +9332,15 @@ soap_instantiate___ns1__deleteManyResponse(struct soap *, int, const char *,
 
 inline struct __ns1__deleteManyResponse *
 soap_new___ns1__deleteManyResponse(struct soap *soap, int n = -1) {
-  return soap_instantiate___ns1__deleteManyResponse(soap, n, NULL, NULL, NULL);
+  return soap_instantiate___ns1__deleteManyResponse(soap, n, nullptr, nullptr,
+                                                    nullptr);
 }
 
 inline struct __ns1__deleteManyResponse *
 soap_new_req___ns1__deleteManyResponse(struct soap *soap) {
   struct __ns1__deleteManyResponse *_p =
-      soap_instantiate___ns1__deleteManyResponse(soap, -1, NULL, NULL, NULL);
+      soap_instantiate___ns1__deleteManyResponse(soap, -1, nullptr, nullptr,
+                                                 nullptr);
   if (_p) {
     soap_default___ns1__deleteManyResponse(soap, _p);
   }
@@ -9244,7 +9350,8 @@ soap_new_req___ns1__deleteManyResponse(struct soap *soap) {
 inline struct __ns1__deleteManyResponse *soap_new_set___ns1__deleteManyResponse(
     struct soap *soap, ns1__deleteManyResponse *ns1__deleteManyResponse_) {
   struct __ns1__deleteManyResponse *_p =
-      soap_instantiate___ns1__deleteManyResponse(soap, -1, NULL, NULL, NULL);
+      soap_instantiate___ns1__deleteManyResponse(soap, -1, nullptr, nullptr,
+                                                 nullptr);
   if (_p) {
     soap_default___ns1__deleteManyResponse(soap, _p);
     _p->ns1__deleteManyResponse_ = ns1__deleteManyResponse_;
@@ -9308,13 +9415,13 @@ soap_instantiate___ns1__createMany(struct soap *, int, const char *,
 
 inline struct __ns1__createMany *soap_new___ns1__createMany(struct soap *soap,
                                                             int n = -1) {
-  return soap_instantiate___ns1__createMany(soap, n, NULL, NULL, NULL);
+  return soap_instantiate___ns1__createMany(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline struct __ns1__createMany *
 soap_new_req___ns1__createMany(struct soap *soap) {
   struct __ns1__createMany *_p =
-      soap_instantiate___ns1__createMany(soap, -1, NULL, NULL, NULL);
+      soap_instantiate___ns1__createMany(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__createMany(soap, _p);
   }
@@ -9325,7 +9432,7 @@ inline struct __ns1__createMany *
 soap_new_set___ns1__createMany(struct soap *soap,
                                ns1__createMany *ns1__createMany_) {
   struct __ns1__createMany *_p =
-      soap_instantiate___ns1__createMany(soap, -1, NULL, NULL, NULL);
+      soap_instantiate___ns1__createMany(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__createMany(soap, _p);
     _p->ns1__createMany_ = ns1__createMany_;
@@ -9393,13 +9500,15 @@ soap_instantiate___ns1__luceneGetPopulating(struct soap *, int, const char *,
 
 inline struct __ns1__luceneGetPopulating *
 soap_new___ns1__luceneGetPopulating(struct soap *soap, int n = -1) {
-  return soap_instantiate___ns1__luceneGetPopulating(soap, n, NULL, NULL, NULL);
+  return soap_instantiate___ns1__luceneGetPopulating(soap, n, nullptr, nullptr,
+                                                     nullptr);
 }
 
 inline struct __ns1__luceneGetPopulating *
 soap_new_req___ns1__luceneGetPopulating(struct soap *soap) {
   struct __ns1__luceneGetPopulating *_p =
-      soap_instantiate___ns1__luceneGetPopulating(soap, -1, NULL, NULL, NULL);
+      soap_instantiate___ns1__luceneGetPopulating(soap, -1, nullptr, nullptr,
+                                                  nullptr);
   if (_p) {
     soap_default___ns1__luceneGetPopulating(soap, _p);
   }
@@ -9410,7 +9519,8 @@ inline struct __ns1__luceneGetPopulating *
 soap_new_set___ns1__luceneGetPopulating(
     struct soap *soap, ns1__luceneGetPopulating *ns1__luceneGetPopulating_) {
   struct __ns1__luceneGetPopulating *_p =
-      soap_instantiate___ns1__luceneGetPopulating(soap, -1, NULL, NULL, NULL);
+      soap_instantiate___ns1__luceneGetPopulating(soap, -1, nullptr, nullptr,
+                                                  nullptr);
   if (_p) {
     soap_default___ns1__luceneGetPopulating(soap, _p);
     _p->ns1__luceneGetPopulating_ = ns1__luceneGetPopulating_;
@@ -9474,13 +9584,14 @@ soap_instantiate___ns1__luceneSearch(struct soap *, int, const char *,
 
 inline struct __ns1__luceneSearch *
 soap_new___ns1__luceneSearch(struct soap *soap, int n = -1) {
-  return soap_instantiate___ns1__luceneSearch(soap, n, NULL, NULL, NULL);
+  return soap_instantiate___ns1__luceneSearch(soap, n, nullptr, nullptr,
+                                              nullptr);
 }
 
 inline struct __ns1__luceneSearch *
 soap_new_req___ns1__luceneSearch(struct soap *soap) {
   struct __ns1__luceneSearch *_p =
-      soap_instantiate___ns1__luceneSearch(soap, -1, NULL, NULL, NULL);
+      soap_instantiate___ns1__luceneSearch(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__luceneSearch(soap, _p);
   }
@@ -9491,7 +9602,7 @@ inline struct __ns1__luceneSearch *
 soap_new_set___ns1__luceneSearch(struct soap *soap,
                                  ns1__luceneSearch *ns1__luceneSearch_) {
   struct __ns1__luceneSearch *_p =
-      soap_instantiate___ns1__luceneSearch(soap, -1, NULL, NULL, NULL);
+      soap_instantiate___ns1__luceneSearch(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__luceneSearch(soap, _p);
     _p->ns1__luceneSearch_ = ns1__luceneSearch_;
@@ -9554,13 +9665,14 @@ soap_instantiate___ns1__luceneCommit(struct soap *, int, const char *,
 
 inline struct __ns1__luceneCommit *
 soap_new___ns1__luceneCommit(struct soap *soap, int n = -1) {
-  return soap_instantiate___ns1__luceneCommit(soap, n, NULL, NULL, NULL);
+  return soap_instantiate___ns1__luceneCommit(soap, n, nullptr, nullptr,
+                                              nullptr);
 }
 
 inline struct __ns1__luceneCommit *
 soap_new_req___ns1__luceneCommit(struct soap *soap) {
   struct __ns1__luceneCommit *_p =
-      soap_instantiate___ns1__luceneCommit(soap, -1, NULL, NULL, NULL);
+      soap_instantiate___ns1__luceneCommit(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__luceneCommit(soap, _p);
   }
@@ -9571,7 +9683,7 @@ inline struct __ns1__luceneCommit *
 soap_new_set___ns1__luceneCommit(struct soap *soap,
                                  ns1__luceneCommit *ns1__luceneCommit_) {
   struct __ns1__luceneCommit *_p =
-      soap_instantiate___ns1__luceneCommit(soap, -1, NULL, NULL, NULL);
+      soap_instantiate___ns1__luceneCommit(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__luceneCommit(soap, _p);
     _p->ns1__luceneCommit_ = ns1__luceneCommit_;
@@ -9639,14 +9751,15 @@ soap_instantiate___ns1__luceneCommitResponse(struct soap *, int, const char *,
 
 inline struct __ns1__luceneCommitResponse *
 soap_new___ns1__luceneCommitResponse(struct soap *soap, int n = -1) {
-  return soap_instantiate___ns1__luceneCommitResponse(soap, n, NULL, NULL,
-                                                      NULL);
+  return soap_instantiate___ns1__luceneCommitResponse(soap, n, nullptr, nullptr,
+                                                      nullptr);
 }
 
 inline struct __ns1__luceneCommitResponse *
 soap_new_req___ns1__luceneCommitResponse(struct soap *soap) {
   struct __ns1__luceneCommitResponse *_p =
-      soap_instantiate___ns1__luceneCommitResponse(soap, -1, NULL, NULL, NULL);
+      soap_instantiate___ns1__luceneCommitResponse(soap, -1, nullptr, nullptr,
+                                                   nullptr);
   if (_p) {
     soap_default___ns1__luceneCommitResponse(soap, _p);
   }
@@ -9657,7 +9770,8 @@ inline struct __ns1__luceneCommitResponse *
 soap_new_set___ns1__luceneCommitResponse(
     struct soap *soap, ns1__luceneCommitResponse *ns1__luceneCommitResponse_) {
   struct __ns1__luceneCommitResponse *_p =
-      soap_instantiate___ns1__luceneCommitResponse(soap, -1, NULL, NULL, NULL);
+      soap_instantiate___ns1__luceneCommitResponse(soap, -1, nullptr, nullptr,
+                                                   nullptr);
   if (_p) {
     soap_default___ns1__luceneCommitResponse(soap, _p);
     _p->ns1__luceneCommitResponse_ = ns1__luceneCommitResponse_;
@@ -9721,13 +9835,14 @@ soap_instantiate___ns1__luceneClear(struct soap *, int, const char *,
 
 inline struct __ns1__luceneClear *soap_new___ns1__luceneClear(struct soap *soap,
                                                               int n = -1) {
-  return soap_instantiate___ns1__luceneClear(soap, n, NULL, NULL, NULL);
+  return soap_instantiate___ns1__luceneClear(soap, n, nullptr, nullptr,
+                                             nullptr);
 }
 
 inline struct __ns1__luceneClear *
 soap_new_req___ns1__luceneClear(struct soap *soap) {
   struct __ns1__luceneClear *_p =
-      soap_instantiate___ns1__luceneClear(soap, -1, NULL, NULL, NULL);
+      soap_instantiate___ns1__luceneClear(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__luceneClear(soap, _p);
   }
@@ -9738,7 +9853,7 @@ inline struct __ns1__luceneClear *
 soap_new_set___ns1__luceneClear(struct soap *soap,
                                 ns1__luceneClear *ns1__luceneClear_) {
   struct __ns1__luceneClear *_p =
-      soap_instantiate___ns1__luceneClear(soap, -1, NULL, NULL, NULL);
+      soap_instantiate___ns1__luceneClear(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__luceneClear(soap, _p);
     _p->ns1__luceneClear_ = ns1__luceneClear_;
@@ -9806,13 +9921,15 @@ soap_instantiate___ns1__luceneClearResponse(struct soap *, int, const char *,
 
 inline struct __ns1__luceneClearResponse *
 soap_new___ns1__luceneClearResponse(struct soap *soap, int n = -1) {
-  return soap_instantiate___ns1__luceneClearResponse(soap, n, NULL, NULL, NULL);
+  return soap_instantiate___ns1__luceneClearResponse(soap, n, nullptr, nullptr,
+                                                     nullptr);
 }
 
 inline struct __ns1__luceneClearResponse *
 soap_new_req___ns1__luceneClearResponse(struct soap *soap) {
   struct __ns1__luceneClearResponse *_p =
-      soap_instantiate___ns1__luceneClearResponse(soap, -1, NULL, NULL, NULL);
+      soap_instantiate___ns1__luceneClearResponse(soap, -1, nullptr, nullptr,
+                                                  nullptr);
   if (_p) {
     soap_default___ns1__luceneClearResponse(soap, _p);
   }
@@ -9823,7 +9940,8 @@ inline struct __ns1__luceneClearResponse *
 soap_new_set___ns1__luceneClearResponse(
     struct soap *soap, ns1__luceneClearResponse *ns1__luceneClearResponse_) {
   struct __ns1__luceneClearResponse *_p =
-      soap_instantiate___ns1__luceneClearResponse(soap, -1, NULL, NULL, NULL);
+      soap_instantiate___ns1__luceneClearResponse(soap, -1, nullptr, nullptr,
+                                                  nullptr);
   if (_p) {
     soap_default___ns1__luceneClearResponse(soap, _p);
     _p->ns1__luceneClearResponse_ = ns1__luceneClearResponse_;
@@ -9890,13 +10008,14 @@ soap_instantiate___ns1__lucenePopulate(struct soap *, int, const char *,
 
 inline struct __ns1__lucenePopulate *
 soap_new___ns1__lucenePopulate(struct soap *soap, int n = -1) {
-  return soap_instantiate___ns1__lucenePopulate(soap, n, NULL, NULL, NULL);
+  return soap_instantiate___ns1__lucenePopulate(soap, n, nullptr, nullptr,
+                                                nullptr);
 }
 
 inline struct __ns1__lucenePopulate *
 soap_new_req___ns1__lucenePopulate(struct soap *soap) {
-  struct __ns1__lucenePopulate *_p =
-      soap_instantiate___ns1__lucenePopulate(soap, -1, NULL, NULL, NULL);
+  struct __ns1__lucenePopulate *_p = soap_instantiate___ns1__lucenePopulate(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__lucenePopulate(soap, _p);
   }
@@ -9906,8 +10025,8 @@ soap_new_req___ns1__lucenePopulate(struct soap *soap) {
 inline struct __ns1__lucenePopulate *
 soap_new_set___ns1__lucenePopulate(struct soap *soap,
                                    ns1__lucenePopulate *ns1__lucenePopulate_) {
-  struct __ns1__lucenePopulate *_p =
-      soap_instantiate___ns1__lucenePopulate(soap, -1, NULL, NULL, NULL);
+  struct __ns1__lucenePopulate *_p = soap_instantiate___ns1__lucenePopulate(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__lucenePopulate(soap, _p);
     _p->ns1__lucenePopulate_ = ns1__lucenePopulate_;
@@ -9973,15 +10092,15 @@ soap_instantiate___ns1__lucenePopulateResponse(struct soap *, int, const char *,
 
 inline struct __ns1__lucenePopulateResponse *
 soap_new___ns1__lucenePopulateResponse(struct soap *soap, int n = -1) {
-  return soap_instantiate___ns1__lucenePopulateResponse(soap, n, NULL, NULL,
-                                                        NULL);
+  return soap_instantiate___ns1__lucenePopulateResponse(soap, n, nullptr,
+                                                        nullptr, nullptr);
 }
 
 inline struct __ns1__lucenePopulateResponse *
 soap_new_req___ns1__lucenePopulateResponse(struct soap *soap) {
   struct __ns1__lucenePopulateResponse *_p =
-      soap_instantiate___ns1__lucenePopulateResponse(soap, -1, NULL, NULL,
-                                                     NULL);
+      soap_instantiate___ns1__lucenePopulateResponse(soap, -1, nullptr, nullptr,
+                                                     nullptr);
   if (_p) {
     soap_default___ns1__lucenePopulateResponse(soap, _p);
   }
@@ -9993,8 +10112,8 @@ soap_new_set___ns1__lucenePopulateResponse(
     struct soap *soap,
     ns1__lucenePopulateResponse *ns1__lucenePopulateResponse_) {
   struct __ns1__lucenePopulateResponse *_p =
-      soap_instantiate___ns1__lucenePopulateResponse(soap, -1, NULL, NULL,
-                                                     NULL);
+      soap_instantiate___ns1__lucenePopulateResponse(soap, -1, nullptr, nullptr,
+                                                     nullptr);
   if (_p) {
     soap_default___ns1__lucenePopulateResponse(soap, _p);
     _p->ns1__lucenePopulateResponse_ = ns1__lucenePopulateResponse_;
@@ -10060,13 +10179,14 @@ soap_instantiate___ns1__isAccessAllowed(struct soap *, int, const char *,
 
 inline struct __ns1__isAccessAllowed *
 soap_new___ns1__isAccessAllowed(struct soap *soap, int n = -1) {
-  return soap_instantiate___ns1__isAccessAllowed(soap, n, NULL, NULL, NULL);
+  return soap_instantiate___ns1__isAccessAllowed(soap, n, nullptr, nullptr,
+                                                 nullptr);
 }
 
 inline struct __ns1__isAccessAllowed *
 soap_new_req___ns1__isAccessAllowed(struct soap *soap) {
-  struct __ns1__isAccessAllowed *_p =
-      soap_instantiate___ns1__isAccessAllowed(soap, -1, NULL, NULL, NULL);
+  struct __ns1__isAccessAllowed *_p = soap_instantiate___ns1__isAccessAllowed(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__isAccessAllowed(soap, _p);
   }
@@ -10075,8 +10195,8 @@ soap_new_req___ns1__isAccessAllowed(struct soap *soap) {
 
 inline struct __ns1__isAccessAllowed *soap_new_set___ns1__isAccessAllowed(
     struct soap *soap, ns1__isAccessAllowed *ns1__isAccessAllowed_) {
-  struct __ns1__isAccessAllowed *_p =
-      soap_instantiate___ns1__isAccessAllowed(soap, -1, NULL, NULL, NULL);
+  struct __ns1__isAccessAllowed *_p = soap_instantiate___ns1__isAccessAllowed(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__isAccessAllowed(soap, _p);
     _p->ns1__isAccessAllowed_ = ns1__isAccessAllowed_;
@@ -10140,13 +10260,13 @@ soap_instantiate___ns1__searchText(struct soap *, int, const char *,
 
 inline struct __ns1__searchText *soap_new___ns1__searchText(struct soap *soap,
                                                             int n = -1) {
-  return soap_instantiate___ns1__searchText(soap, n, NULL, NULL, NULL);
+  return soap_instantiate___ns1__searchText(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline struct __ns1__searchText *
 soap_new_req___ns1__searchText(struct soap *soap) {
   struct __ns1__searchText *_p =
-      soap_instantiate___ns1__searchText(soap, -1, NULL, NULL, NULL);
+      soap_instantiate___ns1__searchText(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__searchText(soap, _p);
   }
@@ -10157,7 +10277,7 @@ inline struct __ns1__searchText *
 soap_new_set___ns1__searchText(struct soap *soap,
                                ns1__searchText *ns1__searchText_) {
   struct __ns1__searchText *_p =
-      soap_instantiate___ns1__searchText(soap, -1, NULL, NULL, NULL);
+      soap_instantiate___ns1__searchText(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__searchText(soap, _p);
     _p->ns1__searchText_ = ns1__searchText_;
@@ -10225,13 +10345,15 @@ soap_instantiate___ns1__getRemainingMinutes(struct soap *, int, const char *,
 
 inline struct __ns1__getRemainingMinutes *
 soap_new___ns1__getRemainingMinutes(struct soap *soap, int n = -1) {
-  return soap_instantiate___ns1__getRemainingMinutes(soap, n, NULL, NULL, NULL);
+  return soap_instantiate___ns1__getRemainingMinutes(soap, n, nullptr, nullptr,
+                                                     nullptr);
 }
 
 inline struct __ns1__getRemainingMinutes *
 soap_new_req___ns1__getRemainingMinutes(struct soap *soap) {
   struct __ns1__getRemainingMinutes *_p =
-      soap_instantiate___ns1__getRemainingMinutes(soap, -1, NULL, NULL, NULL);
+      soap_instantiate___ns1__getRemainingMinutes(soap, -1, nullptr, nullptr,
+                                                  nullptr);
   if (_p) {
     soap_default___ns1__getRemainingMinutes(soap, _p);
   }
@@ -10242,7 +10364,8 @@ inline struct __ns1__getRemainingMinutes *
 soap_new_set___ns1__getRemainingMinutes(
     struct soap *soap, ns1__getRemainingMinutes *ns1__getRemainingMinutes_) {
   struct __ns1__getRemainingMinutes *_p =
-      soap_instantiate___ns1__getRemainingMinutes(soap, -1, NULL, NULL, NULL);
+      soap_instantiate___ns1__getRemainingMinutes(soap, -1, nullptr, nullptr,
+                                                  nullptr);
   if (_p) {
     soap_default___ns1__getRemainingMinutes(soap, _p);
     _p->ns1__getRemainingMinutes_ = ns1__getRemainingMinutes_;
@@ -10305,12 +10428,12 @@ soap_instantiate___ns1__logout(struct soap *, int, const char *, const char *,
 
 inline struct __ns1__logout *soap_new___ns1__logout(struct soap *soap,
                                                     int n = -1) {
-  return soap_instantiate___ns1__logout(soap, n, NULL, NULL, NULL);
+  return soap_instantiate___ns1__logout(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline struct __ns1__logout *soap_new_req___ns1__logout(struct soap *soap) {
   struct __ns1__logout *_p =
-      soap_instantiate___ns1__logout(soap, -1, NULL, NULL, NULL);
+      soap_instantiate___ns1__logout(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__logout(soap, _p);
   }
@@ -10320,7 +10443,7 @@ inline struct __ns1__logout *soap_new_req___ns1__logout(struct soap *soap) {
 inline struct __ns1__logout *
 soap_new_set___ns1__logout(struct soap *soap, ns1__logout *ns1__logout_) {
   struct __ns1__logout *_p =
-      soap_instantiate___ns1__logout(soap, -1, NULL, NULL, NULL);
+      soap_instantiate___ns1__logout(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__logout(soap, _p);
     _p->ns1__logout_ = ns1__logout_;
@@ -10386,13 +10509,14 @@ soap_instantiate___ns1__logoutResponse(struct soap *, int, const char *,
 
 inline struct __ns1__logoutResponse *
 soap_new___ns1__logoutResponse(struct soap *soap, int n = -1) {
-  return soap_instantiate___ns1__logoutResponse(soap, n, NULL, NULL, NULL);
+  return soap_instantiate___ns1__logoutResponse(soap, n, nullptr, nullptr,
+                                                nullptr);
 }
 
 inline struct __ns1__logoutResponse *
 soap_new_req___ns1__logoutResponse(struct soap *soap) {
-  struct __ns1__logoutResponse *_p =
-      soap_instantiate___ns1__logoutResponse(soap, -1, NULL, NULL, NULL);
+  struct __ns1__logoutResponse *_p = soap_instantiate___ns1__logoutResponse(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__logoutResponse(soap, _p);
   }
@@ -10402,8 +10526,8 @@ soap_new_req___ns1__logoutResponse(struct soap *soap) {
 inline struct __ns1__logoutResponse *
 soap_new_set___ns1__logoutResponse(struct soap *soap,
                                    ns1__logoutResponse *ns1__logoutResponse_) {
-  struct __ns1__logoutResponse *_p =
-      soap_instantiate___ns1__logoutResponse(soap, -1, NULL, NULL, NULL);
+  struct __ns1__logoutResponse *_p = soap_instantiate___ns1__logoutResponse(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__logoutResponse(soap, _p);
     _p->ns1__logoutResponse_ = ns1__logoutResponse_;
@@ -10465,12 +10589,12 @@ soap_instantiate___ns1__dummy(struct soap *, int, const char *, const char *,
 
 inline struct __ns1__dummy *soap_new___ns1__dummy(struct soap *soap,
                                                   int n = -1) {
-  return soap_instantiate___ns1__dummy(soap, n, NULL, NULL, NULL);
+  return soap_instantiate___ns1__dummy(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline struct __ns1__dummy *soap_new_req___ns1__dummy(struct soap *soap) {
   struct __ns1__dummy *_p =
-      soap_instantiate___ns1__dummy(soap, -1, NULL, NULL, NULL);
+      soap_instantiate___ns1__dummy(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__dummy(soap, _p);
   }
@@ -10480,7 +10604,7 @@ inline struct __ns1__dummy *soap_new_req___ns1__dummy(struct soap *soap) {
 inline struct __ns1__dummy *soap_new_set___ns1__dummy(struct soap *soap,
                                                       ns1__dummy *ns1__dummy_) {
   struct __ns1__dummy *_p =
-      soap_instantiate___ns1__dummy(soap, -1, NULL, NULL, NULL);
+      soap_instantiate___ns1__dummy(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__dummy(soap, _p);
     _p->ns1__dummy_ = ns1__dummy_;
@@ -10545,13 +10669,14 @@ soap_instantiate___ns1__dummyResponse(struct soap *, int, const char *,
 
 inline struct __ns1__dummyResponse *
 soap_new___ns1__dummyResponse(struct soap *soap, int n = -1) {
-  return soap_instantiate___ns1__dummyResponse(soap, n, NULL, NULL, NULL);
+  return soap_instantiate___ns1__dummyResponse(soap, n, nullptr, nullptr,
+                                               nullptr);
 }
 
 inline struct __ns1__dummyResponse *
 soap_new_req___ns1__dummyResponse(struct soap *soap) {
-  struct __ns1__dummyResponse *_p =
-      soap_instantiate___ns1__dummyResponse(soap, -1, NULL, NULL, NULL);
+  struct __ns1__dummyResponse *_p = soap_instantiate___ns1__dummyResponse(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__dummyResponse(soap, _p);
   }
@@ -10561,8 +10686,8 @@ soap_new_req___ns1__dummyResponse(struct soap *soap) {
 inline struct __ns1__dummyResponse *
 soap_new_set___ns1__dummyResponse(struct soap *soap,
                                   ns1__dummyResponse *ns1__dummyResponse_) {
-  struct __ns1__dummyResponse *_p =
-      soap_instantiate___ns1__dummyResponse(soap, -1, NULL, NULL, NULL);
+  struct __ns1__dummyResponse *_p = soap_instantiate___ns1__dummyResponse(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__dummyResponse(soap, _p);
     _p->ns1__dummyResponse_ = ns1__dummyResponse_;
@@ -10624,12 +10749,12 @@ soap_instantiate___ns1__refresh(struct soap *, int, const char *, const char *,
 
 inline struct __ns1__refresh *soap_new___ns1__refresh(struct soap *soap,
                                                       int n = -1) {
-  return soap_instantiate___ns1__refresh(soap, n, NULL, NULL, NULL);
+  return soap_instantiate___ns1__refresh(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline struct __ns1__refresh *soap_new_req___ns1__refresh(struct soap *soap) {
   struct __ns1__refresh *_p =
-      soap_instantiate___ns1__refresh(soap, -1, NULL, NULL, NULL);
+      soap_instantiate___ns1__refresh(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__refresh(soap, _p);
   }
@@ -10639,7 +10764,7 @@ inline struct __ns1__refresh *soap_new_req___ns1__refresh(struct soap *soap) {
 inline struct __ns1__refresh *
 soap_new_set___ns1__refresh(struct soap *soap, ns1__refresh *ns1__refresh_) {
   struct __ns1__refresh *_p =
-      soap_instantiate___ns1__refresh(soap, -1, NULL, NULL, NULL);
+      soap_instantiate___ns1__refresh(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__refresh(soap, _p);
     _p->ns1__refresh_ = ns1__refresh_;
@@ -10705,13 +10830,14 @@ soap_instantiate___ns1__refreshResponse(struct soap *, int, const char *,
 
 inline struct __ns1__refreshResponse *
 soap_new___ns1__refreshResponse(struct soap *soap, int n = -1) {
-  return soap_instantiate___ns1__refreshResponse(soap, n, NULL, NULL, NULL);
+  return soap_instantiate___ns1__refreshResponse(soap, n, nullptr, nullptr,
+                                                 nullptr);
 }
 
 inline struct __ns1__refreshResponse *
 soap_new_req___ns1__refreshResponse(struct soap *soap) {
-  struct __ns1__refreshResponse *_p =
-      soap_instantiate___ns1__refreshResponse(soap, -1, NULL, NULL, NULL);
+  struct __ns1__refreshResponse *_p = soap_instantiate___ns1__refreshResponse(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__refreshResponse(soap, _p);
   }
@@ -10720,8 +10846,8 @@ soap_new_req___ns1__refreshResponse(struct soap *soap) {
 
 inline struct __ns1__refreshResponse *soap_new_set___ns1__refreshResponse(
     struct soap *soap, ns1__refreshResponse *ns1__refreshResponse_) {
-  struct __ns1__refreshResponse *_p =
-      soap_instantiate___ns1__refreshResponse(soap, -1, NULL, NULL, NULL);
+  struct __ns1__refreshResponse *_p = soap_instantiate___ns1__refreshResponse(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__refreshResponse(soap, _p);
     _p->ns1__refreshResponse_ = ns1__refreshResponse_;
@@ -10788,13 +10914,14 @@ soap_instantiate___ns1__getEntityNames(struct soap *, int, const char *,
 
 inline struct __ns1__getEntityNames *
 soap_new___ns1__getEntityNames(struct soap *soap, int n = -1) {
-  return soap_instantiate___ns1__getEntityNames(soap, n, NULL, NULL, NULL);
+  return soap_instantiate___ns1__getEntityNames(soap, n, nullptr, nullptr,
+                                                nullptr);
 }
 
 inline struct __ns1__getEntityNames *
 soap_new_req___ns1__getEntityNames(struct soap *soap) {
-  struct __ns1__getEntityNames *_p =
-      soap_instantiate___ns1__getEntityNames(soap, -1, NULL, NULL, NULL);
+  struct __ns1__getEntityNames *_p = soap_instantiate___ns1__getEntityNames(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__getEntityNames(soap, _p);
   }
@@ -10804,8 +10931,8 @@ soap_new_req___ns1__getEntityNames(struct soap *soap) {
 inline struct __ns1__getEntityNames *
 soap_new_set___ns1__getEntityNames(struct soap *soap,
                                    ns1__getEntityNames *ns1__getEntityNames_) {
-  struct __ns1__getEntityNames *_p =
-      soap_instantiate___ns1__getEntityNames(soap, -1, NULL, NULL, NULL);
+  struct __ns1__getEntityNames *_p = soap_instantiate___ns1__getEntityNames(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__getEntityNames(soap, _p);
     _p->ns1__getEntityNames_ = ns1__getEntityNames_;
@@ -10870,13 +10997,14 @@ soap_instantiate___ns1__getApiVersion(struct soap *, int, const char *,
 
 inline struct __ns1__getApiVersion *
 soap_new___ns1__getApiVersion(struct soap *soap, int n = -1) {
-  return soap_instantiate___ns1__getApiVersion(soap, n, NULL, NULL, NULL);
+  return soap_instantiate___ns1__getApiVersion(soap, n, nullptr, nullptr,
+                                               nullptr);
 }
 
 inline struct __ns1__getApiVersion *
 soap_new_req___ns1__getApiVersion(struct soap *soap) {
-  struct __ns1__getApiVersion *_p =
-      soap_instantiate___ns1__getApiVersion(soap, -1, NULL, NULL, NULL);
+  struct __ns1__getApiVersion *_p = soap_instantiate___ns1__getApiVersion(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__getApiVersion(soap, _p);
   }
@@ -10886,8 +11014,8 @@ soap_new_req___ns1__getApiVersion(struct soap *soap) {
 inline struct __ns1__getApiVersion *
 soap_new_set___ns1__getApiVersion(struct soap *soap,
                                   ns1__getApiVersion *ns1__getApiVersion_) {
-  struct __ns1__getApiVersion *_p =
-      soap_instantiate___ns1__getApiVersion(soap, -1, NULL, NULL, NULL);
+  struct __ns1__getApiVersion *_p = soap_instantiate___ns1__getApiVersion(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__getApiVersion(soap, _p);
     _p->ns1__getApiVersion_ = ns1__getApiVersion_;
@@ -10949,12 +11077,12 @@ soap_instantiate___ns1__update(struct soap *, int, const char *, const char *,
 
 inline struct __ns1__update *soap_new___ns1__update(struct soap *soap,
                                                     int n = -1) {
-  return soap_instantiate___ns1__update(soap, n, NULL, NULL, NULL);
+  return soap_instantiate___ns1__update(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline struct __ns1__update *soap_new_req___ns1__update(struct soap *soap) {
   struct __ns1__update *_p =
-      soap_instantiate___ns1__update(soap, -1, NULL, NULL, NULL);
+      soap_instantiate___ns1__update(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__update(soap, _p);
   }
@@ -10964,7 +11092,7 @@ inline struct __ns1__update *soap_new_req___ns1__update(struct soap *soap) {
 inline struct __ns1__update *
 soap_new_set___ns1__update(struct soap *soap, ns1__update *ns1__update_) {
   struct __ns1__update *_p =
-      soap_instantiate___ns1__update(soap, -1, NULL, NULL, NULL);
+      soap_instantiate___ns1__update(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__update(soap, _p);
     _p->ns1__update_ = ns1__update_;
@@ -11030,13 +11158,14 @@ soap_instantiate___ns1__updateResponse(struct soap *, int, const char *,
 
 inline struct __ns1__updateResponse *
 soap_new___ns1__updateResponse(struct soap *soap, int n = -1) {
-  return soap_instantiate___ns1__updateResponse(soap, n, NULL, NULL, NULL);
+  return soap_instantiate___ns1__updateResponse(soap, n, nullptr, nullptr,
+                                                nullptr);
 }
 
 inline struct __ns1__updateResponse *
 soap_new_req___ns1__updateResponse(struct soap *soap) {
-  struct __ns1__updateResponse *_p =
-      soap_instantiate___ns1__updateResponse(soap, -1, NULL, NULL, NULL);
+  struct __ns1__updateResponse *_p = soap_instantiate___ns1__updateResponse(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__updateResponse(soap, _p);
   }
@@ -11046,8 +11175,8 @@ soap_new_req___ns1__updateResponse(struct soap *soap) {
 inline struct __ns1__updateResponse *
 soap_new_set___ns1__updateResponse(struct soap *soap,
                                    ns1__updateResponse *ns1__updateResponse_) {
-  struct __ns1__updateResponse *_p =
-      soap_instantiate___ns1__updateResponse(soap, -1, NULL, NULL, NULL);
+  struct __ns1__updateResponse *_p = soap_instantiate___ns1__updateResponse(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__updateResponse(soap, _p);
     _p->ns1__updateResponse_ = ns1__updateResponse_;
@@ -11109,12 +11238,12 @@ soap_instantiate___ns1__create(struct soap *, int, const char *, const char *,
 
 inline struct __ns1__create *soap_new___ns1__create(struct soap *soap,
                                                     int n = -1) {
-  return soap_instantiate___ns1__create(soap, n, NULL, NULL, NULL);
+  return soap_instantiate___ns1__create(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline struct __ns1__create *soap_new_req___ns1__create(struct soap *soap) {
   struct __ns1__create *_p =
-      soap_instantiate___ns1__create(soap, -1, NULL, NULL, NULL);
+      soap_instantiate___ns1__create(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__create(soap, _p);
   }
@@ -11124,7 +11253,7 @@ inline struct __ns1__create *soap_new_req___ns1__create(struct soap *soap) {
 inline struct __ns1__create *
 soap_new_set___ns1__create(struct soap *soap, ns1__create *ns1__create_) {
   struct __ns1__create *_p =
-      soap_instantiate___ns1__create(soap, -1, NULL, NULL, NULL);
+      soap_instantiate___ns1__create(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__create(soap, _p);
     _p->ns1__create_ = ns1__create_;
@@ -11186,12 +11315,12 @@ soap_instantiate___ns1__search(struct soap *, int, const char *, const char *,
 
 inline struct __ns1__search *soap_new___ns1__search(struct soap *soap,
                                                     int n = -1) {
-  return soap_instantiate___ns1__search(soap, n, NULL, NULL, NULL);
+  return soap_instantiate___ns1__search(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline struct __ns1__search *soap_new_req___ns1__search(struct soap *soap) {
   struct __ns1__search *_p =
-      soap_instantiate___ns1__search(soap, -1, NULL, NULL, NULL);
+      soap_instantiate___ns1__search(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__search(soap, _p);
   }
@@ -11201,7 +11330,7 @@ inline struct __ns1__search *soap_new_req___ns1__search(struct soap *soap) {
 inline struct __ns1__search *
 soap_new_set___ns1__search(struct soap *soap, ns1__search *ns1__search_) {
   struct __ns1__search *_p =
-      soap_instantiate___ns1__search(soap, -1, NULL, NULL, NULL);
+      soap_instantiate___ns1__search(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__search(soap, _p);
     _p->ns1__search_ = ns1__search_;
@@ -11263,12 +11392,12 @@ soap_instantiate___ns1__delete(struct soap *, int, const char *, const char *,
 
 inline struct __ns1__delete *soap_new___ns1__delete(struct soap *soap,
                                                     int n = -1) {
-  return soap_instantiate___ns1__delete(soap, n, NULL, NULL, NULL);
+  return soap_instantiate___ns1__delete(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline struct __ns1__delete *soap_new_req___ns1__delete(struct soap *soap) {
   struct __ns1__delete *_p =
-      soap_instantiate___ns1__delete(soap, -1, NULL, NULL, NULL);
+      soap_instantiate___ns1__delete(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__delete(soap, _p);
   }
@@ -11278,7 +11407,7 @@ inline struct __ns1__delete *soap_new_req___ns1__delete(struct soap *soap) {
 inline struct __ns1__delete *
 soap_new_set___ns1__delete(struct soap *soap, ns1__delete *ns1__delete_) {
   struct __ns1__delete *_p =
-      soap_instantiate___ns1__delete(soap, -1, NULL, NULL, NULL);
+      soap_instantiate___ns1__delete(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__delete(soap, _p);
     _p->ns1__delete_ = ns1__delete_;
@@ -11344,13 +11473,14 @@ soap_instantiate___ns1__deleteResponse(struct soap *, int, const char *,
 
 inline struct __ns1__deleteResponse *
 soap_new___ns1__deleteResponse(struct soap *soap, int n = -1) {
-  return soap_instantiate___ns1__deleteResponse(soap, n, NULL, NULL, NULL);
+  return soap_instantiate___ns1__deleteResponse(soap, n, nullptr, nullptr,
+                                                nullptr);
 }
 
 inline struct __ns1__deleteResponse *
 soap_new_req___ns1__deleteResponse(struct soap *soap) {
-  struct __ns1__deleteResponse *_p =
-      soap_instantiate___ns1__deleteResponse(soap, -1, NULL, NULL, NULL);
+  struct __ns1__deleteResponse *_p = soap_instantiate___ns1__deleteResponse(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__deleteResponse(soap, _p);
   }
@@ -11360,8 +11490,8 @@ soap_new_req___ns1__deleteResponse(struct soap *soap) {
 inline struct __ns1__deleteResponse *
 soap_new_set___ns1__deleteResponse(struct soap *soap,
                                    ns1__deleteResponse *ns1__deleteResponse_) {
-  struct __ns1__deleteResponse *_p =
-      soap_instantiate___ns1__deleteResponse(soap, -1, NULL, NULL, NULL);
+  struct __ns1__deleteResponse *_p = soap_instantiate___ns1__deleteResponse(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__deleteResponse(soap, _p);
     _p->ns1__deleteResponse_ = ns1__deleteResponse_;
@@ -11426,13 +11556,14 @@ soap_instantiate___ns1__getProperties(struct soap *, int, const char *,
 
 inline struct __ns1__getProperties *
 soap_new___ns1__getProperties(struct soap *soap, int n = -1) {
-  return soap_instantiate___ns1__getProperties(soap, n, NULL, NULL, NULL);
+  return soap_instantiate___ns1__getProperties(soap, n, nullptr, nullptr,
+                                               nullptr);
 }
 
 inline struct __ns1__getProperties *
 soap_new_req___ns1__getProperties(struct soap *soap) {
-  struct __ns1__getProperties *_p =
-      soap_instantiate___ns1__getProperties(soap, -1, NULL, NULL, NULL);
+  struct __ns1__getProperties *_p = soap_instantiate___ns1__getProperties(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__getProperties(soap, _p);
   }
@@ -11442,8 +11573,8 @@ soap_new_req___ns1__getProperties(struct soap *soap) {
 inline struct __ns1__getProperties *
 soap_new_set___ns1__getProperties(struct soap *soap,
                                   ns1__getProperties *ns1__getProperties_) {
-  struct __ns1__getProperties *_p =
-      soap_instantiate___ns1__getProperties(soap, -1, NULL, NULL, NULL);
+  struct __ns1__getProperties *_p = soap_instantiate___ns1__getProperties(
+      soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__getProperties(soap, _p);
     _p->ns1__getProperties_ = ns1__getProperties_;
@@ -11504,12 +11635,12 @@ soap_instantiate___ns1__get(struct soap *, int, const char *, const char *,
                             size_t *);
 
 inline struct __ns1__get *soap_new___ns1__get(struct soap *soap, int n = -1) {
-  return soap_instantiate___ns1__get(soap, n, NULL, NULL, NULL);
+  return soap_instantiate___ns1__get(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline struct __ns1__get *soap_new_req___ns1__get(struct soap *soap) {
   struct __ns1__get *_p =
-      soap_instantiate___ns1__get(soap, -1, NULL, NULL, NULL);
+      soap_instantiate___ns1__get(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__get(soap, _p);
   }
@@ -11519,7 +11650,7 @@ inline struct __ns1__get *soap_new_req___ns1__get(struct soap *soap) {
 inline struct __ns1__get *soap_new_set___ns1__get(struct soap *soap,
                                                   ns1__get *ns1__get_) {
   struct __ns1__get *_p =
-      soap_instantiate___ns1__get(soap, -1, NULL, NULL, NULL);
+      soap_instantiate___ns1__get(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__get(soap, _p);
     _p->ns1__get_ = ns1__get_;
@@ -11580,13 +11711,14 @@ soap_instantiate___ns1__getUserName(struct soap *, int, const char *,
 
 inline struct __ns1__getUserName *soap_new___ns1__getUserName(struct soap *soap,
                                                               int n = -1) {
-  return soap_instantiate___ns1__getUserName(soap, n, NULL, NULL, NULL);
+  return soap_instantiate___ns1__getUserName(soap, n, nullptr, nullptr,
+                                             nullptr);
 }
 
 inline struct __ns1__getUserName *
 soap_new_req___ns1__getUserName(struct soap *soap) {
   struct __ns1__getUserName *_p =
-      soap_instantiate___ns1__getUserName(soap, -1, NULL, NULL, NULL);
+      soap_instantiate___ns1__getUserName(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__getUserName(soap, _p);
   }
@@ -11597,7 +11729,7 @@ inline struct __ns1__getUserName *
 soap_new_set___ns1__getUserName(struct soap *soap,
                                 ns1__getUserName *ns1__getUserName_) {
   struct __ns1__getUserName *_p =
-      soap_instantiate___ns1__getUserName(soap, -1, NULL, NULL, NULL);
+      soap_instantiate___ns1__getUserName(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__getUserName(soap, _p);
     _p->ns1__getUserName_ = ns1__getUserName_;
@@ -11659,12 +11791,12 @@ soap_instantiate___ns1__login(struct soap *, int, const char *, const char *,
 
 inline struct __ns1__login *soap_new___ns1__login(struct soap *soap,
                                                   int n = -1) {
-  return soap_instantiate___ns1__login(soap, n, NULL, NULL, NULL);
+  return soap_instantiate___ns1__login(soap, n, nullptr, nullptr, nullptr);
 }
 
 inline struct __ns1__login *soap_new_req___ns1__login(struct soap *soap) {
   struct __ns1__login *_p =
-      soap_instantiate___ns1__login(soap, -1, NULL, NULL, NULL);
+      soap_instantiate___ns1__login(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__login(soap, _p);
   }
@@ -11674,7 +11806,7 @@ inline struct __ns1__login *soap_new_req___ns1__login(struct soap *soap) {
 inline struct __ns1__login *soap_new_set___ns1__login(struct soap *soap,
                                                       ns1__login *ns1__login_) {
   struct __ns1__login *_p =
-      soap_instantiate___ns1__login(soap, -1, NULL, NULL, NULL);
+      soap_instantiate___ns1__login(soap, -1, nullptr, nullptr, nullptr);
   if (_p) {
     soap_default___ns1__login(soap, _p);
     _p->ns1__login_ = ns1__login_;
@@ -15948,7 +16080,7 @@ inline std::vector<ns1__sampleParameter *> *
 soap_new_std__vectorTemplateOfPointerTons1__sampleParameter(struct soap *soap,
                                                             int n = -1) {
   return soap_instantiate_std__vectorTemplateOfPointerTons1__sampleParameter(
-      soap, n, NULL, NULL, NULL);
+      soap, n, nullptr, nullptr, nullptr);
 }
 
 inline void soap_delete_std__vectorTemplateOfPointerTons1__sampleParameter(
@@ -15986,7 +16118,7 @@ inline std::vector<ns1__permissibleStringValue *> *
 soap_new_std__vectorTemplateOfPointerTons1__permissibleStringValue(
     struct soap *soap, int n = -1) {
   return soap_instantiate_std__vectorTemplateOfPointerTons1__permissibleStringValue(
-      soap, n, NULL, NULL, NULL);
+      soap, n, nullptr, nullptr, nullptr);
 }
 
 inline void
@@ -16023,8 +16155,8 @@ soap_instantiate_std__vectorTemplateOfPointerTons1__rule(struct soap *, int,
 inline std::vector<ns1__rule *> *
 soap_new_std__vectorTemplateOfPointerTons1__rule(struct soap *soap,
                                                  int n = -1) {
-  return soap_instantiate_std__vectorTemplateOfPointerTons1__rule(soap, n, NULL,
-                                                                  NULL, NULL);
+  return soap_instantiate_std__vectorTemplateOfPointerTons1__rule(
+      soap, n, nullptr, nullptr, nullptr);
 }
 
 inline void soap_delete_std__vectorTemplateOfPointerTons1__rule(
@@ -16062,7 +16194,7 @@ inline std::vector<ns1__userGroup *> *
 soap_new_std__vectorTemplateOfPointerTons1__userGroup(struct soap *soap,
                                                       int n = -1) {
   return soap_instantiate_std__vectorTemplateOfPointerTons1__userGroup(
-      soap, n, NULL, NULL, NULL);
+      soap, n, nullptr, nullptr, nullptr);
 }
 
 inline void soap_delete_std__vectorTemplateOfPointerTons1__userGroup(
@@ -16101,7 +16233,7 @@ inline std::vector<ns1__study *> *
 soap_new_std__vectorTemplateOfPointerTons1__study(struct soap *soap,
                                                   int n = -1) {
   return soap_instantiate_std__vectorTemplateOfPointerTons1__study(
-      soap, n, NULL, NULL, NULL);
+      soap, n, nullptr, nullptr, nullptr);
 }
 
 inline void soap_delete_std__vectorTemplateOfPointerTons1__study(
@@ -16140,7 +16272,7 @@ inline std::vector<ns1__instrumentScientist *> *
 soap_new_std__vectorTemplateOfPointerTons1__instrumentScientist(
     struct soap *soap, int n = -1) {
   return soap_instantiate_std__vectorTemplateOfPointerTons1__instrumentScientist(
-      soap, n, NULL, NULL, NULL);
+      soap, n, nullptr, nullptr, nullptr);
 }
 
 inline void soap_delete_std__vectorTemplateOfPointerTons1__instrumentScientist(
@@ -16177,7 +16309,7 @@ inline std::vector<ns1__sampleType *> *
 soap_new_std__vectorTemplateOfPointerTons1__sampleType(struct soap *soap,
                                                        int n = -1) {
   return soap_instantiate_std__vectorTemplateOfPointerTons1__sampleType(
-      soap, n, NULL, NULL, NULL);
+      soap, n, nullptr, nullptr, nullptr);
 }
 
 inline void soap_delete_std__vectorTemplateOfPointerTons1__sampleType(
@@ -16215,7 +16347,7 @@ inline std::vector<ns1__parameterType *> *
 soap_new_std__vectorTemplateOfPointerTons1__parameterType(struct soap *soap,
                                                           int n = -1) {
   return soap_instantiate_std__vectorTemplateOfPointerTons1__parameterType(
-      soap, n, NULL, NULL, NULL);
+      soap, n, nullptr, nullptr, nullptr);
 }
 
 inline void soap_delete_std__vectorTemplateOfPointerTons1__parameterType(
@@ -16254,7 +16386,7 @@ inline std::vector<ns1__investigation *> *
 soap_new_std__vectorTemplateOfPointerTons1__investigation(struct soap *soap,
                                                           int n = -1) {
   return soap_instantiate_std__vectorTemplateOfPointerTons1__investigation(
-      soap, n, NULL, NULL, NULL);
+      soap, n, nullptr, nullptr, nullptr);
 }
 
 inline void soap_delete_std__vectorTemplateOfPointerTons1__investigation(
@@ -16294,7 +16426,7 @@ inline std::vector<ns1__investigationType *> *
 soap_new_std__vectorTemplateOfPointerTons1__investigationType(struct soap *soap,
                                                               int n = -1) {
   return soap_instantiate_std__vectorTemplateOfPointerTons1__investigationType(
-      soap, n, NULL, NULL, NULL);
+      soap, n, nullptr, nullptr, nullptr);
 }
 
 inline void soap_delete_std__vectorTemplateOfPointerTons1__investigationType(
@@ -16331,7 +16463,7 @@ inline std::vector<ns1__instrument *> *
 soap_new_std__vectorTemplateOfPointerTons1__instrument(struct soap *soap,
                                                        int n = -1) {
   return soap_instantiate_std__vectorTemplateOfPointerTons1__instrument(
-      soap, n, NULL, NULL, NULL);
+      soap, n, nullptr, nullptr, nullptr);
 }
 
 inline void soap_delete_std__vectorTemplateOfPointerTons1__instrument(
@@ -16369,7 +16501,7 @@ inline std::vector<ns1__facilityCycle *> *
 soap_new_std__vectorTemplateOfPointerTons1__facilityCycle(struct soap *soap,
                                                           int n = -1) {
   return soap_instantiate_std__vectorTemplateOfPointerTons1__facilityCycle(
-      soap, n, NULL, NULL, NULL);
+      soap, n, nullptr, nullptr, nullptr);
 }
 
 inline void soap_delete_std__vectorTemplateOfPointerTons1__facilityCycle(
@@ -16408,7 +16540,7 @@ inline std::vector<ns1__datasetType *> *
 soap_new_std__vectorTemplateOfPointerTons1__datasetType(struct soap *soap,
                                                         int n = -1) {
   return soap_instantiate_std__vectorTemplateOfPointerTons1__datasetType(
-      soap, n, NULL, NULL, NULL);
+      soap, n, nullptr, nullptr, nullptr);
 }
 
 inline void soap_delete_std__vectorTemplateOfPointerTons1__datasetType(
@@ -16446,7 +16578,7 @@ inline std::vector<ns1__datafileFormat *> *
 soap_new_std__vectorTemplateOfPointerTons1__datafileFormat(struct soap *soap,
                                                            int n = -1) {
   return soap_instantiate_std__vectorTemplateOfPointerTons1__datafileFormat(
-      soap, n, NULL, NULL, NULL);
+      soap, n, nullptr, nullptr, nullptr);
 }
 
 inline void soap_delete_std__vectorTemplateOfPointerTons1__datafileFormat(
@@ -16485,7 +16617,7 @@ inline std::vector<ns1__application *> *
 soap_new_std__vectorTemplateOfPointerTons1__application(struct soap *soap,
                                                         int n = -1) {
   return soap_instantiate_std__vectorTemplateOfPointerTons1__application(
-      soap, n, NULL, NULL, NULL);
+      soap, n, nullptr, nullptr, nullptr);
 }
 
 inline void soap_delete_std__vectorTemplateOfPointerTons1__application(
@@ -16524,7 +16656,7 @@ inline std::vector<ns1__studyInvestigation *> *
 soap_new_std__vectorTemplateOfPointerTons1__studyInvestigation(
     struct soap *soap, int n = -1) {
   return soap_instantiate_std__vectorTemplateOfPointerTons1__studyInvestigation(
-      soap, n, NULL, NULL, NULL);
+      soap, n, nullptr, nullptr, nullptr);
 }
 
 inline void soap_delete_std__vectorTemplateOfPointerTons1__studyInvestigation(
@@ -16562,7 +16694,7 @@ inline std::vector<ns1__shift *> *
 soap_new_std__vectorTemplateOfPointerTons1__shift(struct soap *soap,
                                                   int n = -1) {
   return soap_instantiate_std__vectorTemplateOfPointerTons1__shift(
-      soap, n, NULL, NULL, NULL);
+      soap, n, nullptr, nullptr, nullptr);
 }
 
 inline void soap_delete_std__vectorTemplateOfPointerTons1__shift(
@@ -16601,7 +16733,7 @@ inline std::vector<ns1__sample *> *
 soap_new_std__vectorTemplateOfPointerTons1__sample(struct soap *soap,
                                                    int n = -1) {
   return soap_instantiate_std__vectorTemplateOfPointerTons1__sample(
-      soap, n, NULL, NULL, NULL);
+      soap, n, nullptr, nullptr, nullptr);
 }
 
 inline void soap_delete_std__vectorTemplateOfPointerTons1__sample(
@@ -16639,7 +16771,7 @@ inline std::vector<ns1__publication *> *
 soap_new_std__vectorTemplateOfPointerTons1__publication(struct soap *soap,
                                                         int n = -1) {
   return soap_instantiate_std__vectorTemplateOfPointerTons1__publication(
-      soap, n, NULL, NULL, NULL);
+      soap, n, nullptr, nullptr, nullptr);
 }
 
 inline void soap_delete_std__vectorTemplateOfPointerTons1__publication(
@@ -16678,7 +16810,7 @@ inline std::vector<ns1__investigationParameter *> *
 soap_new_std__vectorTemplateOfPointerTons1__investigationParameter(
     struct soap *soap, int n = -1) {
   return soap_instantiate_std__vectorTemplateOfPointerTons1__investigationParameter(
-      soap, n, NULL, NULL, NULL);
+      soap, n, nullptr, nullptr, nullptr);
 }
 
 inline void
@@ -16716,7 +16848,7 @@ inline std::vector<ns1__keyword *> *
 soap_new_std__vectorTemplateOfPointerTons1__keyword(struct soap *soap,
                                                     int n = -1) {
   return soap_instantiate_std__vectorTemplateOfPointerTons1__keyword(
-      soap, n, NULL, NULL, NULL);
+      soap, n, nullptr, nullptr, nullptr);
 }
 
 inline void soap_delete_std__vectorTemplateOfPointerTons1__keyword(
@@ -16755,7 +16887,7 @@ inline std::vector<ns1__investigationUser *> *
 soap_new_std__vectorTemplateOfPointerTons1__investigationUser(struct soap *soap,
                                                               int n = -1) {
   return soap_instantiate_std__vectorTemplateOfPointerTons1__investigationUser(
-      soap, n, NULL, NULL, NULL);
+      soap, n, nullptr, nullptr, nullptr);
 }
 
 inline void soap_delete_std__vectorTemplateOfPointerTons1__investigationUser(
@@ -16793,7 +16925,7 @@ inline std::vector<ns1__investigationInstrument *> *
 soap_new_std__vectorTemplateOfPointerTons1__investigationInstrument(
     struct soap *soap, int n = -1) {
   return soap_instantiate_std__vectorTemplateOfPointerTons1__investigationInstrument(
-      soap, n, NULL, NULL, NULL);
+      soap, n, nullptr, nullptr, nullptr);
 }
 
 inline void
@@ -16831,7 +16963,7 @@ inline std::vector<ns1__dataset *> *
 soap_new_std__vectorTemplateOfPointerTons1__dataset(struct soap *soap,
                                                     int n = -1) {
   return soap_instantiate_std__vectorTemplateOfPointerTons1__dataset(
-      soap, n, NULL, NULL, NULL);
+      soap, n, nullptr, nullptr, nullptr);
 }
 
 inline void soap_delete_std__vectorTemplateOfPointerTons1__dataset(
@@ -16870,7 +17002,7 @@ inline std::vector<ns1__datasetParameter *> *
 soap_new_std__vectorTemplateOfPointerTons1__datasetParameter(struct soap *soap,
                                                              int n = -1) {
   return soap_instantiate_std__vectorTemplateOfPointerTons1__datasetParameter(
-      soap, n, NULL, NULL, NULL);
+      soap, n, nullptr, nullptr, nullptr);
 }
 
 inline void soap_delete_std__vectorTemplateOfPointerTons1__datasetParameter(
@@ -16907,7 +17039,7 @@ inline std::vector<ns1__datafile *> *
 soap_new_std__vectorTemplateOfPointerTons1__datafile(struct soap *soap,
                                                      int n = -1) {
   return soap_instantiate_std__vectorTemplateOfPointerTons1__datafile(
-      soap, n, NULL, NULL, NULL);
+      soap, n, nullptr, nullptr, nullptr);
 }
 
 inline void soap_delete_std__vectorTemplateOfPointerTons1__datafile(
@@ -16946,7 +17078,7 @@ inline std::vector<ns1__dataCollectionParameter *> *
 soap_new_std__vectorTemplateOfPointerTons1__dataCollectionParameter(
     struct soap *soap, int n = -1) {
   return soap_instantiate_std__vectorTemplateOfPointerTons1__dataCollectionParameter(
-      soap, n, NULL, NULL, NULL);
+      soap, n, nullptr, nullptr, nullptr);
 }
 
 inline void
@@ -16984,8 +17116,8 @@ soap_instantiate_std__vectorTemplateOfPointerTons1__job(struct soap *, int,
 
 inline std::vector<ns1__job *> *
 soap_new_std__vectorTemplateOfPointerTons1__job(struct soap *soap, int n = -1) {
-  return soap_instantiate_std__vectorTemplateOfPointerTons1__job(soap, n, NULL,
-                                                                 NULL, NULL);
+  return soap_instantiate_std__vectorTemplateOfPointerTons1__job(
+      soap, n, nullptr, nullptr, nullptr);
 }
 
 inline void
@@ -17025,7 +17157,7 @@ inline std::vector<ns1__dataCollectionDataset *> *
 soap_new_std__vectorTemplateOfPointerTons1__dataCollectionDataset(
     struct soap *soap, int n = -1) {
   return soap_instantiate_std__vectorTemplateOfPointerTons1__dataCollectionDataset(
-      soap, n, NULL, NULL, NULL);
+      soap, n, nullptr, nullptr, nullptr);
 }
 
 inline void
@@ -17064,7 +17196,7 @@ inline std::vector<ns1__datafileParameter *> *
 soap_new_std__vectorTemplateOfPointerTons1__datafileParameter(struct soap *soap,
                                                               int n = -1) {
   return soap_instantiate_std__vectorTemplateOfPointerTons1__datafileParameter(
-      soap, n, NULL, NULL, NULL);
+      soap, n, nullptr, nullptr, nullptr);
 }
 
 inline void soap_delete_std__vectorTemplateOfPointerTons1__datafileParameter(
@@ -17101,7 +17233,7 @@ inline std::vector<ns1__relatedDatafile *> *
 soap_new_std__vectorTemplateOfPointerTons1__relatedDatafile(struct soap *soap,
                                                             int n = -1) {
   return soap_instantiate_std__vectorTemplateOfPointerTons1__relatedDatafile(
-      soap, n, NULL, NULL, NULL);
+      soap, n, nullptr, nullptr, nullptr);
 }
 
 inline void soap_delete_std__vectorTemplateOfPointerTons1__relatedDatafile(
@@ -17139,7 +17271,7 @@ inline std::vector<ns1__dataCollectionDatafile *> *
 soap_new_std__vectorTemplateOfPointerTons1__dataCollectionDatafile(
     struct soap *soap, int n = -1) {
   return soap_instantiate_std__vectorTemplateOfPointerTons1__dataCollectionDatafile(
-      soap, n, NULL, NULL, NULL);
+      soap, n, nullptr, nullptr, nullptr);
 }
 
 inline void
@@ -17177,7 +17309,7 @@ inline std::vector<xsd__anyType *> *
 soap_new_std__vectorTemplateOfPointerToxsd__anyType(struct soap *soap,
                                                     int n = -1) {
   return soap_instantiate_std__vectorTemplateOfPointerToxsd__anyType(
-      soap, n, NULL, NULL, NULL);
+      soap, n, nullptr, nullptr, nullptr);
 }
 
 inline void soap_delete_std__vectorTemplateOfPointerToxsd__anyType(
@@ -17215,7 +17347,7 @@ inline std::vector<ns1__entityField *> *
 soap_new_std__vectorTemplateOfPointerTons1__entityField(struct soap *soap,
                                                         int n = -1) {
   return soap_instantiate_std__vectorTemplateOfPointerTons1__entityField(
-      soap, n, NULL, NULL, NULL);
+      soap, n, nullptr, nullptr, nullptr);
 }
 
 inline void soap_delete_std__vectorTemplateOfPointerTons1__entityField(
@@ -17253,7 +17385,7 @@ inline std::vector<ns1__constraint *> *
 soap_new_std__vectorTemplateOfPointerTons1__constraint(struct soap *soap,
                                                        int n = -1) {
   return soap_instantiate_std__vectorTemplateOfPointerTons1__constraint(
-      soap, n, NULL, NULL, NULL);
+      soap, n, nullptr, nullptr, nullptr);
 }
 
 inline void soap_delete_std__vectorTemplateOfPointerTons1__constraint(
@@ -17291,7 +17423,7 @@ inline std::vector<_ns1__login_credentials_entry> *
 soap_new_std__vectorTemplateOf_ns1__login_credentials_entry(struct soap *soap,
                                                             int n = -1) {
   return soap_instantiate_std__vectorTemplateOf_ns1__login_credentials_entry(
-      soap, n, NULL, NULL, NULL);
+      soap, n, nullptr, nullptr, nullptr);
 }
 
 inline void soap_delete_std__vectorTemplateOf_ns1__login_credentials_entry(
@@ -17326,8 +17458,8 @@ soap_instantiate_std__vectorTemplateOfstd__string(struct soap *, int,
 
 inline std::vector<std::string> *
 soap_new_std__vectorTemplateOfstd__string(struct soap *soap, int n = -1) {
-  return soap_instantiate_std__vectorTemplateOfstd__string(soap, n, NULL, NULL,
-                                                           NULL);
+  return soap_instantiate_std__vectorTemplateOfstd__string(soap, n, nullptr,
+                                                           nullptr, nullptr);
 }
 
 inline void
@@ -17360,8 +17492,8 @@ soap_instantiate_std__vectorTemplateOfLONG64(struct soap *, int, const char *,
 
 inline std::vector<LONG64> *
 soap_new_std__vectorTemplateOfLONG64(struct soap *soap, int n = -1) {
-  return soap_instantiate_std__vectorTemplateOfLONG64(soap, n, NULL, NULL,
-                                                      NULL);
+  return soap_instantiate_std__vectorTemplateOfLONG64(soap, n, nullptr, nullptr,
+                                                      nullptr);
 }
 
 inline void soap_delete_std__vectorTemplateOfLONG64(struct soap *soap,
@@ -17398,7 +17530,7 @@ inline std::vector<ns1__entityBaseBean *> *
 soap_new_std__vectorTemplateOfPointerTons1__entityBaseBean(struct soap *soap,
                                                            int n = -1) {
   return soap_instantiate_std__vectorTemplateOfPointerTons1__entityBaseBean(
-      soap, n, NULL, NULL, NULL);
+      soap, n, nullptr, nullptr, nullptr);
 }
 
 inline void soap_delete_std__vectorTemplateOfPointerTons1__entityBaseBean(
diff --git a/Framework/ICat/inc/MantidICat/ICat4/GSoapGenerated/ICat4ICATPortBindingProxy.h b/Framework/ICat/inc/MantidICat/ICat4/GSoapGenerated/ICat4ICATPortBindingProxy.h
index bbb5ef8e62881d49cd21c187577b1b07fe777028..18d3c0943d70565f53e8706d3190460ceb702c25 100644
--- a/Framework/ICat/inc/MantidICat/ICat4/GSoapGenerated/ICat4ICATPortBindingProxy.h
+++ b/Framework/ICat/inc/MantidICat/ICat4/GSoapGenerated/ICat4ICATPortBindingProxy.h
@@ -67,7 +67,7 @@ public:
   /// Web service operation 'login' (returns error code or SOAP_OK)
   virtual int login(ns1__login *ns1__login_,
                     ns1__loginResponse *ns1__loginResponse_) {
-    return this->login(NULL, NULL, ns1__login_, ns1__loginResponse_);
+    return this->login(nullptr, nullptr, ns1__login_, ns1__loginResponse_);
   }
   virtual int login(const char *endpoint, const char *soap_action,
                     ns1__login *ns1__login_,
@@ -76,7 +76,7 @@ public:
   /// Web service operation 'getUserName' (returns error code or SOAP_OK)
   virtual int getUserName(ns1__getUserName *ns1__getUserName_,
                           ns1__getUserNameResponse *ns1__getUserNameResponse_) {
-    return this->getUserName(NULL, NULL, ns1__getUserName_,
+    return this->getUserName(nullptr, nullptr, ns1__getUserName_,
                              ns1__getUserNameResponse_);
   }
   virtual int getUserName(const char *endpoint, const char *soap_action,
@@ -85,7 +85,7 @@ public:
 
   /// Web service operation 'get' (returns error code or SOAP_OK)
   virtual int get(ns1__get *ns1__get_, ns1__getResponse *ns1__getResponse_) {
-    return this->get(NULL, NULL, ns1__get_, ns1__getResponse_);
+    return this->get(nullptr, nullptr, ns1__get_, ns1__getResponse_);
   }
   virtual int get(const char *endpoint, const char *soap_action,
                   ns1__get *ns1__get_, ns1__getResponse *ns1__getResponse_);
@@ -94,7 +94,7 @@ public:
   virtual int
   getProperties(ns1__getProperties *ns1__getProperties_,
                 ns1__getPropertiesResponse *ns1__getPropertiesResponse_) {
-    return this->getProperties(NULL, NULL, ns1__getProperties_,
+    return this->getProperties(nullptr, nullptr, ns1__getProperties_,
                                ns1__getPropertiesResponse_);
   }
   virtual int
@@ -105,7 +105,7 @@ public:
   /// Web service operation 'delete' (returns error code or SOAP_OK)
   virtual int delete_(ns1__delete *ns1__delete_,
                       ns1__deleteResponse *ns1__deleteResponse_) {
-    return this->delete_(NULL, NULL, ns1__delete_, ns1__deleteResponse_);
+    return this->delete_(nullptr, nullptr, ns1__delete_, ns1__deleteResponse_);
   }
   virtual int delete_(const char *endpoint, const char *soap_action,
                       ns1__delete *ns1__delete_,
@@ -114,7 +114,7 @@ public:
   /// Web service operation 'search' (returns error code or SOAP_OK)
   virtual int search(ns1__search *ns1__search_,
                      ns1__searchResponse *ns1__searchResponse_) {
-    return this->search(NULL, NULL, ns1__search_, ns1__searchResponse_);
+    return this->search(nullptr, nullptr, ns1__search_, ns1__searchResponse_);
   }
   virtual int search(const char *endpoint, const char *soap_action,
                      ns1__search *ns1__search_,
@@ -123,7 +123,7 @@ public:
   /// Web service operation 'create' (returns error code or SOAP_OK)
   virtual int create(ns1__create *ns1__create_,
                      ns1__createResponse *ns1__createResponse_) {
-    return this->create(NULL, NULL, ns1__create_, ns1__createResponse_);
+    return this->create(nullptr, nullptr, ns1__create_, ns1__createResponse_);
   }
   virtual int create(const char *endpoint, const char *soap_action,
                      ns1__create *ns1__create_,
@@ -132,7 +132,7 @@ public:
   /// Web service operation 'update' (returns error code or SOAP_OK)
   virtual int update(ns1__update *ns1__update_,
                      ns1__updateResponse *ns1__updateResponse_) {
-    return this->update(NULL, NULL, ns1__update_, ns1__updateResponse_);
+    return this->update(nullptr, nullptr, ns1__update_, ns1__updateResponse_);
   }
   virtual int update(const char *endpoint, const char *soap_action,
                      ns1__update *ns1__update_,
@@ -142,7 +142,7 @@ public:
   virtual int
   getApiVersion(ns1__getApiVersion *ns1__getApiVersion_,
                 ns1__getApiVersionResponse *ns1__getApiVersionResponse_) {
-    return this->getApiVersion(NULL, NULL, ns1__getApiVersion_,
+    return this->getApiVersion(nullptr, nullptr, ns1__getApiVersion_,
                                ns1__getApiVersionResponse_);
   }
   virtual int
@@ -154,7 +154,7 @@ public:
   virtual int
   getEntityNames(ns1__getEntityNames *ns1__getEntityNames_,
                  ns1__getEntityNamesResponse *ns1__getEntityNamesResponse_) {
-    return this->getEntityNames(NULL, NULL, ns1__getEntityNames_,
+    return this->getEntityNames(nullptr, nullptr, ns1__getEntityNames_,
                                 ns1__getEntityNamesResponse_);
   }
   virtual int
@@ -165,7 +165,8 @@ public:
   /// Web service operation 'refresh' (returns error code or SOAP_OK)
   virtual int refresh(ns1__refresh *ns1__refresh_,
                       ns1__refreshResponse *ns1__refreshResponse_) {
-    return this->refresh(NULL, NULL, ns1__refresh_, ns1__refreshResponse_);
+    return this->refresh(nullptr, nullptr, ns1__refresh_,
+                         ns1__refreshResponse_);
   }
   virtual int refresh(const char *endpoint, const char *soap_action,
                       ns1__refresh *ns1__refresh_,
@@ -174,7 +175,7 @@ public:
   /// Web service operation 'dummy' (returns error code or SOAP_OK)
   virtual int dummy(ns1__dummy *ns1__dummy_,
                     ns1__dummyResponse *ns1__dummyResponse_) {
-    return this->dummy(NULL, NULL, ns1__dummy_, ns1__dummyResponse_);
+    return this->dummy(nullptr, nullptr, ns1__dummy_, ns1__dummyResponse_);
   }
   virtual int dummy(const char *endpoint, const char *soap_action,
                     ns1__dummy *ns1__dummy_,
@@ -183,7 +184,7 @@ public:
   /// Web service operation 'logout' (returns error code or SOAP_OK)
   virtual int logout(ns1__logout *ns1__logout_,
                      ns1__logoutResponse *ns1__logoutResponse_) {
-    return this->logout(NULL, NULL, ns1__logout_, ns1__logoutResponse_);
+    return this->logout(nullptr, nullptr, ns1__logout_, ns1__logoutResponse_);
   }
   virtual int logout(const char *endpoint, const char *soap_action,
                      ns1__logout *ns1__logout_,
@@ -194,7 +195,8 @@ public:
   virtual int getRemainingMinutes(
       ns1__getRemainingMinutes *ns1__getRemainingMinutes_,
       ns1__getRemainingMinutesResponse *ns1__getRemainingMinutesResponse_) {
-    return this->getRemainingMinutes(NULL, NULL, ns1__getRemainingMinutes_,
+    return this->getRemainingMinutes(nullptr, nullptr,
+                                     ns1__getRemainingMinutes_,
                                      ns1__getRemainingMinutesResponse_);
   }
   virtual int getRemainingMinutes(
@@ -205,7 +207,7 @@ public:
   /// Web service operation 'searchText' (returns error code or SOAP_OK)
   virtual int searchText(ns1__searchText *ns1__searchText_,
                          ns1__searchTextResponse *ns1__searchTextResponse_) {
-    return this->searchText(NULL, NULL, ns1__searchText_,
+    return this->searchText(nullptr, nullptr, ns1__searchText_,
                             ns1__searchTextResponse_);
   }
   virtual int searchText(const char *endpoint, const char *soap_action,
@@ -216,7 +218,7 @@ public:
   virtual int
   isAccessAllowed(ns1__isAccessAllowed *ns1__isAccessAllowed_,
                   ns1__isAccessAllowedResponse *ns1__isAccessAllowedResponse_) {
-    return this->isAccessAllowed(NULL, NULL, ns1__isAccessAllowed_,
+    return this->isAccessAllowed(nullptr, nullptr, ns1__isAccessAllowed_,
                                  ns1__isAccessAllowedResponse_);
   }
   virtual int
@@ -228,7 +230,7 @@ public:
   virtual int
   lucenePopulate(ns1__lucenePopulate *ns1__lucenePopulate_,
                  ns1__lucenePopulateResponse *ns1__lucenePopulateResponse_) {
-    return this->lucenePopulate(NULL, NULL, ns1__lucenePopulate_,
+    return this->lucenePopulate(nullptr, nullptr, ns1__lucenePopulate_,
                                 ns1__lucenePopulateResponse_);
   }
   virtual int
@@ -239,7 +241,7 @@ public:
   /// Web service operation 'luceneClear' (returns error code or SOAP_OK)
   virtual int luceneClear(ns1__luceneClear *ns1__luceneClear_,
                           ns1__luceneClearResponse *ns1__luceneClearResponse_) {
-    return this->luceneClear(NULL, NULL, ns1__luceneClear_,
+    return this->luceneClear(nullptr, nullptr, ns1__luceneClear_,
                              ns1__luceneClearResponse_);
   }
   virtual int luceneClear(const char *endpoint, const char *soap_action,
@@ -250,7 +252,7 @@ public:
   virtual int
   luceneCommit(ns1__luceneCommit *ns1__luceneCommit_,
                ns1__luceneCommitResponse *ns1__luceneCommitResponse_) {
-    return this->luceneCommit(NULL, NULL, ns1__luceneCommit_,
+    return this->luceneCommit(nullptr, nullptr, ns1__luceneCommit_,
                               ns1__luceneCommitResponse_);
   }
   virtual int
@@ -262,7 +264,7 @@ public:
   virtual int
   luceneSearch(ns1__luceneSearch *ns1__luceneSearch_,
                ns1__luceneSearchResponse *ns1__luceneSearchResponse_) {
-    return this->luceneSearch(NULL, NULL, ns1__luceneSearch_,
+    return this->luceneSearch(nullptr, nullptr, ns1__luceneSearch_,
                               ns1__luceneSearchResponse_);
   }
   virtual int
@@ -275,7 +277,8 @@ public:
   virtual int luceneGetPopulating(
       ns1__luceneGetPopulating *ns1__luceneGetPopulating_,
       ns1__luceneGetPopulatingResponse *ns1__luceneGetPopulatingResponse_) {
-    return this->luceneGetPopulating(NULL, NULL, ns1__luceneGetPopulating_,
+    return this->luceneGetPopulating(nullptr, nullptr,
+                                     ns1__luceneGetPopulating_,
                                      ns1__luceneGetPopulatingResponse_);
   }
   virtual int luceneGetPopulating(
@@ -286,7 +289,7 @@ public:
   /// Web service operation 'createMany' (returns error code or SOAP_OK)
   virtual int createMany(ns1__createMany *ns1__createMany_,
                          ns1__createManyResponse *ns1__createManyResponse_) {
-    return this->createMany(NULL, NULL, ns1__createMany_,
+    return this->createMany(nullptr, nullptr, ns1__createMany_,
                             ns1__createManyResponse_);
   }
   virtual int createMany(const char *endpoint, const char *soap_action,
@@ -296,7 +299,7 @@ public:
   /// Web service operation 'deleteMany' (returns error code or SOAP_OK)
   virtual int deleteMany(ns1__deleteMany *ns1__deleteMany_,
                          ns1__deleteManyResponse *ns1__deleteManyResponse_) {
-    return this->deleteMany(NULL, NULL, ns1__deleteMany_,
+    return this->deleteMany(nullptr, nullptr, ns1__deleteMany_,
                             ns1__deleteManyResponse_);
   }
   virtual int deleteMany(const char *endpoint, const char *soap_action,
@@ -307,7 +310,7 @@ public:
   virtual int
   getEntityInfo(ns1__getEntityInfo *ns1__getEntityInfo_,
                 ns1__getEntityInfoResponse *ns1__getEntityInfoResponse_) {
-    return this->getEntityInfo(NULL, NULL, ns1__getEntityInfo_,
+    return this->getEntityInfo(nullptr, nullptr, ns1__getEntityInfo_,
                                ns1__getEntityInfoResponse_);
   }
   virtual int
diff --git a/Framework/ICat/inc/MantidICat/ICat4/GSoapGenerated/ICat4Stub.h b/Framework/ICat/inc/MantidICat/ICat4/GSoapGenerated/ICat4Stub.h
index cba2e1e1367ad343a77205d85709d9cae7dd34de..69bf0f4ce7309d223ea6709261e1781256a443dd 100644
--- a/Framework/ICat/inc/MantidICat/ICat4/GSoapGenerated/ICat4Stub.h
+++ b/Framework/ICat/inc/MantidICat/ICat4/GSoapGenerated/ICat4Stub.h
@@ -118,7 +118,7 @@ public:
   virtual int soap_out(struct soap *, const char *, int, const char *) const;
   virtual void *soap_get(struct soap *, const char *, const char *);
   virtual void *soap_in(struct soap *, const char *, const char *);
-  xsd__anyType() { xsd__anyType::soap_default(NULL); }
+  xsd__anyType() { xsd__anyType::soap_default(nullptr); }
   virtual ~xsd__anyType() {}
 };
 #endif
@@ -140,7 +140,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  xsd__boolean() { xsd__boolean::soap_default(NULL); }
+  xsd__boolean() { xsd__boolean::soap_default(nullptr); }
   ~xsd__boolean() override {}
 };
 #endif
@@ -162,7 +162,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  xsd__dateTime() { xsd__dateTime::soap_default(NULL); }
+  xsd__dateTime() { xsd__dateTime::soap_default(nullptr); }
   ~xsd__dateTime() override {}
 };
 #endif
@@ -184,7 +184,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  xsd__double() { xsd__double::soap_default(NULL); }
+  xsd__double() { xsd__double::soap_default(nullptr); }
   ~xsd__double() override {}
 };
 #endif
@@ -206,7 +206,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  xsd__int() { xsd__int::soap_default(NULL); }
+  xsd__int() { xsd__int::soap_default(nullptr); }
   ~xsd__int() override {}
 };
 #endif
@@ -228,7 +228,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  xsd__long() { xsd__long::soap_default(NULL); }
+  xsd__long() { xsd__long::soap_default(nullptr); }
   ~xsd__long() override {}
 };
 #endif
@@ -254,7 +254,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  xsd__string() { xsd__string::soap_default(NULL); }
+  xsd__string() { xsd__string::soap_default(nullptr); }
   ~xsd__string() override {}
 };
 #endif
@@ -276,7 +276,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__icatExceptionType_() { ns1__icatExceptionType_::soap_default(NULL); }
+  ns1__icatExceptionType_() { ns1__icatExceptionType_::soap_default(nullptr); }
   ~ns1__icatExceptionType_() override {}
 };
 #endif
@@ -298,7 +298,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__studyStatus_() { ns1__studyStatus_::soap_default(NULL); }
+  ns1__studyStatus_() { ns1__studyStatus_::soap_default(nullptr); }
   ~ns1__studyStatus_() override {}
 };
 #endif
@@ -320,7 +320,9 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__parameterValueType_() { ns1__parameterValueType_::soap_default(NULL); }
+  ns1__parameterValueType_() {
+    ns1__parameterValueType_::soap_default(nullptr);
+  }
   ~ns1__parameterValueType_() override {}
 };
 #endif
@@ -342,7 +344,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__relType_() { ns1__relType_::soap_default(NULL); }
+  ns1__relType_() { ns1__relType_::soap_default(nullptr); }
   ~ns1__relType_() override {}
 };
 #endif
@@ -364,7 +366,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__accessType_() { ns1__accessType_::soap_default(NULL); }
+  ns1__accessType_() { ns1__accessType_::soap_default(nullptr); }
   ~ns1__accessType_() override {}
 };
 #endif
@@ -385,7 +387,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__luceneClear() { ns1__luceneClear::soap_default(NULL); }
+  ns1__luceneClear() { ns1__luceneClear::soap_default(nullptr); }
   ~ns1__luceneClear() override {}
 };
 #endif
@@ -404,7 +406,9 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__luceneClearResponse() { ns1__luceneClearResponse::soap_default(NULL); }
+  ns1__luceneClearResponse() {
+    ns1__luceneClearResponse::soap_default(nullptr);
+  }
   ~ns1__luceneClearResponse() override {}
 };
 #endif
@@ -428,7 +432,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__IcatException() { ns1__IcatException::soap_default(NULL); }
+  ns1__IcatException() { ns1__IcatException::soap_default(nullptr); }
   ~ns1__IcatException() override {}
 };
 #endif
@@ -451,7 +455,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__createMany() { ns1__createMany::soap_default(NULL); }
+  ns1__createMany() { ns1__createMany::soap_default(nullptr); }
   ~ns1__createMany() override {}
 };
 #endif
@@ -476,7 +480,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__entityBaseBean() { ns1__entityBaseBean::soap_default(NULL); }
+  ns1__entityBaseBean() { ns1__entityBaseBean::soap_default(nullptr); }
   ~ns1__entityBaseBean() override {}
 };
 #endif
@@ -502,7 +506,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__createManyResponse() { ns1__createManyResponse::soap_default(NULL); }
+  ns1__createManyResponse() { ns1__createManyResponse::soap_default(nullptr); }
   ~ns1__createManyResponse() override {}
 };
 #endif
@@ -524,7 +528,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__create() { ns1__create::soap_default(NULL); }
+  ns1__create() { ns1__create::soap_default(nullptr); }
   ~ns1__create() override {}
 };
 #endif
@@ -550,7 +554,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__createResponse() { ns1__createResponse::soap_default(NULL); }
+  ns1__createResponse() { ns1__createResponse::soap_default(nullptr); }
   ~ns1__createResponse() override {}
 };
 #endif
@@ -571,7 +575,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__getProperties() { ns1__getProperties::soap_default(NULL); }
+  ns1__getProperties() { ns1__getProperties::soap_default(nullptr); }
   ~ns1__getProperties() override {}
 };
 #endif
@@ -598,7 +602,7 @@ public:
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
   ns1__getPropertiesResponse() {
-    ns1__getPropertiesResponse::soap_default(NULL);
+    ns1__getPropertiesResponse::soap_default(nullptr);
   }
   ~ns1__getPropertiesResponse() override {}
 };
@@ -623,7 +627,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__luceneSearch() { ns1__luceneSearch::soap_default(NULL); }
+  ns1__luceneSearch() { ns1__luceneSearch::soap_default(nullptr); }
   ~ns1__luceneSearch() override {}
 };
 #endif
@@ -649,7 +653,9 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__luceneSearchResponse() { ns1__luceneSearchResponse::soap_default(NULL); }
+  ns1__luceneSearchResponse() {
+    ns1__luceneSearchResponse::soap_default(nullptr);
+  }
   ~ns1__luceneSearchResponse() override {}
 };
 #endif
@@ -671,7 +677,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__lucenePopulate() { ns1__lucenePopulate::soap_default(NULL); }
+  ns1__lucenePopulate() { ns1__lucenePopulate::soap_default(nullptr); }
   ~ns1__lucenePopulate() override {}
 };
 #endif
@@ -691,7 +697,7 @@ public:
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
   ns1__lucenePopulateResponse() {
-    ns1__lucenePopulateResponse::soap_default(NULL);
+    ns1__lucenePopulateResponse::soap_default(nullptr);
   }
   ~ns1__lucenePopulateResponse() override {}
 };
@@ -715,7 +721,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__get() { ns1__get::soap_default(NULL); }
+  ns1__get() { ns1__get::soap_default(nullptr); }
   ~ns1__get() override {}
 };
 #endif
@@ -741,7 +747,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__getResponse() { ns1__getResponse::soap_default(NULL); }
+  ns1__getResponse() { ns1__getResponse::soap_default(nullptr); }
   ~ns1__getResponse() override {}
 };
 #endif
@@ -760,7 +766,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__getEntityNames() { ns1__getEntityNames::soap_default(NULL); }
+  ns1__getEntityNames() { ns1__getEntityNames::soap_default(nullptr); }
   ~ns1__getEntityNames() override {}
 };
 #endif
@@ -787,7 +793,7 @@ public:
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
   ns1__getEntityNamesResponse() {
-    ns1__getEntityNamesResponse::soap_default(NULL);
+    ns1__getEntityNamesResponse::soap_default(nullptr);
   }
   ~ns1__getEntityNamesResponse() override {}
 };
@@ -807,7 +813,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__getApiVersion() { ns1__getApiVersion::soap_default(NULL); }
+  ns1__getApiVersion() { ns1__getApiVersion::soap_default(nullptr); }
   ~ns1__getApiVersion() override {}
 };
 #endif
@@ -834,7 +840,7 @@ public:
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
   ns1__getApiVersionResponse() {
-    ns1__getApiVersionResponse::soap_default(NULL);
+    ns1__getApiVersionResponse::soap_default(nullptr);
   }
   ~ns1__getApiVersionResponse() override {}
 };
@@ -856,7 +862,9 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__luceneGetPopulating() { ns1__luceneGetPopulating::soap_default(NULL); }
+  ns1__luceneGetPopulating() {
+    ns1__luceneGetPopulating::soap_default(nullptr);
+  }
   ~ns1__luceneGetPopulating() override {}
 };
 #endif
@@ -883,7 +891,7 @@ public:
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
   ns1__luceneGetPopulatingResponse() {
-    ns1__luceneGetPopulatingResponse::soap_default(NULL);
+    ns1__luceneGetPopulatingResponse::soap_default(nullptr);
   }
   ~ns1__luceneGetPopulatingResponse() override {}
 };
@@ -906,7 +914,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__update() { ns1__update::soap_default(NULL); }
+  ns1__update() { ns1__update::soap_default(nullptr); }
   ~ns1__update() override {}
 };
 #endif
@@ -925,7 +933,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__updateResponse() { ns1__updateResponse::soap_default(NULL); }
+  ns1__updateResponse() { ns1__updateResponse::soap_default(nullptr); }
   ~ns1__updateResponse() override {}
 };
 #endif
@@ -948,7 +956,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__deleteMany() { ns1__deleteMany::soap_default(NULL); }
+  ns1__deleteMany() { ns1__deleteMany::soap_default(nullptr); }
   ~ns1__deleteMany() override {}
 };
 #endif
@@ -967,7 +975,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__deleteManyResponse() { ns1__deleteManyResponse::soap_default(NULL); }
+  ns1__deleteManyResponse() { ns1__deleteManyResponse::soap_default(nullptr); }
   ~ns1__deleteManyResponse() override {}
 };
 #endif
@@ -988,7 +996,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__getUserName() { ns1__getUserName::soap_default(NULL); }
+  ns1__getUserName() { ns1__getUserName::soap_default(nullptr); }
   ~ns1__getUserName() override {}
 };
 #endif
@@ -1014,7 +1022,9 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__getUserNameResponse() { ns1__getUserNameResponse::soap_default(NULL); }
+  ns1__getUserNameResponse() {
+    ns1__getUserNameResponse::soap_default(nullptr);
+  }
   ~ns1__getUserNameResponse() override {}
 };
 #endif
@@ -1035,7 +1045,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__refresh() { ns1__refresh::soap_default(NULL); }
+  ns1__refresh() { ns1__refresh::soap_default(nullptr); }
   ~ns1__refresh() override {}
 };
 #endif
@@ -1054,7 +1064,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__refreshResponse() { ns1__refreshResponse::soap_default(NULL); }
+  ns1__refreshResponse() { ns1__refreshResponse::soap_default(nullptr); }
   ~ns1__refreshResponse() override {}
 };
 #endif
@@ -1077,7 +1087,7 @@ public:
   virtual void *soap_get(struct soap *, const char *, const char *);
   virtual void *soap_in(struct soap *, const char *, const char *);
   _ns1__login_credentials_entry() {
-    _ns1__login_credentials_entry::soap_default(NULL);
+    _ns1__login_credentials_entry::soap_default(nullptr);
   }
   virtual ~_ns1__login_credentials_entry() {}
 };
@@ -1100,7 +1110,7 @@ public:
   virtual int soap_out(struct soap *, const char *, int, const char *) const;
   virtual void *soap_get(struct soap *, const char *, const char *);
   virtual void *soap_in(struct soap *, const char *, const char *);
-  _ns1__login_credentials() { _ns1__login_credentials::soap_default(NULL); }
+  _ns1__login_credentials() { _ns1__login_credentials::soap_default(nullptr); }
   virtual ~_ns1__login_credentials() {}
 };
 #endif
@@ -1123,7 +1133,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__login() { ns1__login::soap_default(NULL); }
+  ns1__login() { ns1__login::soap_default(nullptr); }
   ~ns1__login() override {}
 };
 #endif
@@ -1149,7 +1159,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__loginResponse() { ns1__loginResponse::soap_default(NULL); }
+  ns1__loginResponse() { ns1__loginResponse::soap_default(nullptr); }
   ~ns1__loginResponse() override {}
 };
 #endif
@@ -1219,7 +1229,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__dummy() { ns1__dummy::soap_default(NULL); }
+  ns1__dummy() { ns1__dummy::soap_default(nullptr); }
   ~ns1__dummy() override {}
 };
 #endif
@@ -1238,7 +1248,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__dummyResponse() { ns1__dummyResponse::soap_default(NULL); }
+  ns1__dummyResponse() { ns1__dummyResponse::soap_default(nullptr); }
   ~ns1__dummyResponse() override {}
 };
 #endif
@@ -1259,7 +1269,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__getEntityInfo() { ns1__getEntityInfo::soap_default(NULL); }
+  ns1__getEntityInfo() { ns1__getEntityInfo::soap_default(nullptr); }
   ~ns1__getEntityInfo() override {}
 };
 #endif
@@ -1286,7 +1296,7 @@ public:
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
   ns1__getEntityInfoResponse() {
-    ns1__getEntityInfoResponse::soap_default(NULL);
+    ns1__getEntityInfoResponse::soap_default(nullptr);
   }
   ~ns1__getEntityInfoResponse() override {}
 };
@@ -1312,7 +1322,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__entityInfo() { ns1__entityInfo::soap_default(NULL); }
+  ns1__entityInfo() { ns1__entityInfo::soap_default(nullptr); }
   ~ns1__entityInfo() override {}
 };
 #endif
@@ -1333,7 +1343,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__constraint() { ns1__constraint::soap_default(NULL); }
+  ns1__constraint() { ns1__constraint::soap_default(nullptr); }
   ~ns1__constraint() override {}
 };
 #endif
@@ -1359,7 +1369,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__entityField() { ns1__entityField::soap_default(NULL); }
+  ns1__entityField() { ns1__entityField::soap_default(nullptr); }
   ~ns1__entityField() override {}
 };
 #endif
@@ -1380,7 +1390,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__luceneCommit() { ns1__luceneCommit::soap_default(NULL); }
+  ns1__luceneCommit() { ns1__luceneCommit::soap_default(nullptr); }
   ~ns1__luceneCommit() override {}
 };
 #endif
@@ -1399,7 +1409,9 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__luceneCommitResponse() { ns1__luceneCommitResponse::soap_default(NULL); }
+  ns1__luceneCommitResponse() {
+    ns1__luceneCommitResponse::soap_default(nullptr);
+  }
   ~ns1__luceneCommitResponse() override {}
 };
 #endif
@@ -1423,7 +1435,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__searchText() { ns1__searchText::soap_default(NULL); }
+  ns1__searchText() { ns1__searchText::soap_default(nullptr); }
   ~ns1__searchText() override {}
 };
 #endif
@@ -1449,7 +1461,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__searchTextResponse() { ns1__searchTextResponse::soap_default(NULL); }
+  ns1__searchTextResponse() { ns1__searchTextResponse::soap_default(nullptr); }
   ~ns1__searchTextResponse() override {}
 };
 #endif
@@ -1471,7 +1483,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__delete() { ns1__delete::soap_default(NULL); }
+  ns1__delete() { ns1__delete::soap_default(nullptr); }
   ~ns1__delete() override {}
 };
 #endif
@@ -1490,7 +1502,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__deleteResponse() { ns1__deleteResponse::soap_default(NULL); }
+  ns1__deleteResponse() { ns1__deleteResponse::soap_default(nullptr); }
   ~ns1__deleteResponse() override {}
 };
 #endif
@@ -1514,7 +1526,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__isAccessAllowed() { ns1__isAccessAllowed::soap_default(NULL); }
+  ns1__isAccessAllowed() { ns1__isAccessAllowed::soap_default(nullptr); }
   ~ns1__isAccessAllowed() override {}
 };
 #endif
@@ -1541,7 +1553,7 @@ public:
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
   ns1__isAccessAllowedResponse() {
-    ns1__isAccessAllowedResponse::soap_default(NULL);
+    ns1__isAccessAllowedResponse::soap_default(nullptr);
   }
   ~ns1__isAccessAllowedResponse() override {}
 };
@@ -1564,7 +1576,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__search() { ns1__search::soap_default(NULL); }
+  ns1__search() { ns1__search::soap_default(nullptr); }
   ~ns1__search() override {}
 };
 #endif
@@ -1590,7 +1602,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__searchResponse() { ns1__searchResponse::soap_default(NULL); }
+  ns1__searchResponse() { ns1__searchResponse::soap_default(nullptr); }
   ~ns1__searchResponse() override {}
 };
 #endif
@@ -1611,7 +1623,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__logout() { ns1__logout::soap_default(NULL); }
+  ns1__logout() { ns1__logout::soap_default(nullptr); }
   ~ns1__logout() override {}
 };
 #endif
@@ -1630,7 +1642,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__logoutResponse() { ns1__logoutResponse::soap_default(NULL); }
+  ns1__logoutResponse() { ns1__logoutResponse::soap_default(nullptr); }
   ~ns1__logoutResponse() override {}
 };
 #endif
@@ -1651,7 +1663,9 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__getRemainingMinutes() { ns1__getRemainingMinutes::soap_default(NULL); }
+  ns1__getRemainingMinutes() {
+    ns1__getRemainingMinutes::soap_default(nullptr);
+  }
   ~ns1__getRemainingMinutes() override {}
 };
 #endif
@@ -1678,7 +1692,7 @@ public:
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
   ns1__getRemainingMinutesResponse() {
-    ns1__getRemainingMinutesResponse::soap_default(NULL);
+    ns1__getRemainingMinutesResponse::soap_default(nullptr);
   }
   ~ns1__getRemainingMinutesResponse() override {}
 };
@@ -1719,7 +1733,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__datafile() { ns1__datafile::soap_default(NULL); }
+  ns1__datafile() { ns1__datafile::soap_default(nullptr); }
   ~ns1__datafile() override {}
 };
 #endif
@@ -1743,7 +1757,7 @@ public:
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
   ns1__dataCollectionDatafile() {
-    ns1__dataCollectionDatafile::soap_default(NULL);
+    ns1__dataCollectionDatafile::soap_default(nullptr);
   }
   ~ns1__dataCollectionDatafile() override {}
 };
@@ -1774,7 +1788,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__dataCollection() { ns1__dataCollection::soap_default(NULL); }
+  ns1__dataCollection() { ns1__dataCollection::soap_default(nullptr); }
   ~ns1__dataCollection() override {}
 };
 #endif
@@ -1798,7 +1812,7 @@ public:
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
   ns1__dataCollectionDataset() {
-    ns1__dataCollectionDataset::soap_default(NULL);
+    ns1__dataCollectionDataset::soap_default(nullptr);
   }
   ~ns1__dataCollectionDataset() override {}
 };
@@ -1837,7 +1851,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__dataset() { ns1__dataset::soap_default(NULL); }
+  ns1__dataset() { ns1__dataset::soap_default(nullptr); }
   ~ns1__dataset() override {}
 };
 #endif
@@ -1885,7 +1899,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__investigation() { ns1__investigation::soap_default(NULL); }
+  ns1__investigation() { ns1__investigation::soap_default(nullptr); }
   ~ns1__investigation() override {}
 };
 #endif
@@ -1928,7 +1942,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__facility() { ns1__facility::soap_default(NULL); }
+  ns1__facility() { ns1__facility::soap_default(nullptr); }
   ~ns1__facility() override {}
 };
 #endif
@@ -1952,7 +1966,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__application() { ns1__application::soap_default(NULL); }
+  ns1__application() { ns1__application::soap_default(nullptr); }
   ~ns1__application() override {}
 };
 #endif
@@ -1978,7 +1992,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__job() { ns1__job::soap_default(NULL); }
+  ns1__job() { ns1__job::soap_default(nullptr); }
   ~ns1__job() override {}
 };
 #endif
@@ -2005,7 +2019,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__datafileFormat() { ns1__datafileFormat::soap_default(NULL); }
+  ns1__datafileFormat() { ns1__datafileFormat::soap_default(nullptr); }
   ~ns1__datafileFormat() override {}
 };
 #endif
@@ -2030,7 +2044,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__datasetType() { ns1__datasetType::soap_default(NULL); }
+  ns1__datasetType() { ns1__datasetType::soap_default(nullptr); }
   ~ns1__datasetType() override {}
 };
 #endif
@@ -2055,7 +2069,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__facilityCycle() { ns1__facilityCycle::soap_default(NULL); }
+  ns1__facilityCycle() { ns1__facilityCycle::soap_default(nullptr); }
   ~ns1__facilityCycle() override {}
 };
 #endif
@@ -2087,7 +2101,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__instrument() { ns1__instrument::soap_default(NULL); }
+  ns1__instrument() { ns1__instrument::soap_default(nullptr); }
   ~ns1__instrument() override {}
 };
 #endif
@@ -2109,7 +2123,9 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__instrumentScientist() { ns1__instrumentScientist::soap_default(NULL); }
+  ns1__instrumentScientist() {
+    ns1__instrumentScientist::soap_default(nullptr);
+  }
   ~ns1__instrumentScientist() override {}
 };
 #endif
@@ -2139,7 +2155,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__user() { ns1__user::soap_default(NULL); }
+  ns1__user() { ns1__user::soap_default(nullptr); }
   ~ns1__user() override {}
 };
 #endif
@@ -2163,7 +2179,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__investigationUser() { ns1__investigationUser::soap_default(NULL); }
+  ns1__investigationUser() { ns1__investigationUser::soap_default(nullptr); }
   ~ns1__investigationUser() override {}
 };
 #endif
@@ -2190,7 +2206,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__study() { ns1__study::soap_default(NULL); }
+  ns1__study() { ns1__study::soap_default(nullptr); }
   ~ns1__study() override {}
 };
 #endif
@@ -2213,7 +2229,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__studyInvestigation() { ns1__studyInvestigation::soap_default(NULL); }
+  ns1__studyInvestigation() { ns1__studyInvestigation::soap_default(nullptr); }
   ~ns1__studyInvestigation() override {}
 };
 #endif
@@ -2235,7 +2251,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__userGroup() { ns1__userGroup::soap_default(NULL); }
+  ns1__userGroup() { ns1__userGroup::soap_default(nullptr); }
   ~ns1__userGroup() override {}
 };
 #endif
@@ -2259,7 +2275,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__grouping() { ns1__grouping::soap_default(NULL); }
+  ns1__grouping() { ns1__grouping::soap_default(nullptr); }
   ~ns1__grouping() override {}
 };
 #endif
@@ -2282,7 +2298,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__rule() { ns1__rule::soap_default(NULL); }
+  ns1__rule() { ns1__rule::soap_default(nullptr); }
   ~ns1__rule() override {}
 };
 #endif
@@ -2306,7 +2322,7 @@ public:
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
   ns1__investigationInstrument() {
-    ns1__investigationInstrument::soap_default(NULL);
+    ns1__investigationInstrument::soap_default(nullptr);
   }
   ~ns1__investigationInstrument() override {}
 };
@@ -2332,7 +2348,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__investigationType() { ns1__investigationType::soap_default(NULL); }
+  ns1__investigationType() { ns1__investigationType::soap_default(nullptr); }
   ~ns1__investigationType() override {}
 };
 #endif
@@ -2383,7 +2399,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__parameterType() { ns1__parameterType::soap_default(NULL); }
+  ns1__parameterType() { ns1__parameterType::soap_default(nullptr); }
   ~ns1__parameterType() override {}
 };
 #endif
@@ -2410,7 +2426,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__parameter() { ns1__parameter::soap_default(NULL); }
+  ns1__parameter() { ns1__parameter::soap_default(nullptr); }
   ~ns1__parameter() override {}
 };
 #endif
@@ -2433,7 +2449,7 @@ public:
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
   ns1__permissibleStringValue() {
-    ns1__permissibleStringValue::soap_default(NULL);
+    ns1__permissibleStringValue::soap_default(nullptr);
   }
   ~ns1__permissibleStringValue() override {}
 };
@@ -2462,7 +2478,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__sample() { ns1__sample::soap_default(NULL); }
+  ns1__sample() { ns1__sample::soap_default(nullptr); }
   ~ns1__sample() override {}
 };
 #endif
@@ -2487,7 +2503,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__sampleType() { ns1__sampleType::soap_default(NULL); }
+  ns1__sampleType() { ns1__sampleType::soap_default(nullptr); }
   ~ns1__sampleType() override {}
 };
 #endif
@@ -2510,7 +2526,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__keyword() { ns1__keyword::soap_default(NULL); }
+  ns1__keyword() { ns1__keyword::soap_default(nullptr); }
   ~ns1__keyword() override {}
 };
 #endif
@@ -2537,7 +2553,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__publication() { ns1__publication::soap_default(NULL); }
+  ns1__publication() { ns1__publication::soap_default(nullptr); }
   ~ns1__publication() override {}
 };
 #endif
@@ -2562,7 +2578,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__shift() { ns1__shift::soap_default(NULL); }
+  ns1__shift() { ns1__shift::soap_default(nullptr); }
   ~ns1__shift() override {}
 };
 #endif
@@ -2585,7 +2601,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__relatedDatafile() { ns1__relatedDatafile::soap_default(NULL); }
+  ns1__relatedDatafile() { ns1__relatedDatafile::soap_default(nullptr); }
   ~ns1__relatedDatafile() override {}
 };
 #endif
@@ -2610,7 +2626,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__log() { ns1__log::soap_default(NULL); }
+  ns1__log() { ns1__log::soap_default(nullptr); }
   ~ns1__log() override {}
 };
 #endif
@@ -2632,7 +2648,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__publicStep() { ns1__publicStep::soap_default(NULL); }
+  ns1__publicStep() { ns1__publicStep::soap_default(nullptr); }
   ~ns1__publicStep() override {}
 };
 #endif
@@ -2655,7 +2671,7 @@ public:
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
   ns1__dataCollectionParameter() {
-    ns1__dataCollectionParameter::soap_default(NULL);
+    ns1__dataCollectionParameter::soap_default(nullptr);
   }
   ~ns1__dataCollectionParameter() override {}
 };
@@ -2677,7 +2693,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__datafileParameter() { ns1__datafileParameter::soap_default(NULL); }
+  ns1__datafileParameter() { ns1__datafileParameter::soap_default(nullptr); }
   ~ns1__datafileParameter() override {}
 };
 #endif
@@ -2698,7 +2714,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__datasetParameter() { ns1__datasetParameter::soap_default(NULL); }
+  ns1__datasetParameter() { ns1__datasetParameter::soap_default(nullptr); }
   ~ns1__datasetParameter() override {}
 };
 #endif
@@ -2721,7 +2737,7 @@ public:
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
   ns1__investigationParameter() {
-    ns1__investigationParameter::soap_default(NULL);
+    ns1__investigationParameter::soap_default(nullptr);
   }
   ~ns1__investigationParameter() override {}
 };
@@ -2743,7 +2759,7 @@ public:
   int soap_out(struct soap *, const char *, int, const char *) const override;
   void *soap_get(struct soap *, const char *, const char *) override;
   void *soap_in(struct soap *, const char *, const char *) override;
-  ns1__sampleParameter() { ns1__sampleParameter::soap_default(NULL); }
+  ns1__sampleParameter() { ns1__sampleParameter::soap_default(nullptr); }
   ~ns1__sampleParameter() override {}
 };
 #endif
diff --git a/Framework/ICat/inc/MantidICat/ICat4/ICat4Catalog.h b/Framework/ICat/inc/MantidICat/ICat4/ICat4Catalog.h
index fdaf07ecf7bd47cd1eb2abf7a86a8d9857bd0497..2ac16c89d9061ff5d61f0f1e8e0ffa22f567e308 100644
--- a/Framework/ICat/inc/MantidICat/ICat4/ICat4Catalog.h
+++ b/Framework/ICat/inc/MantidICat/ICat4/ICat4Catalog.h
@@ -125,7 +125,7 @@ private:
    */
   template <class T>
   void savetoTableWorkspace(T *input, Mantid::API::TableRow &table) {
-    if (input != 0) {
+    if (input) {
       table << *input;
     } else {
       table << "";
diff --git a/Framework/ICat/src/CatalogAlgorithmHelper.cpp b/Framework/ICat/src/CatalogAlgorithmHelper.cpp
index 7a7a53baeea199575a0c6c40763d7a0984f85420..dd603e19251635b48ddde8c3ac6f1e85eb9665e9 100644
--- a/Framework/ICat/src/CatalogAlgorithmHelper.cpp
+++ b/Framework/ICat/src/CatalogAlgorithmHelper.cpp
@@ -1,8 +1,8 @@
 #include "MantidICat/CatalogAlgorithmHelper.h"
 
-#include <boost/assign/list_of.hpp>
 #include <json/reader.h>
 #include <json/value.h>
+#include <set>
 
 namespace Mantid {
 namespace ICat {
diff --git a/Framework/ICat/src/GSoap/soapserializersC.cpp b/Framework/ICat/src/GSoap/soapserializersC.cpp
index feeaabb0dd84af42ff5740dbe07ff3df357edb6e..ec18448a06eb550729bfe33431c96ab2d7e7e5bc 100644
--- a/Framework/ICat/src/GSoap/soapserializersC.cpp
+++ b/Framework/ICat/src/GSoap/soapserializersC.cpp
@@ -23,16 +23,16 @@ SOAP_SOURCE_STAMP(
 SOAP_FMAC3 int SOAP_FMAC4 soap_getheader(struct soap *soap) {
   soap->part = SOAP_IN_HEADER;
   soap->header =
-      soap_in_SOAP_ENV__Header(soap, "SOAP-ENV:Header", soap->header, NULL);
+      soap_in_SOAP_ENV__Header(soap, "SOAP-ENV:Header", soap->header, nullptr);
   soap->part = SOAP_END_HEADER;
-  return soap->header == NULL;
+  return soap->header == nullptr;
 }
 
 SOAP_FMAC3 int SOAP_FMAC4 soap_putheader(struct soap *soap) {
   if (soap->version && soap->header) {
     soap->part = SOAP_IN_HEADER;
     if (soap_out_SOAP_ENV__Header(soap, "SOAP-ENV:Header", 0, soap->header,
-                                  NULL))
+                                  nullptr))
       return soap->error;
     soap->part = SOAP_END_HEADER;
   }
@@ -45,16 +45,16 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_serializeheader(struct soap *soap) {
 }
 
 SOAP_FMAC3 void SOAP_FMAC4 soap_header(struct soap *soap) {
-  if (soap->header == NULL) {
+  if (soap->header == nullptr) {
     if ((soap->header = soap_new_SOAP_ENV__Header(soap, -1)))
       soap_default_SOAP_ENV__Header(soap, soap->header);
   }
 }
 
 SOAP_FMAC3 void SOAP_FMAC4 soap_fault(struct soap *soap) {
-  if (soap->fault == NULL) {
+  if (soap->fault == nullptr) {
     soap->fault = soap_new_SOAP_ENV__Fault(soap, -1);
-    if (soap->fault == NULL)
+    if (soap->fault == nullptr)
       return;
     soap_default_SOAP_ENV__Fault(soap, soap->fault);
   }
@@ -76,13 +76,14 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_serializefault(struct soap *soap) {
 
 SOAP_FMAC3 int SOAP_FMAC4 soap_putfault(struct soap *soap) {
   if (soap->fault)
-    return soap_put_SOAP_ENV__Fault(soap, soap->fault, "SOAP-ENV:Fault", NULL);
+    return soap_put_SOAP_ENV__Fault(soap, soap->fault, "SOAP-ENV:Fault",
+                                    nullptr);
   return SOAP_OK;
 }
 
 SOAP_FMAC3 int SOAP_FMAC4 soap_getfault(struct soap *soap) {
-  return (soap->fault = soap_get_SOAP_ENV__Fault(soap, NULL, "SOAP-ENV:Fault",
-                                                 NULL)) == NULL;
+  return (soap->fault = soap_get_SOAP_ENV__Fault(
+              soap, nullptr, "SOAP-ENV:Fault", nullptr)) == nullptr;
 }
 
 SOAP_FMAC3 const char **SOAP_FMAC4 soap_faultcode(struct soap *soap) {
@@ -95,7 +96,7 @@ SOAP_FMAC3 const char **SOAP_FMAC4 soap_faultcode(struct soap *soap) {
 SOAP_FMAC3 const char **SOAP_FMAC4 soap_faultsubcode(struct soap *soap) {
   soap_fault(soap);
   if (soap->version == 2) {
-    if (soap->fault->SOAP_ENV__Code->SOAP_ENV__Subcode == NULL) {
+    if (soap->fault->SOAP_ENV__Code->SOAP_ENV__Subcode == nullptr) {
       soap->fault->SOAP_ENV__Code->SOAP_ENV__Subcode =
           soap_new_SOAP_ENV__Code(soap, -1);
       soap_default_SOAP_ENV__Code(
@@ -114,7 +115,7 @@ SOAP_FMAC3 const char *SOAP_FMAC4 soap_check_faultsubcode(struct soap *soap) {
         soap->fault->SOAP_ENV__Code->SOAP_ENV__Subcode &&
         soap->fault->SOAP_ENV__Code->SOAP_ENV__Subcode)
       return soap->fault->SOAP_ENV__Code->SOAP_ENV__Subcode->SOAP_ENV__Value;
-    return NULL;
+    return nullptr;
   }
   return soap->fault->faultcode;
 }
@@ -129,13 +130,13 @@ SOAP_FMAC3 const char **SOAP_FMAC4 soap_faultstring(struct soap *soap) {
 SOAP_FMAC3 const char **SOAP_FMAC4 soap_faultdetail(struct soap *soap) {
   soap_fault(soap);
   if (soap->version == 2) {
-    if (soap->fault->SOAP_ENV__Detail == NULL) {
+    if (soap->fault->SOAP_ENV__Detail == nullptr) {
       soap->fault->SOAP_ENV__Detail = soap_new_SOAP_ENV__Detail(soap, -1);
       soap_default_SOAP_ENV__Detail(soap, soap->fault->SOAP_ENV__Detail);
     }
     return (const char **)&soap->fault->SOAP_ENV__Detail->__any;
   }
-  if (soap->fault->detail == NULL) {
+  if (soap->fault->detail == nullptr) {
     soap->fault->detail = soap_new_SOAP_ENV__Detail(soap, -1);
     soap_default_SOAP_ENV__Detail(soap, soap->fault->detail);
   }
@@ -148,7 +149,7 @@ SOAP_FMAC3 const char *SOAP_FMAC4 soap_check_faultdetail(struct soap *soap) {
     return soap->fault->SOAP_ENV__Detail->__any;
   if (soap->fault->detail)
     return soap->fault->detail->__any;
-  return NULL;
+  return nullptr;
 }
 
 #endif
@@ -175,24 +176,24 @@ extern "C" {
 SOAP_FMAC3 void *SOAP_FMAC4 soap_getelement(struct soap *soap, int *type) {
   (void)type;
   if (soap_peek_element(soap))
-    return NULL;
+    return nullptr;
 #ifndef WITH_NOIDREF
   if (!*soap->id || !(*type = soap_lookup_type(soap, soap->id)))
     *type = soap_lookup_type(soap, soap->href);
   switch (*type) {
   case SOAP_TYPE_byte:
-    return soap_in_byte(soap, NULL, NULL, "xsd:byte");
+    return soap_in_byte(soap, nullptr, nullptr, "xsd:byte");
   case SOAP_TYPE_int:
-    return soap_in_int(soap, NULL, NULL, "xsd:int");
+    return soap_in_int(soap, nullptr, nullptr, "xsd:int");
   case SOAP_TYPE__QName: {
     char **s;
-    s = soap_in__QName(soap, NULL, NULL, "xsd:QName");
-    return s ? *s : NULL;
+    s = soap_in__QName(soap, nullptr, nullptr, "xsd:QName");
+    return s ? *s : nullptr;
   }
   case SOAP_TYPE_string: {
     char **s;
-    s = soap_in_string(soap, NULL, NULL, "xsd:string");
-    return s ? *s : NULL;
+    s = soap_in_string(soap, nullptr, nullptr, "xsd:string");
+    return s ? *s : nullptr;
   }
   default:
 #endif
@@ -202,23 +203,23 @@ SOAP_FMAC3 void *SOAP_FMAC4 soap_getelement(struct soap *soap, int *type) {
       t = soap->tag;
     if (!soap_match_tag(soap, t, "xsd:byte")) {
       *type = SOAP_TYPE_byte;
-      return soap_in_byte(soap, NULL, NULL, NULL);
+      return soap_in_byte(soap, nullptr, nullptr, nullptr);
     }
     if (!soap_match_tag(soap, t, "xsd:int")) {
       *type = SOAP_TYPE_int;
-      return soap_in_int(soap, NULL, NULL, NULL);
+      return soap_in_int(soap, nullptr, nullptr, nullptr);
     }
     if (!soap_match_tag(soap, t, "xsd:QName")) {
       char **s;
       *type = SOAP_TYPE__QName;
-      s = soap_in__QName(soap, NULL, NULL, NULL);
-      return s ? *s : NULL;
+      s = soap_in__QName(soap, nullptr, nullptr, nullptr);
+      return s ? *s : nullptr;
     }
     if (!soap_match_tag(soap, t, "xsd:string")) {
       char **s;
       *type = SOAP_TYPE_string;
-      s = soap_in_string(soap, NULL, NULL, NULL);
-      return s ? *s : NULL;
+      s = soap_in_string(soap, nullptr, nullptr, nullptr);
+      return s ? *s : nullptr;
     }
     t = soap->tag;
 #ifndef WITH_NOIDREF
@@ -226,7 +227,7 @@ SOAP_FMAC3 void *SOAP_FMAC4 soap_getelement(struct soap *soap, int *type) {
 #endif
   }
   soap->error = SOAP_TAG_MISMATCH;
-  return NULL;
+  return nullptr;
 }
 
 #ifdef __cplusplus
@@ -260,7 +261,7 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_ignore_element(struct soap *soap) {
         while (!soap_ignore_element(soap))
           ;
         if (soap->error == SOAP_NO_TAG)
-          soap->error = soap_element_end_in(soap, NULL);
+          soap->error = soap_element_end_in(soap, nullptr);
       }
     }
   }
@@ -361,7 +362,7 @@ soapserializers_instantiate(struct soap *soap, int t, const char *type,
                                                     n);
 #endif
   }
-  return NULL;
+  return nullptr;
 }
 
 SOAP_FMAC3 int SOAP_FMAC4 soapserializers_fdelete(struct soap_clist *p) {
@@ -447,7 +448,7 @@ soap_in_byte(struct soap *soap, const char *tag, char *a, const char *type) {
 
 SOAP_FMAC3 int SOAP_FMAC4 soap_put_byte(struct soap *soap, const char *a,
                                         const char *tag, const char *type) {
-  int id = soap_embed(soap, (void *)a, NULL, 0, tag, SOAP_TYPE_byte);
+  int id = soap_embed(soap, (void *)a, nullptr, 0, tag, SOAP_TYPE_byte);
   if (soap_out_byte(soap, tag ? tag : "byte", id, a, type))
     return soap->error;
   return soap_putindependent(soap);
@@ -457,7 +458,7 @@ SOAP_FMAC3 char *SOAP_FMAC4
 soap_get_byte(struct soap *soap, char *p, const char *tag, const char *type) {
   if ((p = soap_in_byte(soap, tag, p, type)))
     if (soap_getindependent(soap))
-      return NULL;
+      return nullptr;
   return p;
 }
 
@@ -488,7 +489,7 @@ soap_in_int(struct soap *soap, const char *tag, int *a, const char *type) {
 
 SOAP_FMAC3 int SOAP_FMAC4 soap_put_int(struct soap *soap, const int *a,
                                        const char *tag, const char *type) {
-  int id = soap_embed(soap, (void *)a, NULL, 0, tag, SOAP_TYPE_int);
+  int id = soap_embed(soap, (void *)a, nullptr, 0, tag, SOAP_TYPE_int);
   if (soap_out_int(soap, tag ? tag : "int", id, a, type))
     return soap->error;
   return soap_putindependent(soap);
@@ -498,7 +499,7 @@ SOAP_FMAC3 int *SOAP_FMAC4
 soap_get_int(struct soap *soap, int *p, const char *tag, const char *type) {
   if ((p = soap_in_int(soap, tag, p, type)))
     if (soap_getindependent(soap))
-      return NULL;
+      return nullptr;
   return p;
 }
 
@@ -511,12 +512,12 @@ soap_default_SOAP_ENV__Fault(struct soap *soap, struct SOAP_ENV__Fault *a) {
   soap_default__QName(soap, &a->faultcode);
   soap_default_string(soap, &a->faultstring);
   soap_default_string(soap, &a->faultactor);
-  a->detail = NULL;
-  a->SOAP_ENV__Code = NULL;
-  a->SOAP_ENV__Reason = NULL;
+  a->detail = nullptr;
+  a->SOAP_ENV__Code = nullptr;
+  a->SOAP_ENV__Reason = nullptr;
   soap_default_string(soap, &a->SOAP_ENV__Node);
   soap_default_string(soap, &a->SOAP_ENV__Role);
-  a->SOAP_ENV__Detail = NULL;
+  a->SOAP_ENV__Detail = nullptr;
 }
 
 SOAP_FMAC3 void SOAP_FMAC4
@@ -587,12 +588,12 @@ soap_in_SOAP_ENV__Fault(struct soap *soap, const char *tag,
   size_t soap_flag_SOAP_ENV__Role = 1;
   size_t soap_flag_SOAP_ENV__Detail = 1;
   if (soap_element_begin_in(soap, tag, 0, type))
-    return NULL;
+    return nullptr;
   a = (struct SOAP_ENV__Fault *)soap_id_enter(
       soap, soap->id, a, SOAP_TYPE_SOAP_ENV__Fault,
-      sizeof(struct SOAP_ENV__Fault), 0, NULL, NULL, NULL);
+      sizeof(struct SOAP_ENV__Fault), 0, nullptr, NULL, NULL);
   if (!a)
-    return NULL;
+    return nullptr;
   soap_default_SOAP_ENV__Fault(soap, a);
   if (soap->body && !*soap->href) {
     for (;;) {
@@ -658,16 +659,16 @@ soap_in_SOAP_ENV__Fault(struct soap *soap, const char *tag,
       if (soap->error == SOAP_NO_TAG)
         break;
       if (soap->error)
-        return NULL;
+        return nullptr;
     }
     if (soap_element_end_in(soap, tag))
-      return NULL;
+      return nullptr;
   } else {
     a = (struct SOAP_ENV__Fault *)soap_id_forward(
         soap, soap->href, (void *)a, 0, SOAP_TYPE_SOAP_ENV__Fault, 0,
-        sizeof(struct SOAP_ENV__Fault), 0, NULL);
+        sizeof(struct SOAP_ENV__Fault), 0, nullptr);
     if (soap->body && soap_element_end_in(soap, tag))
-      return NULL;
+      return nullptr;
   }
   return a;
 }
@@ -675,7 +676,8 @@ soap_in_SOAP_ENV__Fault(struct soap *soap, const char *tag,
 SOAP_FMAC3 int SOAP_FMAC4
 soap_put_SOAP_ENV__Fault(struct soap *soap, const struct SOAP_ENV__Fault *a,
                          const char *tag, const char *type) {
-  int id = soap_embed(soap, (void *)a, NULL, 0, tag, SOAP_TYPE_SOAP_ENV__Fault);
+  int id =
+      soap_embed(soap, (void *)a, nullptr, 0, tag, SOAP_TYPE_SOAP_ENV__Fault);
   if (soap_out_SOAP_ENV__Fault(soap, tag ? tag : "SOAP-ENV:Fault", id, a, type))
     return soap->error;
   return soap_putindependent(soap);
@@ -686,7 +688,7 @@ soap_get_SOAP_ENV__Fault(struct soap *soap, struct SOAP_ENV__Fault *p,
                          const char *tag, const char *type) {
   if ((p = soap_in_SOAP_ENV__Fault(soap, tag, p, type)))
     if (soap_getindependent(soap))
-      return NULL;
+      return nullptr;
   return p;
 }
 
@@ -698,10 +700,10 @@ soap_instantiate_SOAP_ENV__Fault(struct soap *soap, int n, const char *type,
   DBGLOG(TEST,
          SOAP_MESSAGE(fdebug, "soap_instantiate_SOAP_ENV__Fault(%d, %s, %s)\n",
                       n, type ? type : "", arrayType ? arrayType : ""));
-  struct soap_clist *cp = soap_link(soap, NULL, SOAP_TYPE_SOAP_ENV__Fault, n,
+  struct soap_clist *cp = soap_link(soap, nullptr, SOAP_TYPE_SOAP_ENV__Fault, n,
                                     soapserializers_fdelete);
   if (!cp)
-    return NULL;
+    return nullptr;
   if (n < 0) {
     cp->ptr = (void *)SOAP_NEW(struct SOAP_ENV__Fault);
     if (size)
@@ -774,12 +776,12 @@ soap_in_SOAP_ENV__Reason(struct soap *soap, const char *tag,
                          struct SOAP_ENV__Reason *a, const char *type) {
   size_t soap_flag_SOAP_ENV__Text = 1;
   if (soap_element_begin_in(soap, tag, 0, type))
-    return NULL;
+    return nullptr;
   a = (struct SOAP_ENV__Reason *)soap_id_enter(
       soap, soap->id, a, SOAP_TYPE_SOAP_ENV__Reason,
-      sizeof(struct SOAP_ENV__Reason), 0, NULL, NULL, NULL);
+      sizeof(struct SOAP_ENV__Reason), 0, nullptr, NULL, NULL);
   if (!a)
-    return NULL;
+    return nullptr;
   soap_default_SOAP_ENV__Reason(soap, a);
   if (soap->body && !*soap->href) {
     for (;;) {
@@ -796,16 +798,16 @@ soap_in_SOAP_ENV__Reason(struct soap *soap, const char *tag,
       if (soap->error == SOAP_NO_TAG)
         break;
       if (soap->error)
-        return NULL;
+        return nullptr;
     }
     if (soap_element_end_in(soap, tag))
-      return NULL;
+      return nullptr;
   } else {
     a = (struct SOAP_ENV__Reason *)soap_id_forward(
         soap, soap->href, (void *)a, 0, SOAP_TYPE_SOAP_ENV__Reason, 0,
-        sizeof(struct SOAP_ENV__Reason), 0, NULL);
+        sizeof(struct SOAP_ENV__Reason), 0, nullptr);
     if (soap->body && soap_element_end_in(soap, tag))
-      return NULL;
+      return nullptr;
   }
   return a;
 }
@@ -814,7 +816,7 @@ SOAP_FMAC3 int SOAP_FMAC4
 soap_put_SOAP_ENV__Reason(struct soap *soap, const struct SOAP_ENV__Reason *a,
                           const char *tag, const char *type) {
   int id =
-      soap_embed(soap, (void *)a, NULL, 0, tag, SOAP_TYPE_SOAP_ENV__Reason);
+      soap_embed(soap, (void *)a, nullptr, 0, tag, SOAP_TYPE_SOAP_ENV__Reason);
   if (soap_out_SOAP_ENV__Reason(soap, tag ? tag : "SOAP-ENV:Reason", id, a,
                                 type))
     return soap->error;
@@ -826,7 +828,7 @@ soap_get_SOAP_ENV__Reason(struct soap *soap, struct SOAP_ENV__Reason *p,
                           const char *tag, const char *type) {
   if ((p = soap_in_SOAP_ENV__Reason(soap, tag, p, type)))
     if (soap_getindependent(soap))
-      return NULL;
+      return nullptr;
   return p;
 }
 
@@ -838,10 +840,10 @@ soap_instantiate_SOAP_ENV__Reason(struct soap *soap, int n, const char *type,
   DBGLOG(TEST,
          SOAP_MESSAGE(fdebug, "soap_instantiate_SOAP_ENV__Reason(%d, %s, %s)\n",
                       n, type ? type : "", arrayType ? arrayType : ""));
-  struct soap_clist *cp = soap_link(soap, NULL, SOAP_TYPE_SOAP_ENV__Reason, n,
-                                    soapserializers_fdelete);
+  struct soap_clist *cp = soap_link(soap, nullptr, SOAP_TYPE_SOAP_ENV__Reason,
+                                    n, soapserializers_fdelete);
   if (!cp)
-    return NULL;
+    return nullptr;
   if (n < 0) {
     cp->ptr = (void *)SOAP_NEW(struct SOAP_ENV__Reason);
     if (size)
@@ -878,9 +880,9 @@ SOAP_FMAC3 void SOAP_FMAC4
 soap_default_SOAP_ENV__Detail(struct soap *soap, struct SOAP_ENV__Detail *a) {
   (void)soap;
   (void)a; /* appease -Wall -Werror */
-  a->__any = NULL;
+  a->__any = nullptr;
   a->__type = 0;
-  a->fault = NULL;
+  a->fault = nullptr;
 }
 
 SOAP_FMAC3 void SOAP_FMAC4
@@ -904,7 +906,7 @@ soap_out_SOAP_ENV__Detail(struct soap *soap, const char *tag, int id,
           soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_SOAP_ENV__Detail),
           type))
     return soap->error;
-  soap_outliteral(soap, "-any", &a->__any, NULL);
+  soap_outliteral(soap, "-any", &a->__any, nullptr);
   if (soap_putelement(soap, a->fault, "fault", -1, a->__type))
     return soap->error;
   return soap_element_end_out(soap, tag);
@@ -916,12 +918,12 @@ soap_in_SOAP_ENV__Detail(struct soap *soap, const char *tag,
   size_t soap_flag___any = 1;
   size_t soap_flag_fault = 1;
   if (soap_element_begin_in(soap, tag, 0, type))
-    return NULL;
+    return nullptr;
   a = (struct SOAP_ENV__Detail *)soap_id_enter(
       soap, soap->id, a, SOAP_TYPE_SOAP_ENV__Detail,
-      sizeof(struct SOAP_ENV__Detail), 0, NULL, NULL, NULL);
+      sizeof(struct SOAP_ENV__Detail), 0, nullptr, NULL, NULL);
   if (!a)
-    return NULL;
+    return nullptr;
   soap_default_SOAP_ENV__Detail(soap, a);
   if (soap->body && !*soap->href) {
     for (;;) {
@@ -942,16 +944,16 @@ soap_in_SOAP_ENV__Detail(struct soap *soap, const char *tag,
       if (soap->error == SOAP_NO_TAG)
         break;
       if (soap->error)
-        return NULL;
+        return nullptr;
     }
     if (soap_element_end_in(soap, tag))
-      return NULL;
+      return nullptr;
   } else {
     a = (struct SOAP_ENV__Detail *)soap_id_forward(
         soap, soap->href, (void *)a, 0, SOAP_TYPE_SOAP_ENV__Detail, 0,
-        sizeof(struct SOAP_ENV__Detail), 0, NULL);
+        sizeof(struct SOAP_ENV__Detail), 0, nullptr);
     if (soap->body && soap_element_end_in(soap, tag))
-      return NULL;
+      return nullptr;
   }
   return a;
 }
@@ -960,7 +962,7 @@ SOAP_FMAC3 int SOAP_FMAC4
 soap_put_SOAP_ENV__Detail(struct soap *soap, const struct SOAP_ENV__Detail *a,
                           const char *tag, const char *type) {
   int id =
-      soap_embed(soap, (void *)a, NULL, 0, tag, SOAP_TYPE_SOAP_ENV__Detail);
+      soap_embed(soap, (void *)a, nullptr, 0, tag, SOAP_TYPE_SOAP_ENV__Detail);
   if (soap_out_SOAP_ENV__Detail(soap, tag ? tag : "SOAP-ENV:Detail", id, a,
                                 type))
     return soap->error;
@@ -972,7 +974,7 @@ soap_get_SOAP_ENV__Detail(struct soap *soap, struct SOAP_ENV__Detail *p,
                           const char *tag, const char *type) {
   if ((p = soap_in_SOAP_ENV__Detail(soap, tag, p, type)))
     if (soap_getindependent(soap))
-      return NULL;
+      return nullptr;
   return p;
 }
 
@@ -984,10 +986,10 @@ soap_instantiate_SOAP_ENV__Detail(struct soap *soap, int n, const char *type,
   DBGLOG(TEST,
          SOAP_MESSAGE(fdebug, "soap_instantiate_SOAP_ENV__Detail(%d, %s, %s)\n",
                       n, type ? type : "", arrayType ? arrayType : ""));
-  struct soap_clist *cp = soap_link(soap, NULL, SOAP_TYPE_SOAP_ENV__Detail, n,
-                                    soapserializers_fdelete);
+  struct soap_clist *cp = soap_link(soap, nullptr, SOAP_TYPE_SOAP_ENV__Detail,
+                                    n, soapserializers_fdelete);
   if (!cp)
-    return NULL;
+    return nullptr;
   if (n < 0) {
     cp->ptr = (void *)SOAP_NEW(struct SOAP_ENV__Detail);
     if (size)
@@ -1025,7 +1027,7 @@ soap_default_SOAP_ENV__Code(struct soap *soap, struct SOAP_ENV__Code *a) {
   (void)soap;
   (void)a; /* appease -Wall -Werror */
   soap_default__QName(soap, &a->SOAP_ENV__Value);
-  a->SOAP_ENV__Subcode = NULL;
+  a->SOAP_ENV__Subcode = nullptr;
 }
 
 SOAP_FMAC3 void SOAP_FMAC4
@@ -1066,12 +1068,12 @@ soap_in_SOAP_ENV__Code(struct soap *soap, const char *tag,
   size_t soap_flag_SOAP_ENV__Value = 1;
   size_t soap_flag_SOAP_ENV__Subcode = 1;
   if (soap_element_begin_in(soap, tag, 0, type))
-    return NULL;
+    return nullptr;
   a = (struct SOAP_ENV__Code *)soap_id_enter(
       soap, soap->id, a, SOAP_TYPE_SOAP_ENV__Code,
-      sizeof(struct SOAP_ENV__Code), 0, NULL, NULL, NULL);
+      sizeof(struct SOAP_ENV__Code), 0, nullptr, NULL, NULL);
   if (!a)
-    return NULL;
+    return nullptr;
   soap_default_SOAP_ENV__Code(soap, a);
   if (soap->body && !*soap->href) {
     for (;;) {
@@ -1093,16 +1095,16 @@ soap_in_SOAP_ENV__Code(struct soap *soap, const char *tag,
       if (soap->error == SOAP_NO_TAG)
         break;
       if (soap->error)
-        return NULL;
+        return nullptr;
     }
     if (soap_element_end_in(soap, tag))
-      return NULL;
+      return nullptr;
   } else {
     a = (struct SOAP_ENV__Code *)soap_id_forward(
         soap, soap->href, (void *)a, 0, SOAP_TYPE_SOAP_ENV__Code, 0,
-        sizeof(struct SOAP_ENV__Code), 0, NULL);
+        sizeof(struct SOAP_ENV__Code), 0, nullptr);
     if (soap->body && soap_element_end_in(soap, tag))
-      return NULL;
+      return nullptr;
   }
   return a;
 }
@@ -1110,7 +1112,8 @@ soap_in_SOAP_ENV__Code(struct soap *soap, const char *tag,
 SOAP_FMAC3 int SOAP_FMAC4
 soap_put_SOAP_ENV__Code(struct soap *soap, const struct SOAP_ENV__Code *a,
                         const char *tag, const char *type) {
-  int id = soap_embed(soap, (void *)a, NULL, 0, tag, SOAP_TYPE_SOAP_ENV__Code);
+  int id =
+      soap_embed(soap, (void *)a, nullptr, 0, tag, SOAP_TYPE_SOAP_ENV__Code);
   if (soap_out_SOAP_ENV__Code(soap, tag ? tag : "SOAP-ENV:Code", id, a, type))
     return soap->error;
   return soap_putindependent(soap);
@@ -1121,7 +1124,7 @@ soap_get_SOAP_ENV__Code(struct soap *soap, struct SOAP_ENV__Code *p,
                         const char *tag, const char *type) {
   if ((p = soap_in_SOAP_ENV__Code(soap, tag, p, type)))
     if (soap_getindependent(soap))
-      return NULL;
+      return nullptr;
   return p;
 }
 
@@ -1133,10 +1136,10 @@ soap_instantiate_SOAP_ENV__Code(struct soap *soap, int n, const char *type,
   DBGLOG(TEST,
          SOAP_MESSAGE(fdebug, "soap_instantiate_SOAP_ENV__Code(%d, %s, %s)\n",
                       n, type ? type : "", arrayType ? arrayType : ""));
-  struct soap_clist *cp = soap_link(soap, NULL, SOAP_TYPE_SOAP_ENV__Code, n,
+  struct soap_clist *cp = soap_link(soap, nullptr, SOAP_TYPE_SOAP_ENV__Code, n,
                                     soapserializers_fdelete);
   if (!cp)
-    return NULL;
+    return nullptr;
   if (n < 0) {
     cp->ptr = (void *)SOAP_NEW(struct SOAP_ENV__Code);
     if (size)
@@ -1202,12 +1205,12 @@ SOAP_FMAC3 struct SOAP_ENV__Header *SOAP_FMAC4
 soap_in_SOAP_ENV__Header(struct soap *soap, const char *tag,
                          struct SOAP_ENV__Header *a, const char *type) {
   if (soap_element_begin_in(soap, tag, 0, type))
-    return NULL;
+    return nullptr;
   a = (struct SOAP_ENV__Header *)soap_id_enter(
       soap, soap->id, a, SOAP_TYPE_SOAP_ENV__Header,
-      sizeof(struct SOAP_ENV__Header), 0, NULL, NULL, NULL);
+      sizeof(struct SOAP_ENV__Header), 0, nullptr, NULL, NULL);
   if (!a)
-    return NULL;
+    return nullptr;
   soap_default_SOAP_ENV__Header(soap, a);
   if (soap->body && !*soap->href) {
     for (;;) {
@@ -1217,16 +1220,16 @@ soap_in_SOAP_ENV__Header(struct soap *soap, const char *tag,
       if (soap->error == SOAP_NO_TAG)
         break;
       if (soap->error)
-        return NULL;
+        return nullptr;
     }
     if (soap_element_end_in(soap, tag))
-      return NULL;
+      return nullptr;
   } else {
     a = (struct SOAP_ENV__Header *)soap_id_forward(
         soap, soap->href, (void *)a, 0, SOAP_TYPE_SOAP_ENV__Header, 0,
-        sizeof(struct SOAP_ENV__Header), 0, NULL);
+        sizeof(struct SOAP_ENV__Header), 0, nullptr);
     if (soap->body && soap_element_end_in(soap, tag))
-      return NULL;
+      return nullptr;
   }
   return a;
 }
@@ -1235,7 +1238,7 @@ SOAP_FMAC3 int SOAP_FMAC4
 soap_put_SOAP_ENV__Header(struct soap *soap, const struct SOAP_ENV__Header *a,
                           const char *tag, const char *type) {
   int id =
-      soap_embed(soap, (void *)a, NULL, 0, tag, SOAP_TYPE_SOAP_ENV__Header);
+      soap_embed(soap, (void *)a, nullptr, 0, tag, SOAP_TYPE_SOAP_ENV__Header);
   if (soap_out_SOAP_ENV__Header(soap, tag ? tag : "SOAP-ENV:Header", id, a,
                                 type))
     return soap->error;
@@ -1247,7 +1250,7 @@ soap_get_SOAP_ENV__Header(struct soap *soap, struct SOAP_ENV__Header *p,
                           const char *tag, const char *type) {
   if ((p = soap_in_SOAP_ENV__Header(soap, tag, p, type)))
     if (soap_getindependent(soap))
-      return NULL;
+      return nullptr;
   return p;
 }
 
@@ -1259,10 +1262,10 @@ soap_instantiate_SOAP_ENV__Header(struct soap *soap, int n, const char *type,
   DBGLOG(TEST,
          SOAP_MESSAGE(fdebug, "soap_instantiate_SOAP_ENV__Header(%d, %s, %s)\n",
                       n, type ? type : "", arrayType ? arrayType : ""));
-  struct soap_clist *cp = soap_link(soap, NULL, SOAP_TYPE_SOAP_ENV__Header, n,
-                                    soapserializers_fdelete);
+  struct soap_clist *cp = soap_link(soap, nullptr, SOAP_TYPE_SOAP_ENV__Header,
+                                    n, soapserializers_fdelete);
   if (!cp)
-    return NULL;
+    return nullptr;
   if (n < 0) {
     cp->ptr = (void *)SOAP_NEW(struct SOAP_ENV__Header);
     if (size)
@@ -1308,7 +1311,7 @@ SOAP_FMAC3 int SOAP_FMAC4
 soap_out_PointerToSOAP_ENV__Reason(struct soap *soap, const char *tag, int id,
                                    struct SOAP_ENV__Reason *const *a,
                                    const char *type) {
-  id = soap_element_id(soap, tag, id, *a, NULL, 0, type,
+  id = soap_element_id(soap, tag, id, *a, nullptr, 0, type,
                        SOAP_TYPE_SOAP_ENV__Reason);
   if (id < 0)
     return soap->error;
@@ -1319,23 +1322,23 @@ SOAP_FMAC3 struct SOAP_ENV__Reason **SOAP_FMAC4
 soap_in_PointerToSOAP_ENV__Reason(struct soap *soap, const char *tag,
                                   struct SOAP_ENV__Reason **a,
                                   const char *type) {
-  if (soap_element_begin_in(soap, tag, 1, NULL))
-    return NULL;
+  if (soap_element_begin_in(soap, tag, 1, nullptr))
+    return nullptr;
   if (!a)
     if (!(a = (struct SOAP_ENV__Reason **)soap_malloc(
               soap, sizeof(struct SOAP_ENV__Reason *))))
-      return NULL;
-  *a = NULL;
+      return nullptr;
+  *a = nullptr;
   if (!soap->null && *soap->href != '#') {
     soap_revert(soap);
     if (!(*a = soap_in_SOAP_ENV__Reason(soap, tag, *a, type)))
-      return NULL;
+      return nullptr;
   } else {
     a = (struct SOAP_ENV__Reason **)soap_id_lookup(
         soap, soap->href, (void **)a, SOAP_TYPE_SOAP_ENV__Reason,
         sizeof(struct SOAP_ENV__Reason), 0);
     if (soap->body && soap_element_end_in(soap, tag))
-      return NULL;
+      return nullptr;
   }
   return a;
 }
@@ -1344,7 +1347,7 @@ SOAP_FMAC3 int SOAP_FMAC4
 soap_put_PointerToSOAP_ENV__Reason(struct soap *soap,
                                    struct SOAP_ENV__Reason *const *a,
                                    const char *tag, const char *type) {
-  int id = soap_embed(soap, (void *)a, NULL, 0, tag,
+  int id = soap_embed(soap, (void *)a, nullptr, 0, tag,
                       SOAP_TYPE_PointerToSOAP_ENV__Reason);
   if (soap_out_PointerToSOAP_ENV__Reason(soap, tag ? tag : "SOAP-ENV:Reason",
                                          id, a, type))
@@ -1358,7 +1361,7 @@ soap_get_PointerToSOAP_ENV__Reason(struct soap *soap,
                                    const char *type) {
   if ((p = soap_in_PointerToSOAP_ENV__Reason(soap, tag, p, type)))
     if (soap_getindependent(soap))
-      return NULL;
+      return nullptr;
   return p;
 }
 
@@ -1379,7 +1382,7 @@ SOAP_FMAC3 int SOAP_FMAC4
 soap_out_PointerToSOAP_ENV__Detail(struct soap *soap, const char *tag, int id,
                                    struct SOAP_ENV__Detail *const *a,
                                    const char *type) {
-  id = soap_element_id(soap, tag, id, *a, NULL, 0, type,
+  id = soap_element_id(soap, tag, id, *a, nullptr, 0, type,
                        SOAP_TYPE_SOAP_ENV__Detail);
   if (id < 0)
     return soap->error;
@@ -1390,23 +1393,23 @@ SOAP_FMAC3 struct SOAP_ENV__Detail **SOAP_FMAC4
 soap_in_PointerToSOAP_ENV__Detail(struct soap *soap, const char *tag,
                                   struct SOAP_ENV__Detail **a,
                                   const char *type) {
-  if (soap_element_begin_in(soap, tag, 1, NULL))
-    return NULL;
+  if (soap_element_begin_in(soap, tag, 1, nullptr))
+    return nullptr;
   if (!a)
     if (!(a = (struct SOAP_ENV__Detail **)soap_malloc(
               soap, sizeof(struct SOAP_ENV__Detail *))))
-      return NULL;
-  *a = NULL;
+      return nullptr;
+  *a = nullptr;
   if (!soap->null && *soap->href != '#') {
     soap_revert(soap);
     if (!(*a = soap_in_SOAP_ENV__Detail(soap, tag, *a, type)))
-      return NULL;
+      return nullptr;
   } else {
     a = (struct SOAP_ENV__Detail **)soap_id_lookup(
         soap, soap->href, (void **)a, SOAP_TYPE_SOAP_ENV__Detail,
         sizeof(struct SOAP_ENV__Detail), 0);
     if (soap->body && soap_element_end_in(soap, tag))
-      return NULL;
+      return nullptr;
   }
   return a;
 }
@@ -1415,7 +1418,7 @@ SOAP_FMAC3 int SOAP_FMAC4
 soap_put_PointerToSOAP_ENV__Detail(struct soap *soap,
                                    struct SOAP_ENV__Detail *const *a,
                                    const char *tag, const char *type) {
-  int id = soap_embed(soap, (void *)a, NULL, 0, tag,
+  int id = soap_embed(soap, (void *)a, nullptr, 0, tag,
                       SOAP_TYPE_PointerToSOAP_ENV__Detail);
   if (soap_out_PointerToSOAP_ENV__Detail(soap, tag ? tag : "SOAP-ENV:Detail",
                                          id, a, type))
@@ -1429,7 +1432,7 @@ soap_get_PointerToSOAP_ENV__Detail(struct soap *soap,
                                    const char *type) {
   if ((p = soap_in_PointerToSOAP_ENV__Detail(soap, tag, p, type)))
     if (soap_getindependent(soap))
-      return NULL;
+      return nullptr;
   return p;
 }
 
@@ -1450,7 +1453,7 @@ SOAP_FMAC3 int SOAP_FMAC4
 soap_out_PointerToSOAP_ENV__Code(struct soap *soap, const char *tag, int id,
                                  struct SOAP_ENV__Code *const *a,
                                  const char *type) {
-  id = soap_element_id(soap, tag, id, *a, NULL, 0, type,
+  id = soap_element_id(soap, tag, id, *a, nullptr, 0, type,
                        SOAP_TYPE_SOAP_ENV__Code);
   if (id < 0)
     return soap->error;
@@ -1460,23 +1463,23 @@ soap_out_PointerToSOAP_ENV__Code(struct soap *soap, const char *tag, int id,
 SOAP_FMAC3 struct SOAP_ENV__Code **SOAP_FMAC4
 soap_in_PointerToSOAP_ENV__Code(struct soap *soap, const char *tag,
                                 struct SOAP_ENV__Code **a, const char *type) {
-  if (soap_element_begin_in(soap, tag, 1, NULL))
-    return NULL;
+  if (soap_element_begin_in(soap, tag, 1, nullptr))
+    return nullptr;
   if (!a)
     if (!(a = (struct SOAP_ENV__Code **)soap_malloc(
               soap, sizeof(struct SOAP_ENV__Code *))))
-      return NULL;
-  *a = NULL;
+      return nullptr;
+  *a = nullptr;
   if (!soap->null && *soap->href != '#') {
     soap_revert(soap);
     if (!(*a = soap_in_SOAP_ENV__Code(soap, tag, *a, type)))
-      return NULL;
+      return nullptr;
   } else {
     a = (struct SOAP_ENV__Code **)soap_id_lookup(
         soap, soap->href, (void **)a, SOAP_TYPE_SOAP_ENV__Code,
         sizeof(struct SOAP_ENV__Code), 0);
     if (soap->body && soap_element_end_in(soap, tag))
-      return NULL;
+      return nullptr;
   }
   return a;
 }
@@ -1485,7 +1488,7 @@ SOAP_FMAC3 int SOAP_FMAC4
 soap_put_PointerToSOAP_ENV__Code(struct soap *soap,
                                  struct SOAP_ENV__Code *const *a,
                                  const char *tag, const char *type) {
-  int id = soap_embed(soap, (void *)a, NULL, 0, tag,
+  int id = soap_embed(soap, (void *)a, nullptr, 0, tag,
                       SOAP_TYPE_PointerToSOAP_ENV__Code);
   if (soap_out_PointerToSOAP_ENV__Code(soap, tag ? tag : "SOAP-ENV:Code", id, a,
                                        type))
@@ -1498,7 +1501,7 @@ soap_get_PointerToSOAP_ENV__Code(struct soap *soap, struct SOAP_ENV__Code **p,
                                  const char *tag, const char *type) {
   if ((p = soap_in_PointerToSOAP_ENV__Code(soap, tag, p, type)))
     if (soap_getindependent(soap))
-      return NULL;
+      return nullptr;
   return p;
 }
 
@@ -1526,7 +1529,7 @@ soap_in__QName(struct soap *soap, const char *tag, char **a, const char *type) {
 
 SOAP_FMAC3 int SOAP_FMAC4 soap_put__QName(struct soap *soap, char *const *a,
                                           const char *tag, const char *type) {
-  int id = soap_embed(soap, (void *)a, NULL, 0, tag, SOAP_TYPE__QName);
+  int id = soap_embed(soap, (void *)a, nullptr, 0, tag, SOAP_TYPE__QName);
   if (soap_out__QName(soap, tag ? tag : "byte", id, a, type))
     return soap->error;
   return soap_putindependent(soap);
@@ -1537,7 +1540,7 @@ SOAP_FMAC3 char **SOAP_FMAC4 soap_get__QName(struct soap *soap, char **p,
                                              const char *type) {
   if ((p = soap_in__QName(soap, tag, p, type)))
     if (soap_getindependent(soap))
-      return NULL;
+      return nullptr;
   return p;
 }
 
@@ -1546,7 +1549,7 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_default_string(struct soap *soap, char **a) {
 #ifdef SOAP_DEFAULT_string
   *a = SOAP_DEFAULT_string;
 #else
-  *a = (char *)0;
+  *a = (char *)nullptr;
 #endif
 }
 
@@ -1572,7 +1575,7 @@ soap_in_string(struct soap *soap, const char *tag, char **a, const char *type) {
 
 SOAP_FMAC3 int SOAP_FMAC4 soap_put_string(struct soap *soap, char *const *a,
                                           const char *tag, const char *type) {
-  int id = soap_embed(soap, (void *)a, NULL, 0, tag, SOAP_TYPE_string);
+  int id = soap_embed(soap, (void *)a, nullptr, 0, tag, SOAP_TYPE_string);
   if (soap_out_string(soap, tag ? tag : "byte", id, a, type))
     return soap->error;
   return soap_putindependent(soap);
@@ -1583,7 +1586,7 @@ SOAP_FMAC3 char **SOAP_FMAC4 soap_get_string(struct soap *soap, char **p,
                                              const char *type) {
   if ((p = soap_in_string(soap, tag, p, type)))
     if (soap_getindependent(soap))
-      return NULL;
+      return nullptr;
   return p;
 }
 
diff --git a/Framework/ICat/src/GSoap/stdsoap2.cpp b/Framework/ICat/src/GSoap/stdsoap2.cpp
index d351d6dcbe205759e64022794e4a7dcbbd5662d5..9868a9640d94245397101f9c8d885194fca1fba3 100644
--- a/Framework/ICat/src/GSoap/stdsoap2.cpp
+++ b/Framework/ICat/src/GSoap/stdsoap2.cpp
@@ -468,7 +468,7 @@ static const struct soap_code_map
      {253, "yacute"},
      {254, "thorn"},
      {255, "yuml"},
-     {0, NULL}};
+     {0, nullptr}};
 #endif
 
 #ifndef WITH_NOIO
@@ -489,7 +489,7 @@ static const struct soap_code_map h_error_codes[] = {
 #ifdef NO_ADDRESS
     {NO_ADDRESS, "No Address"},
 #endif
-    {0, NULL}};
+    {0, nullptr}};
 #endif
 #endif
 
@@ -534,7 +534,7 @@ static const struct soap_code_map h_http_error_codes[] = {
     {503, "Service Unavailable"},
     {504, "Gateway Time-out"},
     {505, "HTTP Version not supported"},
-    {0, NULL}};
+    {0, nullptr}};
 #endif
 #endif
 
@@ -549,7 +549,7 @@ static const struct soap_code_map h_ssl_error_codes[] = {
     _SSL_ERROR(SSL_ERROR_WANT_CONNECT),
     _SSL_ERROR(SSL_ERROR_WANT_X509_LOOKUP),
     _SSL_ERROR(SSL_ERROR_SYSCALL),
-    {0, NULL}};
+    {0, nullptr}};
 #endif
 
 #ifndef WITH_LEANER
@@ -561,7 +561,7 @@ static const struct soap_code_map mime_codes[] = {
     {SOAP_MIME_BASE64, "base64"},
     {SOAP_MIME_IETF_TOKEN, "ietf-token"},
     {SOAP_MIME_X_TOKEN, "x-token"},
-    {0, NULL}};
+    {0, nullptr}};
 #endif
 
 #ifdef WIN32
@@ -855,7 +855,7 @@ SOAP_FMAC1
 int SOAP_FMAC2 soap_flush_raw(struct soap *soap, const char *s, size_t n) {
   if ((soap->mode & SOAP_IO) == SOAP_IO_STORE) {
     char *t;
-    if (!(t = (char *)soap_push_block(soap, NULL, n)))
+    if (!(t = (char *)soap_push_block(soap, nullptr, n)))
       return soap->error = SOAP_EOM;
     memcpy(t, s, n);
     return SOAP_OK;
@@ -1426,7 +1426,7 @@ soap_code(const struct soap_code_map *code_map, const char *str) {
       code_map++;
     }
   }
-  return NULL;
+  return nullptr;
 }
 #endif
 
@@ -1452,7 +1452,7 @@ SOAP_FMAC1
 const char *SOAP_FMAC2
 soap_code_str(const struct soap_code_map *code_map, long code) {
   if (!code_map)
-    return NULL;
+    return nullptr;
   while (code_map->code != code && code_map->string)
     code_map++;
   return code_map->string;
@@ -1528,8 +1528,8 @@ static soap_wchar soap_char(struct soap *soap) {
   *s = '\0';
   if (*tmp == '#') {
     if (tmp[1] == 'x' || tmp[1] == 'X')
-      return (soap_wchar)soap_strtol(tmp + 2, NULL, 16);
-    return (soap_wchar)soap_strtol(tmp + 1, NULL, 10);
+      return (soap_wchar)soap_strtol(tmp + 2, nullptr, 16);
+    return (soap_wchar)soap_strtol(tmp + 1, nullptr, 10);
   }
   if (!strcmp(tmp, "lt"))
     return '<';
@@ -1843,8 +1843,8 @@ unsigned char *SOAP_FMAC2 soap_gethex(struct soap *soap, int *n) {
   for (;;) {
     char *s;
     size_t i, k;
-    if (soap_append_lab(soap, NULL, 0))
-      return NULL;
+    if (soap_append_lab(soap, nullptr, 0))
+      return nullptr;
     s = soap->labbuf + soap->labidx;
     k = soap->lablen - soap->labidx;
     soap->labidx = soap->lablen;
@@ -1859,7 +1859,7 @@ unsigned char *SOAP_FMAC2 soap_gethex(struct soap *soap, int *n) {
           d2 = (char)c;
         else {
           soap->error = SOAP_TYPE;
-          return NULL;
+          return nullptr;
         }
       } else {
         unsigned char *p;
@@ -1974,13 +1974,13 @@ soap_getbase64(struct soap *soap, int *n, int malloc_flag) {
   for (;;) {
     size_t i, k;
     char *s;
-    if (soap_append_lab(soap, NULL, 2))
-      return NULL;
+    if (soap_append_lab(soap, nullptr, 2))
+      return nullptr;
     s = soap->labbuf + soap->labidx;
     k = soap->lablen - soap->labidx;
     soap->labidx = 3 * (soap->lablen / 3);
     if (!s)
-      return NULL;
+      return nullptr;
     if (k > 2) {
       for (i = 0; i < k - 2; i += 3) {
         unsigned long m = 0;
@@ -2019,13 +2019,13 @@ soap_getbase64(struct soap *soap, int *n, int malloc_flag) {
             int b = soap_base64i[c];
             if (b >= 64) {
               soap->error = SOAP_TYPE;
-              return NULL;
+              return nullptr;
             }
             m = (m << 6) + b;
             j++;
           } else if (!soap_blank(c + '+')) {
             soap->error = SOAP_TYPE;
-            return NULL;
+            return nullptr;
           }
         } while (j < 4);
         *s++ = (char)((m >> 16) & 0xFF);
@@ -2109,7 +2109,7 @@ int SOAP_FMAC2 soap_xop_forward(struct soap *soap, unsigned char **ptr,
   /* TODO: this code to be obsoleted with new import/xop.h conventions */
   short body = soap->body; /* should save type too? */
   if (!soap_peek_element(soap)) {
-    if (!soap_element_begin_in(soap, "xop:Include", 0, NULL)) {
+    if (!soap_element_begin_in(soap, "xop:Include", 0, nullptr)) {
       if (soap_dime_forward(soap, ptr, size, id, type, options) ||
           (soap->body && soap_element_end_in(soap, "xop:Include")))
         return soap->error;
@@ -2129,11 +2129,11 @@ int SOAP_FMAC2 soap_dime_forward(struct soap *soap, unsigned char **ptr,
                                  int *size, char **id, char **type,
                                  char **options) {
   struct soap_xlist *xp;
-  *ptr = NULL;
+  *ptr = nullptr;
   *size = 0;
-  *id = NULL;
-  *type = NULL;
-  *options = NULL;
+  *id = nullptr;
+  *type = nullptr;
+  *options = nullptr;
   if (!*soap->href)
     return SOAP_OK;
   *id = soap_strdup(soap, soap->href);
@@ -2156,7 +2156,7 @@ int SOAP_FMAC2 soap_dime_forward(struct soap *soap, unsigned char **ptr,
 #ifndef PALM_1
 SOAP_FMAC1
 char *SOAP_FMAC2 soap_strdup(struct soap *soap, const char *s) {
-  char *t = NULL;
+  char *t = nullptr;
   if (s && (t = (char *)soap_malloc(soap, strlen(s) + 1)))
     strcpy(t, s);
   return t;
@@ -2167,7 +2167,7 @@ char *SOAP_FMAC2 soap_strdup(struct soap *soap, const char *s) {
 #ifndef PALM_1
 SOAP_FMAC1
 wchar_t *SOAP_FMAC2 soap_wstrdup(struct soap *soap, const wchar_t *s) {
-  wchar_t *t = NULL;
+  wchar_t *t = nullptr;
   if (s) {
     size_t n = 0;
     while (s[n])
@@ -2189,10 +2189,10 @@ struct soap_blist *SOAP_FMAC2 soap_new_block(struct soap *soap) {
   if (!(p = (struct soap_blist *)SOAP_MALLOC(soap,
                                              sizeof(struct soap_blist)))) {
     soap->error = SOAP_EOM;
-    return NULL;
+    return nullptr;
   }
   p->next = soap->blist;
-  p->ptr = NULL;
+  p->ptr = nullptr;
   p->size = 0;
   soap->blist = p;
   return p;
@@ -2212,7 +2212,7 @@ soap_push_block(struct soap *soap, struct soap_blist *b, size_t n) {
                             (unsigned int)b->size + (unsigned int)n));
   if (!(p = (char *)SOAP_MALLOC(soap, n + sizeof(char *) + sizeof(size_t)))) {
     soap->error = SOAP_EOM;
-    return NULL;
+    return nullptr;
   }
   *(char **)p = b->ptr;
   *(size_t *)(p + sizeof(char *)) = n;
@@ -2246,10 +2246,10 @@ void SOAP_FMAC2 soap_update_pointers(struct soap *soap, char *start, char *end,
                                      char *p1, char *p2) {
 #ifndef WITH_NOIDREF
   int i;
-  struct soap_ilist *ip = NULL;
-  struct soap_flist *fp = NULL;
+  struct soap_ilist *ip = nullptr;
+  struct soap_flist *fp = nullptr;
 #ifndef WITH_LEANER
-  struct soap_xlist *xp = NULL;
+  struct soap_xlist *xp = nullptr;
 #endif
   void *p, **q;
   for (i = 0; i < SOAP_IDHASH; i++) {
@@ -2313,8 +2313,8 @@ void SOAP_FMAC2 soap_update_pointers(struct soap *soap, char *start, char *end,
 static int soap_has_copies(struct soap *soap, const char *start,
                            const char *end) {
   int i;
-  struct soap_ilist *ip = NULL;
-  struct soap_flist *fp = NULL;
+  struct soap_ilist *ip = nullptr;
+  struct soap_flist *fp = nullptr;
   const char *p;
   for (i = 0; i < SOAP_IDHASH; i++) {
     for (ip = soap->iht[i]; ip; ip = ip->next) {
@@ -2337,8 +2337,8 @@ static int soap_has_copies(struct soap *soap, const char *start,
 SOAP_FMAC1
 int SOAP_FMAC2 soap_resolve(struct soap *soap) {
   int i;
-  struct soap_ilist *ip = NULL;
-  struct soap_flist *fp = NULL;
+  struct soap_ilist *ip = nullptr;
+  struct soap_flist *fp = nullptr;
   short flag;
   DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Resolving forwarded data\n"));
   for (i = 0; i < SOAP_IDHASH; i++) {
@@ -2346,7 +2346,7 @@ int SOAP_FMAC2 soap_resolve(struct soap *soap) {
       if (ip->ptr) {
         void *p, **q, *r;
         q = (void **)ip->link;
-        ip->link = NULL;
+        ip->link = nullptr;
         r = ip->ptr;
         DBGLOG(TEST, if (q) SOAP_MESSAGE(
                          fdebug, "Traversing link chain to resolve id='%s'\n",
@@ -2380,7 +2380,7 @@ int SOAP_FMAC2 soap_resolve(struct soap *soap) {
                    if (q) SOAP_MESSAGE(
                        fdebug, "Traversing copy chain to resolve id='%s'\n",
                        ip->id));
-            ip->copy = NULL;
+            ip->copy = nullptr;
             do {
               DBGLOG(TEST,
                      SOAP_MESSAGE(fdebug, "... copy %p -> %p (%u bytes)\n",
@@ -2468,9 +2468,9 @@ char *SOAP_FMAC2 soap_first_block(struct soap *soap, struct soap_blist *b) {
     b = soap->blist;
   p = b->ptr;
   if (!p)
-    return NULL;
+    return nullptr;
   DBGLOG(TEST, SOAP_MESSAGE(fdebug, "First block\n"));
-  r = NULL;
+  r = nullptr;
   do {
     q = *(char **)p;
     *(char **)p = r;
@@ -2497,7 +2497,7 @@ char *SOAP_FMAC2 soap_next_block(struct soap *soap, struct soap_blist *b) {
     if (b->ptr)
       return b->ptr + sizeof(char *) + sizeof(size_t);
   }
-  return NULL;
+  return nullptr;
 }
 #endif
 
@@ -2596,7 +2596,7 @@ char *SOAP_FMAC2 soap_putsize(struct soap *soap, const char *type, int size) {
 SOAP_FMAC1
 char *SOAP_FMAC2
 soap_putsizes(struct soap *soap, const char *type, const int *size, int dim) {
-  return soap_putsizesoffsets(soap, type, size, NULL, dim);
+  return soap_putsizesoffsets(soap, type, size, nullptr, dim);
 }
 #endif
 
@@ -2608,7 +2608,7 @@ char *SOAP_FMAC2 soap_putsizesoffsets(struct soap *soap, const char *type,
                                       int dim) {
   int i;
   if (!type)
-    return NULL;
+    return nullptr;
   if (soap->version == 2) {
     sprintf(soap->type, "%s[%d", type, size[0]);
     for (i = 1; i < dim; i++)
@@ -2672,14 +2672,14 @@ soap_getoffsets(const char *attr, const int *size, int *offset, int dim) {
     for (i = 0; i < dim && attr && *attr; i++) {
       attr++;
       j *= size[i];
-      j += offset[i] = (int)soap_strtol(attr, NULL, 10);
+      j += offset[i] = (int)soap_strtol(attr, nullptr, 10);
       attr = strchr(attr, ',');
     }
   else
     for (i = 0; i < dim && attr && *attr; i++) {
       attr++;
       j *= size[i];
-      j += (int)soap_strtol(attr, NULL, 10);
+      j += (int)soap_strtol(attr, nullptr, 10);
       attr = strchr(attr, ',');
     }
   return j;
@@ -2736,7 +2736,7 @@ int SOAP_FMAC2 soap_getsizes(const char *attr, int *size, int dim) {
     for (i = i - 1; i >= 0; i--)
       if (attr[i] == '[' || attr[i] == ',' || attr[i] == ' ')
         break;
-    k = (int)soap_strtol(attr + i + 1, NULL, 10);
+    k = (int)soap_strtol(attr + i + 1, nullptr, 10);
     n *= size[--dim] = k;
     if (k < 0 || n > SOAP_MAXARRAYSIZE)
       return -1;
@@ -2755,7 +2755,7 @@ int SOAP_FMAC2 soap_getposition(const char *attr, int *pos) {
   n = 0;
   i = 1;
   do {
-    pos[n++] = (int)soap_strtol(attr + i, NULL, 10);
+    pos[n++] = (int)soap_strtol(attr + i, nullptr, 10);
     while (attr[i] && attr[i] != ',' && attr[i] != ']')
       i++;
     if (attr[i] == ',')
@@ -2801,7 +2801,7 @@ soap_push_namespace(struct soap *soap, const char *id, const char *ns) {
       (struct soap_nlist *)SOAP_MALLOC(soap, sizeof(struct soap_nlist) + n + k);
   if (!np) {
     soap->error = SOAP_EOM;
-    return NULL;
+    return nullptr;
   }
   np->next = soap->nlist;
   soap->nlist = np;
@@ -2818,7 +2818,7 @@ soap_push_namespace(struct soap *soap, const char *id, const char *ns) {
                                       "anyway)\n",
                               ns));
   } else {
-    np->ns = NULL;
+    np->ns = nullptr;
     DBGLOG(TEST, SOAP_MESSAGE(
                      fdebug, "Push OK ('%s' matches '%s' in namespace table)\n",
                      id, p->id));
@@ -2876,7 +2876,7 @@ soap_current_namespace(struct soap *soap, const char *tag) {
   struct soap_nlist *np;
   const char *s;
   if (!tag || !strncmp(tag, "xml", 3))
-    return NULL;
+    return nullptr;
   np = soap->nlist;
   if (!(s = strchr(tag, ':'))) {
     while (np && *np->id) /* find default namespace, if present */
@@ -2893,7 +2893,7 @@ soap_current_namespace(struct soap *soap, const char *tag) {
     if (np->ns)
       return soap_strdup(soap, np->ns);
   }
-  return NULL;
+  return nullptr;
 }
 #endif
 
@@ -3062,12 +3062,12 @@ soap_ssl_server_context(struct soap *soap, unsigned short flags,
   soap->password = password;
   soap->cafile = cafile;
   soap->capath = capath;
-  soap->crlfile = NULL;
+  soap->crlfile = nullptr;
 #ifdef WITH_OPENSSL
   soap->dhfile = dhfile;
   soap->randfile = randfile;
 #endif
-  soap->ssl_flags = flags | (dhfile == NULL ? SOAP_SSL_RSA : 0);
+  soap->ssl_flags = flags | (dhfile == nullptr ? SOAP_SSL_RSA : 0);
 #ifdef WITH_GNUTLS
   if (dhfile) {
     char *s;
@@ -3149,7 +3149,7 @@ soap_ssl_client_context(struct soap *soap, unsigned short flags,
   soap->capath = capath;
   soap->ssl_flags = SOAP_SSL_CLIENT | flags;
 #ifdef WITH_OPENSSL
-  soap->dhfile = NULL;
+  soap->dhfile = nullptr;
   soap->randfile = randfile;
   soap->fsslverify = (flags & SOAP_SSL_ALLOW_EXPIRED_CERTIFICATE) == 0
                          ? ssl_verify_callback
@@ -3345,7 +3345,7 @@ static int ssl_auth_init(struct soap *soap) {
   }
 #endif
   if ((soap->ssl_flags & SOAP_SSL_RSA)) {
-    RSA *rsa = RSA_generate_key(SOAP_SSL_RSA_BITS, RSA_F4, NULL, NULL);
+    RSA *rsa = RSA_generate_key(SOAP_SSL_RSA_BITS, RSA_F4, nullptr, nullptr);
     if (!SSL_CTX_set_tmp_rsa(soap->ctx, rsa)) {
       if (rsa)
         RSA_free(rsa);
@@ -3354,7 +3354,7 @@ static int ssl_auth_init(struct soap *soap) {
     }
     RSA_free(rsa);
   } else if (soap->dhfile) {
-    DH *dh = 0;
+    DH *dh = nullptr;
     char *s;
     int n = (int)soap_strtoul(soap->dhfile, &s, 10);
     /* if dhfile is numeric, treat it as a key length to generate DH params
@@ -3363,7 +3363,7 @@ static int ssl_auth_init(struct soap *soap) {
 #if defined(VXWORKS)
       DH_generate_parameters_ex(dh, n, 2 /*or 5*/, NULL);
 #else
-      dh = DH_generate_parameters(n, 2 /*or 5*/, NULL, NULL);
+      dh = DH_generate_parameters(n, 2 /*or 5*/, nullptr, nullptr);
 #endif
     else {
       BIO *bio;
@@ -3371,7 +3371,7 @@ static int ssl_auth_init(struct soap *soap) {
       if (!bio)
         return soap_set_receiver_error(soap, "SSL/TLS error",
                                        "Can't read DH file", SOAP_SSL_ERROR);
-      dh = PEM_read_bio_DHparams(bio, NULL, NULL, NULL);
+      dh = PEM_read_bio_DHparams(bio, nullptr, nullptr, nullptr);
       BIO_free(bio);
     }
     if (!dh || DH_check(dh, &n) != 1 || SSL_CTX_set_tmp_dh(soap->ctx, dh) < 0) {
@@ -3772,7 +3772,7 @@ static int tcp_init(struct soap *soap) {
 #ifndef WITH_NOIO
 #ifndef PALM_1
 static const char *tcp_error(struct soap *soap) {
-  const char *msg = NULL;
+  const char *msg = nullptr;
   switch (soap->errmode) {
   case 0:
     msg = soap_strerror(soap);
@@ -4313,7 +4313,7 @@ again:
       soap->status = SOAP_CONNECT;
       soap->keep_alive = 1;
       if ((soap->error =
-               soap->fpost(soap, endpoint, host, port, NULL, NULL, 0)) ||
+               soap->fpost(soap, endpoint, host, port, nullptr, nullptr, 0)) ||
           soap_end_send_flush(soap)) {
         soap->fclosesocket(soap, sk);
         return SOAP_INVALID_SOCKET;
@@ -4365,7 +4365,7 @@ again:
       if (!strcmp(soap->session_host, host) && soap->session_port == port)
         SSL_set_session(soap->ssl, soap->session);
       SSL_SESSION_free(soap->session);
-      soap->session = NULL;
+      soap->session = nullptr;
     }
     soap->imode |= SOAP_ENC_SSL;
     soap->omode |= SOAP_ENC_SSL;
@@ -4435,9 +4435,9 @@ again:
       }
       if (!(soap->ssl_flags & SOAP_SSL_SKIP_HOST_CHECK)) {
         X509_NAME *subj;
-        STACK_OF(CONF_VALUE) *val = NULL;
+        STACK_OF(CONF_VALUE) *val = nullptr;
 #if (OPENSSL_VERSION_NUMBER >= 0x0090800fL)
-        GENERAL_NAMES *names = NULL;
+        GENERAL_NAMES *names = nullptr;
 #else
         int ext_count;
 #endif
@@ -4515,9 +4515,9 @@ again:
         }
 #else
         names = (GENERAL_NAMES *)X509_get_ext_d2i(peer, NID_subject_alt_name,
-                                                  NULL, NULL);
+                                                  nullptr, NULL);
         if (names) {
-          val = i2v_GENERAL_NAMES(NULL, names, val);
+          val = i2v_GENERAL_NAMES(nullptr, names, val);
           sk_GENERAL_NAME_pop_free(names, GENERAL_NAME_free);
         }
         if (val) {
@@ -4545,7 +4545,7 @@ again:
               if (!soap_tag_cmp(host, (const char *)M_ASN1_STRING_data(name)))
                 ok = 1;
               else {
-                unsigned char *tmp = NULL;
+                unsigned char *tmp = nullptr;
                 ASN1_STRING_to_UTF8(&tmp, name);
                 if (tmp) {
                   if (!soap_tag_cmp(host, (const char *)tmp))
@@ -4699,7 +4699,7 @@ static int tcp_select(struct soap *soap, SOAP_SOCKET sk, int flags,
   }
 #endif
 #endif
-  rfd = sfd = efd = NULL;
+  rfd = sfd = efd = nullptr;
   if (flags & SOAP_TCP_SELECT_RCV) {
     rfd = &fd[0];
     FD_ZERO(rfd);
@@ -4771,7 +4771,7 @@ static int tcp_disconnect(struct soap *soap) {
     int r, s = 0;
     if (soap->session) {
       SSL_SESSION_free(soap->session);
-      soap->session = NULL;
+      soap->session = nullptr;
     }
     if (*soap->host) {
       soap->session = SSL_get1_session(soap->ssl);
@@ -4784,7 +4784,7 @@ static int tcp_disconnect(struct soap *soap) {
     /* SSL shutdown does not work when reads are pending, non-blocking */
     if (r == 0) {
       while (SSL_want_read(soap->ssl)) {
-        if (SSL_read(soap->ssl, NULL, 0) ||
+        if (SSL_read(soap->ssl, nullptr, 0) ||
             soap_socket_errno(soap->socket) != SOAP_EAGAIN) {
           r = SSL_shutdown(soap->ssl);
           break;
@@ -4809,7 +4809,7 @@ static int tcp_disconnect(struct soap *soap) {
             soap->socket = SOAP_INVALID_SOCKET;
             ERR_remove_state(0);
             SSL_free(soap->ssl);
-            soap->ssl = NULL;
+            soap->ssl = nullptr;
             return SOAP_OK;
           }
 #else
@@ -4830,7 +4830,7 @@ static int tcp_disconnect(struct soap *soap) {
       }
     }
     SSL_free(soap->ssl);
-    soap->ssl = NULL;
+    soap->ssl = nullptr;
     if (s)
       return SOAP_SSL_ERROR;
     ERR_remove_state(0);
@@ -5314,10 +5314,10 @@ int SOAP_FMAC2 soap_closesock(struct soap *soap) {
 #ifndef WITH_LEANER
   if (status) /* close on error: attachment state is not to be trusted */
   {
-    soap->mime.first = NULL;
-    soap->mime.last = NULL;
-    soap->dime.first = NULL;
-    soap->dime.last = NULL;
+    soap->mime.first = nullptr;
+    soap->mime.last = nullptr;
+    soap->dime.first = nullptr;
+    soap->dime.last = nullptr;
   }
 #endif
   if (soap->fdisconnect && (soap->error = soap->fdisconnect(soap)))
@@ -5405,7 +5405,7 @@ void SOAP_FMAC2 soap_done(struct soap *soap) {
     soap->plugins = p;
   }
   soap->fplugin = fplugin;
-  soap->fmalloc = NULL;
+  soap->fmalloc = nullptr;
 #ifndef WITH_NOHTTP
   soap->fpost = http_post;
   soap->fget = http_get;
@@ -5413,13 +5413,13 @@ void SOAP_FMAC2 soap_done(struct soap *soap) {
   soap->fdel = http_405;
   soap->fopt = http_200;
   soap->fhead = http_200;
-  soap->fform = NULL;
+  soap->fform = nullptr;
   soap->fposthdr = http_post_header;
   soap->fresponse = http_response;
   soap->fparse = http_parse;
   soap->fparsehdr = http_parse_header;
 #endif
-  soap->fheader = NULL;
+  soap->fheader = nullptr;
 #ifndef WITH_NOIO
 #ifndef WITH_IPV6
   soap->fresolve = tcp_gethost;
@@ -5440,26 +5440,26 @@ void SOAP_FMAC2 soap_done(struct soap *soap) {
   soap->fpoll = NULL;
 #endif
 #ifndef WITH_LEANER
-  soap->feltbegin = NULL;
-  soap->feltendin = NULL;
-  soap->feltbegout = NULL;
-  soap->feltendout = NULL;
-  soap->fprepareinitsend = NULL;
-  soap->fprepareinitrecv = NULL;
-  soap->fpreparesend = NULL;
-  soap->fpreparerecv = NULL;
-  soap->fpreparefinalsend = NULL;
-  soap->fpreparefinalrecv = NULL;
-  soap->ffiltersend = NULL;
-  soap->ffilterrecv = NULL;
-#endif
-  soap->fseterror = NULL;
-  soap->fignore = NULL;
-  soap->fserveloop = NULL;
+  soap->feltbegin = nullptr;
+  soap->feltendin = nullptr;
+  soap->feltbegout = nullptr;
+  soap->feltendout = nullptr;
+  soap->fprepareinitsend = nullptr;
+  soap->fprepareinitrecv = nullptr;
+  soap->fpreparesend = nullptr;
+  soap->fpreparerecv = nullptr;
+  soap->fpreparefinalsend = nullptr;
+  soap->fpreparefinalrecv = nullptr;
+  soap->ffiltersend = nullptr;
+  soap->ffilterrecv = nullptr;
+#endif
+  soap->fseterror = nullptr;
+  soap->fignore = nullptr;
+  soap->fserveloop = nullptr;
 #ifdef WITH_OPENSSL
   if (soap->session) {
     SSL_SESSION_free(soap->session);
-    soap->session = NULL;
+    soap->session = nullptr;
   }
 #endif
   if (soap->state == SOAP_INIT) {
@@ -5471,12 +5471,12 @@ void SOAP_FMAC2 soap_done(struct soap *soap) {
 #ifdef WITH_OPENSSL
   if (soap->ssl) {
     SSL_free(soap->ssl);
-    soap->ssl = NULL;
+    soap->ssl = nullptr;
   }
   if (soap->state == SOAP_INIT) {
     if (soap->ctx) {
       SSL_CTX_free(soap->ctx);
-      soap->ctx = NULL;
+      soap->ctx = nullptr;
     }
   }
   ERR_remove_state(0);
@@ -5562,18 +5562,18 @@ int http_parse(struct soap *soap) {
   if (!soap->ntlm_challenge)
 #endif
   {
-    soap->userid = NULL;
-    soap->passwd = NULL;
-    soap->authrealm = NULL;
+    soap->userid = nullptr;
+    soap->passwd = nullptr;
+    soap->authrealm = nullptr;
   }
 #ifdef WITH_NTLM
   soap->ntlm_challenge = NULL;
 #endif
-  soap->proxy_from = NULL;
+  soap->proxy_from = nullptr;
   do {
     soap->length = 0;
-    soap->http_content = NULL;
-    soap->action = NULL;
+    soap->http_content = nullptr;
+    soap->action = nullptr;
     soap->status = 0;
     soap->body = 1;
     if (soap_getline(soap, soap->msgbuf, sizeof(soap->msgbuf))) {
@@ -5774,7 +5774,7 @@ static int http_parse_header(struct soap *soap, const char *key,
   }
 #endif
   else if (!soap_tag_cmp(key, "Content-Length")) {
-    soap->length = soap_strtoul(val, NULL, 10);
+    soap->length = soap_strtoul(val, nullptr, 10);
     if (!soap->length)
       soap->body = 0;
   } else if (!soap_tag_cmp(key, "Content-Encoding")) {
@@ -5844,8 +5844,9 @@ static int http_parse_header(struct soap *soap, const char *key,
           soap_strdup(soap, soap_get_header_attribute(soap, val + 6, "realm"));
   } else if (!soap_tag_cmp(key, "Expect")) {
     if (!soap_tag_cmp(val, "100-continue")) {
-      if ((soap->error = soap->fposthdr(soap, "HTTP/1.1 100 Continue", NULL)) ||
-          (soap->error = soap->fposthdr(soap, NULL, NULL)))
+      if ((soap->error =
+               soap->fposthdr(soap, "HTTP/1.1 100 Continue", nullptr)) ||
+          (soap->error = soap->fposthdr(soap, nullptr, nullptr)))
         return soap->error;
     }
   }
@@ -5892,7 +5893,7 @@ const char *SOAP_FMAC2 soap_get_header_attribute(struct soap *soap,
         return soap->tmpbuf;
     }
   }
-  return NULL;
+  return nullptr;
 }
 #endif
 #endif
@@ -6048,7 +6049,7 @@ static int http_post(struct soap *soap, const char *endpoint, const char *host,
   else
     sprintf(soap->tmpbuf, "%s /%s HTTP/%s", s, (*path == '/' ? path + 1 : path),
             soap->http_version);
-  if ((err = soap->fposthdr(soap, soap->tmpbuf, NULL)))
+  if ((err = soap->fposthdr(soap, soap->tmpbuf, nullptr)))
     return err;
 #ifdef WITH_OPENSSL
   if ((soap->ssl && port != 443) || (!soap->ssl && port != 80))
@@ -6140,7 +6141,7 @@ static int http_post(struct soap *soap, const char *endpoint, const char *host,
     if ((err = soap->fposthdr(soap, "SOAPAction", soap->tmpbuf)))
       return err;
   }
-  return soap->fposthdr(soap, NULL, NULL);
+  return soap->fposthdr(soap, nullptr, nullptr);
 }
 #endif
 #endif
@@ -6207,14 +6208,14 @@ static int http_response(struct soap *soap, int status, size_t count) {
 #endif
     {
       sprintf(soap->tmpbuf, "HTTP/%s %s", soap->http_version, s);
-      if ((err = soap->fposthdr(soap, soap->tmpbuf, NULL)))
+      if ((err = soap->fposthdr(soap, soap->tmpbuf, nullptr)))
         return err;
     } else if ((err = soap->fposthdr(soap, "Status", s))) /* CGI header */
       return err;
   } else if (status >= 200 && status < 600) {
     sprintf(soap->tmpbuf, "HTTP/%s %d %s", soap->http_version, status,
             http_error(soap, status));
-    if ((err = soap->fposthdr(soap, soap->tmpbuf, NULL)))
+    if ((err = soap->fposthdr(soap, soap->tmpbuf, nullptr)))
       return err;
 #ifndef WITH_LEAN
     if (status == 401) {
@@ -6248,7 +6249,7 @@ static int http_response(struct soap *soap, int status, size_t count) {
 #endif
     {
       sprintf(soap->tmpbuf, "HTTP/%s %s", soap->http_version, s);
-      if ((err = soap->fposthdr(soap, soap->tmpbuf, NULL)))
+      if ((err = soap->fposthdr(soap, soap->tmpbuf, nullptr)))
         return err;
     } else if ((err = soap->fposthdr(soap, "Status", s))) /* CGI */
       return err;
@@ -6260,7 +6261,7 @@ static int http_response(struct soap *soap, int status, size_t count) {
   if (soap_putsetcookies(soap))
     return soap->error;
 #endif
-  return soap->fposthdr(soap, NULL, NULL);
+  return soap->fposthdr(soap, nullptr, nullptr);
 }
 #endif
 #endif
@@ -7046,10 +7047,10 @@ size_t SOAP_FMAC2 soap_hash(const char *s) {
 #ifndef PALM_1
 static void soap_init_pht(struct soap *soap) {
   int i;
-  soap->pblk = NULL;
+  soap->pblk = nullptr;
   soap->pidx = 0;
   for (i = 0; i < (int)SOAP_PTRHASH; i++)
-    soap->pht[i] = NULL;
+    soap->pht[i] = nullptr;
 }
 #endif
 #endif
@@ -7092,10 +7093,10 @@ static void soap_free_pht(struct soap *soap) {
     next = pb->next;
     SOAP_FREE(soap, pb);
   }
-  soap->pblk = NULL;
+  soap->pblk = nullptr;
   soap->pidx = 0;
   for (i = 0; i < (int)SOAP_PTRHASH; i++)
-    soap->pht[i] = NULL;
+    soap->pht[i] = nullptr;
 }
 #endif
 #endif
@@ -7133,7 +7134,7 @@ SOAP_FMAC1
 int SOAP_FMAC2 soap_pointer_lookup(struct soap *soap, const void *p, int type,
                                    struct soap_plist **ppp) {
   struct soap_plist *pp;
-  *ppp = NULL;
+  *ppp = nullptr;
   if (p) {
     for (pp = soap->pht[soap_hash_ptr(p)]; pp; pp = pp->next) {
       if (pp->ptr == p && pp->type == type) {
@@ -7204,7 +7205,7 @@ int SOAP_FMAC2 soap_array_pointer_lookup(struct soap *soap, const void *p,
                                          const struct soap_array *a, int n,
                                          int type, struct soap_plist **ppp) {
   struct soap_plist *pp;
-  *ppp = NULL;
+  *ppp = nullptr;
   if (!p || !a->__ptr)
     return 0;
   for (pp = soap->pht[soap_hash_ptr(a->__ptr)]; pp; pp = pp->next) {
@@ -7353,7 +7354,7 @@ int SOAP_FMAC2 soap_begin_send(struct soap *soap) {
   }
   soap->mode &= ~SOAP_IO_LENGTH;
   if ((soap->mode & SOAP_IO) == SOAP_IO_STORE)
-    if (soap_new_block(soap) == NULL)
+    if (soap_new_block(soap) == nullptr)
       return soap->error;
   if (!(soap->mode & SOAP_IO_KEEPALIVE))
     soap->keep_alive = 0;
@@ -7475,7 +7476,7 @@ int SOAP_FMAC2 soap_reference(struct soap *soap, const void *p, int t) {
       pp->mark1 = 2;
       pp->mark2 = 2;
     }
-  } else if (!soap_pointer_enter(soap, p, NULL, 0, t, &pp))
+  } else if (!soap_pointer_enter(soap, p, nullptr, 0, t, &pp))
     return 1;
   DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Reference %p type=%d (%d %d)\n", p, t,
                             (int)pp->mark1, (int)pp->mark2));
@@ -7517,7 +7518,7 @@ int SOAP_FMAC2 soap_array_reference(struct soap *soap, const void *p,
 SOAP_FMAC1
 int SOAP_FMAC2
 soap_embedded_id(struct soap *soap, int id, const void *p, int t) {
-  struct soap_plist *pp = NULL;
+  struct soap_plist *pp = nullptr;
   if (!id || (!soap->encodingStyle && !(soap->omode & SOAP_XML_GRAPH)) ||
       (soap->omode & SOAP_XML_TREE))
     return id;
@@ -7699,7 +7700,7 @@ soap_attachment(struct soap *soap, const char *tag, int id, const void *p,
 static void soap_init_iht(struct soap *soap) {
   int i;
   for (i = 0; i < SOAP_IDHASH; i++)
-    soap->iht[i] = NULL;
+    soap->iht[i] = nullptr;
 }
 #endif
 #endif
@@ -7709,8 +7710,8 @@ static void soap_init_iht(struct soap *soap) {
 #ifndef PALM_1
 static void soap_free_iht(struct soap *soap) {
   int i;
-  struct soap_ilist *ip = NULL, *p = NULL;
-  struct soap_flist *fp = NULL, *fq = NULL;
+  struct soap_ilist *ip = nullptr, *p = nullptr;
+  struct soap_flist *fp = nullptr, *fq = nullptr;
   DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free ID hashtable\n"));
   for (i = 0; i < SOAP_IDHASH; i++) {
     for (ip = soap->iht[i]; ip; ip = p) {
@@ -7721,7 +7722,7 @@ static void soap_free_iht(struct soap *soap) {
       p = ip->next;
       SOAP_FREE(soap, ip);
     }
-    soap->iht[i] = NULL;
+    soap->iht[i] = nullptr;
   }
 }
 #endif
@@ -7732,11 +7733,11 @@ static void soap_free_iht(struct soap *soap) {
 #ifndef PALM_2
 SOAP_FMAC1
 struct soap_ilist *SOAP_FMAC2 soap_lookup(struct soap *soap, const char *id) {
-  struct soap_ilist *ip = NULL;
+  struct soap_ilist *ip = nullptr;
   for (ip = soap->iht[soap_hash(id)]; ip; ip = ip->next)
     if (!strcmp(ip->id, id))
       return ip;
-  return NULL;
+  return nullptr;
 }
 #endif
 #endif
@@ -7778,7 +7779,7 @@ void *SOAP_FMAC2 soap_malloc(struct soap *soap, size_t n) {
          (sizeof(void *) - 1); /* align at 4-, 8- or 16-byte boundary */
     if (!(p = (char *)SOAP_MALLOC(soap, n + sizeof(void *) + sizeof(size_t)))) {
       soap->error = SOAP_EOM;
-      return NULL;
+      return nullptr;
     }
     /* set the canary to detect corruption */
     *(unsigned short *)(p + n - sizeof(unsigned short)) =
@@ -7934,13 +7935,13 @@ void SOAP_FMAC2 soap_dealloc(struct soap *soap, void *p) {
       SOAP_FREE(soap, q);
     }
     /* we must assume these were deallocated: */
-    soap->http_content = NULL;
-    soap->action = NULL;
-    soap->fault = NULL;
-    soap->header = NULL;
-    soap->userid = NULL;
-    soap->passwd = NULL;
-    soap->authrealm = NULL;
+    soap->http_content = nullptr;
+    soap->action = nullptr;
+    soap->fault = nullptr;
+    soap->header = nullptr;
+    soap->userid = nullptr;
+    soap->passwd = nullptr;
+    soap->authrealm = nullptr;
 #ifdef WITH_NTLM
     soap->ntlm_challenge = NULL;
 #endif
@@ -8002,8 +8003,8 @@ void SOAP_FMAC2 soap_delete(struct soap *soap, void *p) {
       SOAP_FREE(soap, q);
     }
   }
-  soap->fault = NULL;  /* this was possibly deallocated */
-  soap->header = NULL; /* this was possibly deallocated */
+  soap->fault = nullptr;  /* this was possibly deallocated */
+  soap->header = nullptr; /* this was possibly deallocated */
 }
 #endif
 
@@ -8047,7 +8048,7 @@ soap_delegate_deletion(struct soap *soap, struct soap *soap_to) {
   }
   *q = (char *)soap_to->alist;
   soap_to->alist = soap->alist;
-  soap->alist = NULL;
+  soap->alist = nullptr;
 #ifdef SOAP_MEM_DEBUG
   cp = soap->clist;
   while (cp) {
@@ -8071,7 +8072,7 @@ soap_delegate_deletion(struct soap *soap, struct soap *soap_to) {
     cp->next = soap->clist;
   } else
     soap_to->clist = soap->clist;
-  soap->clist = NULL;
+  soap->clist = nullptr;
 }
 #endif
 
@@ -8164,7 +8165,7 @@ void *SOAP_FMAC2 soap_id_lookup(struct soap *soap, const char *id, void **p,
                    id); /* lookup pointer to hash table entry for string id */
   if (!ip) {
     if (!(ip = soap_enter(soap, id))) /* new hash table entry for string id */
-      return NULL;
+      return nullptr;
     DBGLOG(TEST,
            SOAP_MESSAGE(fdebug,
                         "Forwarding first href='%s' type=%d %p (%u bytes)\n",
@@ -8172,11 +8173,11 @@ void *SOAP_FMAC2 soap_id_lookup(struct soap *soap, const char *id, void **p,
     ip->type = t;
     ip->size = n;
     ip->link = p;
-    ip->copy = NULL;
-    ip->flist = NULL;
-    ip->ptr = NULL;
+    ip->copy = nullptr;
+    ip->flist = nullptr;
+    ip->ptr = nullptr;
     ip->level = k;
-    *p = NULL;
+    *p = nullptr;
   } else if (ip->ptr) {
     DBGLOG(TEST,
            SOAP_MESSAGE(fdebug,
@@ -8191,12 +8192,12 @@ void *SOAP_FMAC2 soap_id_lookup(struct soap *soap, const char *id, void **p,
                  fdebug,
                  "Type incompatibility: href='%s' id-type=%d href-type=%d\n",
                  id, ip->type, t));
-      return NULL;
+      return nullptr;
     }
     while (ip->level < k) {
       q = (void **)soap_malloc(soap, sizeof(void *));
       if (!q)
-        return NULL;
+        return nullptr;
       *p = (void *)q;
       p = q;
       k--;
@@ -8213,7 +8214,7 @@ void *SOAP_FMAC2 soap_id_lookup(struct soap *soap, const char *id, void **p,
       while (q) {
         void **tmp = (void **)soap_malloc(soap, sizeof(void *));
         if (!tmp)
-          return NULL;
+          return nullptr;
         *r = (void *)tmp;
 
         s = *q;
@@ -8221,9 +8222,9 @@ void *SOAP_FMAC2 soap_id_lookup(struct soap *soap, const char *id, void **p,
         r = (void **)*r;
         q = (void **)s;
       }
-      *r = NULL;
+      *r = nullptr;
       ip->size = n;
-      ip->copy = NULL;
+      ip->copy = nullptr;
       ip->level = ip->level - 1;
       DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Descending one level...\n"));
     }
@@ -8238,7 +8239,7 @@ void *SOAP_FMAC2 soap_id_lookup(struct soap *soap, const char *id, void **p,
     while (ip->level < k) {
       q = (void **)soap_malloc(soap, sizeof(void *));
       if (!q)
-        return NULL;
+        return nullptr;
       *p = q;
       p = q;
       k--;
@@ -8269,14 +8270,14 @@ void *SOAP_FMAC2 soap_id_forward(struct soap *soap, const char *href, void *p,
                    href); /* lookup pointer to hash table entry for string id */
   if (!ip) {
     if (!(ip = soap_enter(soap, href))) /* new hash table entry for string id */
-      return NULL;
+      return nullptr;
     ip->type = st;
     ip->size = n;
-    ip->link = NULL;
-    ip->copy = NULL;
-    ip->ptr = NULL;
+    ip->link = nullptr;
+    ip->copy = nullptr;
+    ip->ptr = nullptr;
     ip->level = 0;
-    ip->flist = NULL;
+    ip->flist = nullptr;
     DBGLOG(TEST,
            SOAP_MESSAGE(
                fdebug,
@@ -8291,14 +8292,14 @@ void *SOAP_FMAC2 soap_id_forward(struct soap *soap, const char *href, void *p,
     strncpy(soap->id, href, sizeof(soap->id) - 1);
     soap->id[sizeof(soap->id) - 1] = '\0';
     soap->error = SOAP_HREF;
-    return NULL;
+    return nullptr;
   }
   if (fcopy || n < sizeof(void *) || *href != '#') {
     struct soap_flist *fp =
         (struct soap_flist *)SOAP_MALLOC(soap, sizeof(struct soap_flist));
     if (!fp) {
       soap->error = SOAP_EOM;
-      return NULL;
+      return nullptr;
     }
     fp->next = ip->flist;
     fp->type = tt;
@@ -8361,11 +8362,11 @@ soap_id_enter(struct soap *soap, const char *id, void *p, int t, size_t n,
          SOAP_MESSAGE(fdebug, "Lookup entry id='%s for location=%p'\n", id, p));
   if (!ip) {
     if (!(ip = soap_enter(soap, id))) /* new hash table entry for string id */
-      return NULL;
+      return nullptr;
     ip->type = t;
-    ip->link = NULL;
-    ip->copy = NULL;
-    ip->flist = NULL;
+    ip->link = nullptr;
+    ip->copy = nullptr;
+    ip->flist = nullptr;
     ip->size = n;
     ip->ptr = p;
     ip->level = k;
@@ -8384,13 +8385,13 @@ soap_id_enter(struct soap *soap, const char *id, void *p, int t, size_t n,
     strncpy(soap->id, id, sizeof(soap->id) - 1);
     soap->id[sizeof(soap->id) - 1] = '\0';
     soap->error = SOAP_HREF;
-    return NULL;
+    return nullptr;
   } else if (ip->ptr) {
     DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Multiply defined id='%s'\n", id));
     strncpy(soap->id, id, sizeof(soap->id) - 1);
     soap->id[sizeof(soap->id) - 1] = '\0';
     soap->error = SOAP_DUPLICATE_ID;
-    return NULL;
+    return nullptr;
   } else {
     ip->size = n;
     ip->ptr = p;
@@ -8434,17 +8435,17 @@ int SOAP_FMAC2 soap_end_send(struct soap *soap) {
           .list) { /* SOAP body referenced attachments must appear first */
     soap->dime.last->next = soap->dime.first;
     soap->dime.first = soap->dime.list->next;
-    soap->dime.list->next = NULL;
+    soap->dime.list->next = nullptr;
     soap->dime.last = soap->dime.list;
   }
   if (!(err = soap_putdime(soap)))
     err = soap_putmime(soap);
-  soap->mime.list = NULL;
-  soap->mime.first = NULL;
-  soap->mime.last = NULL;
-  soap->dime.list = NULL;
-  soap->dime.first = NULL;
-  soap->dime.last = NULL;
+  soap->mime.list = nullptr;
+  soap->mime.first = nullptr;
+  soap->mime.last = nullptr;
+  soap->dime.list = nullptr;
+  soap->dime.first = nullptr;
+  soap->dime.last = nullptr;
   if (err)
     return err;
 #endif
@@ -8539,15 +8540,16 @@ int SOAP_FMAC2 soap_end_send_flush(struct soap *soap) {
         soap->mode++;
       }
 #endif
-      for (p = soap_first_block(soap, NULL); p;
-           p = soap_next_block(soap, NULL)) {
+      for (p = soap_first_block(soap, nullptr); p;
+           p = soap_next_block(soap, nullptr)) {
         DBGMSG(SENT, p, soap_block_size(soap, NULL));
-        if ((soap->error = soap->fsend(soap, p, soap_block_size(soap, NULL)))) {
-          soap_end_block(soap, NULL);
+        if ((soap->error =
+                 soap->fsend(soap, p, soap_block_size(soap, nullptr)))) {
+          soap_end_block(soap, nullptr);
           return soap->error;
         }
       }
-      soap_end_block(soap, NULL);
+      soap_end_block(soap, nullptr);
     }
 #ifndef WITH_LEANER
     else if ((soap->mode & SOAP_IO) == SOAP_IO_CHUNK) {
@@ -8582,19 +8584,19 @@ SOAP_FMAC1
 int SOAP_FMAC2 soap_end_recv(struct soap *soap) {
   soap->part = SOAP_END;
 #ifndef WITH_LEAN
-  soap->wsuid = NULL;       /* reset before next send */
-  soap->c14nexclude = NULL; /* reset before next send */
+  soap->wsuid = nullptr;       /* reset before next send */
+  soap->c14nexclude = nullptr; /* reset before next send */
 #endif
 #ifndef WITH_LEANER
-  soap->ffilterrecv = NULL;
+  soap->ffilterrecv = nullptr;
   if ((soap->mode & SOAP_ENC_DIME) && soap_getdime(soap)) {
-    soap->dime.first = NULL;
-    soap->dime.last = NULL;
+    soap->dime.first = nullptr;
+    soap->dime.last = nullptr;
     return soap->error;
   }
   soap->dime.list = soap->dime.first;
-  soap->dime.first = NULL;
-  soap->dime.last = NULL;
+  soap->dime.first = nullptr;
+  soap->dime.last = nullptr;
   /* Check if MIME attachments and mime-post-check flag is set, if so call
    * soap_resolve() and return */
   if (soap->mode & SOAP_ENC_MIME) {
@@ -8611,9 +8613,9 @@ int SOAP_FMAC2 soap_end_recv(struct soap *soap) {
       return soap->error;
   }
   soap->mime.list = soap->mime.first;
-  soap->mime.first = NULL;
-  soap->mime.last = NULL;
-  soap->mime.boundary = NULL;
+  soap->mime.first = nullptr;
+  soap->mime.last = nullptr;
+  soap->mime.boundary = nullptr;
   if (soap->xlist) {
     struct soap_multipart *content;
     for (content = soap->mime.list; content; content = content->next)
@@ -8705,7 +8707,7 @@ void SOAP_FMAC2 soap_free_temp(struct soap *soap) {
   soap_free_ns(soap);
   DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free any remaining temp blocks\n"));
   while (soap->blist)
-    soap_end_block(soap, NULL);
+    soap_end_block(soap, nullptr);
   DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free attribute storage\n"));
   for (tp = soap->attributes; tp; tp = tq) {
     tq = tp->next;
@@ -8713,11 +8715,11 @@ void SOAP_FMAC2 soap_free_temp(struct soap *soap) {
       SOAP_FREE(soap, tp->value);
     SOAP_FREE(soap, tp);
   }
-  soap->attributes = NULL;
+  soap->attributes = nullptr;
 #ifdef WITH_FAST
   if (soap->labbuf)
     SOAP_FREE(soap, soap->labbuf);
-  soap->labbuf = NULL;
+  soap->labbuf = nullptr;
   soap->lablen = 0;
   soap->labidx = 0;
 #endif
@@ -8728,13 +8730,13 @@ void SOAP_FMAC2 soap_free_temp(struct soap *soap) {
         if (soap->encodingStyle == ns->out)
           soap->encodingStyle = SOAP_STR_EOS;
         SOAP_FREE(soap, ns->out);
-        ns->out = NULL;
+        ns->out = nullptr;
       }
       if (soap->encodingStyle == ns->ns)
         soap->encodingStyle = SOAP_STR_EOS;
     }
     SOAP_FREE(soap, soap->local_namespaces);
-    soap->local_namespaces = NULL;
+    soap->local_namespaces = nullptr;
   }
 #ifndef WITH_LEANER
   while (soap->xlist) {
@@ -8759,7 +8761,7 @@ static void soap_free_ns(struct soap *soap) {
     nq = np->next;
     SOAP_FREE(soap, np);
   }
-  soap->nlist = NULL;
+  soap->nlist = nullptr;
 }
 #endif
 
@@ -8769,8 +8771,8 @@ static void soap_free_ns(struct soap *soap) {
 static void soap_init_logs(struct soap *soap) {
   int i;
   for (i = 0; i < SOAP_MAXLOGS; i++) {
-    soap->logfile[i] = NULL;
-    soap->fdebug[i] = NULL;
+    soap->logfile[i] = nullptr;
+    soap->fdebug[i] = nullptr;
   }
 }
 #endif
@@ -8862,9 +8864,9 @@ soap_copy_context(struct soap *copy, const struct soap *soap) {
   if (copy == soap)
     return copy;
   if (soap_check_state(soap))
-    return NULL;
+    return nullptr;
   if (copy) {
-    struct soap_plugin *p = NULL;
+    struct soap_plugin *p = nullptr;
     DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Copying context\n"));
 #ifdef __cplusplus
     *copy = *soap;
@@ -8873,17 +8875,17 @@ soap_copy_context(struct soap *copy, const struct soap *soap) {
 #endif
     copy->state = SOAP_COPY;
     copy->error = SOAP_OK;
-    copy->userid = NULL;
-    copy->passwd = NULL;
+    copy->userid = nullptr;
+    copy->passwd = nullptr;
 #ifdef WITH_NTLM
     copy->ntlm_challenge = NULL;
 #endif
-    copy->nlist = NULL;
-    copy->blist = NULL;
-    copy->clist = NULL;
-    copy->alist = NULL;
-    copy->attributes = NULL;
-    copy->labbuf = NULL;
+    copy->nlist = nullptr;
+    copy->blist = nullptr;
+    copy->clist = nullptr;
+    copy->alist = nullptr;
+    copy->attributes = nullptr;
+    copy->labbuf = nullptr;
     copy->lablen = 0;
     copy->labidx = 0;
 #ifdef SOAP_MEM_DEBUG
@@ -8898,7 +8900,7 @@ soap_copy_context(struct soap *copy, const struct soap *soap) {
     soap_set_recv_logfile(copy, soap->logfile[SOAP_INDEX_RECV]);
 #endif
     copy->namespaces = soap->local_namespaces;
-    copy->local_namespaces = NULL;
+    copy->local_namespaces = nullptr;
     soap_set_local_namespaces(
         copy); /* copy content of soap->local_namespaces */
     copy->namespaces =
@@ -8910,12 +8912,12 @@ soap_copy_context(struct soap *copy, const struct soap *soap) {
     copy->c_locale = duplocale(soap->c_locale);
 #endif
 #else
-    copy->c_locale = NULL;
+    copy->c_locale = nullptr;
 #endif
 #ifdef WITH_OPENSSL
-    copy->bio = NULL;
-    copy->ssl = NULL;
-    copy->session = NULL;
+    copy->bio = nullptr;
+    copy->ssl = nullptr;
+    copy->session = nullptr;
 #endif
 #ifdef WITH_GNUTLS
     copy->session = NULL;
@@ -8931,29 +8933,29 @@ soap_copy_context(struct soap *copy, const struct soap *soap) {
     soap_init_iht(copy);
     soap_init_pht(copy);
 #endif
-    copy->header = NULL;
-    copy->fault = NULL;
-    copy->action = NULL;
+    copy->header = nullptr;
+    copy->fault = nullptr;
+    copy->action = nullptr;
 #ifndef WITH_LEAN
 #ifdef WITH_COOKIES
     copy->cookies = soap_copy_cookies(copy, soap);
 #else
-    copy->cookies = NULL;
+    copy->cookies = nullptr;
 #endif
 #endif
-    copy->plugins = NULL;
+    copy->plugins = nullptr;
     for (p = soap->plugins; p; p = p->next) {
       struct soap_plugin *q =
           (struct soap_plugin *)SOAP_MALLOC(copy, sizeof(struct soap_plugin));
       if (!q)
-        return NULL;
+        return nullptr;
       DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Copying plugin '%s'\n", p->id));
       *q = *p;
       if (p->fcopy && p->fcopy(copy, q, p)) {
         DBGLOG(TEST,
                SOAP_MESSAGE(fdebug, "Could not copy plugin '%s'\n", p->id));
         SOAP_FREE(copy, q);
-        return NULL;
+        return nullptr;
       }
       q->next = copy->plugins;
       copy->plugins = q;
@@ -8967,7 +8969,7 @@ soap_copy_context(struct soap *copy, const struct soap *soap) {
 #ifndef PALM_1
 SOAP_FMAC1
 void SOAP_FMAC2 soap_copy_stream(struct soap *copy, struct soap *soap) {
-  struct soap_attribute *tp = NULL, *tq;
+  struct soap_attribute *tp = nullptr, *tq;
   if (copy == soap)
     return;
   copy->mode = soap->mode;
@@ -9041,7 +9043,7 @@ void SOAP_FMAC2 soap_copy_stream(struct soap *copy, struct soap *soap) {
   soap_set_local_namespaces(copy);
   copy->version = soap->version;
   if (soap->nlist && soap->local_namespaces) {
-    struct soap_nlist *np = NULL, *nq;
+    struct soap_nlist *np = nullptr, *nq;
     /* copy reversed nlist */
     for (nq = soap->nlist; nq; nq = nq->next) {
       struct soap_nlist *nr = np;
@@ -9060,7 +9062,7 @@ void SOAP_FMAC2 soap_copy_stream(struct soap *copy, struct soap *soap) {
         if (!s)
           s = soap->local_namespaces[np->index].ns;
       }
-      if (s && soap_push_namespace(copy, np->id, s) == NULL)
+      if (s && soap_push_namespace(copy, np->id, s) == nullptr)
         break;
       nq = np;
       np = np->next;
@@ -9090,7 +9092,7 @@ void SOAP_FMAC2 soap_copy_stream(struct soap *copy, struct soap *soap) {
       if (tp->value)
         strcpy(tp->value, tq->value);
     }
-    tp->ns = NULL;
+    tp->ns = nullptr;
     tp->next = tr;
   }
   copy->attributes = tp;
@@ -9105,9 +9107,9 @@ void SOAP_FMAC2 soap_free_stream(struct soap *soap) {
   soap->sendsk = SOAP_INVALID_SOCKET;
   soap->recvsk = SOAP_INVALID_SOCKET;
 #ifdef WITH_OPENSSL
-  soap->bio = NULL;
-  soap->ctx = NULL;
-  soap->ssl = NULL;
+  soap->bio = nullptr;
+  soap->ctx = nullptr;
+  soap->ssl = nullptr;
 #endif
 #ifdef WITH_GNUTLS
   soap->xcred = NULL;
@@ -9153,13 +9155,13 @@ void SOAP_FMAC2 soap_versioning(soap_init)(struct soap *soap, soap_mode imode,
   soap_mode(soap, imode);
   soap_imode(soap, imode);
   soap_omode(soap, omode);
-  soap->plugins = NULL;
-  soap->user = NULL;
+  soap->plugins = nullptr;
+  soap->user = nullptr;
   for (i = 0; i < sizeof(soap->data) / sizeof(*soap->data); i++)
-    soap->data[i] = NULL;
-  soap->userid = NULL;
-  soap->passwd = NULL;
-  soap->authrealm = NULL;
+    soap->data[i] = nullptr;
+  soap->userid = nullptr;
+  soap->passwd = nullptr;
+  soap->authrealm = nullptr;
 #ifdef WITH_NTLM
   soap->ntlm_challenge = NULL;
 #endif
@@ -9170,19 +9172,19 @@ void SOAP_FMAC2 soap_versioning(soap_init)(struct soap *soap, soap_mode imode,
   soap->fdel = http_405;
   soap->fopt = http_200;
   soap->fhead = http_200;
-  soap->fform = NULL;
+  soap->fform = nullptr;
   soap->fposthdr = http_post_header;
   soap->fresponse = http_response;
   soap->fparse = http_parse;
   soap->fparsehdr = http_parse_header;
 #endif
-  soap->fheader = NULL;
-  soap->fconnect = NULL;
-  soap->fdisconnect = NULL;
+  soap->fheader = nullptr;
+  soap->fconnect = nullptr;
+  soap->fdisconnect = nullptr;
 #ifndef WITH_NOIO
-  soap->ipv6_multicast_if = 0;    /* in_addr_t value */
-  soap->ipv4_multicast_if = NULL; /* points to struct in_addr or in_addr_t */
-  soap->ipv4_multicast_ttl = 0;   /* 0: use default */
+  soap->ipv6_multicast_if = 0;       /* in_addr_t value */
+  soap->ipv4_multicast_if = nullptr; /* points to struct in_addr or in_addr_t */
+  soap->ipv4_multicast_ttl = 0;      /* 0: use default */
 #ifndef WITH_IPV6
   soap->fresolve = tcp_gethost;
 #else
@@ -9201,44 +9203,44 @@ void SOAP_FMAC2 soap_versioning(soap_init)(struct soap *soap, soap_mode imode,
   soap->fclose = NULL;
   soap->fpoll = NULL;
 #endif
-  soap->fseterror = NULL;
-  soap->fignore = NULL;
-  soap->fserveloop = NULL;
+  soap->fseterror = nullptr;
+  soap->fignore = nullptr;
+  soap->fserveloop = nullptr;
   soap->fplugin = fplugin;
-  soap->fmalloc = NULL;
+  soap->fmalloc = nullptr;
 #ifndef WITH_LEANER
-  soap->feltbegin = NULL;
-  soap->feltendin = NULL;
-  soap->feltbegout = NULL;
-  soap->feltendout = NULL;
-  soap->fprepareinitsend = NULL;
-  soap->fprepareinitrecv = NULL;
-  soap->fpreparesend = NULL;
-  soap->fpreparerecv = NULL;
-  soap->fpreparefinalsend = NULL;
-  soap->fpreparefinalrecv = NULL;
-  soap->ffiltersend = NULL;
-  soap->ffilterrecv = NULL;
-  soap->fdimereadopen = NULL;
-  soap->fdimewriteopen = NULL;
-  soap->fdimereadclose = NULL;
-  soap->fdimewriteclose = NULL;
-  soap->fdimeread = NULL;
-  soap->fdimewrite = NULL;
-  soap->fmimereadopen = NULL;
-  soap->fmimewriteopen = NULL;
-  soap->fmimereadclose = NULL;
-  soap->fmimewriteclose = NULL;
-  soap->fmimeread = NULL;
-  soap->fmimewrite = NULL;
+  soap->feltbegin = nullptr;
+  soap->feltendin = nullptr;
+  soap->feltbegout = nullptr;
+  soap->feltendout = nullptr;
+  soap->fprepareinitsend = nullptr;
+  soap->fprepareinitrecv = nullptr;
+  soap->fpreparesend = nullptr;
+  soap->fpreparerecv = nullptr;
+  soap->fpreparefinalsend = nullptr;
+  soap->fpreparefinalrecv = nullptr;
+  soap->ffiltersend = nullptr;
+  soap->ffilterrecv = nullptr;
+  soap->fdimereadopen = nullptr;
+  soap->fdimewriteopen = nullptr;
+  soap->fdimereadclose = nullptr;
+  soap->fdimewriteclose = nullptr;
+  soap->fdimeread = nullptr;
+  soap->fdimewrite = nullptr;
+  soap->fmimereadopen = nullptr;
+  soap->fmimewriteopen = nullptr;
+  soap->fmimereadclose = nullptr;
+  soap->fmimewriteclose = nullptr;
+  soap->fmimeread = nullptr;
+  soap->fmimewrite = nullptr;
 #endif
   soap->float_format = "%.9G";       /* Alternative: use "%G" */
   soap->double_format = "%.17lG";    /* Alternative: use "%lG" */
   soap->dime_id_format = "cid:id%d"; /* default DIME id format */
   soap->http_version = "1.1";
   soap->proxy_http_version = "1.0";
-  soap->http_content = NULL;
-  soap->actor = NULL;
+  soap->http_content = nullptr;
+  soap->actor = nullptr;
   soap->lang = "en";
   soap->keep_alive = 0;
   soap->tcp_keep_alive = 0;
@@ -9256,40 +9258,40 @@ void SOAP_FMAC2 soap_versioning(soap_init)(struct soap *soap, soap_mode imode,
   soap->accept_flags = 0;
   soap->linger_time = 0;
   soap->ip = 0;
-  soap->labbuf = NULL;
+  soap->labbuf = nullptr;
   soap->lablen = 0;
   soap->labidx = 0;
   soap->encodingStyle = SOAP_STR_EOS;
 #ifndef WITH_NONAMESPACES
   soap->namespaces = namespaces;
 #else
-  soap->namespaces = NULL;
-#endif
-  soap->local_namespaces = NULL;
-  soap->nlist = NULL;
-  soap->blist = NULL;
-  soap->clist = NULL;
-  soap->alist = NULL;
-  soap->attributes = NULL;
-  soap->header = NULL;
-  soap->fault = NULL;
+  soap->namespaces = nullptr;
+#endif
+  soap->local_namespaces = nullptr;
+  soap->nlist = nullptr;
+  soap->blist = nullptr;
+  soap->clist = nullptr;
+  soap->alist = nullptr;
+  soap->attributes = nullptr;
+  soap->header = nullptr;
+  soap->fault = nullptr;
   soap->master = SOAP_INVALID_SOCKET;
   soap->socket = SOAP_INVALID_SOCKET;
   soap->sendsk = SOAP_INVALID_SOCKET;
   soap->recvsk = SOAP_INVALID_SOCKET;
-  soap->os = NULL;
-  soap->is = NULL;
+  soap->os = nullptr;
+  soap->is = nullptr;
 #ifndef WITH_LEANER
-  soap->dom = NULL;
-  soap->dime.list = NULL;
-  soap->dime.first = NULL;
-  soap->dime.last = NULL;
-  soap->mime.list = NULL;
-  soap->mime.first = NULL;
-  soap->mime.last = NULL;
-  soap->mime.boundary = NULL;
-  soap->mime.start = NULL;
-  soap->xlist = NULL;
+  soap->dom = nullptr;
+  soap->dime.list = nullptr;
+  soap->dime.first = nullptr;
+  soap->dime.last = nullptr;
+  soap->mime.list = nullptr;
+  soap->mime.first = nullptr;
+  soap->mime.last = nullptr;
+  soap->mime.boundary = nullptr;
+  soap->mime.start = nullptr;
+  soap->xlist = nullptr;
 #endif
 #ifndef UNDER_CE
   soap->recvfd = 0;
@@ -9300,12 +9302,12 @@ void SOAP_FMAC2 soap_versioning(soap_init)(struct soap *soap, soap_mode imode,
 #endif
   soap->host[0] = '\0';
   soap->port = 0;
-  soap->action = NULL;
-  soap->proxy_host = NULL;
+  soap->action = nullptr;
+  soap->proxy_host = nullptr;
   soap->proxy_port = 8080;
-  soap->proxy_userid = NULL;
-  soap->proxy_passwd = NULL;
-  soap->prolog = NULL;
+  soap->proxy_userid = nullptr;
+  soap->proxy_passwd = nullptr;
+  soap->prolog = nullptr;
 #ifdef WITH_ZLIB
   soap->zlib_state = SOAP_ZLIB_NONE;
   soap->zlib_in = SOAP_ZLIB_NONE;
@@ -9320,11 +9322,11 @@ void SOAP_FMAC2 soap_versioning(soap_init)(struct soap *soap, soap_mode imode,
   soap->z_dict_len = 0;
 #endif
 #ifndef WITH_LEAN
-  soap->wsuid = NULL;
-  soap->c14nexclude = NULL;
-  soap->cookies = NULL;
-  soap->cookie_domain = NULL;
-  soap->cookie_path = NULL;
+  soap->wsuid = nullptr;
+  soap->c14nexclude = nullptr;
+  soap->cookies = nullptr;
+  soap->cookie_domain = nullptr;
+  soap->cookie_path = nullptr;
   soap->cookie_max = 32;
 #endif
 #ifdef WMW_RPM_IO
@@ -9342,19 +9344,19 @@ void SOAP_FMAC2 soap_versioning(soap_init)(struct soap *soap, soap_mode imode,
     soap_ssl_init();
   soap->fsslauth = ssl_auth_init;
   soap->fsslverify = ssl_verify_callback;
-  soap->bio = NULL;
-  soap->ssl = NULL;
-  soap->ctx = NULL;
-  soap->session = NULL;
+  soap->bio = nullptr;
+  soap->ssl = nullptr;
+  soap->ctx = nullptr;
+  soap->session = nullptr;
   soap->ssl_flags = SOAP_SSL_DEFAULT;
-  soap->keyfile = NULL;
-  soap->keyid = NULL;
-  soap->password = NULL;
-  soap->cafile = NULL;
-  soap->capath = NULL;
-  soap->crlfile = NULL;
-  soap->dhfile = NULL;
-  soap->randfile = NULL;
+  soap->keyfile = nullptr;
+  soap->keyid = nullptr;
+  soap->password = nullptr;
+  soap->cafile = nullptr;
+  soap->capath = nullptr;
+  soap->crlfile = nullptr;
+  soap->dhfile = nullptr;
+  soap->randfile = nullptr;
 #endif
 #ifdef WITH_GNUTLS
   if (!soap_ssl_init_done)
@@ -9382,7 +9384,7 @@ void SOAP_FMAC2 soap_versioning(soap_init)(struct soap *soap, soap_mode imode,
   soap->c_locale = newlocale(LC_ALL_MASK, "C", NULL);
 #endif
 #else
-  soap->c_locale = NULL;
+  soap->c_locale = nullptr;
 #endif
   soap->buflen = 0;
   soap->bufidx = 0;
@@ -9454,7 +9456,7 @@ void SOAP_FMAC2 soap_end(struct soap *soap) {
   if (soap_check_state(soap))
     return;
   soap_free_temp(soap);
-  soap_dealloc(soap, NULL);
+  soap_dealloc(soap, nullptr);
   while (soap->clist) {
     struct soap_clist *cp = soap->clist->next;
     SOAP_FREE(soap, soap->clist);
@@ -9497,14 +9499,14 @@ soap_set_namespaces(struct soap *soap, const struct Namespace *p) {
   struct soap_nlist *np, *nq, *nr;
   unsigned int level = soap->level;
   soap->namespaces = p;
-  soap->local_namespaces = NULL;
+  soap->local_namespaces = nullptr;
   soap_set_local_namespaces(soap);
   /* reverse the namespace list */
   np = soap->nlist;
-  soap->nlist = NULL;
+  soap->nlist = nullptr;
   if (np) {
     nq = np->next;
-    np->next = NULL;
+    np->next = nullptr;
     while (nq) {
       nr = nq->next;
       nq->next = np;
@@ -9522,7 +9524,7 @@ soap_set_namespaces(struct soap *soap, const struct Namespace *p) {
       if (!s)
         s = ns[np->index].ns;
     }
-    if (s && soap_push_namespace(soap, np->id, s) == NULL)
+    if (s && soap_push_namespace(soap, np->id, s) == nullptr)
       return soap->error;
     nq = np;
     np = np->next;
@@ -9533,7 +9535,7 @@ soap_set_namespaces(struct soap *soap, const struct Namespace *p) {
     for (i = 0; ns[i].id; i++) {
       if (ns[i].out) {
         SOAP_FREE(soap, ns[i].out);
-        ns[i].out = NULL;
+        ns[i].out = nullptr;
       }
     }
     SOAP_FREE(soap, ns);
@@ -9565,7 +9567,7 @@ void SOAP_FMAC2 soap_set_local_namespaces(struct soap *soap) {
       }
       soap->local_namespaces = ns2;
       for (; ns2->id; ns2++)
-        ns2->out = NULL;
+        ns2->out = nullptr;
     }
   }
 }
@@ -9595,7 +9597,7 @@ const char *SOAP_FMAC2 soap_tagsearch(const char *big, const char *little) {
         s++;
     }
   }
-  return NULL;
+  return nullptr;
 }
 #endif
 #endif
@@ -9611,7 +9613,7 @@ soap_lookup_ns(struct soap *soap, const char *tag, size_t n) {
     if (!strncmp(np->id, tag, n) && !np->id[n])
       return np;
   }
-  return NULL;
+  return nullptr;
 }
 #endif
 #endif
@@ -9623,7 +9625,7 @@ static struct soap_nlist *soap_push_ns(struct soap *soap, const char *id,
   struct soap_nlist *np;
   size_t n, k;
   if (soap_tagsearch(soap->c14nexclude, id))
-    return NULL;
+    return nullptr;
   if (!utilized) {
     for (np = soap->nlist; np; np = np->next) {
       if (!strcmp(np->id, id) && (!np->ns || !strcmp(np->ns, ns)))
@@ -9633,7 +9635,7 @@ static struct soap_nlist *soap_push_ns(struct soap *soap, const char *id,
       if ((np->level < soap->level || !np->ns) && np->index == 1)
         utilized = 1;
       else
-        return NULL;
+        return nullptr;
     }
   }
   DBGLOG(TEST,
@@ -9650,7 +9652,7 @@ static struct soap_nlist *soap_push_ns(struct soap *soap, const char *id,
                                         sizeof(struct soap_nlist) + n + k + 1);
   if (!np) {
     soap->error = SOAP_EOM;
-    return NULL;
+    return nullptr;
   }
   np->next = soap->nlist;
   soap->nlist = np;
@@ -9658,7 +9660,7 @@ static struct soap_nlist *soap_push_ns(struct soap *soap, const char *id,
   if (ns)
     np->ns = strcpy((char *)np->id + n + 1, ns);
   else
-    np->ns = NULL;
+    np->ns = nullptr;
   np->level = soap->level;
   np->index = utilized;
   return np;
@@ -9681,7 +9683,7 @@ static void soap_utilize_ns(struct soap *soap, const char *tag) {
   } else if (strncmp(tag, "xml", 3)) {
     strncpy(soap->tmpbuf, tag, n);
     soap->tmpbuf[n] = '\0';
-    soap_push_ns(soap, soap->tmpbuf, NULL, 1);
+    soap_push_ns(soap, soap->tmpbuf, nullptr, 1);
   }
 }
 #endif
@@ -9778,7 +9780,7 @@ soap_element(struct soap *soap, const char *tag, int id, const char *type) {
         return soap->error;
       if (soap->nlist && !strncmp(soap->nlist->id, tag, n) &&
           !soap->nlist->id[n])
-        ns = NULL;
+        ns = nullptr;
       for (; ns && ns->id; ns++) {
         if (*ns->id && (ns->out || ns->ns) && !strncmp(ns->id, tag, n) &&
             !ns->id[n]) {
@@ -9889,7 +9891,7 @@ soap_element(struct soap *soap, const char *tag, int id, const char *type) {
           soap_attribute(soap, "SOAP-ENV:encodingStyle", soap->encodingStyle))
         return soap->error;
     } else
-      soap->encodingStyle = NULL;
+      soap->encodingStyle = nullptr;
     soap->encoding = 0;
   }
   soap->null = 0;
@@ -9916,7 +9918,7 @@ int SOAP_FMAC2 soap_element_begin_out(struct soap *soap, const char *tag,
     return soap->error = soap->feltbegout(soap, tag);
   return SOAP_OK;
 #else
-  return soap_element_start_end_out(soap, NULL);
+  return soap_element_start_end_out(soap, nullptr);
 #endif
 }
 #endif
@@ -10031,7 +10033,7 @@ SOAP_FMAC1
 int SOAP_FMAC2 soap_array_begin_out(struct soap *soap, const char *tag, int id,
                                     const char *type, const char *offset) {
   if (!type || !*type)
-    return soap_element_begin_out(soap, tag, id, NULL);
+    return soap_element_begin_out(soap, tag, id, nullptr);
   if (soap_element(soap, tag, id, "SOAP-ENC:Array"))
     return soap->error;
   if (soap->version == 2) {
@@ -10055,7 +10057,7 @@ int SOAP_FMAC2 soap_array_begin_out(struct soap *soap, const char *tag, int id,
   if ((soap->mode & SOAP_XML_CANONICAL))
     soap_utilize_ns(soap, type);
 #endif
-  return soap_element_start_end_out(soap, NULL);
+  return soap_element_start_end_out(soap, nullptr);
 }
 #endif
 
@@ -10217,7 +10219,7 @@ int SOAP_FMAC2 soap_element_href(struct soap *soap, const char *tag, int id,
                                  const char *ref, const char *val) {
   DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Element '%s' reference %s='%s'\n", tag,
                             ref, val));
-  if (soap_element(soap, tag, id, NULL) || soap_attribute(soap, ref, val) ||
+  if (soap_element(soap, tag, id, nullptr) || soap_attribute(soap, ref, val) ||
       soap_element_start_end_out(soap, tag))
     return soap->error;
   return SOAP_OK;
@@ -10229,7 +10231,7 @@ int SOAP_FMAC2 soap_element_href(struct soap *soap, const char *tag, int id,
 SOAP_FMAC1
 int SOAP_FMAC2 soap_element_null(struct soap *soap, const char *tag, int id,
                                  const char *type) {
-  struct soap_attribute *tp = NULL;
+  struct soap_attribute *tp = nullptr;
   for (tp = soap->attributes; tp; tp = tp->next)
     if (tp->visible)
       break;
@@ -10251,7 +10253,7 @@ int SOAP_FMAC2 soap_element_null(struct soap *soap, const char *tag, int id,
 #ifndef PALM_1
 SOAP_FMAC1
 int SOAP_FMAC2 soap_element_nil(struct soap *soap, const char *tag) {
-  if (soap_element(soap, tag, -1, NULL) ||
+  if (soap_element(soap, tag, -1, nullptr) ||
       ((soap->mode & SOAP_XML_NIL) && soap_attribute(soap, "xsi:nil", "true")))
     return soap->error;
   return soap_element_start_end_out(soap, tag);
@@ -10300,9 +10302,9 @@ int SOAP_FMAC2 soap_element_id(struct soap *soap, const char *tag, int id,
 SOAP_FMAC1
 int SOAP_FMAC2 soap_element_result(struct soap *soap, const char *tag) {
   if (soap->version == 2 && soap->encodingStyle) {
-    if (soap_element(soap, "SOAP-RPC:result", 0, NULL) ||
+    if (soap_element(soap, "SOAP-RPC:result", 0, nullptr) ||
         soap_attribute(soap, "xmlns:SOAP-RPC", soap_rpc) ||
-        soap_element_start_end_out(soap, NULL) ||
+        soap_element_start_end_out(soap, nullptr) ||
         soap_string_out(soap, tag, 0) ||
         soap_element_end_out(soap, "SOAP-RPC:result"))
       return soap->error;
@@ -10316,7 +10318,7 @@ int SOAP_FMAC2 soap_element_result(struct soap *soap, const char *tag) {
 SOAP_FMAC1
 void SOAP_FMAC2 soap_check_result(struct soap *soap, const char *tag) {
   if (soap->version == 2 && soap->encodingStyle) {
-    soap_instring(soap, ":result", NULL, NULL, 0, 2, -1, -1);
+    soap_instring(soap, ":result", nullptr, nullptr, 0, 2, -1, -1);
     /* just ignore content for compliance reasons, but should compare tag to
      * element's QName value? */
   }
@@ -10494,7 +10496,7 @@ soap_attr_value(struct soap *soap, const char *name, int flag) {
     soap->error = SOAP_REQUIRED;
   else
     soap->error = SOAP_OK;
-  return NULL;
+  return nullptr;
 }
 #endif
 
@@ -10517,7 +10519,7 @@ int SOAP_FMAC2 soap_set_attr(struct soap *soap, const char *name,
     if (!(tp = (struct soap_attribute *)SOAP_MALLOC(
               soap, sizeof(struct soap_attribute) + strlen(name))))
       return soap->error = SOAP_EOM;
-    tp->ns = NULL;
+    tp->ns = nullptr;
 #ifndef WITH_LEAN
     if ((soap->mode & SOAP_XML_CANONICAL)) {
       struct soap_attribute **tpp = &soap->attributes;
@@ -10566,15 +10568,15 @@ int SOAP_FMAC2 soap_set_attr(struct soap *soap, const char *name,
       soap->attributes = tp;
     }
     strcpy((char *)tp->name, name);
-    tp->value = NULL;
+    tp->value = nullptr;
   } else if (tp->visible) {
     return SOAP_OK;
   } else if (value && tp->value && tp->size <= strlen(value)) {
     DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free attribute value of %s (free %p)\n",
                               name, tp->value));
     SOAP_FREE(soap, tp->value);
-    tp->value = NULL;
-    tp->ns = NULL;
+    tp->value = nullptr;
+    tp->ns = nullptr;
   }
   if (value) {
     if (!tp->value) {
@@ -10738,7 +10740,7 @@ int SOAP_FMAC2 soap_peek_element(struct soap *soap) {
   struct soap_dom_attribute **att = NULL;
   char *lead = NULL;
 #endif
-  struct soap_attribute *tp, *tq = NULL;
+  struct soap_attribute *tp, *tq = nullptr;
   const char *t;
   char *s;
   soap_wchar c;
@@ -10893,12 +10895,12 @@ int SOAP_FMAC2 soap_peek_element(struct soap *soap) {
       if (soap->tmpbuf[5] == ':')
         t = soap->tmpbuf + 6;
       else if (soap->tmpbuf[5])
-        t = NULL;
+        t = nullptr;
       else
         t = SOAP_STR_EOS;
     } else
-      t = NULL;
-    tq = NULL;
+      t = nullptr;
+    tq = nullptr;
     for (tp = soap->attributes; tp; tq = tp, tp = tp->next) {
       if (!SOAP_STRCMP(tp->name, soap->tmpbuf))
         break;
@@ -10909,13 +10911,13 @@ int SOAP_FMAC2 soap_peek_element(struct soap *soap) {
       if (!tp)
         return soap->error = SOAP_EOM;
       strcpy((char *)tp->name, soap->tmpbuf);
-      tp->value = NULL;
+      tp->value = nullptr;
       tp->size = 0;
-      tp->ns = NULL;
+      tp->ns = nullptr;
       /* if attribute name is qualified, append it to the end of the list */
       if (tq && strchr(soap->tmpbuf, ':')) {
         tq->next = tp;
-        tp->next = NULL;
+        tp->next = nullptr;
       } else {
         tp->next = soap->attributes;
         soap->attributes = tp;
@@ -10940,7 +10942,7 @@ int SOAP_FMAC2 soap_peek_element(struct soap *soap) {
           return soap->error;
         if (tp->value)
           SOAP_FREE(soap, tp->value);
-        tp->value = NULL;
+        tp->value = nullptr;
         for (;;) {
           if (soap_getattrval(soap, soap->labbuf + soap->labidx,
                               soap->lablen - soap->labidx, c)) {
@@ -10948,7 +10950,7 @@ int SOAP_FMAC2 soap_peek_element(struct soap *soap) {
               return soap->error;
             soap->error = SOAP_OK;
             soap->labidx = soap->lablen;
-            if (soap_append_lab(soap, NULL, 0))
+            if (soap_append_lab(soap, nullptr, 0))
               return soap->error;
           } else
             break;
@@ -11007,7 +11009,7 @@ int SOAP_FMAC2 soap_peek_element(struct soap *soap) {
       att = &(*att)->next;
 #endif
     if (t && tp->value) {
-      if (soap_push_namespace(soap, t, tp->value) == NULL)
+      if (soap_push_namespace(soap, t, tp->value) == nullptr)
         return soap->error;
     }
   }
@@ -11255,7 +11257,7 @@ SOAP_FMAC1
 char *SOAP_FMAC2
 soap_string_in(struct soap *soap, int flag, long minlen, long maxlen) {
   char *s;
-  char *t = NULL;
+  char *t = nullptr;
   size_t i;
   long l = 0;
   int n = 0, f = 0, m = 0;
@@ -11321,9 +11323,9 @@ soap_string_in(struct soap *soap, int flag, long minlen, long maxlen) {
 #ifdef WITH_FAST
       size_t k;
       if (soap_append_lab(
-              soap, NULL,
+              soap, nullptr,
               0)) /* allocate more space in look-aside buffer if necessary */
-        return NULL;
+        return nullptr;
       s = soap->labbuf + soap->labidx; /* space to populate */
       k = soap->lablen - soap->labidx; /* number of bytes available */
       soap->labidx = soap->lablen;     /* claim this space */
@@ -11539,7 +11541,7 @@ soap_string_in(struct soap *soap, int flag, long minlen, long maxlen) {
           DBGLOG(TEST,
                  SOAP_MESSAGE(fdebug, "String too long: maxlen=%ld\n", maxlen));
           soap->error = SOAP_LENGTH;
-          return NULL;
+          return nullptr;
         }
       }
     }
@@ -11555,9 +11557,9 @@ soap_string_in(struct soap *soap, int flag, long minlen, long maxlen) {
 #ifdef WITH_FAST
     size_t k;
     if (soap_append_lab(
-            soap, NULL,
+            soap, nullptr,
             0)) /* allocate more space in look-aside buffer if necessary */
-      return NULL;
+      return nullptr;
     s = soap->labbuf + soap->labidx; /* space to populate */
     k = soap->lablen - soap->labidx; /* number of bytes available */
     soap->labidx = soap->lablen;     /* claim this space */
@@ -11711,7 +11713,7 @@ soap_string_in(struct soap *soap, int flag, long minlen, long maxlen) {
         DBGLOG(TEST,
                SOAP_MESSAGE(fdebug, "String too long: maxlen=%ld\n", maxlen));
         soap->error = SOAP_LENGTH;
-        return NULL;
+        return nullptr;
       }
     }
   }
@@ -11729,7 +11731,7 @@ end:
            SOAP_MESSAGE(fdebug, "String too short: %ld chars, minlen=%ld\n", l,
                         minlen));
     soap->error = SOAP_LENGTH;
-    return NULL;
+    return nullptr;
   }
 #ifdef WITH_DOM
   if ((soap->mode & SOAP_XML_DOM) && soap->dom) {
@@ -11741,7 +11743,7 @@ end:
 #endif
   if (flag == 2)
     if (soap_s2QName(soap, t, &t, minlen, maxlen))
-      return NULL;
+      return nullptr;
   return t;
 }
 #endif
@@ -11838,7 +11840,7 @@ soap_wstring_in(struct soap *soap, int flag, long minlen, long maxlen) {
   int i, n = 0, f = 0;
   long l = 0;
   soap_wchar c;
-  char *t = NULL;
+  char *t = nullptr;
   DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Reading wide string content\n"));
   if (soap->peeked) {
     if (*soap->tag) {
@@ -11879,17 +11881,17 @@ soap_wstring_in(struct soap *soap, int flag, long minlen, long maxlen) {
       soap->peeked = 0;
     }
   }
-  if (soap_new_block(soap) == NULL)
-    return NULL;
+  if (soap_new_block(soap) == nullptr)
+    return nullptr;
   for (;;) {
-    if (!(s = (wchar_t *)soap_push_block(soap, NULL,
+    if (!(s = (wchar_t *)soap_push_block(soap, nullptr,
                                          sizeof(wchar_t) * SOAP_BLKLEN)))
-      return NULL;
+      return nullptr;
     for (i = 0; i < SOAP_BLKLEN; i++) {
       if (t) {
         *s++ = (wchar_t)*t++;
         if (!*t)
-          t = NULL;
+          t = nullptr;
         continue;
       }
       c = soap_getutf8(soap);
@@ -11967,22 +11969,22 @@ soap_wstring_in(struct soap *soap, int flag, long minlen, long maxlen) {
         DBGLOG(TEST,
                SOAP_MESSAGE(fdebug, "String too long: maxlen=%ld\n", maxlen));
         soap->error = SOAP_LENGTH;
-        return NULL;
+        return nullptr;
       }
     }
   }
 end:
   soap_unget(soap, c);
   *s = '\0';
-  soap_size_block(soap, NULL, sizeof(wchar_t) * (i + 1));
+  soap_size_block(soap, nullptr, sizeof(wchar_t) * (i + 1));
   if (l < minlen) {
     DBGLOG(TEST,
            SOAP_MESSAGE(fdebug, "String too short: %ld chars, minlen=%ld\n", l,
                         minlen));
     soap->error = SOAP_LENGTH;
-    return NULL;
+    return nullptr;
   }
-  s = (wchar_t *)soap_save_block(soap, NULL, NULL, 0);
+  s = (wchar_t *)soap_save_block(soap, nullptr, NULL, 0);
 #ifdef WITH_DOM
   if ((soap->mode & SOAP_XML_DOM) && soap->dom)
     soap->dom->wide = s;
@@ -12048,8 +12050,8 @@ int SOAP_FMAC2 soap_s2int(struct soap *soap, const char *s, int *p) {
 SOAP_FMAC1
 int *SOAP_FMAC2 soap_inint(struct soap *soap, const char *tag, int *p,
                            const char *type, int t) {
-  if (soap_element_begin_in(soap, tag, 0, NULL))
-    return NULL;
+  if (soap_element_begin_in(soap, tag, 0, nullptr))
+    return nullptr;
 #ifndef WITH_LEAN
   if (*soap->type && soap_match_tag(soap, soap->type, type) &&
       soap_match_tag(soap, soap->type, ":int") &&
@@ -12057,20 +12059,20 @@ int *SOAP_FMAC2 soap_inint(struct soap *soap, const char *tag, int *p,
       soap_match_tag(soap, soap->type, ":byte")) {
     soap->error = SOAP_TYPE;
     soap_revert(soap);
-    return NULL;
+    return nullptr;
   }
 #endif
-  p = (int *)soap_id_enter(soap, soap->id, p, t, sizeof(int), 0, NULL, NULL,
+  p = (int *)soap_id_enter(soap, soap->id, p, t, sizeof(int), 0, nullptr, NULL,
                            NULL);
   if (*soap->href)
     p = (int *)soap_id_forward(soap, soap->href, p, 0, t, 0, sizeof(int), 0,
-                               NULL);
+                               nullptr);
   else if (p) {
     if (soap_s2int(soap, soap_value(soap), p))
-      return NULL;
+      return nullptr;
   }
   if (soap->body && soap_element_end_in(soap, tag))
-    return NULL;
+    return nullptr;
   return p;
 }
 #endif
@@ -12127,8 +12129,8 @@ int SOAP_FMAC2 soap_s2long(struct soap *soap, const char *s, long *p) {
 SOAP_FMAC1
 long *SOAP_FMAC2 soap_inlong(struct soap *soap, const char *tag, long *p,
                              const char *type, int t) {
-  if (soap_element_begin_in(soap, tag, 0, NULL))
-    return NULL;
+  if (soap_element_begin_in(soap, tag, 0, nullptr))
+    return nullptr;
 #ifndef WITH_LEAN
   if (*soap->type && soap_match_tag(soap, soap->type, type) &&
       soap_match_tag(soap, soap->type, ":int") &&
@@ -12136,20 +12138,20 @@ long *SOAP_FMAC2 soap_inlong(struct soap *soap, const char *tag, long *p,
       soap_match_tag(soap, soap->type, ":byte")) {
     soap->error = SOAP_TYPE;
     soap_revert(soap);
-    return NULL;
+    return nullptr;
   }
 #endif
-  p = (long *)soap_id_enter(soap, soap->id, p, t, sizeof(long), 0, NULL, NULL,
-                            NULL);
+  p = (long *)soap_id_enter(soap, soap->id, p, t, sizeof(long), 0, nullptr,
+                            NULL, NULL);
   if (*soap->href)
     p = (long *)soap_id_forward(soap, soap->href, p, 0, t, 0, sizeof(long), 0,
-                                NULL);
+                                nullptr);
   else if (p) {
     if (soap_s2long(soap, soap_value(soap), p))
-      return NULL;
+      return nullptr;
   }
   if (soap->body && soap_element_end_in(soap, tag))
-    return NULL;
+    return nullptr;
   return p;
 }
 #endif
@@ -12212,8 +12214,8 @@ int SOAP_FMAC2 soap_s2LONG64(struct soap *soap, const char *s, LONG64 *p) {
 SOAP_FMAC1
 LONG64 *SOAP_FMAC2 soap_inLONG64(struct soap *soap, const char *tag, LONG64 *p,
                                  const char *type, int t) {
-  if (soap_element_begin_in(soap, tag, 0, NULL))
-    return NULL;
+  if (soap_element_begin_in(soap, tag, 0, nullptr))
+    return nullptr;
 #ifndef WITH_LEAN
   if (*soap->type && soap_match_tag(soap, soap->type, type) &&
       soap_match_tag(soap, soap->type, ":integer") &&
@@ -12227,20 +12229,20 @@ LONG64 *SOAP_FMAC2 soap_inLONG64(struct soap *soap, const char *tag, LONG64 *p,
       soap_match_tag(soap, soap->type, ":byte")) {
     soap->error = SOAP_TYPE;
     soap_revert(soap);
-    return NULL;
+    return nullptr;
   }
 #endif
-  p = (LONG64 *)soap_id_enter(soap, soap->id, p, t, sizeof(LONG64), 0, NULL,
+  p = (LONG64 *)soap_id_enter(soap, soap->id, p, t, sizeof(LONG64), 0, nullptr,
                               NULL, NULL);
   if (*soap->href)
     p = (LONG64 *)soap_id_forward(soap, soap->href, p, 0, t, 0, sizeof(LONG64),
-                                  0, NULL);
+                                  0, nullptr);
   else if (p) {
     if (soap_s2LONG64(soap, soap_value(soap), p))
-      return NULL;
+      return nullptr;
   }
   if (soap->body && soap_element_end_in(soap, tag))
-    return NULL;
+    return nullptr;
   return p;
 }
 #endif
@@ -12287,27 +12289,27 @@ int SOAP_FMAC2 soap_s2byte(struct soap *soap, const char *s, char *p) {
 SOAP_FMAC1
 char *SOAP_FMAC2 soap_inbyte(struct soap *soap, const char *tag, char *p,
                              const char *type, int t) {
-  if (soap_element_begin_in(soap, tag, 0, NULL))
-    return NULL;
+  if (soap_element_begin_in(soap, tag, 0, nullptr))
+    return nullptr;
 #ifndef WITH_LEAN
   if (*soap->type && soap_match_tag(soap, soap->type, type) &&
       soap_match_tag(soap, soap->type, ":byte")) {
     soap->error = SOAP_TYPE;
     soap_revert(soap);
-    return NULL;
+    return nullptr;
   }
 #endif
-  p = (char *)soap_id_enter(soap, soap->id, p, t, sizeof(char), 0, NULL, NULL,
-                            NULL);
+  p = (char *)soap_id_enter(soap, soap->id, p, t, sizeof(char), 0, nullptr,
+                            NULL, NULL);
   if (*soap->href)
     p = (char *)soap_id_forward(soap, soap->href, p, 0, t, 0, sizeof(char), 0,
-                                NULL);
+                                nullptr);
   else if (p) {
     if (soap_s2byte(soap, soap_value(soap), p))
-      return NULL;
+      return nullptr;
   }
   if (soap->body && soap_element_end_in(soap, tag))
-    return NULL;
+    return nullptr;
   return p;
 }
 #endif
@@ -12354,28 +12356,28 @@ int SOAP_FMAC2 soap_s2short(struct soap *soap, const char *s, short *p) {
 SOAP_FMAC1
 short *SOAP_FMAC2 soap_inshort(struct soap *soap, const char *tag, short *p,
                                const char *type, int t) {
-  if (soap_element_begin_in(soap, tag, 0, NULL))
-    return NULL;
+  if (soap_element_begin_in(soap, tag, 0, nullptr))
+    return nullptr;
 #ifndef WITH_LEAN
   if (*soap->type && soap_match_tag(soap, soap->type, type) &&
       soap_match_tag(soap, soap->type, ":short") &&
       soap_match_tag(soap, soap->type, ":byte")) {
     soap->error = SOAP_TYPE;
     soap_revert(soap);
-    return NULL;
+    return nullptr;
   }
 #endif
-  p = (short *)soap_id_enter(soap, soap->id, p, t, sizeof(short), 0, NULL, NULL,
-                             NULL);
+  p = (short *)soap_id_enter(soap, soap->id, p, t, sizeof(short), 0, nullptr,
+                             NULL, NULL);
   if (*soap->href)
     p = (short *)soap_id_forward(soap, soap->href, p, 0, t, 0, sizeof(short), 0,
-                                 NULL);
+                                 nullptr);
   else if (p) {
     if (soap_s2short(soap, soap_value(soap), p))
-      return NULL;
+      return nullptr;
   }
   if (soap->body && soap_element_end_in(soap, tag))
-    return NULL;
+    return nullptr;
   return p;
 }
 #endif
@@ -12511,23 +12513,23 @@ static int soap_isnumeric(struct soap *soap, const char *type) {
 SOAP_FMAC1
 float *SOAP_FMAC2 soap_infloat(struct soap *soap, const char *tag, float *p,
                                const char *type, int t) {
-  if (soap_element_begin_in(soap, tag, 0, NULL))
-    return NULL;
+  if (soap_element_begin_in(soap, tag, 0, nullptr))
+    return nullptr;
 #ifndef WITH_LEAN
   if (*soap->type != '\0' && soap_isnumeric(soap, type))
-    return NULL;
+    return nullptr;
 #endif
-  p = (float *)soap_id_enter(soap, soap->id, p, t, sizeof(float), 0, NULL, NULL,
-                             NULL);
+  p = (float *)soap_id_enter(soap, soap->id, p, t, sizeof(float), 0, nullptr,
+                             NULL, NULL);
   if (*soap->href)
     p = (float *)soap_id_forward(soap, soap->href, p, 0, t, 0, sizeof(float), 0,
-                                 NULL);
+                                 nullptr);
   else if (p) {
     if (soap_s2float(soap, soap_value(soap), p))
-      return NULL;
+      return nullptr;
   }
   if (soap->body && soap_element_end_in(soap, tag))
-    return NULL;
+    return nullptr;
   return p;
 }
 #endif
@@ -12625,23 +12627,23 @@ int SOAP_FMAC2 soap_s2double(struct soap *soap, const char *s, double *p) {
 SOAP_FMAC1
 double *SOAP_FMAC2 soap_indouble(struct soap *soap, const char *tag, double *p,
                                  const char *type, int t) {
-  if (soap_element_begin_in(soap, tag, 0, NULL))
-    return NULL;
+  if (soap_element_begin_in(soap, tag, 0, nullptr))
+    return nullptr;
 #ifndef WITH_LEAN
   if (*soap->type != '\0' && soap_isnumeric(soap, type))
-    return NULL;
+    return nullptr;
 #endif
-  p = (double *)soap_id_enter(soap, soap->id, p, t, sizeof(double), 0, NULL,
+  p = (double *)soap_id_enter(soap, soap->id, p, t, sizeof(double), 0, nullptr,
                               NULL, NULL);
   if (*soap->href)
     p = (double *)soap_id_forward(soap, soap->href, p, 0, t, 0, sizeof(double),
-                                  0, NULL);
+                                  0, nullptr);
   else if (p) {
     if (soap_s2double(soap, soap_value(soap), p))
-      return NULL;
+      return nullptr;
   }
   if (soap->body && soap_element_end_in(soap, tag))
-    return NULL;
+    return nullptr;
   return p;
 }
 #endif
@@ -12691,27 +12693,27 @@ SOAP_FMAC1
 unsigned char *SOAP_FMAC2 soap_inunsignedByte(struct soap *soap,
                                               const char *tag, unsigned char *p,
                                               const char *type, int t) {
-  if (soap_element_begin_in(soap, tag, 0, NULL))
-    return NULL;
+  if (soap_element_begin_in(soap, tag, 0, nullptr))
+    return nullptr;
 #ifndef WITH_LEAN
   if (*soap->type && soap_match_tag(soap, soap->type, type) &&
       soap_match_tag(soap, soap->type, ":unsignedByte")) {
     soap->error = SOAP_TYPE;
     soap_revert(soap);
-    return NULL;
+    return nullptr;
   }
 #endif
   p = (unsigned char *)soap_id_enter(
-      soap, soap->id, p, t, sizeof(unsigned char), 0, NULL, NULL, NULL);
+      soap, soap->id, p, t, sizeof(unsigned char), 0, nullptr, NULL, NULL);
   if (*soap->href)
     p = (unsigned char *)soap_id_forward(soap, soap->href, p, 0, t, 0,
-                                         sizeof(unsigned char), 0, NULL);
+                                         sizeof(unsigned char), 0, nullptr);
   else if (p) {
     if (soap_s2unsignedByte(soap, soap_value(soap), p))
-      return NULL;
+      return nullptr;
   }
   if (soap->body && soap_element_end_in(soap, tag))
-    return NULL;
+    return nullptr;
   return p;
 }
 #endif
@@ -12762,28 +12764,28 @@ SOAP_FMAC1
 unsigned short *SOAP_FMAC2
 soap_inunsignedShort(struct soap *soap, const char *tag, unsigned short *p,
                      const char *type, int t) {
-  if (soap_element_begin_in(soap, tag, 0, NULL))
-    return NULL;
+  if (soap_element_begin_in(soap, tag, 0, nullptr))
+    return nullptr;
 #ifndef WITH_LEAN
   if (*soap->type && soap_match_tag(soap, soap->type, type) &&
       soap_match_tag(soap, soap->type, ":unsignedShort") &&
       soap_match_tag(soap, soap->type, ":unsignedByte")) {
     soap->error = SOAP_TYPE;
     soap_revert(soap);
-    return NULL;
+    return nullptr;
   }
 #endif
   p = (unsigned short *)soap_id_enter(
-      soap, soap->id, p, t, sizeof(unsigned short), 0, NULL, NULL, NULL);
+      soap, soap->id, p, t, sizeof(unsigned short), 0, nullptr, NULL, NULL);
   if (*soap->href)
     p = (unsigned short *)soap_id_forward(soap, soap->href, p, 0, t, 0,
-                                          sizeof(unsigned short), 0, NULL);
+                                          sizeof(unsigned short), 0, nullptr);
   else if (p) {
     if (soap_s2unsignedShort(soap, soap_value(soap), p))
-      return NULL;
+      return nullptr;
   }
   if (soap->body && soap_element_end_in(soap, tag))
-    return NULL;
+    return nullptr;
   return p;
 }
 #endif
@@ -12842,8 +12844,8 @@ SOAP_FMAC1
 unsigned int *SOAP_FMAC2 soap_inunsignedInt(struct soap *soap, const char *tag,
                                             unsigned int *p, const char *type,
                                             int t) {
-  if (soap_element_begin_in(soap, tag, 0, NULL))
-    return NULL;
+  if (soap_element_begin_in(soap, tag, 0, nullptr))
+    return nullptr;
 #ifndef WITH_LEAN
   if (*soap->type && soap_match_tag(soap, soap->type, type) &&
       soap_match_tag(soap, soap->type, ":unsignedInt") &&
@@ -12851,20 +12853,20 @@ unsigned int *SOAP_FMAC2 soap_inunsignedInt(struct soap *soap, const char *tag,
       soap_match_tag(soap, soap->type, ":unsignedByte")) {
     soap->error = SOAP_TYPE;
     soap_revert(soap);
-    return NULL;
+    return nullptr;
   }
 #endif
   p = (unsigned int *)soap_id_enter(soap, soap->id, p, t, sizeof(unsigned int),
-                                    0, NULL, NULL, NULL);
+                                    0, nullptr, NULL, NULL);
   if (*soap->href)
     p = (unsigned int *)soap_id_forward(soap, soap->href, p, 0, t, 0,
-                                        sizeof(unsigned int), 0, NULL);
+                                        sizeof(unsigned int), 0, nullptr);
   else if (p) {
     if (soap_s2unsignedInt(soap, soap_value(soap), p))
-      return NULL;
+      return nullptr;
   }
   if (soap->body && soap_element_end_in(soap, tag))
-    return NULL;
+    return nullptr;
   return p;
 }
 #endif
@@ -12924,8 +12926,8 @@ SOAP_FMAC1
 unsigned long *SOAP_FMAC2 soap_inunsignedLong(struct soap *soap,
                                               const char *tag, unsigned long *p,
                                               const char *type, int t) {
-  if (soap_element_begin_in(soap, tag, 0, NULL))
-    return NULL;
+  if (soap_element_begin_in(soap, tag, 0, nullptr))
+    return nullptr;
 #ifndef WITH_LEAN
   if (*soap->type && soap_match_tag(soap, soap->type, type) &&
       soap_match_tag(soap, soap->type, ":unsignedInt") &&
@@ -12933,20 +12935,20 @@ unsigned long *SOAP_FMAC2 soap_inunsignedLong(struct soap *soap,
       soap_match_tag(soap, soap->type, ":unsignedByte")) {
     soap->error = SOAP_TYPE;
     soap_revert(soap);
-    return NULL;
+    return nullptr;
   }
 #endif
   p = (unsigned long *)soap_id_enter(
-      soap, soap->id, p, t, sizeof(unsigned long), 0, NULL, NULL, NULL);
+      soap, soap->id, p, t, sizeof(unsigned long), 0, nullptr, NULL, NULL);
   if (*soap->href)
     p = (unsigned long *)soap_id_forward(soap, soap->href, p, 0, t, 0,
-                                         sizeof(unsigned long), 0, NULL);
+                                         sizeof(unsigned long), 0, nullptr);
   else if (p) {
     if (soap_s2unsignedLong(soap, soap_value(soap), p))
-      return NULL;
+      return nullptr;
   }
   if (soap->body && soap_element_end_in(soap, tag))
-    return NULL;
+    return nullptr;
   return p;
 }
 #endif
@@ -13009,8 +13011,8 @@ int SOAP_FMAC2 soap_s2ULONG64(struct soap *soap, const char *s, ULONG64 *p) {
 SOAP_FMAC1
 ULONG64 *SOAP_FMAC2 soap_inULONG64(struct soap *soap, const char *tag,
                                    ULONG64 *p, const char *type, int t) {
-  if (soap_element_begin_in(soap, tag, 0, NULL))
-    return NULL;
+  if (soap_element_begin_in(soap, tag, 0, nullptr))
+    return nullptr;
   if (*soap->type && soap_match_tag(soap, soap->type, type) &&
       soap_match_tag(soap, soap->type, ":positiveInteger") &&
       soap_match_tag(soap, soap->type, ":nonNegativeInteger") &&
@@ -13020,19 +13022,19 @@ ULONG64 *SOAP_FMAC2 soap_inULONG64(struct soap *soap, const char *tag,
       soap_match_tag(soap, soap->type, ":unsignedByte")) {
     soap->error = SOAP_TYPE;
     soap_revert(soap);
-    return NULL;
+    return nullptr;
   }
-  p = (ULONG64 *)soap_id_enter(soap, soap->id, p, t, sizeof(ULONG64), 0, NULL,
-                               NULL, NULL);
+  p = (ULONG64 *)soap_id_enter(soap, soap->id, p, t, sizeof(ULONG64), 0,
+                               nullptr, NULL, NULL);
   if (*soap->href)
     p = (ULONG64 *)soap_id_forward(soap, soap->href, p, 0, t, 0,
-                                   sizeof(ULONG64), 0, NULL);
+                                   sizeof(ULONG64), 0, nullptr);
   else if (p) {
     if (soap_s2ULONG64(soap, soap_value(soap), p))
-      return NULL;
+      return nullptr;
   }
   if (soap->body && soap_element_end_in(soap, tag))
-    return NULL;
+    return nullptr;
   return p;
 }
 #endif
@@ -13159,7 +13161,7 @@ int SOAP_FMAC2 soap_s2QName(struct soap *soap, const char *s, char **t,
 #ifndef PALM_2
 SOAP_FMAC1
 const char *SOAP_FMAC2 soap_QName2s(struct soap *soap, const char *s) {
-  const char *t = NULL;
+  const char *t = nullptr;
   if (s) {
     soap->labidx = 0;
     for (;;) {
@@ -13350,7 +13352,7 @@ const char *SOAP_FMAC2 soap_wchar2s(struct soap *soap, const wchar_t *s) {
 SOAP_FMAC1
 int SOAP_FMAC2 soap_outstring(struct soap *soap, const char *tag, int id,
                               char *const *p, const char *type, int n) {
-  id = soap_element_id(soap, tag, id, *p, NULL, 0, type, n);
+  id = soap_element_id(soap, tag, id, *p, nullptr, 0, type, n);
   if (id < 0)
     return soap->error;
   if (!**p && (soap->mode & SOAP_C_NILSTRING))
@@ -13369,40 +13371,40 @@ char **SOAP_FMAC2 soap_instring(struct soap *soap, const char *tag, char **p,
                                 const char *type, int t, int flag, long minlen,
                                 long maxlen) {
   (void)type;
-  if (soap_element_begin_in(soap, tag, 1, NULL)) {
+  if (soap_element_begin_in(soap, tag, 1, nullptr)) {
     if (!tag || *tag != '-' || soap->error != SOAP_NO_TAG)
-      return NULL;
+      return nullptr;
     soap->error = SOAP_OK;
   }
   if (!p) {
     if (!(p = (char **)soap_malloc(soap, sizeof(char *))))
-      return NULL;
+      return nullptr;
   }
   if (soap->null)
-    *p = NULL;
+    *p = nullptr;
   else if (soap->body) {
     *p = soap_string_in(soap, flag, minlen, maxlen);
     if (!*p ||
-        !(char *)soap_id_enter(soap, soap->id, *p, t, sizeof(char *), 0, NULL,
-                               NULL, NULL))
-      return NULL;
+        !(char *)soap_id_enter(soap, soap->id, *p, t, sizeof(char *), 0,
+                               nullptr, NULL, NULL))
+      return nullptr;
     if (!**p && tag && *tag == '-') {
       soap->error = SOAP_NO_TAG;
-      return NULL;
+      return nullptr;
     }
   } else if (tag && *tag == '-') {
     soap->error = SOAP_NO_TAG;
-    return NULL;
+    return nullptr;
   } else if (!*soap->href && minlen > 0) {
     soap->error = SOAP_LENGTH;
-    return NULL;
+    return nullptr;
   } else
     *p = soap_strdup(soap, SOAP_STR_EOS);
   if (*soap->href)
     p = (char **)soap_id_lookup(soap, soap->href, (void **)p, t,
                                 sizeof(char **), 0);
   if (soap->body && soap_element_end_in(soap, tag))
-    return NULL;
+    return nullptr;
   return p;
 }
 #endif
@@ -13413,7 +13415,7 @@ char **SOAP_FMAC2 soap_instring(struct soap *soap, const char *tag, char **p,
 SOAP_FMAC1
 int SOAP_FMAC2 soap_outwstring(struct soap *soap, const char *tag, int id,
                                wchar_t *const *p, const char *type, int n) {
-  id = soap_element_id(soap, tag, id, *p, NULL, 0, type, n);
+  id = soap_element_id(soap, tag, id, *p, nullptr, 0, type, n);
   if (id < 0)
     return soap->error;
   if (!**p && (soap->mode & SOAP_C_NILSTRING))
@@ -13434,37 +13436,37 @@ wchar_t **SOAP_FMAC2 soap_inwstring(struct soap *soap, const char *tag,
                                     wchar_t **p, const char *type, int t,
                                     long minlen, long maxlen) {
   (void)type;
-  if (soap_element_begin_in(soap, tag, 1, NULL)) {
+  if (soap_element_begin_in(soap, tag, 1, nullptr)) {
     if (!tag || *tag != '-' || soap->error != SOAP_NO_TAG)
-      return NULL;
+      return nullptr;
     soap->error = SOAP_OK;
   }
   if (!p) {
     if (!(p = (wchar_t **)soap_malloc(soap, sizeof(wchar_t *))))
-      return NULL;
+      return nullptr;
   }
   if (soap->body) {
     *p = soap_wstring_in(soap, 1, minlen, maxlen);
     if (!*p ||
         !(wchar_t *)soap_id_enter(soap, soap->id, *p, t, sizeof(wchar_t *), 0,
-                                  NULL, NULL, NULL))
-      return NULL;
+                                  nullptr, NULL, NULL))
+      return nullptr;
     if (!**p && tag && *tag == '-') {
       soap->error = SOAP_NO_TAG;
-      return NULL;
+      return nullptr;
     }
   } else if (tag && *tag == '-') {
     soap->error = SOAP_NO_TAG;
-    return NULL;
+    return nullptr;
   } else if (soap->null)
-    *p = NULL;
+    *p = nullptr;
   else
     *p = soap_wstrdup(soap, (wchar_t *)SOAP_STR_EOS);
   if (*soap->href)
     p = (wchar_t **)soap_id_lookup(soap, soap->href, (void **)p, t,
                                    sizeof(wchar_t **), 0);
   if (soap->body && soap_element_end_in(soap, tag))
-    return NULL;
+    return nullptr;
   return p;
 }
 #endif
@@ -13622,7 +13624,7 @@ int SOAP_FMAC2 soap_s2dateTime(struct soap *soap, const char *s, time_t *p) {
             m = -m;
         } else /* +hhmm */
         {
-          m = (int)soap_strtol(s, NULL, 10);
+          m = (int)soap_strtol(s, nullptr, 10);
           h = m / 100;
           m = m % 100;
         }
@@ -13660,25 +13662,25 @@ int SOAP_FMAC2 soap_s2dateTime(struct soap *soap, const char *s, time_t *p) {
 SOAP_FMAC1
 time_t *SOAP_FMAC2 soap_indateTime(struct soap *soap, const char *tag,
                                    time_t *p, const char *type, int t) {
-  if (soap_element_begin_in(soap, tag, 0, NULL))
-    return NULL;
+  if (soap_element_begin_in(soap, tag, 0, nullptr))
+    return nullptr;
   if (*soap->type && soap_match_tag(soap, soap->type, type) &&
       soap_match_tag(soap, soap->type, ":dateTime")) {
     soap->error = SOAP_TYPE;
     soap_revert(soap);
-    return NULL;
+    return nullptr;
   }
-  p = (time_t *)soap_id_enter(soap, soap->id, p, t, sizeof(time_t), 0, NULL,
+  p = (time_t *)soap_id_enter(soap, soap->id, p, t, sizeof(time_t), 0, nullptr,
                               NULL, NULL);
   if (*soap->href)
     p = (time_t *)soap_id_forward(soap, soap->href, p, 0, t, 0, sizeof(time_t),
-                                  0, NULL);
+                                  0, nullptr);
   else if (p) {
     if (soap_s2dateTime(soap, soap_value(soap), p))
-      return NULL;
+      return nullptr;
   }
   if (soap->body && soap_element_end_in(soap, tag))
-    return NULL;
+    return nullptr;
   return p;
 }
 #endif
@@ -13689,7 +13691,7 @@ SOAP_FMAC1
 int SOAP_FMAC2 soap_outliteral(struct soap *soap, const char *tag,
                                char *const *p, const char *type) {
   int i;
-  const char *t = NULL;
+  const char *t = nullptr;
   if (tag && *tag != '-') {
     if (soap->local_namespaces && (t = strchr(tag, ':'))) {
       strncpy(soap->tmpbuf, tag, t - tag);
@@ -13702,7 +13704,7 @@ int SOAP_FMAC2 soap_outliteral(struct soap *soap, const char *tag,
           soap_attribute(soap, "xmlns", soap->local_namespaces[i].ns
                                             ? soap->local_namespaces[i].ns
                                             : SOAP_STR_EOS) ||
-          soap_element_start_end_out(soap, NULL))
+          soap_element_start_end_out(soap, nullptr))
         return soap->error;
     } else {
       t = tag;
@@ -13724,30 +13726,30 @@ int SOAP_FMAC2 soap_outliteral(struct soap *soap, const char *tag,
 #ifndef PALM_2
 SOAP_FMAC1
 char **SOAP_FMAC2 soap_inliteral(struct soap *soap, const char *tag, char **p) {
-  if (soap_element_begin_in(soap, tag, 1, NULL)) {
+  if (soap_element_begin_in(soap, tag, 1, nullptr)) {
     if (soap->error != SOAP_NO_TAG ||
         soap_unget(soap, soap_get(soap)) == SOAP_TT)
-      return NULL;
+      return nullptr;
     soap->error = SOAP_OK;
   }
   if (!p) {
     if (!(p = (char **)soap_malloc(soap, sizeof(char *))))
-      return NULL;
+      return nullptr;
   }
   if (soap->body || (tag && *tag == '-')) {
     *p = soap_string_in(soap, 0, -1, -1);
     if (!*p)
-      return NULL;
+      return nullptr;
     if (!**p && tag && *tag == '-') {
       soap->error = SOAP_NO_TAG;
-      return NULL;
+      return nullptr;
     }
   } else if (soap->null)
-    *p = NULL;
+    *p = nullptr;
   else
     *p = soap_strdup(soap, SOAP_STR_EOS);
   if (soap->body && soap_element_end_in(soap, tag))
-    return NULL;
+    return nullptr;
   return p;
 }
 #endif
@@ -13759,7 +13761,7 @@ SOAP_FMAC1
 int SOAP_FMAC2 soap_outwliteral(struct soap *soap, const char *tag,
                                 wchar_t *const *p, const char *type) {
   int i;
-  const char *t = NULL;
+  const char *t = nullptr;
   if (tag && *tag != '-') {
     if (soap->local_namespaces && (t = strchr(tag, ':'))) {
       strncpy(soap->tmpbuf, tag, t - tag);
@@ -13772,7 +13774,7 @@ int SOAP_FMAC2 soap_outwliteral(struct soap *soap, const char *tag,
           soap_attribute(soap, "xmlns", soap->local_namespaces[i].ns
                                             ? soap->local_namespaces[i].ns
                                             : SOAP_STR_EOS) ||
-          soap_element_start_end_out(soap, NULL))
+          soap_element_start_end_out(soap, nullptr))
         return soap->error;
     } else {
       t = tag;
@@ -13803,33 +13805,33 @@ int SOAP_FMAC2 soap_outwliteral(struct soap *soap, const char *tag,
 SOAP_FMAC1
 wchar_t **SOAP_FMAC2
 soap_inwliteral(struct soap *soap, const char *tag, wchar_t **p) {
-  if (soap_element_begin_in(soap, tag, 1, NULL)) {
+  if (soap_element_begin_in(soap, tag, 1, nullptr)) {
     if (soap->error != SOAP_NO_TAG ||
         soap_unget(soap, soap_get(soap)) == SOAP_TT)
-      return NULL;
+      return nullptr;
     soap->error = SOAP_OK;
   }
   if (!p) {
     if (!(p = (wchar_t **)soap_malloc(soap, sizeof(wchar_t *))))
-      return NULL;
+      return nullptr;
   }
   if (soap->body) {
     *p = soap_wstring_in(soap, 0, -1, -1);
     if (!*p)
-      return NULL;
+      return nullptr;
     if (!**p && tag && *tag == '-') {
       soap->error = SOAP_NO_TAG;
-      return NULL;
+      return nullptr;
     }
   } else if (tag && *tag == '-') {
     soap->error = SOAP_NO_TAG;
-    return NULL;
+    return nullptr;
   } else if (soap->null)
-    *p = NULL;
+    *p = nullptr;
   else
     *p = soap_wstrdup(soap, (wchar_t *)SOAP_STR_EOS);
   if (soap->body && soap_element_end_in(soap, tag))
-    return NULL;
+    return nullptr;
   return p;
 }
 #endif
@@ -13864,7 +13866,7 @@ const char *SOAP_FMAC2 soap_value(struct soap *soap) {
     soap_unget(soap, c);
   else if (soap->mode & SOAP_XML_STRICT) {
     soap->error = SOAP_LENGTH;
-    return NULL;
+    return nullptr;
   }
 #ifdef WITH_DOM
   if ((soap->mode & SOAP_XML_DOM) && soap->dom)
@@ -14000,7 +14002,7 @@ SOAP_FMAC1
 char *SOAP_FMAC2
 soap_dime_option(struct soap *soap, unsigned short optype, const char *option) {
   size_t n;
-  char *s = NULL;
+  char *s = nullptr;
   if (option) {
     n = strlen(option);
     s = (char *)soap_malloc(soap, n + 5);
@@ -14107,9 +14109,9 @@ int SOAP_FMAC2 soap_putdime(struct soap *soap) {
             break;
           if (soap->dime.id) {
             soap->dime.flags &= ~(SOAP_DIME_MB | SOAP_DIME_MEDIA);
-            soap->dime.id = NULL;
-            soap->dime.type = NULL;
-            soap->dime.options = NULL;
+            soap->dime.id = nullptr;
+            soap->dime.type = nullptr;
+            soap->dime.options = nullptr;
           }
         } while (size >= chunksize);
       } else {
@@ -14163,7 +14165,7 @@ static char *soap_getdimefield(struct soap *soap, size_t n) {
   soap_wchar c;
   size_t i;
   char *s;
-  char *p = NULL;
+  char *p = nullptr;
   if (n) {
     p = (char *)soap_malloc(soap, n + 1);
     if (p) {
@@ -14171,13 +14173,13 @@ static char *soap_getdimefield(struct soap *soap, size_t n) {
       for (i = n; i > 0; i--) {
         if ((int)(c = soap_get1(soap)) == EOF) {
           soap->error = SOAP_CHK_EOF;
-          return NULL;
+          return nullptr;
         }
         *s++ = (char)c;
       }
       *s = '\0';
       if ((soap->error = soap_move(soap, -(long)n & 3)))
-        return NULL;
+        return nullptr;
     } else
       soap->error = SOAP_EOM;
   }
@@ -14307,13 +14309,13 @@ int SOAP_FMAC2 soap_getdime(struct soap *soap) {
       id = soap->dime.id;
       type = soap->dime.type;
       options = soap->dime.options;
-      if (soap_new_block(soap) == NULL)
+      if (soap_new_block(soap) == nullptr)
         return SOAP_EOM;
       for (;;) {
         soap_wchar c;
         size_t i;
         char *s;
-        s = (char *)soap_push_block(soap, NULL, soap->dime.size);
+        s = (char *)soap_push_block(soap, nullptr, soap->dime.size);
         if (!s)
           return soap->error = SOAP_EOM;
         for (i = soap->dime.size; i > 0; i--) {
@@ -14329,7 +14331,7 @@ int SOAP_FMAC2 soap_getdime(struct soap *soap) {
           return soap->error;
       }
       soap->dime.size = soap->blist->size++; /* allocate one more for '\0' */
-      if (!(soap->dime.ptr = soap_save_block(soap, NULL, NULL, 0)))
+      if (!(soap->dime.ptr = soap_save_block(soap, nullptr, nullptr, 0)))
         return soap->error;
       soap->dime.ptr[soap->dime.size] = '\0'; /* force 0-terminated */
       soap->dime.id = id;
@@ -14379,8 +14381,8 @@ int SOAP_FMAC2 soap_getmimehdr(struct soap *soap) {
     if (soap_getline(soap, soap->msgbuf, sizeof(soap->msgbuf)))
       return soap->error;
   }
-  if (soap_set_mime_attachment(soap, NULL, 0, SOAP_MIME_NONE, NULL, NULL, NULL,
-                               NULL))
+  if (soap_set_mime_attachment(soap, nullptr, 0, SOAP_MIME_NONE, nullptr,
+                               nullptr, nullptr, nullptr))
     return soap->error = SOAP_EOM;
   content = soap->mime.last;
   for (;;) {
@@ -14423,7 +14425,7 @@ int SOAP_FMAC2 soap_getmimehdr(struct soap *soap) {
 #ifndef PALM_1
 SOAP_FMAC1
 int SOAP_FMAC2 soap_getmime(struct soap *soap) {
-  while (soap_get_mime_attachment(soap, NULL))
+  while (soap_get_mime_attachment(soap, nullptr))
     ;
   return soap->error;
 }
@@ -14446,7 +14448,7 @@ void SOAP_FMAC2 soap_post_check_mime_attachments(struct soap *soap) {
 SOAP_FMAC1
 int SOAP_FMAC2 soap_check_mime_attachments(struct soap *soap) {
   if (soap->mode & SOAP_MIME_POSTCHECK)
-    return soap_get_mime_attachment(soap, NULL) != NULL;
+    return soap_get_mime_attachment(soap, nullptr) != nullptr;
   return SOAP_OK;
 }
 #endif
@@ -14460,15 +14462,15 @@ struct soap_multipart *SOAP_FMAC2
 soap_get_mime_attachment(struct soap *soap, void *handle) {
   soap_wchar c = 0;
   size_t i, m = 0;
-  char *s, *t = NULL;
+  char *s, *t = nullptr;
   struct soap_multipart *content;
   short flag = 0;
   if (!(soap->mode & SOAP_ENC_MIME))
-    return NULL;
+    return nullptr;
   content = soap->mime.last;
   if (!content) {
     if (soap_getmimehdr(soap))
-      return NULL;
+      return nullptr;
     content = soap->mime.last;
   } else if (content != soap->mime.first) {
     if (soap->fmimewriteopen &&
@@ -14477,22 +14479,23 @@ soap_get_mime_attachment(struct soap *soap, void *handle) {
               content->description, content->encoding)) ||
          soap->error)) {
       if (!content->ptr)
-        return NULL;
+        return nullptr;
     }
   }
   DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Parsing MIME content id=%s type=%s\n",
                             content->id ? content->id : SOAP_STR_EOS,
                             content->type ? content->type : SOAP_STR_EOS));
-  if (!content->ptr && soap_new_block(soap) == NULL) {
+  if (!content->ptr && soap_new_block(soap) == nullptr) {
     soap->error = SOAP_EOM;
-    return NULL;
+    return nullptr;
   }
   for (;;) {
     if (content->ptr)
       s = soap->tmpbuf;
-    else if (!(s = (char *)soap_push_block(soap, NULL, sizeof(soap->tmpbuf)))) {
+    else if (!(s = (char *)soap_push_block(soap, nullptr,
+                                           sizeof(soap->tmpbuf)))) {
       soap->error = SOAP_EOM;
-      return NULL;
+      return nullptr;
     }
     for (i = 0; i < sizeof(soap->tmpbuf); i++) {
       if (m > 0) {
@@ -14505,7 +14508,7 @@ soap_get_mime_attachment(struct soap *soap, void *handle) {
             if (content->ptr && soap->fmimewriteclose)
               soap->fmimewriteclose(soap, (void *)content->ptr);
             soap->error = SOAP_CHK_EOF;
-            return NULL;
+            return nullptr;
           }
         }
         if (flag || c == '\r') {
@@ -14521,7 +14524,7 @@ soap_get_mime_attachment(struct soap *soap, void *handle) {
             if (content->ptr && soap->fmimewriteclose)
               soap->fmimewriteclose(soap, (void *)content->ptr);
             soap->error = SOAP_CHK_EOF;
-            return NULL;
+            return nullptr;
           }
           if (!*--t)
             goto end;
@@ -14549,10 +14552,10 @@ end:
     if (soap->fmimewriteclose)
       soap->fmimewriteclose(soap, (void *)content->ptr);
     if (soap->error)
-      return NULL;
+      return nullptr;
   } else {
-    content->size = soap_size_block(soap, NULL, i + 1) - 1;
-    content->ptr = soap_save_block(soap, NULL, NULL, 0);
+    content->size = soap_size_block(soap, nullptr, i + 1) - 1;
+    content->ptr = soap_save_block(soap, nullptr, nullptr, 0);
   }
   soap_resolve_attachment(soap, content);
   if (c == '-' && soap_getchar(soap) == '-') {
@@ -14561,17 +14564,17 @@ end:
       if (soap->keep_alive < 0)
         soap->keep_alive = 0;
       soap_closesock(soap);
-      return NULL;
+      return nullptr;
     }
   } else {
     while (c != '\r' && (int)c != EOF && soap_blank(c))
       c = soap_getchar(soap);
     if (c != '\r' || soap_getchar(soap) != '\n') {
       soap->error = SOAP_MIME_ERROR;
-      return NULL;
+      return nullptr;
     }
     if (soap_getmimehdr(soap))
-      return NULL;
+      return nullptr;
   }
   return content;
 }
@@ -14751,8 +14754,8 @@ int SOAP_FMAC2 soap_putmime(struct soap *soap) {
 SOAP_FMAC1
 void SOAP_FMAC2 soap_set_dime(struct soap *soap) {
   soap->omode |= SOAP_ENC_DIME;
-  soap->dime.first = NULL;
-  soap->dime.last = NULL;
+  soap->dime.first = nullptr;
+  soap->dime.last = nullptr;
 }
 #endif
 #endif
@@ -14764,8 +14767,8 @@ SOAP_FMAC1
 void SOAP_FMAC2
 soap_set_mime(struct soap *soap, const char *boundary, const char *start) {
   soap->omode |= SOAP_ENC_MIME;
-  soap->mime.first = NULL;
-  soap->mime.last = NULL;
+  soap->mime.first = nullptr;
+  soap->mime.last = nullptr;
   soap->mime.boundary = soap_strdup(soap, boundary);
   soap->mime.start = soap_strdup(soap, start);
 }
@@ -14778,8 +14781,8 @@ soap_set_mime(struct soap *soap, const char *boundary, const char *start) {
 SOAP_FMAC1
 void SOAP_FMAC2 soap_clr_dime(struct soap *soap) {
   soap->omode &= ~SOAP_ENC_DIME;
-  soap->dime.first = NULL;
-  soap->dime.last = NULL;
+  soap->dime.first = nullptr;
+  soap->dime.last = nullptr;
 }
 #endif
 #endif
@@ -14790,10 +14793,10 @@ void SOAP_FMAC2 soap_clr_dime(struct soap *soap) {
 SOAP_FMAC1
 void SOAP_FMAC2 soap_clr_mime(struct soap *soap) {
   soap->omode &= ~SOAP_ENC_MIME;
-  soap->mime.first = NULL;
-  soap->mime.last = NULL;
-  soap->mime.boundary = NULL;
-  soap->mime.start = NULL;
+  soap->mime.first = nullptr;
+  soap->mime.last = nullptr;
+  soap->mime.boundary = nullptr;
+  soap->mime.start = nullptr;
 }
 #endif
 #endif
@@ -14809,15 +14812,15 @@ static struct soap_multipart *soap_new_multipart(struct soap *soap,
   content =
       (struct soap_multipart *)soap_malloc(soap, sizeof(struct soap_multipart));
   if (content) {
-    content->next = NULL;
+    content->next = nullptr;
     content->ptr = ptr;
     content->size = size;
-    content->id = NULL;
-    content->type = NULL;
-    content->options = NULL;
+    content->id = nullptr;
+    content->type = nullptr;
+    content->options = nullptr;
     content->encoding = SOAP_MIME_NONE;
-    content->location = NULL;
-    content->description = NULL;
+    content->location = nullptr;
+    content->description = nullptr;
     if (!*first)
       *first = content;
     if (*last)
@@ -14880,7 +14883,7 @@ struct soap_multipart *SOAP_FMAC2
 soap_next_multipart(struct soap_multipart *content) {
   if (content)
     return content->next;
-  return NULL;
+  return nullptr;
 }
 #endif
 #endif
@@ -15045,23 +15048,23 @@ int SOAP_FMAC2 soap_begin_recv(struct soap *soap) {
   soap->length = 0;
   soap->cdata = 0;
   *soap->endpoint = '\0';
-  soap->action = NULL;
-  soap->header = NULL;
-  soap->fault = NULL;
+  soap->action = nullptr;
+  soap->header = nullptr;
+  soap->fault = nullptr;
   soap->status = 0;
-  soap->fform = NULL;
+  soap->fform = nullptr;
 #ifndef WITH_LEANER
-  soap->dom = NULL;
+  soap->dom = nullptr;
   soap->dime.chunksize = 0;
   soap->dime.buflen = 0;
-  soap->dime.list = NULL;
-  soap->dime.first = NULL;
-  soap->dime.last = NULL;
-  soap->mime.list = NULL;
-  soap->mime.first = NULL;
-  soap->mime.last = NULL;
-  soap->mime.boundary = NULL;
-  soap->mime.start = NULL;
+  soap->dime.list = nullptr;
+  soap->dime.first = nullptr;
+  soap->dime.last = nullptr;
+  soap->mime.list = nullptr;
+  soap->mime.first = nullptr;
+  soap->mime.last = nullptr;
+  soap->mime.boundary = nullptr;
+  soap->mime.start = nullptr;
 #endif
 #ifdef WIN32
 #ifndef UNDER_CE
@@ -15272,7 +15275,7 @@ int SOAP_FMAC2 soap_begin_recv(struct soap *soap) {
           break;
         if (!soap_match_cid(soap, soap->mime.start, soap->mime.last->id))
           break;
-      } while (soap_get_mime_attachment(soap, NULL));
+      } while (soap_get_mime_attachment(soap, nullptr));
     }
     if (soap_get_header_attribute(soap, soap->mime.first->type,
                                   "application/dime"))
@@ -15336,7 +15339,7 @@ int SOAP_FMAC2 soap_envelope_begin_out(struct soap *soap) {
   if (soap->version == 0)
     return SOAP_OK;
   soap->part = SOAP_IN_ENVELOPE;
-  return soap_element_begin_out(soap, "SOAP-ENV:Envelope", 0, NULL);
+  return soap_element_begin_out(soap, "SOAP-ENV:Envelope", 0, nullptr);
 }
 #endif
 
@@ -15362,7 +15365,7 @@ int SOAP_FMAC2 soap_envelope_end_out(struct soap *soap) {
       else
         soap->dime.type = (char *)soap->local_namespaces[0].ns;
     }
-    soap->dime.options = NULL;
+    soap->dime.options = nullptr;
     soap->dime.flags = SOAP_DIME_MB | SOAP_DIME_ABSURI;
     if (!soap->dime.first)
       soap->dime.flags |= SOAP_DIME_ME;
@@ -15391,7 +15394,7 @@ char *SOAP_FMAC2 soap_get_http_body(struct soap *soap) {
       (soap->mode & SOAP_IO) != SOAP_IO_CHUNK) {
     n = soap->length;
     if (!n)
-      return NULL;
+      return nullptr;
   }
   DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Parsing HTTP body (mode=0x%x,len=%lu)\n",
                             soap->mode, (unsigned long)n));
@@ -15405,9 +15408,9 @@ char *SOAP_FMAC2 soap_get_http_body(struct soap *soap) {
 #ifdef WITH_FAST
     size_t i, k;
     if (soap_append_lab(
-            soap, NULL,
+            soap, nullptr,
             0)) /* allocate more space in look-aside buffer if necessary */
-      return NULL;
+      return nullptr;
     s = soap->labbuf + soap->labidx; /* space to populate */
     k = soap->lablen - soap->labidx; /* number of bytes available */
     soap->labidx = soap->lablen;     /* claim this space */
@@ -15449,9 +15452,9 @@ SOAP_FMAC1
 int SOAP_FMAC2 soap_envelope_begin_in(struct soap *soap) {
   struct Namespace *p;
   soap->part = SOAP_IN_ENVELOPE;
-  if (soap_element_begin_in(soap, "SOAP-ENV:Envelope", 0, NULL)) {
+  if (soap_element_begin_in(soap, "SOAP-ENV:Envelope", 0, nullptr)) {
     if (soap->error == SOAP_TAG_MISMATCH) {
-      if (!soap_element_begin_in(soap, "Envelope", 0, NULL))
+      if (!soap_element_begin_in(soap, "Envelope", 0, nullptr))
         soap->error = SOAP_VERSIONMISMATCH;
       else if (soap->status == 0 ||
                (soap->status >= 200 && soap->status <= 299))
@@ -15508,7 +15511,7 @@ int SOAP_FMAC2 soap_body_begin_out(struct soap *soap) {
   if (soap->version == 0)
     return SOAP_OK;
   soap->part = SOAP_IN_BODY;
-  return soap_element_begin_out(soap, "SOAP-ENV:Body", 0, NULL);
+  return soap_element_begin_out(soap, "SOAP-ENV:Body", 0, nullptr);
 }
 #endif
 
@@ -15532,7 +15535,7 @@ int SOAP_FMAC2 soap_body_begin_in(struct soap *soap) {
   if (soap->version == 0)
     return SOAP_OK;
   soap->part = SOAP_IN_BODY;
-  if (soap_element_begin_in(soap, "SOAP-ENV:Body", 0, NULL))
+  if (soap_element_begin_in(soap, "SOAP-ENV:Body", 0, nullptr))
     return soap->error;
   if (!soap->body)
     soap->part = SOAP_NO_BODY;
@@ -15619,7 +15622,7 @@ void SOAP_FMAC2 soap_set_endpoint(struct soap *soap, const char *endpoint) {
 #endif
   soap->host[i] = '\0';
   if (s[i] == ':') {
-    soap->port = (int)soap_strtol(s + i + 1, NULL, 10);
+    soap->port = (int)soap_strtol(s + i + 1, nullptr, 10);
     for (i++; i < n; i++)
       if (s[i] == '/')
         break;
@@ -15866,7 +15869,7 @@ soap_s2base64(struct soap *soap, const unsigned char *s, char *t, int n) {
   if (!t)
     t = (char *)soap_malloc(soap, (n + 2) / 3 * 4 + 1);
   if (!t)
-    return NULL;
+    return nullptr;
   p = t;
   t[0] = '\0';
   if (!s)
@@ -15909,7 +15912,7 @@ soap_base642s(struct soap *soap, const char *s, char *t, size_t l, int *n) {
     if (n)
       *n = 0;
     if (soap->error)
-      return NULL;
+      return nullptr;
     return SOAP_NON_NULL;
   }
   if (!t) {
@@ -15917,7 +15920,7 @@ soap_base642s(struct soap *soap, const char *s, char *t, size_t l, int *n) {
     t = (char *)soap_malloc(soap, l);
   }
   if (!t)
-    return NULL;
+    return nullptr;
   p = t;
   if (n)
     *n = 0;
@@ -15950,13 +15953,13 @@ soap_base642s(struct soap *soap, const char *s, char *t, size_t l, int *n) {
           int b = soap_base64i[c];
           if (b >= 64) {
             soap->error = SOAP_TYPE;
-            return NULL;
+            return nullptr;
           }
           m = (m << 6) + b;
           j++;
         } else if (!soap_blank(c + '+')) {
           soap->error = SOAP_TYPE;
-          return NULL;
+          return nullptr;
         }
       }
       if (l < 3) {
@@ -15985,7 +15988,7 @@ soap_s2hex(struct soap *soap, const unsigned char *s, char *t, int n) {
   if (!t)
     t = (char *)soap_malloc(soap, 2 * n + 1);
   if (!t)
-    return NULL;
+    return nullptr;
   p = t;
   t[0] = '\0';
   if (s) {
@@ -16011,7 +16014,7 @@ soap_hex2s(struct soap *soap, const char *s, char *t, size_t l, int *n) {
     if (n)
       *n = 0;
     if (soap->error)
-      return NULL;
+      return nullptr;
     return SOAP_NON_NULL;
   }
   if (!t) {
@@ -16019,7 +16022,7 @@ soap_hex2s(struct soap *soap, const char *s, char *t, size_t l, int *n) {
     t = (char *)soap_malloc(soap, l);
   }
   if (!t)
-    return NULL;
+    return nullptr;
   p = t;
   while (l) {
     int d1, d2;
@@ -16051,7 +16054,7 @@ int SOAP_FMAC2 soap_puthttphdr(struct soap *soap, int status, size_t count) {
     const char *s = "text/xml; charset=utf-8";
     int err = SOAP_OK;
 #ifndef WITH_LEANER
-    const char *r = NULL;
+    const char *r = nullptr;
 #endif
     if ((status == SOAP_FILE || soap->status == SOAP_PUT ||
          soap->status == SOAP_POST_FILE) &&
@@ -16195,8 +16198,8 @@ void SOAP_FMAC2 soap_set_fault(struct soap *soap) {
     *s = "Server fault";
     break;
   case SOAP_TAG_MISMATCH:
-    *s =
-        soap_set_validation_fault(soap, "tag name or namespace mismatch", NULL);
+    *s = soap_set_validation_fault(soap, "tag name or namespace mismatch",
+                                   nullptr);
     break;
   case SOAP_TYPE:
     *s = soap_set_validation_fault(soap, "data type mismatch ", soap->type);
@@ -16230,7 +16233,7 @@ void SOAP_FMAC2 soap_set_fault(struct soap *soap) {
     *s = "Unsupported SOAP data encoding";
     break;
   case SOAP_NAMESPACE:
-    *s = soap_set_validation_fault(soap, "namespace error", NULL);
+    *s = soap_set_validation_fault(soap, "namespace error", nullptr);
     break;
   case SOAP_USER_ERROR:
     *s = "User data error";
@@ -16277,7 +16280,7 @@ void SOAP_FMAC2 soap_set_fault(struct soap *soap) {
     *s = "Array index out of bounds";
     break;
   case SOAP_NULL:
-    *s = soap_set_validation_fault(soap, "nil not allowed", NULL);
+    *s = soap_set_validation_fault(soap, "nil not allowed", nullptr);
     break;
   case SOAP_DUPLICATE_ID:
     *s = soap_set_validation_fault(
@@ -16359,17 +16362,18 @@ void SOAP_FMAC2 soap_set_fault(struct soap *soap) {
 #endif
     break;
   case SOAP_REQUIRED:
-    *s = soap_set_validation_fault(soap, "missing required attribute", NULL);
+    *s = soap_set_validation_fault(soap, "missing required attribute", nullptr);
     break;
   case SOAP_PROHIBITED:
-    *s = soap_set_validation_fault(soap, "prohibited attribute present", NULL);
+    *s = soap_set_validation_fault(soap, "prohibited attribute present",
+                                   nullptr);
     break;
   case SOAP_OCCURS:
-    *s = soap_set_validation_fault(soap, "occurrence violation", NULL);
+    *s = soap_set_validation_fault(soap, "occurrence violation", nullptr);
     break;
   case SOAP_LENGTH:
     *s = soap_set_validation_fault(soap, "content range or length violation",
-                                   NULL);
+                                   nullptr);
     break;
   case SOAP_FD_EXCEEDED:
     *s = "Maximum number of open connections was reached (no define "
@@ -16432,7 +16436,7 @@ int SOAP_FMAC2 soap_send_fault(struct soap *soap) {
   soap->keep_alive = 0; /* to terminate connection */
   soap_set_fault(soap);
   if (soap->error < 200 && soap->error != SOAP_FAULT)
-    soap->header = NULL;
+    soap->header = nullptr;
   if (status != SOAP_EOF || (!soap->recv_timeout && !soap->send_timeout)) {
     int r = 1;
 #ifndef WITH_NOIO
@@ -16702,7 +16706,7 @@ int SOAP_FMAC2 soap_set_sender_error(struct soap *soap, const char *faultstring,
                                      int soaperror) {
   return soap_set_error(soap, soap->version == 2 ? "SOAP-ENV:Sender"
                                                  : "SOAP-ENV:Client",
-                        NULL, faultstring, faultdetailXML, soaperror);
+                        nullptr, faultstring, faultdetailXML, soaperror);
 }
 #endif
 
@@ -16714,7 +16718,7 @@ soap_set_receiver_error(struct soap *soap, const char *faultstring,
                         const char *faultdetailXML, int soaperror) {
   return soap_set_error(soap, soap->version == 2 ? "SOAP-ENV:Receiver"
                                                  : "SOAP-ENV:Server",
-                        NULL, faultstring, faultdetailXML, soaperror);
+                        nullptr, faultstring, faultdetailXML, soaperror);
 }
 #endif
 
@@ -16724,7 +16728,7 @@ static int soap_copy_fault(struct soap *soap, const char *faultcode,
                            const char *faultsubcodeQName,
                            const char *faultstring,
                            const char *faultdetailXML) {
-  char *r = NULL, *s = NULL, *t = NULL;
+  char *r = nullptr, *s = nullptr, *t = nullptr;
   if (faultsubcodeQName)
     r = soap_strdup(soap, faultsubcodeQName);
   if (faultstring)
@@ -16740,7 +16744,7 @@ static int soap_copy_fault(struct soap *soap, const char *faultcode,
 SOAP_FMAC1
 int SOAP_FMAC2 soap_sender_fault(struct soap *soap, const char *faultstring,
                                  const char *faultdetailXML) {
-  return soap_sender_fault_subcode(soap, NULL, faultstring, faultdetailXML);
+  return soap_sender_fault_subcode(soap, nullptr, faultstring, faultdetailXML);
 }
 #endif
 
@@ -16761,7 +16765,8 @@ soap_sender_fault_subcode(struct soap *soap, const char *faultsubcodeQName,
 SOAP_FMAC1
 int SOAP_FMAC2 soap_receiver_fault(struct soap *soap, const char *faultstring,
                                    const char *faultdetailXML) {
-  return soap_receiver_fault_subcode(soap, NULL, faultstring, faultdetailXML);
+  return soap_receiver_fault_subcode(soap, nullptr, faultstring,
+                                     faultdetailXML);
 }
 #endif
 
@@ -16786,7 +16791,7 @@ void SOAP_FMAC2 soap_print_fault(struct soap *soap, FILE *fd) {
   if (soap_check_state(soap))
     fprintf(fd, "Error: soap struct state not initialized\n");
   else if (soap->error) {
-    const char **c, *v = NULL, *s, *d;
+    const char **c, *v = nullptr, *s, *d;
     c = soap_faultcode(soap);
     if (!*c)
       soap_set_fault(soap);
@@ -16813,7 +16818,7 @@ void SOAP_FMAC2 soap_stream_fault(struct soap *soap, std::ostream &os) {
   if (soap_check_state(soap))
     os << "Error: soap struct state not initialized\n";
   else if (soap->error) {
-    const char **c, *v = NULL, *s, *d;
+    const char **c, *v = nullptr, *s, *d;
     c = soap_faultcode(soap);
     if (!*c)
       soap_set_fault(soap);
@@ -16842,7 +16847,7 @@ char *SOAP_FMAC2 soap_sprint_fault(struct soap *soap, char *buf, size_t len) {
   if (soap_check_state(soap))
     strncpy(buf, "Error: soap struct not initialized", len);
   else if (soap->error) {
-    const char **c, *v = NULL, *s, *d;
+    const char **c, *v = nullptr, *s, *d;
     c = soap_faultcode(soap);
     if (!*c)
       soap_set_fault(soap);
@@ -16918,10 +16923,10 @@ int SOAP_FMAC2 soap_register_plugin_arg(
   if (!(p = (struct soap_plugin *)SOAP_MALLOC(soap,
                                               sizeof(struct soap_plugin))))
     return soap->error = SOAP_EOM;
-  p->id = NULL;
-  p->data = NULL;
-  p->fcopy = NULL;
-  p->fdelete = NULL;
+  p->id = nullptr;
+  p->data = nullptr;
+  p->fcopy = nullptr;
+  p->fdelete = nullptr;
   r = fcreate(soap, p, arg);
   if (!r && p->fdelete) {
     p->next = soap->plugins;
@@ -16945,7 +16950,7 @@ static void *fplugin(struct soap *soap, const char *id) {
   for (p = soap->plugins; p; p = p->next)
     if (p->id == id || !strcmp(p->id, id))
       return p->data;
-  return NULL;
+  return nullptr;
 }
 #endif
 
diff --git a/Framework/ISISLiveData/test/CMakeLists.txt b/Framework/ISISLiveData/test/CMakeLists.txt
index 922418ca8e0ed5aa58a546a0178e84eff2f1ae69..3514ffafaee646624b96df874e75589d993809ec 100644
--- a/Framework/ISISLiveData/test/CMakeLists.txt
+++ b/Framework/ISISLiveData/test/CMakeLists.txt
@@ -6,6 +6,7 @@ if ( CXXTEST_FOUND )
   # It will go out of scope at the end of this file so doesn't need un-setting
   set ( TESTHELPER_SRCS ../../TestHelpers/src/TearDownWorld.cpp
                         ../../TestHelpers/src/ComponentCreationHelper.cpp
+                        ../../TestHelpers/src/InstrumentCreationHelper.cpp
                         ../../TestHelpers/src/WorkspaceCreationHelper.cpp
                         )
 
diff --git a/Framework/Kernel/CMakeLists.txt b/Framework/Kernel/CMakeLists.txt
index 994539535d5d346a174c5c029f938f7105c2733f..db554fefd8f230325aab1cde4ab9b2d4fb4eb858 100644
--- a/Framework/Kernel/CMakeLists.txt
+++ b/Framework/Kernel/CMakeLists.txt
@@ -90,6 +90,7 @@ set ( SRC_FILES
 	src/StdoutChannel.cpp
 	src/StringContainsValidator.cpp
 	src/Strings.cpp
+	src/StringTokenizer.cpp
 	src/TestChannel.cpp
 	src/ThreadPool.cpp
 	src/ThreadPoolRunnable.cpp
@@ -244,6 +245,7 @@ set ( INC_FILES
 	inc/MantidKernel/StdoutChannel.h
 	inc/MantidKernel/StringContainsValidator.h
 	inc/MantidKernel/Strings.h
+	inc/MantidKernel/StringTokenizer.h
 	inc/MantidKernel/System.h
 	inc/MantidKernel/Task.h
 	inc/MantidKernel/TestChannel.h
@@ -371,6 +373,7 @@ set ( TEST_FILES
 	StdoutChannelTest.h
 	StringContainsValidatorTest.h
 	StringsTest.h
+        StringTokenizerTest.h
 	TaskTest.h
 	ThreadPoolRunnableTest.h
 	ThreadPoolTest.h
diff --git a/Framework/Kernel/inc/MantidKernel/ANN/ANN.h b/Framework/Kernel/inc/MantidKernel/ANN/ANN.h
index 71ab4039d2c0a18ab00071df5aebbcf98dca19a1..253fc29cfe45ff585f42b10b07485893904045ba 100644
--- a/Framework/Kernel/inc/MantidKernel/ANN/ANN.h
+++ b/Framework/Kernel/inc/MantidKernel/ANN/ANN.h
@@ -545,14 +545,14 @@ public:
       double eps = 0.0     // error bound
       ) = 0;               // pure virtual (defined elsewhere)
 
-  virtual int annkFRSearch(      // approx fixed-radius kNN search
-      ANNpoint q,                // query point
-      ANNdist sqRad,             // squared radius
-      int k = 0,                 // number of near neighbors to return
-      ANNidxArray nn_idx = NULL, // nearest neighbor array (modified)
-      ANNdistArray dd = NULL,    // dist to near neighbors (modified)
-      double eps = 0.0           // error bound
-      ) = 0;                     // pure virtual (defined elsewhere)
+  virtual int annkFRSearch(         // approx fixed-radius kNN search
+      ANNpoint q,                   // query point
+      ANNdist sqRad,                // squared radius
+      int k = 0,                    // number of near neighbors to return
+      ANNidxArray nn_idx = nullptr, // nearest neighbor array (modified)
+      ANNdistArray dd = nullptr,    // dist to near neighbors (modified)
+      double eps = 0.0              // error bound
+      ) = 0;                        // pure virtual (defined elsewhere)
 
   virtual int theDim() = 0;  // return dimension of space
   virtual int nPoints() = 0; // return number of points
@@ -600,13 +600,13 @@ public:
       ANNdistArray dd,            // dist to near neighbors (modified)
       double eps = 0.0) override; // error bound
 
-  int annkFRSearch(               // approx fixed-radius kNN search
-      ANNpoint q,                 // query point
-      ANNdist sqRad,              // squared radius
-      int k = 0,                  // number of near neighbors to return
-      ANNidxArray nn_idx = NULL,  // nearest neighbor array (modified)
-      ANNdistArray dd = NULL,     // dist to near neighbors (modified)
-      double eps = 0.0) override; // error bound
+  int annkFRSearch(                 // approx fixed-radius kNN search
+      ANNpoint q,                   // query point
+      ANNdist sqRad,                // squared radius
+      int k = 0,                    // number of near neighbors to return
+      ANNidxArray nn_idx = nullptr, // nearest neighbor array (modified)
+      ANNdistArray dd = nullptr,    // dist to near neighbors (modified)
+      double eps = 0.0) override;   // error bound
 
   int theDim() override // return dimension of space
   {
@@ -780,12 +780,12 @@ protected:
   ANNpoint bnd_box_lo; // bounding box low point
   ANNpoint bnd_box_hi; // bounding box high point
 
-  void SkeletonTree(           // construct skeleton tree
-      int n,                   // number of points
-      int dd,                  // dimension
-      int bs,                  // bucket size
-      ANNpointArray pa = NULL, // point array (optional)
-      ANNidxArray pi = NULL);  // point indices (optional)
+  void SkeletonTree(              // construct skeleton tree
+      int n,                      // number of points
+      int dd,                     // dimension
+      int bs,                     // bucket size
+      ANNpointArray pa = nullptr, // point array (optional)
+      ANNidxArray pi = nullptr);  // point indices (optional)
 
 public:
   ANNkd_tree(      // build skeleton tree
@@ -819,13 +819,13 @@ public:
       ANNdistArray dd,    // dist to near neighbors (modified)
       double eps = 0.0);  // error bound
 
-  int annkFRSearch(               // approx fixed-radius kNN search
-      ANNpoint q,                 // the query point
-      ANNdist sqRad,              // squared radius of query ball
-      int k,                      // number of neighbors to return
-      ANNidxArray nn_idx = NULL,  // nearest neighbor array (modified)
-      ANNdistArray dd = NULL,     // dist to near neighbors (modified)
-      double eps = 0.0) override; // error bound
+  int annkFRSearch(                 // approx fixed-radius kNN search
+      ANNpoint q,                   // the query point
+      ANNdist sqRad,                // squared radius of query ball
+      int k,                        // number of neighbors to return
+      ANNidxArray nn_idx = nullptr, // nearest neighbor array (modified)
+      ANNdistArray dd = nullptr,    // dist to near neighbors (modified)
+      double eps = 0.0) override;   // error bound
 
   int theDim() override // return dimension of space
   {
diff --git a/Framework/Kernel/inc/MantidKernel/BinaryFile.h b/Framework/Kernel/inc/MantidKernel/BinaryFile.h
index b2002819add4d736435347681826a0d542932448..390d1df317fcd4fdb605da66e318f352b8ae2305 100644
--- a/Framework/Kernel/inc/MantidKernel/BinaryFile.h
+++ b/Framework/Kernel/inc/MantidKernel/BinaryFile.h
@@ -38,7 +38,7 @@ template <typename T> class DLLExport BinaryFile {
 public:
   //------------------------------------------------------------------------------------
   /// Empty constructor
-  BinaryFile() : handle(NULL), num_elements(0), offset(0) {}
+  BinaryFile() : handle(nullptr), num_elements(0), offset(0) {}
 
   //------------------------------------------------------------------------------------
   /// Constructor - open a file
@@ -55,7 +55,7 @@ public:
    * @throw invalid_argument if the file does not exist
    * */
   void open(const std::string &filename) {
-    this->handle = NULL;
+    this->handle = nullptr;
     if (!Poco::File(filename).exists()) {
       std::stringstream msg;
       msg << "BinaryFile::open: File " << filename << " was not found.";
@@ -74,7 +74,7 @@ public:
    * */
   void close() {
     delete handle;
-    handle = NULL;
+    handle = nullptr;
   }
 
   //-----------------------------------------------------------------------------
@@ -139,15 +139,13 @@ public:
   /**
    * Loads the entire contents of the file into a std::vector.
    * The file is closed once done.
-   * @param data :: The contents to load into the file
+   * @returns :: vector with contents of the file
    */
-  void loadAllInto(std::vector<T> &data) {
+  std::vector<T> loadAllIntoVector() {
     if (!handle) {
       throw std::runtime_error("BinaryFile: file is not open.");
     }
-
-    // Clear the vector
-    data.clear();
+    std::vector<T> data;
 
     // A buffer to load from
     size_t buffer_size = getBufferSize(num_elements);
@@ -169,6 +167,8 @@ public:
     this->close();
     // Free memory
     delete[] buffer;
+
+    return data;
   }
 
   //-----------------------------------------------------------------------------
diff --git a/Framework/Kernel/inc/MantidKernel/Chainable.h b/Framework/Kernel/inc/MantidKernel/Chainable.h
index 22a0094cd508b95dda7c24d803dbb431c6d8a69f..3bf7c51043767530f94f93b657a5a1d550428da7 100644
--- a/Framework/Kernel/inc/MantidKernel/Chainable.h
+++ b/Framework/Kernel/inc/MantidKernel/Chainable.h
@@ -59,7 +59,7 @@ public:
     checkSuccessor();
     return *m_successor;
   }
-  bool hasSuccessor() const { return m_successor.get() != NULL; }
+  bool hasSuccessor() const { return bool(m_successor); }
   virtual ~Chainable() = 0;
 };
 
diff --git a/Framework/Kernel/inc/MantidKernel/ConfigService.h b/Framework/Kernel/inc/MantidKernel/ConfigService.h
index 5f3a4d619ce57e668639bd89d88662337351da51..41e0dfc9d2728e0f0ee42f2a642fe0456c8fb2c4 100644
--- a/Framework/Kernel/inc/MantidKernel/ConfigService.h
+++ b/Framework/Kernel/inc/MantidKernel/ConfigService.h
@@ -73,7 +73,7 @@ class InstrumentInfo;
     File change history is stored at: <https://github.com/mantidproject/mantid>.
     Code Documentation is available at: <http://doxygen.mantidproject.org>
  */
-class MANTID_KERNEL_DLL ConfigServiceImpl {
+class MANTID_KERNEL_DLL ConfigServiceImpl final {
 public:
   /**
   * This is the base class for POCO Notifications sent out from the Config
diff --git a/Framework/Kernel/inc/MantidKernel/DataService.h b/Framework/Kernel/inc/MantidKernel/DataService.h
index a359f3a869ba29b077eee34a90db535bc10863b3..012f733a0d413e99d1443e8e0526e057e6fd5028 100644
--- a/Framework/Kernel/inc/MantidKernel/DataService.h
+++ b/Framework/Kernel/inc/MantidKernel/DataService.h
@@ -13,6 +13,7 @@
 #include "MantidKernel/Logger.h"
 #include "MantidKernel/Exception.h"
 #include "MantidKernel/ConfigService.h"
+#include <unordered_set>
 
 #include <mutex>
 
@@ -382,9 +383,7 @@ public:
 
     std::string foundName;
     svc_it it = findNameWithCaseSearch(name, foundName);
-    if (it != datamap.end())
-      return true;
-    return false;
+    return it != datamap.end();
   }
 
   /// Return the number of objects stored by the data service
@@ -404,13 +403,13 @@ public:
   }
 
   /// Get the names of the data objects stored by the service
-  std::set<std::string> getObjectNames() const {
+  std::unordered_set<std::string> getObjectNames() const {
     if (showingHiddenObjects())
       return getObjectNamesInclHidden();
 
     std::lock_guard<std::recursive_mutex> _lock(m_mutex);
 
-    std::set<std::string> names;
+    std::unordered_set<std::string> names;
     for (svc_constit it = datamap.begin(); it != datamap.end(); ++it) {
       if (!isHiddenDataServiceObject(it->first)) {
         names.insert(it->first);
@@ -420,10 +419,10 @@ public:
   }
 
   /// Get the names of the data objects stored by the service
-  std::set<std::string> getObjectNamesInclHidden() const {
+  std::unordered_set<std::string> getObjectNamesInclHidden() const {
     std::lock_guard<std::recursive_mutex> _lock(m_mutex);
 
-    std::set<std::string> names;
+    std::unordered_set<std::string> names;
     for (svc_constit it = datamap.begin(); it != datamap.end(); ++it) {
       names.insert(it->first);
     }
diff --git a/Framework/Kernel/inc/MantidKernel/Exception.h b/Framework/Kernel/inc/MantidKernel/Exception.h
index 3594f22dd0badc869fcbffa8aae65e1fe7b9ccce..ab786e21214d3bd757fc66c1b8b17de311cd6c07 100644
--- a/Framework/Kernel/inc/MantidKernel/Exception.h
+++ b/Framework/Kernel/inc/MantidKernel/Exception.h
@@ -130,7 +130,7 @@ public:
 
 /// Records the filename, the description of failure and the line on which it
 /// happened
-class MANTID_KERNEL_DLL ParseError : public FileError {
+class MANTID_KERNEL_DLL ParseError final : public FileError {
 private:
   /// Number of the line where the error occured
   const int m_lineNumber;
@@ -157,7 +157,7 @@ public:
 };
 
 /// Marks code as not implemented yet.
-class MANTID_KERNEL_DLL NotImplementedError : public std::logic_error {
+class MANTID_KERNEL_DLL NotImplementedError final : public std::logic_error {
 public:
   NotImplementedError(const std::string &);
   NotImplementedError(const NotImplementedError &A);
@@ -170,7 +170,7 @@ public:
 };
 
 /// Exception for when an item is not found in a collection.
-class MANTID_KERNEL_DLL NotFoundError : public std::runtime_error {
+class MANTID_KERNEL_DLL NotFoundError final : public std::runtime_error {
 private:
   /// The name of the search object
   const std::string objectName;
@@ -192,7 +192,7 @@ public:
 };
 
 /// Exception for when an item is already in a collection.
-class MANTID_KERNEL_DLL ExistsError : public std::runtime_error {
+class MANTID_KERNEL_DLL ExistsError final : public std::runtime_error {
 private:
   /// The name of the search object
   const std::string objectName;
@@ -364,7 +364,7 @@ public:
  *  @author Nick Draper, Tessella
  *  @date 13/11/2013
  */
-class MANTID_KERNEL_DLL InternetError : public std::runtime_error {
+class MANTID_KERNEL_DLL InternetError final : public std::runtime_error {
 private:
   /// The message returned by what()
   std::string outMessage;
diff --git a/Framework/Kernel/inc/MantidKernel/FunctionTask.h b/Framework/Kernel/inc/MantidKernel/FunctionTask.h
index 8acbb8c326d4415886f26782ce6b681590e38069..64ee250577315dc5488dedb14cb02f9f8280fa34 100644
--- a/Framework/Kernel/inc/MantidKernel/FunctionTask.h
+++ b/Framework/Kernel/inc/MantidKernel/FunctionTask.h
@@ -22,7 +22,7 @@ namespace Kernel {
  * @author Janik Zikovsky, SNS
  * @date Feb 8, 2011
  */
-class DLLExport FunctionTask : public Task {
+class DLLExport FunctionTask final : public Task {
 public:
   /// Typedef for a function with no arguments and no return
   typedef void (*voidFunction)();
@@ -61,7 +61,7 @@ public:
   //---------------------------------------------------------------------------------------------
   /** Main method that performs the work for the task. */
   void run() override {
-    if (m_voidFunc != NULL)
+    if (m_voidFunc)
       m_voidFunc();
     else
       throw std::runtime_error("FunctionTask: NULL method pointer provided.");
diff --git a/Framework/Kernel/inc/MantidKernel/IPropertyManager.h b/Framework/Kernel/inc/MantidKernel/IPropertyManager.h
index dbfaa5cab13978a8aa59957d67c9345a748b5b2c..30312d07b263fad913cfaa3d120d516192eed640 100644
--- a/Framework/Kernel/inc/MantidKernel/IPropertyManager.h
+++ b/Framework/Kernel/inc/MantidKernel/IPropertyManager.h
@@ -7,7 +7,7 @@
 #include "MantidKernel/PropertyWithValue.h"
 #include "MantidKernel/OptionalBool.h"
 #include <vector>
-#include <set>
+#include <unordered_set>
 
 namespace Json {
 class Value;
@@ -79,8 +79,8 @@ public:
   */
   virtual void setPropertiesWithSimpleString(
       const std::string &propertiesString,
-      const std::set<std::string> &
-          ignoreProperties = std::set<std::string>()) = 0;
+      const std::unordered_set<std::string> &
+          ignoreProperties = std::unordered_set<std::string>()) = 0;
 
   /** Sets all the declared properties from a string.
       @param propertiesJson :: A string of name = value pairs formatted
@@ -90,8 +90,8 @@ public:
    */
   virtual void
   setProperties(const std::string &propertiesJson,
-                const std::set<std::string> &
-                    ignoreProperties = std::set<std::string>()) = 0;
+                const std::unordered_set<std::string> &
+                    ignoreProperties = std::unordered_set<std::string>()) = 0;
 
   /** Sets all the declared properties from a json object
      @param jsonValue :: A json name value pair collection
@@ -100,8 +100,8 @@ public:
   */
   virtual void
   setProperties(const ::Json::Value &jsonValue,
-                const std::set<std::string> &
-                    ignoreProperties = std::set<std::string>()) = 0;
+                const std::unordered_set<std::string> &
+                    ignoreProperties = std::unordered_set<std::string>()) = 0;
 
   /** Sets property value from a string
       @param name :: Property name
diff --git a/Framework/Kernel/inc/MantidKernel/ListValidator.h b/Framework/Kernel/inc/MantidKernel/ListValidator.h
index dae06ff2adb93696175364e101c541288676d046..d5c80a5ab55214e55a1cd4bf6e23dd536248c450 100644
--- a/Framework/Kernel/inc/MantidKernel/ListValidator.h
+++ b/Framework/Kernel/inc/MantidKernel/ListValidator.h
@@ -11,6 +11,7 @@
 #include <vector>
 #include <set>
 #include <map>
+#include <unordered_set>
 
 namespace Mantid {
 namespace Kernel {
@@ -52,6 +53,12 @@ public:
   explicit ListValidator(const std::set<TYPE> &values)
       : TypedValidator<TYPE>(), m_allowedValues(values.begin(), values.end()) {}
 
+  /** Constructor
+   *  @param values :: An unordered set of values consisting of the valid values
+   */
+  explicit ListValidator(const std::unordered_set<TYPE> &values)
+      : TypedValidator<TYPE>(), m_allowedValues(values.begin(), values.end()) {}
+
   /** Constructor
    *  @param values :: A vector of the valid values
    *  @param aliases :: Optional aliases for the valid values.
diff --git a/Framework/Kernel/inc/MantidKernel/MRUList.h b/Framework/Kernel/inc/MantidKernel/MRUList.h
index a0870ada20d8d74ed2df7312db82e96152a1b001..d6afe10d0b18deb27eadadebd839e4311badce6b 100644
--- a/Framework/Kernel/inc/MantidKernel/MRUList.h
+++ b/Framework/Kernel/inc/MantidKernel/MRUList.h
@@ -100,7 +100,7 @@ public:
     if (!p.second) {
       /* duplicate item */
       this->il.relocate(this->il.begin(), p.first); /* put in front */
-      return NULL;
+      return nullptr;
     }
 
     bool exceeding_size;
@@ -117,7 +117,7 @@ public:
       this->il.pop_back();
       return toWrite;
     }
-    return NULL;
+    return nullptr;
   }
 
   //---------------------------------------------------------------------------------------------
@@ -159,7 +159,7 @@ public:
 
     auto it = il.template get<1>().find(int(index));
     if (it == il.template get<1>().end()) {
-      return NULL;
+      return nullptr;
     } else {
       return *it;
     }
diff --git a/Framework/Kernel/inc/MantidKernel/MagneticIon.h b/Framework/Kernel/inc/MantidKernel/MagneticIon.h
index 46aa9fd685ce1d6af2861753b633e32d7941bd83..d8bad5478fa330084d77b32247db58f0c6b281f5 100644
--- a/Framework/Kernel/inc/MantidKernel/MagneticIon.h
+++ b/Framework/Kernel/inc/MantidKernel/MagneticIon.h
@@ -20,9 +20,8 @@ struct MANTID_KERNEL_DLL MagneticIon {
   /// Default constructor
   MagneticIon();
   /// Construct the Ion with data
-  MagneticIon(const std::string symbol, const uint16_t charge,
-              const double j0[8], const double j2[8], const double j4[8],
-              const double j6[8]);
+  MagneticIon(const char *symbol, const uint16_t charge, const double j0[8],
+              const double j2[8], const double j4[8], const double j6[8]);
 
   /// Returns the value of the form factor for the given J/L
   double analyticalFormFactor(const double qsqr, const uint16_t j,
diff --git a/Framework/Kernel/inc/MantidKernel/NexusDescriptor.h b/Framework/Kernel/inc/MantidKernel/NexusDescriptor.h
index f46774eebf53aea807b0107ba22d4e8e51cdeb7f..d4c8f2c0c744f7d3393d00c67e3aef92a23bb4bb 100644
--- a/Framework/Kernel/inc/MantidKernel/NexusDescriptor.h
+++ b/Framework/Kernel/inc/MantidKernel/NexusDescriptor.h
@@ -5,7 +5,7 @@
 #include "MantidKernel/DllConfig.h"
 
 #include <map>
-#include <set>
+#include <unordered_set>
 #include <string>
 #include <utility>
 
@@ -115,7 +115,7 @@ private:
   /// First entry name/type
   std::pair<std::string, std::string> m_firstEntryNameType;
   /// Root attributes
-  std::set<std::string> m_rootAttrs;
+  std::unordered_set<std::string> m_rootAttrs;
   /// Map of full path strings to types. Can check if path exists quickly
   std::map<std::string, std::string> m_pathsToTypes;
 
diff --git a/Framework/Kernel/inc/MantidKernel/NullValidator.h b/Framework/Kernel/inc/MantidKernel/NullValidator.h
index 723da24032df2b996eeee0bba3974520c3aa2ef5..bb03f12f3af30c646e5daacbe8dce5cdb341658b 100644
--- a/Framework/Kernel/inc/MantidKernel/NullValidator.h
+++ b/Framework/Kernel/inc/MantidKernel/NullValidator.h
@@ -36,7 +36,7 @@ namespace Kernel {
     File change history is stored at: <https://github.com/mantidproject/mantid>.
     Code Documentation is available at: <http://doxygen.mantidproject.org>
 */
-class DLLExport NullValidator : public IValidator {
+class DLLExport NullValidator final : public IValidator {
 public:
   IValidator_sptr clone() const override {
     return boost::make_shared<NullValidator>(*this);
diff --git a/Framework/Kernel/inc/MantidKernel/PropertyHistory.h b/Framework/Kernel/inc/MantidKernel/PropertyHistory.h
index 9fa183d329b3988d8b97dba8a635fbf9e565a14a..fc4f0cca95242f9930e52bb9a39cc994afe6d2d8 100644
--- a/Framework/Kernel/inc/MantidKernel/PropertyHistory.h
+++ b/Framework/Kernel/inc/MantidKernel/PropertyHistory.h
@@ -77,11 +77,8 @@ public:
 
   /// this is required for boost.python
   bool operator==(const PropertyHistory &other) const {
-    if (name() == other.name() && value() == other.value() &&
-        type() == other.type() && isDefault() == other.isDefault()) {
-      return true;
-    }
-    return false;
+    return name() == other.name() && value() == other.value() &&
+           type() == other.type() && isDefault() == other.isDefault();
   }
 
 private:
diff --git a/Framework/Kernel/inc/MantidKernel/PropertyManager.h b/Framework/Kernel/inc/MantidKernel/PropertyManager.h
index 9a3893fdb3ddffe0dd3727e166d1d6068bdacee4..afc7bfa4dc7b7e87acc4a7664c426978affe8c7c 100644
--- a/Framework/Kernel/inc/MantidKernel/PropertyManager.h
+++ b/Framework/Kernel/inc/MantidKernel/PropertyManager.h
@@ -75,21 +75,22 @@ public:
 
   // Sets all the declared properties from
   void setProperties(const std::string &propertiesJson,
-                     const std::set<std::string> &ignoreProperties =
-                         std::set<std::string>()) override;
+                     const std::unordered_set<std::string> &ignoreProperties =
+                         std::unordered_set<std::string>()) override;
   void setProperties(const std::string &propertiesJson,
                      IPropertyManager *targetPropertyManager,
-                     const std::set<std::string> &ignoreProperties);
+                     const std::unordered_set<std::string> &ignoreProperties);
   void setProperties(const ::Json::Value &jsonValue,
-                     const std::set<std::string> &ignoreProperties =
-                         std::set<std::string>()) override;
-  void setProperties(
-      const ::Json::Value &jsonValue, IPropertyManager *targetPropertyManager,
-      const std::set<std::string> &ignoreProperties = std::set<std::string>());
-  void
-  setPropertiesWithSimpleString(const std::string &propertiesString,
-                                const std::set<std::string> &ignoreProperties =
-                                    std::set<std::string>()) override;
+                     const std::unordered_set<std::string> &ignoreProperties =
+                         std::unordered_set<std::string>()) override;
+  void setProperties(const ::Json::Value &jsonValue,
+                     IPropertyManager *targetPropertyManager,
+                     const std::unordered_set<std::string> &ignoreProperties =
+                         std::unordered_set<std::string>());
+  void setPropertiesWithSimpleString(
+      const std::string &propertiesString,
+      const std::unordered_set<std::string> &ignoreProperties =
+          std::unordered_set<std::string>()) override;
   void setPropertyValue(const std::string &name,
                         const std::string &value) override;
   void setPropertyOrdinal(const int &index, const std::string &value) override;
diff --git a/Framework/Kernel/inc/MantidKernel/PropertyManagerOwner.h b/Framework/Kernel/inc/MantidKernel/PropertyManagerOwner.h
index e926017973cfad4c52d06973940b84f2c986b67f..8fd7aa924c2a1fa5cce34c1fc3419ff3cae0e31d 100644
--- a/Framework/Kernel/inc/MantidKernel/PropertyManagerOwner.h
+++ b/Framework/Kernel/inc/MantidKernel/PropertyManagerOwner.h
@@ -61,19 +61,19 @@ public:
 
   // Sets all the declared properties from
   void setProperties(const std::string &propertiesJson,
-                     const std::set<std::string> &ignoreProperties =
-                         std::set<std::string>()) override;
+                     const std::unordered_set<std::string> &ignoreProperties =
+                         std::unordered_set<std::string>()) override;
 
   // Sets all the declared properties from a json object
   void setProperties(const ::Json::Value &jsonValue,
-                     const std::set<std::string> &ignoreProperties =
-                         std::set<std::string>()) override;
+                     const std::unordered_set<std::string> &ignoreProperties =
+                         std::unordered_set<std::string>()) override;
 
   // sets all the declared properties using a simple string format
-  void
-  setPropertiesWithSimpleString(const std::string &propertiesString,
-                                const std::set<std::string> &ignoreProperties =
-                                    std::set<std::string>()) override;
+  void setPropertiesWithSimpleString(
+      const std::string &propertiesString,
+      const std::unordered_set<std::string> &ignoreProperties =
+          std::unordered_set<std::string>()) override;
 
   void setPropertyValue(const std::string &name,
                         const std::string &value) override;
diff --git a/Framework/Kernel/inc/MantidKernel/PropertyWithValue.h b/Framework/Kernel/inc/MantidKernel/PropertyWithValue.h
index 3d16e893e9d48802a8735adf3e2d1d4228b28cfa..827817fc6e568f572aa7d3597babb5f73500d142 100644
--- a/Framework/Kernel/inc/MantidKernel/PropertyWithValue.h
+++ b/Framework/Kernel/inc/MantidKernel/PropertyWithValue.h
@@ -15,7 +15,7 @@
 #include <boost/shared_ptr.hpp>
 #endif
 
-#include <Poco/StringTokenizer.h>
+#include <MantidKernel/StringTokenizer.h>
 #include <vector>
 #include "MantidKernel/IPropertySettings.h"
 
@@ -149,7 +149,7 @@ void toValue(const std::string &, boost::shared_ptr<T> &) {
 template <typename T>
 void toValue(const std::string &strvalue, std::vector<T> &value) {
   // Split up comma-separated properties
-  typedef Poco::StringTokenizer tokenizer;
+  typedef Mantid::Kernel::StringTokenizer tokenizer;
   tokenizer values(strvalue, ",",
                    tokenizer::TOK_IGNORE_EMPTY | tokenizer::TOK_TRIM);
 
@@ -165,7 +165,7 @@ template <typename T>
 void toValue(const std::string &strvalue, std::vector<std::vector<T>> &value,
              const std::string &outerDelimiter = ",",
              const std::string &innerDelimiter = "+") {
-  typedef Poco::StringTokenizer tokenizer;
+  typedef Mantid::Kernel::StringTokenizer tokenizer;
   tokenizer tokens(strvalue, outerDelimiter,
                    tokenizer::TOK_IGNORE_EMPTY | tokenizer::TOK_TRIM);
 
@@ -199,7 +199,7 @@ template <typename T> T extractToValueVector(const std::string &strvalue) {
   template <>                                                                  \
   inline void toValue<type>(const std::string &strvalue,                       \
                             std::vector<type> &value) {                        \
-    typedef Poco::StringTokenizer tokenizer;                                   \
+    typedef Mantid::Kernel::StringTokenizer tokenizer;                         \
     tokenizer values(strvalue, ",",                                            \
                      tokenizer::TOK_IGNORE_EMPTY | tokenizer::TOK_TRIM);       \
     value.clear();                                                             \
diff --git a/Framework/Kernel/inc/MantidKernel/SingletonHolder.h b/Framework/Kernel/inc/MantidKernel/SingletonHolder.h
index 61d3f1fe212d817b35b43df1b5009a16f7b4784b..4ab904a35e7af30dd4fada11d88dd934552d3a64 100644
--- a/Framework/Kernel/inc/MantidKernel/SingletonHolder.h
+++ b/Framework/Kernel/inc/MantidKernel/SingletonHolder.h
@@ -91,12 +91,12 @@ template <typename T> void SingletonHolder<T>::DestroySingleton() {
   // std::cerr << "destroying singleton " << typeid(T).name() << std::endl;
   assert(!destroyed);
   CreateUsingNew<T>::Destroy(pInstance);
-  pInstance = 0;
+  pInstance = nullptr;
   destroyed = true;
 }
 
 /// global variable holding pointer to singleton instance
-template <typename T> T *SingletonHolder<T>::pInstance = 0;
+template <typename T> T *SingletonHolder<T>::pInstance = nullptr;
 
 /// variable to allow trapping of attempts to destroy a singleton more than once
 template <typename T> bool SingletonHolder<T>::destroyed = false;
diff --git a/Framework/Kernel/inc/MantidKernel/StringTokenizer.h b/Framework/Kernel/inc/MantidKernel/StringTokenizer.h
new file mode 100644
index 0000000000000000000000000000000000000000..1a7c126277e2541e879380ef61c611b7d0f84a2f
--- /dev/null
+++ b/Framework/Kernel/inc/MantidKernel/StringTokenizer.h
@@ -0,0 +1,129 @@
+#ifndef MANTID_KERNEL_STRINGTOKENIZER_H_
+#define MANTID_KERNEL_STRINGTOKENIZER_H_
+
+//----------------------------------------------------------------------
+// Includes
+//----------------------------------------------------------------------
+
+#include <cstddef> //std::size_t
+#include <string>
+#include <vector>
+
+#include "MantidKernel/System.h" //DLLExport
+
+/** StringTokenizer: A simple tokenizer that splits a string into tokens, which
+ are separated by separator characters. An iterator or index can used to iterate
+ over all tokens or the result returned as a std::vector<std::string>>
+
+ Copyright © 2007-2011 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://svn.mantidproject.org/mantid/trunk/Code/Mantid>
+ Code Documentation is available at <http://doxygen.mantidproject.org>
+ */
+
+namespace Mantid {
+namespace Kernel {
+
+class DLLExport StringTokenizer {
+public:
+  /// Specify tokenizer options. These can be combined using + or |.
+  enum Options {
+    TOK_IGNORE_EMPTY = 1, ///< ignore empty tokens
+    TOK_TRIM = 2, ///< remove leading and trailing whitespace from tokens
+    TOK_IGNORE_FINAL_EMPTY_TOKEN =
+        4 ///< ignore an empty token at the end of the string.
+  };
+  typedef std::vector<std::string> TokenVec;
+  typedef std::vector<std::string>::iterator Iterator;
+  typedef std::vector<std::string>::const_iterator ConstIterator;
+  /// Constructs an object from an empty string.
+  StringTokenizer() = default;
+  /// Constructor requiring a string to tokenize and a string of separators.
+  StringTokenizer(const std::string &str, const std::string &separators,
+                  unsigned options = 0);
+
+  /// Destroys the tokenizer.
+  ~StringTokenizer() = default;
+
+  /** Iterator referring to first element in the container.
+  * @return an iterator referring to the first element in the container.
+  */
+  Iterator begin() { return m_tokens.begin(); }
+
+  /** Iterator referring to the past-the-end element in the container.
+   * @return an iterator referring to the past-the-end element in the container.
+   */
+  Iterator end() { return m_tokens.end(); }
+
+  /** Const iterator referring to first element in the container.
+  * @return a const iterator referring to the first element in the container.
+  */
+  ConstIterator cbegin() const { return m_tokens.cbegin(); }
+  /** Const iterator referring to the past-the-end element in the container.
+   * @return a const iterator referring to the past-the-end element in the
+   * container.
+   */
+  ConstIterator cend() const { return m_tokens.cend(); }
+
+  /** Get a const reference to the index'th token. Indexing an out-of-range
+   * element won't throw, but is otherwise undefined behavior.
+   * @param index Index of the requested token.
+   * @return a const reference to the index'th token.
+   */
+  const std::string &operator[](std::size_t index) const {
+    return m_tokens[index];
+  }
+
+  /** Get a const reference to the index'th token. Indexing an out-of-range
+  * element won't throw, but is otherwise undefined behavior.
+  * @param index Index of the requested token.
+  * @return a const reference to the index'th token.
+  */
+  std::string &operator[](std::size_t index) { return m_tokens[index]; }
+
+  /// Returns a vector of tokenized strings.
+  const TokenVec &asVector() { return m_tokens; }
+
+  /** Get a const reference to the index'th token.
+   * @param index Index of the requested token.
+   * @return a const reference to the index'th token.
+   * @throw Throws std::out_of_range if the index is out of range.
+   */
+  const std::string &at(std::size_t index) const { return m_tokens.at(index); }
+
+  /** Get a reference to the index'th token.
+   * @param index Index of the requested token.
+   * @return a reference to the index'th token.
+   * @throw Throws std::out_of_range if the index is out of range.
+   */
+  std::string &at(std::size_t index) { return m_tokens.at(index); }
+
+  /** Get the total number of tokens.
+   * @return the total number of tokens.
+   */
+  std::size_t count() const { return m_tokens.size(); }
+
+private:
+  std::vector<std::string> m_tokens;
+};
+}
+}
+
+#endif /* StringTokenizer_h */
diff --git a/Framework/Kernel/inc/MantidKernel/ThreadPool.h b/Framework/Kernel/inc/MantidKernel/ThreadPool.h
index 270ca1ba4cff8398ec69ed5ee279a25fff7e5347..dc48699897493c7614e8d8f8f4ba50cba2337e03 100644
--- a/Framework/Kernel/inc/MantidKernel/ThreadPool.h
+++ b/Framework/Kernel/inc/MantidKernel/ThreadPool.h
@@ -46,10 +46,10 @@ namespace Kernel {
   Code Documentation is available at: <http://doxygen.mantidproject.org>
  */
 
-class MANTID_KERNEL_DLL ThreadPool {
+class MANTID_KERNEL_DLL ThreadPool final {
 public:
   ThreadPool(ThreadScheduler *scheduler = new ThreadSchedulerFIFO(),
-             size_t numCores = 0, ProgressBase *prog = NULL);
+             size_t numCores = 0, ProgressBase *prog = nullptr);
 
   ~ThreadPool();
 
diff --git a/Framework/Kernel/inc/MantidKernel/ThreadPoolRunnable.h b/Framework/Kernel/inc/MantidKernel/ThreadPoolRunnable.h
index 78b0383e188d5249163d2d001e069efff6c13af0..f1371cc5132658501607e65b97d85c15e0b4298f 100644
--- a/Framework/Kernel/inc/MantidKernel/ThreadPoolRunnable.h
+++ b/Framework/Kernel/inc/MantidKernel/ThreadPoolRunnable.h
@@ -19,7 +19,7 @@ namespace Kernel {
 class MANTID_KERNEL_DLL ThreadPoolRunnable : public Poco::Runnable {
 public:
   ThreadPoolRunnable(size_t threadnum, ThreadScheduler *scheduler,
-                     ProgressBase *prog = NULL, double waitSec = 0.0);
+                     ProgressBase *prog = nullptr, double waitSec = 0.0);
   ~ThreadPoolRunnable() override;
 
   /// Return the thread number of this thread.
diff --git a/Framework/Kernel/inc/MantidKernel/ThreadScheduler.h b/Framework/Kernel/inc/MantidKernel/ThreadScheduler.h
index 10b74bef660ae19a033e6e38080440bdc3a762cc..3cce843f65abb4fe97fee1c7c37ee5f87116e1ff 100644
--- a/Framework/Kernel/inc/MantidKernel/ThreadScheduler.h
+++ b/Framework/Kernel/inc/MantidKernel/ThreadScheduler.h
@@ -165,7 +165,7 @@ public:
   //-------------------------------------------------------------------------------
   Task *pop(size_t threadnum) override {
     UNUSED_ARG(threadnum);
-    Task *temp = NULL;
+    Task *temp = nullptr;
     m_queueLock.lock();
     // Check the size within the same locking block; otherwise the size may
     // change before you get the next item.
@@ -218,7 +218,7 @@ class MANTID_KERNEL_DLL ThreadSchedulerLIFO : public ThreadSchedulerFIFO {
   //-------------------------------------------------------------------------------
   Task *pop(size_t threadnum) override {
     UNUSED_ARG(threadnum);
-    Task *temp = NULL;
+    Task *temp = nullptr;
     m_queueLock.lock();
     // Check the size within the same locking block; otherwise the size may
     // change before you get the next item.
@@ -270,7 +270,7 @@ public:
   //-------------------------------------------------------------------------------
   Task *pop(size_t threadnum) override {
     UNUSED_ARG(threadnum);
-    Task *temp = NULL;
+    Task *temp = nullptr;
     m_queueLock.lock();
     // Check the size within the same locking block; otherwise the size may
     // change before you get the next item.
diff --git a/Framework/Kernel/inc/MantidKernel/ThreadSchedulerMutexes.h b/Framework/Kernel/inc/MantidKernel/ThreadSchedulerMutexes.h
index 6458feb6c24a139e5ee24bd1f7b8c8cb6b60b0a7..11cbe60535c1ff4fa093298bd3dbed47b9464922 100644
--- a/Framework/Kernel/inc/MantidKernel/ThreadSchedulerMutexes.h
+++ b/Framework/Kernel/inc/MantidKernel/ThreadSchedulerMutexes.h
@@ -45,7 +45,7 @@ public:
   Task *pop(size_t threadnum) override {
     UNUSED_ARG(threadnum);
 
-    Task *temp = NULL;
+    Task *temp = nullptr;
 
     std::lock_guard<std::mutex> lock(m_queueLock);
     // Check the size within the same locking block; otherwise the size may
@@ -75,7 +75,7 @@ public:
           }
         }
       }
-      if (temp == NULL) {
+      if (temp == nullptr) {
         // Nothing was found, meaning all mutexes are in use
         // Try the first non-empty map
         SuperMap::iterator it = m_supermap.begin();
diff --git a/Framework/Kernel/inc/MantidKernel/UnitFactory.h b/Framework/Kernel/inc/MantidKernel/UnitFactory.h
index 0a29b4ccda05837e9ee3527de475e977cc5fe2f2..f17bc5903325e4202217ccf1ce4d007ba4cbda77 100644
--- a/Framework/Kernel/inc/MantidKernel/UnitFactory.h
+++ b/Framework/Kernel/inc/MantidKernel/UnitFactory.h
@@ -68,7 +68,7 @@ class Unit;
     File change history is stored at: <https://github.com/mantidproject/mantid>
     Code Documentation is available at: <http://doxygen.mantidproject.org>
 */
-class MANTID_KERNEL_DLL UnitFactoryImpl : public DynamicFactory<Unit> {
+class MANTID_KERNEL_DLL UnitFactoryImpl final : public DynamicFactory<Unit> {
 
 private:
   friend struct CreateUsingNew<UnitFactoryImpl>;
diff --git a/Framework/Kernel/inc/MantidKernel/Utils.h b/Framework/Kernel/inc/MantidKernel/Utils.h
index d5e29d413e8690c5c47dc8fad6bf2ca3601cb480..7d77132daa63b6009ca8e837c627be77b2b649c5 100644
--- a/Framework/Kernel/inc/MantidKernel/Utils.h
+++ b/Framework/Kernel/inc/MantidKernel/Utils.h
@@ -254,21 +254,20 @@ inline void getIndicesFromLinearIndex(const size_t linear_index,
  * @param num_bins :: a vector of [numDims] size, where numDims is the loop
  *depth and each element equal to number of bins in the correspondent dimension
  *
- * @param[out] out_indices :: the vector, sized numDims, which will be
+ * @returns :: a vector, sized numDims, which will be
  *             filled with the index for each dimension, given the linear index
  */
-inline void getIndicesFromLinearIndex(const size_t linear_index,
-                                      const std::vector<size_t> &num_bins,
-                                      std::vector<size_t> &out_indices) {
-  if (num_bins.empty()) {
-    out_indices.clear();
-    return;
-  } else {
+inline std::vector<size_t>
+getIndicesFromLinearIndex(const size_t linear_index,
+                          const std::vector<size_t> &num_bins) {
+  std::vector<size_t> out_indices;
+  if (!num_bins.empty()) {
     size_t nBins = num_bins.size();
     out_indices.resize(nBins);
     getIndicesFromLinearIndex(linear_index, &num_bins[0], nBins,
                               &out_indices[0]);
   }
+  return out_indices;
 }
 
 /**
diff --git a/Framework/Kernel/inc/MantidKernel/VectorHelper.h b/Framework/Kernel/inc/MantidKernel/VectorHelper.h
index 489b6d1864b0407af065d5b6301f97c7d0980607..0cfb9426b6615e3637b6d7e33df92de7fe6de39f 100644
--- a/Framework/Kernel/inc/MantidKernel/VectorHelper.h
+++ b/Framework/Kernel/inc/MantidKernel/VectorHelper.h
@@ -87,9 +87,9 @@ MANTID_KERNEL_DLL void linearlyInterpolateY(const std::vector<double> &x,
 MANTID_KERNEL_DLL void
 smoothInRange(const std::vector<double> &input, std::vector<double> &output,
               double avrgInterval,
-              std::vector<double> const *const binBoundaris = NULL,
+              std::vector<double> const *const binBoundaris = nullptr,
               size_t startIndex = 0, size_t endIndex = 0,
-              std::vector<double> *const outputBinBoundaries = NULL);
+              std::vector<double> *const outputBinBoundaries = nullptr);
 
 //-------------------------------------------------------------------------------------
 /** Return the length of the vector (in the physical sense),
diff --git a/Framework/Kernel/src/ANN/ANN.cpp b/Framework/Kernel/src/ANN/ANN.cpp
index 3cba35cc6c6c6ba5a6c811683917d91b1de35f4d..27dd75b62716641e73e62d23174524255d23c1aa 100644
--- a/Framework/Kernel/src/ANN/ANN.cpp
+++ b/Framework/Kernel/src/ANN/ANN.cpp
@@ -127,14 +127,14 @@ ANNpointArray annAllocPts(int n, int dim) // allocate n pts in dim
 void annDeallocPt(ANNpoint &p) // deallocate 1 point
 {
   delete[] p;
-  p = NULL;
+  p = nullptr;
 }
 
 void annDeallocPts(ANNpointArray &pa) // deallocate points
 {
   delete[] pa[0]; // dealloc coordinate storage
   delete[] pa;    // dealloc points
-  pa = NULL;
+  pa = nullptr;
 }
 
 ANNpoint annCopyPt(int dim, ANNpoint source) // copy point
diff --git a/Framework/Kernel/src/ANN/bd_tree.cpp b/Framework/Kernel/src/ANN/bd_tree.cpp
index 84ad5bb6652b5aa86d1e08670b52b845446a7b19..9421ce4dcabb7bc36a09b6494c979ff42dba716f 100644
--- a/Framework/Kernel/src/ANN/bd_tree.cpp
+++ b/Framework/Kernel/src/ANN/bd_tree.cpp
@@ -400,8 +400,8 @@ ANNkd_ptr rbd_tree(          // recursive construction of bd-tree
     ANNkd_ptr out = rbd_tree( // build outer subtree pidx[n_in..n]
         pa, pidx + n_in, n - n_in, dim, bsp, bnd_box, splitter, shrink);
 
-    ANNorthHSArray bnds = NULL; // bounds (alloc in Box2Bnds and
-                                // ...freed in bd_shrink destroyer)
+    ANNorthHSArray bnds = nullptr; // bounds (alloc in Box2Bnds and
+                                   // ...freed in bd_shrink destroyer)
 
     annBox2Bnds(   // convert inner box to bounds
         inner_box, // inner box
diff --git a/Framework/Kernel/src/ANN/bd_tree.h b/Framework/Kernel/src/ANN/bd_tree.h
index 0a0b82aaae700dc4e680cffb24fee78a71f9cb8c..b4355711234e6ddaeed0faa463814e385ad88712 100644
--- a/Framework/Kernel/src/ANN/bd_tree.h
+++ b/Framework/Kernel/src/ANN/bd_tree.h
@@ -65,10 +65,10 @@ class ANNbd_shrink : public ANNkd_node // splitting node of a kd-tree
   ANNorthHSArray bnds; // list of bounding halfspaces
   ANNkd_ptr child[2];  // in and out children
 public:
-  ANNbd_shrink(                                 // constructor
-      int nb,                                   // number of bounding halfspaces
-      ANNorthHSArray bds,                       // list of bounding halfspaces
-      ANNkd_ptr ic = NULL, ANNkd_ptr oc = NULL) // children
+  ANNbd_shrink(           // constructor
+      int nb,             // number of bounding halfspaces
+      ANNorthHSArray bds, // list of bounding halfspaces
+      ANNkd_ptr ic = nullptr, ANNkd_ptr oc = nullptr) // children
   {
     n_bnds = nb;        // cutting dimension
     bnds = bds;         // assign bounds
@@ -78,11 +78,11 @@ public:
 
   ~ANNbd_shrink() override // destructor
   {
-    if (child[ANN_IN] != NULL && child[ANN_IN] != KD_TRIVIAL)
+    if (child[ANN_IN] != nullptr && child[ANN_IN] != KD_TRIVIAL)
       delete child[ANN_IN];
-    if (child[ANN_OUT] != NULL && child[ANN_OUT] != KD_TRIVIAL)
+    if (child[ANN_OUT] != nullptr && child[ANN_OUT] != KD_TRIVIAL)
       delete child[ANN_OUT];
-    if (bnds != NULL)
+    if (bnds != nullptr)
       delete[] bnds; // delete bounds
   }
 
diff --git a/Framework/Kernel/src/ANN/brute.cpp b/Framework/Kernel/src/ANN/brute.cpp
index 413cbcfe6c683aa7e766690e1872b19fda2de300..5f2bea9a0716ce7eed53db51c09fb196852b0b94 100644
--- a/Framework/Kernel/src/ANN/brute.cpp
+++ b/Framework/Kernel/src/ANN/brute.cpp
@@ -101,9 +101,9 @@ int ANNbruteForce::annkFRSearch( // approx fixed-radius kNN search
     }
   }
   for (i = 0; i < k; i++) { // extract the k closest points
-    if (dd != NULL)
+    if (dd != nullptr)
       dd[i] = mk.ith_smallest_key(i);
-    if (nn_idx != NULL)
+    if (nn_idx != nullptr)
       nn_idx[i] = mk.ith_smallest_info(i);
   }
 
diff --git a/Framework/Kernel/src/ANN/kd_dump.cpp b/Framework/Kernel/src/ANN/kd_dump.cpp
index eb99a37d414ff2aaefaad18ba3f2f46450b7553c..2410d21cc11b1d116827b30175cdcb2d6c5dd212 100644
--- a/Framework/Kernel/src/ANN/kd_dump.cpp
+++ b/Framework/Kernel/src/ANN/kd_dump.cpp
@@ -131,7 +131,7 @@ void ANNkd_tree::Dump( // dump entire tree
   annPrintPt(bnd_box_hi, dim, out); // print upper bound
   out << "\n";
 
-  if (root == NULL) // empty tree?
+  if (root == nullptr) // empty tree?
     out << "null\n";
   else {
     root->dump(out); // invoke printing at root
@@ -275,7 +275,7 @@ annReadDump(istream &in,              // input stream
   int j;
   char str[STRING_LEN];     // storage for string
   char version[STRING_LEN]; // ANN version number
-  ANNkd_ptr the_root = NULL;
+  ANNkd_ptr the_root = nullptr;
 
   //------------------------------------------------------------------
   //	Input file header
@@ -399,7 +399,7 @@ static ANNkd_ptr annReadTree(istream &in,           // input stream
   in >> tag; // input node tag
 
   if (strcmp(tag, "null") == 0) { // null tree
-    return NULL;
+    return nullptr;
   }
   //------------------------------------------------------------------
   //	Read a leaf
diff --git a/Framework/Kernel/src/ANN/kd_fix_rad_search.cpp b/Framework/Kernel/src/ANN/kd_fix_rad_search.cpp
index 7608a27bba256c86ba8c20056ced29e7b3cfd959..8fd725944d315394655665ad5282772e80f8b0a1 100644
--- a/Framework/Kernel/src/ANN/kd_fix_rad_search.cpp
+++ b/Framework/Kernel/src/ANN/kd_fix_rad_search.cpp
@@ -78,9 +78,9 @@ int ANNkd_tree::annkFRSearch(
   root->ann_FR_search(annBoxDistance(q, bnd_box_lo, bnd_box_hi, dim));
 
   for (int i = 0; i < k; i++) { // extract the k-th closest points
-    if (dd != NULL)
+    if (dd != nullptr)
       dd[i] = ANNkdFRPointMK->ith_smallest_key(i);
-    if (nn_idx != NULL)
+    if (nn_idx != nullptr)
       nn_idx[i] = ANNkdFRPointMK->ith_smallest_info(i);
   }
 
diff --git a/Framework/Kernel/src/ANN/kd_tree.cpp b/Framework/Kernel/src/ANN/kd_tree.cpp
index a19e8e224dea95c0e009d5dc1450fb7c361900a5..7e6151b21f184e80497a085c8c3bf45df020d762 100644
--- a/Framework/Kernel/src/ANN/kd_tree.cpp
+++ b/Framework/Kernel/src/ANN/kd_tree.cpp
@@ -46,8 +46,8 @@
 //	must *never* deallocated (since it may be shared by more than
 //	one tree).
 //----------------------------------------------------------------------
-static int IDX_TRIVIAL[] = {0}; // trivial point index
-ANNkd_leaf *KD_TRIVIAL = NULL;  // trivial leaf node
+static int IDX_TRIVIAL[] = {0};   // trivial point index
+ANNkd_leaf *KD_TRIVIAL = nullptr; // trivial leaf node
 
 //----------------------------------------------------------------------
 //	Printing the kd-tree
@@ -114,7 +114,7 @@ void ANNkd_tree::Print( // print entire tree
       out << "\n";
     }
   }
-  if (root == NULL) // empty tree?
+  if (root == nullptr) // empty tree?
     out << "    Null tree.\n";
   else {
     root->print(0, out); // invoke printing at root
@@ -197,7 +197,7 @@ void ANNkd_tree::getStats( // get tree statistics
   st.reset(dim, n_pts, bkt_size); // reset stats
                                   // create bounding box
   ANNorthRect bnd_box(dim, bnd_box_lo, bnd_box_hi);
-  if (root != NULL) {                 // if nonempty tree
+  if (root != nullptr) {              // if nonempty tree
     root->getStats(dim, st, bnd_box); // get statistics
     st.avg_ar = st.sum_ar / st.n_lf;  // average leaf asp ratio
   }
@@ -211,13 +211,13 @@ void ANNkd_tree::getStats( // get tree statistics
 
 ANNkd_tree::~ANNkd_tree() // tree destructor
 {
-  if (root != NULL)
+  if (root != nullptr)
     delete root;
-  if (pidx != NULL)
+  if (pidx != nullptr)
     delete[] pidx;
-  if (bnd_box_lo != NULL)
+  if (bnd_box_lo != nullptr)
     annDeallocPt(bnd_box_lo);
-  if (bnd_box_hi != NULL)
+  if (bnd_box_hi != nullptr)
     annDeallocPt(bnd_box_hi);
 }
 
@@ -227,9 +227,9 @@ ANNkd_tree::~ANNkd_tree() // tree destructor
 //----------------------------------------------------------------------
 void annClose() // close use of ANN
 {
-  if (KD_TRIVIAL != NULL) {
+  if (KD_TRIVIAL != nullptr) {
     delete KD_TRIVIAL;
-    KD_TRIVIAL = NULL;
+    KD_TRIVIAL = nullptr;
   }
 }
 
@@ -260,9 +260,9 @@ void ANNkd_tree::SkeletonTree( // construct skeleton tree
   bkt_size = bs;
   pts = pa; // initialize points array
 
-  root = NULL; // no associated tree yet
+  root = nullptr; // no associated tree yet
 
-  if (pi == NULL) {       // point indices provided?
+  if (pi == nullptr) {    // point indices provided?
     pidx = new ANNidx[n]; // no, allocate space for point indices
     for (int i = 0; i < n; i++) {
       pidx[i] = i; // initially identity
@@ -271,8 +271,8 @@ void ANNkd_tree::SkeletonTree( // construct skeleton tree
     pidx = pi; // yes, use them
   }
 
-  bnd_box_lo = bnd_box_hi = NULL;                // bounding box is nonexistent
-  if (KD_TRIVIAL == NULL)                        // no trivial leaf node yet?
+  bnd_box_lo = bnd_box_hi = nullptr;             // bounding box is nonexistent
+  if (KD_TRIVIAL == nullptr)                     // no trivial leaf node yet?
     KD_TRIVIAL = new ANNkd_leaf(0, IDX_TRIVIAL); // allocate it
 }
 
diff --git a/Framework/Kernel/src/ANN/kd_tree.h b/Framework/Kernel/src/ANN/kd_tree.h
index d4a2dd4c0304d7caf45a1072a6cf05a9c70d0631..0d760f7a52d9cffafaa37222ab2cf52502b4e39c 100644
--- a/Framework/Kernel/src/ANN/kd_tree.h
+++ b/Framework/Kernel/src/ANN/kd_tree.h
@@ -151,11 +151,11 @@ class ANNkd_split : public ANNkd_node // splitting node of a kd-tree
                        // rectangle along cut_dim
   ANNkd_ptr child[2];  // left and right children
 public:
-  ANNkd_split(                                  // constructor
-      int cd,                                   // cutting dimension
-      ANNcoord cv,                              // cutting value
-      ANNcoord lv, ANNcoord hv,                 // low and high values
-      ANNkd_ptr lc = NULL, ANNkd_ptr hc = NULL) // children
+  ANNkd_split(                                        // constructor
+      int cd,                                         // cutting dimension
+      ANNcoord cv,                                    // cutting value
+      ANNcoord lv, ANNcoord hv,                       // low and high values
+      ANNkd_ptr lc = nullptr, ANNkd_ptr hc = nullptr) // children
   {
     cut_dim = cd;         // cutting dimension
     cut_val = cv;         // cutting value
@@ -167,9 +167,9 @@ public:
 
   ~ANNkd_split() override // destructor
   {
-    if (child[ANN_LO] != NULL && child[ANN_LO] != KD_TRIVIAL)
+    if (child[ANN_LO] != nullptr && child[ANN_LO] != KD_TRIVIAL)
       delete child[ANN_LO];
-    if (child[ANN_HI] != NULL && child[ANN_HI] != KD_TRIVIAL)
+    if (child[ANN_HI] != nullptr && child[ANN_HI] != KD_TRIVIAL)
       delete child[ANN_HI];
   }
 
diff --git a/Framework/Kernel/src/CompositeValidator.cpp b/Framework/Kernel/src/CompositeValidator.cpp
index 770bbdc0261f37bf6c4ce59beb59a66d46492c57..b87ecc4f290104bb1ed23eca042d291e5ac90418 100644
--- a/Framework/Kernel/src/CompositeValidator.cpp
+++ b/Framework/Kernel/src/CompositeValidator.cpp
@@ -1,4 +1,5 @@
 #include "MantidKernel/CompositeValidator.h"
+#include <unordered_set>
 
 using namespace Mantid::Kernel;
 
@@ -11,13 +12,13 @@ CompositeValidator::CompositeValidator() : IValidator(), m_children() {}
 CompositeValidator::~CompositeValidator() { m_children.clear(); }
 
 /**
- * The allowed values for the composite vaidator. This returns
+ * The allowed values for the composite validator. This returns
  * the intersection of the allowedValues for the child validators
  * @return
  */
 std::vector<std::string> CompositeValidator::allowedValues() const {
-  std::set<std::string> elem_unique;
-  std::multiset<std::string> elem_all;
+  std::unordered_set<std::string> elem_unique;
+  std::unordered_multiset<std::string> elem_all;
   // how many validators return non-empty list of allowed values
   int n_combinations(0);
   for (const auto &itr : m_children) {
@@ -36,7 +37,7 @@ std::vector<std::string> CompositeValidator::allowedValues() const {
     auto im = elem_all.find(its);
     elem_all.erase(im);
   }
-  std::set<std::string> rez;
+  std::unordered_set<std::string> rez;
   for (const auto &im : elem_all) {
     rez.insert(im);
   }
diff --git a/Framework/Kernel/src/ConfigService.cpp b/Framework/Kernel/src/ConfigService.cpp
index 89c7012edfc3c4094d3ada345226b3bca1c81223..b851bec456774f8510d77e8ea8305be6f1cbab65 100644
--- a/Framework/Kernel/src/ConfigService.cpp
+++ b/Framework/Kernel/src/ConfigService.cpp
@@ -19,7 +19,7 @@
 #include <Poco/LoggingFactory.h>
 #include <Poco/Path.h>
 #include <Poco/File.h>
-#include <Poco/StringTokenizer.h>
+#include <MantidKernel/StringTokenizer.h>
 #include <Poco/DOM/DOMParser.h>
 #include <Poco/DOM/Document.h>
 #include <Poco/DOM/NodeList.h>
@@ -70,26 +70,25 @@ Logger g_log("ConfigService");
  * Split the supplied string on semicolons.
  *
  * @param path The path to split.
- * @param splitted vector to put the splitted path into.
+ * @returns vector containing the splitted path.
  */
-void splitPath(const std::string &path, std::vector<std::string> &splitted) {
+std::vector<std::string> splitPath(const std::string &path) {
+  std::vector<std::string> splitted;
+
   if (path.find(";") == std::string::npos) { // don't bother tokenizing
     splitted.push_back(path);
-    return;
-  }
-
-  int options =
-      Poco::StringTokenizer::TOK_TRIM + Poco::StringTokenizer::TOK_IGNORE_EMPTY;
-
-  splitted.clear();
-  Poco::StringTokenizer tokenizer(path, ";,", options);
-  auto iend = tokenizer.end();
-  splitted.reserve(tokenizer.count());
-  for (auto itr = tokenizer.begin(); itr != iend; ++itr) {
-    if (!itr->empty()) {
-      splitted.push_back(*itr);
+  } else {
+    int options = Mantid::Kernel::StringTokenizer::TOK_TRIM +
+                  Mantid::Kernel::StringTokenizer::TOK_IGNORE_EMPTY;
+    Mantid::Kernel::StringTokenizer tokenizer(path, ";,", options);
+    auto iend = tokenizer.end();
+    for (auto itr = tokenizer.begin(); itr != iend; ++itr) {
+      if (!itr->empty()) {
+        splitted.push_back(*itr);
+      }
     }
   }
+  return splitted;
 }
 
 } // end of anonymous namespace
@@ -506,11 +505,9 @@ std::string ConfigServiceImpl::makeAbsolute(const std::string &dir,
   std::string converted;
   // If we have a list, chop it up and convert each one
   if (dir.find_first_of(";,") != std::string::npos) {
-    std::vector<std::string> splitted;
-    splitPath(dir, splitted);
-    std::vector<std::string>::const_iterator iend = splitted.end();
-    for (std::vector<std::string>::const_iterator itr = splitted.begin();
-         itr != iend;) {
+    auto splitted = splitPath(dir);
+    auto iend = splitted.cend();
+    for (auto itr = splitted.begin(); itr != iend;) {
       std::string absolute = makeAbsolute(*itr, key);
       if (absolute.empty()) {
         ++itr;
@@ -581,12 +578,12 @@ std::string ConfigServiceImpl::makeAbsolute(const std::string &dir,
  * The value of the key should be a semi-colon separated list of directories
  */
 void ConfigServiceImpl::cacheDataSearchPaths() {
-  m_DataSearchDirs.clear();
   std::string paths = getString("datasearch.directories");
-  // Nothing to do
-  if (paths.empty())
-    return;
-  splitPath(paths, m_DataSearchDirs);
+  if (paths.empty()) {
+    m_DataSearchDirs.clear();
+  } else {
+    m_DataSearchDirs = splitPath(paths);
+  }
 }
 
 /**
@@ -597,10 +594,11 @@ void ConfigServiceImpl::cacheDataSearchPaths() {
 void ConfigServiceImpl::cacheUserSearchPaths() {
   m_UserSearchDirs.clear();
   std::string paths = getString("usersearch.directories");
-  // Nothing to do
-  if (paths.empty())
-    return;
-  splitPath(paths, m_UserSearchDirs);
+  if (paths.empty()) {
+    m_UserSearchDirs.clear();
+  } else {
+    m_UserSearchDirs = splitPath(paths);
+  }
 }
 
 /**
diff --git a/Framework/Kernel/src/FacilityInfo.cpp b/Framework/Kernel/src/FacilityInfo.cpp
index 063883f7d4fe3e7f0923d27b8fc6e2314e629086..af22e665adac4eb1aaf0bfbfcf2c70cd7da35435 100644
--- a/Framework/Kernel/src/FacilityInfo.cpp
+++ b/Framework/Kernel/src/FacilityInfo.cpp
@@ -14,7 +14,7 @@
 
 #include <Poco/DOM/Element.h>
 #include <Poco/DOM/NodeList.h>
-#include <Poco/StringTokenizer.h>
+#include <MantidKernel/StringTokenizer.h>
 
 using Poco::XML::Element;
 
@@ -72,7 +72,7 @@ void FacilityInfo::fillExtensions(const Poco::XML::Element *elem) {
     g_log.error("No file extensions defined");
     throw std::runtime_error("No file extensions defined");
   }
-  typedef Poco::StringTokenizer tokenizer;
+  typedef Mantid::Kernel::StringTokenizer tokenizer;
   tokenizer exts(extsStr, ",",
                  tokenizer::TOK_IGNORE_EMPTY | tokenizer::TOK_TRIM);
   for (const auto &ext : exts) {
diff --git a/Framework/Kernel/src/FilterChannel.cpp b/Framework/Kernel/src/FilterChannel.cpp
index d2b1529b199ca065f5f4bb9924708cce291ff4d1..b888ca2d4b10a1f57df8081f6317b1a80869847c 100644
--- a/Framework/Kernel/src/FilterChannel.cpp
+++ b/Framework/Kernel/src/FilterChannel.cpp
@@ -2,7 +2,7 @@
 #include "MantidKernel/FilterChannel.h"
 
 #include <Poco/LoggingRegistry.h>
-#include <Poco/StringTokenizer.h>
+#include <MantidKernel/StringTokenizer.h>
 #include <Poco/Message.h>
 
 namespace Poco {
@@ -22,8 +22,9 @@ void FilterChannel::addChannel(Channel *pChannel) {
 void FilterChannel::setProperty(const std::string &name,
                                 const std::string &value) {
   if (name.compare(0, 7, "channel") == 0) {
-    StringTokenizer tokenizer(value, ",;", StringTokenizer::TOK_IGNORE_EMPTY |
-                                               StringTokenizer::TOK_TRIM);
+    Mantid::Kernel::StringTokenizer tokenizer(
+        value, ",;", Mantid::Kernel::StringTokenizer::TOK_IGNORE_EMPTY |
+                         Mantid::Kernel::StringTokenizer::TOK_TRIM);
     for (const auto &piece : tokenizer) {
       addChannel(LoggingRegistry::defaultRegistry().channelForName(piece));
     }
diff --git a/Framework/Kernel/src/Interpolation.cpp b/Framework/Kernel/src/Interpolation.cpp
index 5ccaa452831e6e20ca338a6d8414b05257f2b322..1307286d3bb37cb64e06c2329b3cc0c8173e62a3 100644
--- a/Framework/Kernel/src/Interpolation.cpp
+++ b/Framework/Kernel/src/Interpolation.cpp
@@ -1,7 +1,7 @@
 #include "MantidKernel/Interpolation.h"
 #include "MantidKernel/Logger.h"
 #include "MantidKernel/UnitFactory.h"
-#include <Poco/StringTokenizer.h>
+#include <MantidKernel/StringTokenizer.h>
 
 namespace Mantid {
 namespace Kernel {
@@ -170,7 +170,7 @@ std::ostream &operator<<(std::ostream &os, const Interpolation &f) {
 */
 std::istream &operator>>(std::istream &in, Interpolation &f) {
 
-  typedef Poco::StringTokenizer tokenizer;
+  typedef Mantid::Kernel::StringTokenizer tokenizer;
   std::string str;
   getline(in, str);
   tokenizer values(str, ";", tokenizer::TOK_TRIM);
diff --git a/Framework/Kernel/src/LibraryManager.cpp b/Framework/Kernel/src/LibraryManager.cpp
index 94a777034466932bbdcd11af854c3589a85a0802..7ba649cb5f235bf07a74d18ddf4459acd3d2e5f7 100644
--- a/Framework/Kernel/src/LibraryManager.cpp
+++ b/Framework/Kernel/src/LibraryManager.cpp
@@ -10,6 +10,7 @@
 #include <Poco/DirectoryIterator.h>
 #include <boost/algorithm/string.hpp>
 #include <boost/make_shared.hpp>
+#include <unordered_set>
 
 namespace Mantid {
 namespace Kernel {
@@ -80,7 +81,7 @@ int LibraryManagerImpl::OpenAllLibraries(const std::string &filePath,
  * @return True if the library should be skipped
  */
 bool LibraryManagerImpl::skip(const std::string &filename) {
-  static std::set<std::string> excludes;
+  static std::unordered_set<std::string> excludes;
   static bool initialized(false);
   if (!initialized) {
     std::string excludeStr =
diff --git a/Framework/Kernel/src/MDUnitFactory.cpp b/Framework/Kernel/src/MDUnitFactory.cpp
index 396cbd9ff2963c9b16a6ce41a0d43ef245e65537..e70740ba804e0fff9c4b9095f1f2acca93ea5f1f 100644
--- a/Framework/Kernel/src/MDUnitFactory.cpp
+++ b/Framework/Kernel/src/MDUnitFactory.cpp
@@ -1,3 +1,4 @@
+#include "MantidKernel/make_unique.h"
 #include "MantidKernel/MDUnitFactory.h"
 #include "MantidKernel/MDUnit.h"
 #include "MantidKernel/UnitLabel.h"
@@ -50,13 +51,12 @@ bool ReciprocalLatticeUnitFactory::canInterpret(
 }
 
 MDUnitFactory_uptr makeMDUnitFactoryChain() {
-  typedef MDUnitFactory_uptr FactoryType;
-  auto first = FactoryType(new ReciprocalLatticeUnitFactory);
-  first->setSuccessor(FactoryType(new InverseAngstromsUnitFactory))
+  MDUnitFactory_uptr first = make_unique<ReciprocalLatticeUnitFactory>();
+  first->setSuccessor(make_unique<InverseAngstromsUnitFactory>())
       // Add more factories here!
       // Make sure that LabelUnitFactory is the last in the chain to give a fall
       // through
-      .setSuccessor(FactoryType(new LabelUnitFactory));
+      .setSuccessor(make_unique<LabelUnitFactory>());
   return first;
 }
 
diff --git a/Framework/Kernel/src/MagneticIon.cpp b/Framework/Kernel/src/MagneticIon.cpp
index 68e854aa357ffc12957bde4b6a6534e88bd8fc8a..5da93fce5e1dec945fc064e653393e83b1e67727 100644
--- a/Framework/Kernel/src/MagneticIon.cpp
+++ b/Framework/Kernel/src/MagneticIon.cpp
@@ -2,6 +2,7 @@
 #include "MantidKernel/Exception.h"
 
 #include <sstream>
+#include <unordered_map>
 
 namespace Mantid {
 namespace PhysicalConstants {
@@ -18,7 +19,7 @@ MagneticIon::MagneticIon()
  * @param j4i :: Form factor coefficients for n = 4
  * @param j6i :: Form factor coefficients for n = 6
  */
-MagneticIon::MagneticIon(const std::string symbol, const uint16_t charge,
+MagneticIon::MagneticIon(const char *symbol, const uint16_t charge,
                          const double j0i[8], const double j2i[8],
                          const double j4i[8], const double j6i[8])
     : symbol(symbol), charge(charge), j0(j0i, j0i + 8), j2(j2i, j2i + 8),
@@ -79,477 +80,477 @@ namespace {
 // Windows will not accept array initializer syntax within a constructor so put
 // the various j_i definitions here
 // The format is { j0, j2, j4, j6 }
-double j_Sc0[4][8] = {
+constexpr double j_Sc0[4][8] = {
     {0.2512, 90.03, 0.329, 39.402, 0.4235, 14.322, -0.0043, 0.2029},  // <j0>
     {10.8172, 54.327, 4.7353, 14.847, 0.6071, 4.218, 0.0011, 0.1212}, // <j2>
     {1.342, 10.2, 0.3837, 3.079, 0.0468, 0.118, -0.0328, 0.1343},     // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                        // <j6>
-double j_Sc1[4][8] = {
+constexpr double j_Sc1[4][8] = {
     {0.4889, 51.16, 0.5203, 14.076, -0.0286, 0.179, 0.0185, 0.1217}, // <j0>
     {8.5021, 34.285, 3.2116, 10.994, 0.4244, 3.605, 0.0009, 0.1037}, // <j2>
     {7.1167, 15.487, -6.6671, 18.269, 0.49, 2.992, 0.0047, 0.1624},  // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                       // <j6>
-double j_Sc2[4][8] = {
+constexpr double j_Sc2[4][8] = {
     {0.5048, 31.403, 0.5186, 10.99, -0.0241, 1.183, 0, 0.0578},      // <j0>
     {4.3683, 28.654, 3.7231, 10.823, 0.6074, 3.668, 0.0014, 0.0681}, // <j2>
     {-1.6684, 15.648, 1.7742, 9.062, 0.4075, 2.412, 0.0042, 0.1105}, // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                       // <j6>
-double j_Ti0[4][8] = {
+constexpr double j_Ti0[4][8] = {
     {0.4657, 33.59, 0.549, 9.879, -0.0291, 0.323, 0.0123, 0.1088},   // <j0>
     {4.3583, 36.056, 3.823, 11.133, 0.6855, 3.469, 0.002, 0.0967},   // <j2>
     {-2.1515, 11.271, 2.5149, 8.859, 0.3555, 2.149, 0.0045, 0.1244}, // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                       // <j6>
-double j_Ti1[4][8] = {
+constexpr double j_Ti1[4][8] = {
     {0.5093, 36.703, 0.5032, 10.371, -0.0263, 0.311, 0.0116, 0.1125}, // <j0>
     {6.1567, 27.275, 2.6833, 8.983, 0.407, 3.052, 0.0011, 0.0902},    // <j2>
     {-1.0383, 16.19, 1.4699, 8.924, 0.3631, 2.283, 0.0044, 0.127},    // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                        // <j6>
-double j_Ti2[4][8] = {
+constexpr double j_Ti2[4][8] = {
     {0.5091, 24.976, 0.5162, 8.757, -0.0281, 0.916, 0.0015, 0.0589}, // <j0>
     {4.3107, 18.348, 2.096, 6.797, 0.2984, 2.548, 0.0007, 0.064},    // <j2>
     {-1.3242, 15.31, 1.2042, 7.899, 0.3976, 2.156, 0.0051, 0.082},   // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                       // <j6>
-double j_Ti3[4][8] = {
+constexpr double j_Ti3[4][8] = {
     {0.3571, 22.841, 0.6688, 8.931, -0.0354, 0.483, 0.0099, 0.0575}, // <j0>
     {3.3717, 14.444, 1.8258, 5.713, 0.247, 2.265, 0.0005, 0.0491},   // <j2>
     {-1.1117, 14.635, 0.7689, 6.927, 0.4385, 2.089, 0.006, 0.0572},  // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                       // <j6>
-double j_V0[4][8] = {
+constexpr double j_V0[4][8] = {
     {0.4086, 28.811, 0.6077, 8.544, -0.0295, 0.277, 0.0123, 0.097}, // <j0>
     {3.76, 21.831, 2.4026, 7.546, 0.4464, 2.663, 0.0017, 0.0556},   // <j2>
     {-0.9633, 15.273, 0.9274, 7.732, 0.3891, 2.053, 0.0063, 0.084}, // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                      // <j6>
-double j_V1[4][8] = {
+constexpr double j_V1[4][8] = {
     {0.4444, 32.648, 0.5683, 9.097, -0.2285, 0.022, 0.215, 0.1111},  // <j0>
     {4.7474, 23.323, 2.3609, 7.808, 0.4105, 2.706, 0.0014, 0.08},    // <j2>
     {-0.9606, 15.545, 1.1278, 8.118, 0.3653, 2.097, 0.0056, 0.1027}, // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                       // <j6>
-double j_V2[4][8] = {
+constexpr double j_V2[4][8] = {
     {0.4085, 23.853, 0.6091, 8.246, -0.1676, 0.041, 0.1496, 0.0593}, // <j0>
     {3.4386, 16.53, 1.9638, 6.141, 0.2997, 2.267, 0.0009, 0.0565},   // <j2>
     {-1.1729, 14.973, 0.9092, 7.613, 0.4105, 2.039, 0.0067, 0.0719}, // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                       // <j6>
-double j_V3[4][8] = {
+constexpr double j_V3[4][8] = {
     {0.3598, 19.336, 0.6632, 7.617, -0.3064, 0.03, 0.2835, 0.0515},  // <j0>
     {2.3005, 14.682, 2.0364, 6.13, 0.4099, 2.382, 0.0014, 0.0252},   // <j2>
     {-0.9417, 14.205, 0.5284, 6.607, 0.4411, 1.967, 0.0076, 0.0569}, // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                       // <j6>
-double j_V4[4][8] = {
+constexpr double j_V4[4][8] = {
     {0.3106, 16.816, 0.7198, 7.049, -0.0521, 0.302, 0.0221, 0.0433}, // <j0>
     {1.8377, 12.267, 1.8247, 5.458, 0.3979, 2.248, 0.0012, 0.0399},  // <j2>
     {-0.7654, 13.097, 0.3071, 5.674, 0.4476, 1.871, 0.0081, 0.0518}, // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                       // <j6>
-double j_Cr0[4][8] = {
+constexpr double j_Cr0[4][8] = {
     {0.1135, 45.199, 0.3481, 19.493, 0.5477, 7.354, -0.0092, 0.1975}, // <j0>
     {3.4085, 20.127, 2.1006, 6.802, 0.4266, 2.394, 0.0019, 0.0662},   // <j2>
     {-0.667, 19.613, 0.5342, 6.478, 0.3641, 1.905, 0.0073, 0.0628},   // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                        // <j6>
-double j_Cr1[4][8] = {
+constexpr double j_Cr1[4][8] = {
     {-0.0977, 0.047, 0.4544, 26.005, 0.5579, 7.489, 0.0831, 0.1114}, // <j0>
     {3.7768, 20.346, 2.1028, 6.893, 0.401, 2.411, 0.0017, 0.0686},   // <j2>
     {-0.8309, 18.043, 0.7252, 7.531, 0.3828, 2.003, 0.0073, 0.0781}, // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                       // <j6>
-double j_Cr2[4][8] = {
+constexpr double j_Cr2[4][8] = {
     {1.2024, -0.005, 0.4158, 20.548, 0.6032, 6.956, -1.2218, 0.0572}, // <j0>
     {2.6422, 16.06, 1.9198, 6.253, 0.4446, 2.372, 0.002, 0.048},      // <j2>
     {-0.893, 15.664, 0.559, 7.033, 0.4093, 1.924, 0.0081, 0.0631},    // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                        // <j6>
-double j_Cr3[4][8] = {
+constexpr double j_Cr3[4][8] = {
     {-0.3094, 0.027, 0.368, 17.035, 0.6559, 6.524, 0.2856, 0.0436}, // <j0>
     {1.6262, 15.066, 2.0618, 6.284, 0.5281, 2.368, 0.0023, 0.0263}, // <j2>
     {-0.7327, 14.073, 0.3268, 5.674, 0.4114, 1.81, 0.0085, 0.0505}, // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                      // <j6>
-double j_Cr4[4][8] = {
+constexpr double j_Cr4[4][8] = {
     {-0.232, 0.043, 0.3101, 14.952, 0.7182, 6.173, 0.2042, 0.0419}, // <j0>
     {1.0293, 13.95, 1.9933, 6.059, 0.5974, 2.346, 0.0027, 0.0366},  // <j2>
     {-0.6748, 12.946, 0.1805, 6.753, 0.4526, 1.8, 0.0098, 0.0644},  // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                      // <j6>
-double j_Mn0[4][8] = {
+constexpr double j_Mn0[4][8] = {
     {0.2438, 24.963, 0.1472, 15.673, 0.6189, 6.54, -0.0105, 0.1748}, // <j0>
     {2.6681, 16.06, 1.7561, 5.64, 0.3675, 2.049, 0.0017, 0.0595},    // <j2>
     {-0.5452, 15.471, 0.4406, 4.902, 0.2884, 1.543, 0.0059, 0.0488}, // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                       // <j6>
-double j_Mn1[4][8] = {
+constexpr double j_Mn1[4][8] = {
     {-0.0138, 0.421, 0.4231, 24.668, 0.5905, 6.655, -0.001, 0.1242}, // <j0>
     {3.2953, 18.695, 1.8792, 6.24, 0.3927, 2.201, 0.0022, 0.0659},   // <j2>
     {-0.7947, 17.867, 0.6078, 7.704, 0.3798, 1.905, 0.0087, 0.0737}, // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                       // <j6>
-double j_Mn2[4][8] = {
+constexpr double j_Mn2[4][8] = {
     {0.422, 17.684, 0.5948, 6.005, 0.0043, -0.609, -0.0219, 0.0589}, // <j0>
     {2.0515, 15.556, 1.8841, 6.063, 0.4787, 2.232, 0.0027, 0.0306},  // <j2>
     {-0.7416, 15.255, 0.3831, 6.469, 0.3935, 1.8, 0.0093, 0.0577},   // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                       // <j6>
-double j_Mn3[4][8] = {
+constexpr double j_Mn3[4][8] = {
     {0.4198, 14.283, 0.6054, 5.469, 0.9241, -0.009, -0.9498, 0.0392}, // <j0>
     {1.2427, 14.997, 1.9567, 6.118, 0.5732, 2.258, 0.0031, 0.0336},   // <j2>
     {-0.6603, 13.607, 0.2322, 6.218, 0.4104, 1.74, 0.0101, 0.0579},   // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                        // <j6>
-double j_Mn4[4][8] = {
+constexpr double j_Mn4[4][8] = {
     {0.376, 12.566, 0.6602, 5.133, -0.0372, 0.563, 0.0011, 0.0393},  // <j0>
     {0.7879, 13.886, 1.8717, 5.743, 0.5981, 2.182, 0.0034, 0.0434},  // <j2>
     {-0.5127, 13.461, 0.0313, 7.763, 0.4282, 1.701, 0.0113, 0.0693}, // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                       // <j6>
-double j_Fe0[4][8] = {
+constexpr double j_Fe0[4][8] = {
     {0.0706, 35.008, 0.3589, 15.358, 0.5819, 5.561, -0.0114, 0.1398}, // <j0>
     {1.9405, 18.473, 1.9566, 6.323, 0.5166, 2.161, 0.0036, 0.0394},   // <j2>
     {-0.5029, 19.677, 0.2999, 3.776, 0.2576, 1.424, 0.0071, 0.0292},  // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                        // <j6>
-double j_Fe1[4][8] = {
+constexpr double j_Fe1[4][8] = {
     {0.1251, 34.963, 0.3629, 15.514, 0.5223, 5.591, -0.0105, 0.1301}, // <j0>
     {2.629, 18.66, 1.8704, 6.331, 0.469, 2.163, 0.0031, 0.0491},      // <j2>
     {-0.5109, 19.25, 0.3896, 4.891, 0.281, 1.526, 0.0069, 0.0375},    // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                        // <j6>
-double j_Fe2[4][8] = {
+constexpr double j_Fe2[4][8] = {
     {0.0263, 34.96, 0.3668, 15.943, 0.6188, 5.594, -0.0119, 0.1437}, // <j0>
     {1.649, 16.559, 1.9064, 6.133, 0.5206, 2.137, 0.0035, 0.0335},   // <j2>
     {-0.5401, 17.227, 0.2865, 3.742, 0.2658, 1.424, 0.0076, 0.0278}, // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                       // <j6>
-double j_Fe3[4][8] = {
+constexpr double j_Fe3[4][8] = {
     {0.3972, 13.244, 0.6295, 4.903, -0.0314, 0.35, 0.0044, 0.0441},  // <j0>
     {1.3602, 11.998, 1.5188, 5.003, 0.4705, 1.991, 0.0038, 0.0374},  // <j2>
     {-0.5507, 11.493, 0.2153, 4.906, 0.3468, 1.523, 0.0095, 0.0314}, // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                       // <j6>
-double j_Fe4[4][8] = {
+constexpr double j_Fe4[4][8] = {
     {0.3782, 11.38, 0.6556, 4.592, -0.0346, 0.483, 0.0005, 0.0362}, // <j0>
     {1.5582, 8.275, 1.1863, 3.279, 0.1366, 1.107, -0.0022, 0.0327}, // <j2>
     {-0.5352, 9.507, 0.1783, 5.175, 0.3584, 1.469, 0.0097, 0.036},  // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                      // <j6>
-double j_Co0[4][8] = {
+constexpr double j_Co0[4][8] = {
     {0.4139, 16.162, 0.6013, 4.78, -0.1518, 0.021, 0.1345, 0.1033}, // <j0>
     {1.9678, 14.17, 1.4911, 4.948, 0.3844, 1.797, 0.0027, 0.0452},  // <j2>
     {-0.4221, 14.195, 0.29, 3.979, 0.2469, 1.286, 0.0063, 0.04},    // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                      // <j6>
-double j_Co1[4][8] = {
+constexpr double j_Co1[4][8] = {
     {0.099, 33.125, 0.3645, 15.177, 0.547, 5.008, -0.0109, 0.0983}, // <j0>
     {2.4097, 16.161, 1.578, 5.46, 0.4095, 1.914, 0.0031, 0.0581},   // <j2>
     {-0.4115, 14.561, 0.358, 4.717, 0.2644, 1.418, 0.0074, 0.0541}, // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                      // <j6>
-double j_Co2[4][8] = {
+constexpr double j_Co2[4][8] = {
     {0.4332, 14.355, 0.5857, 4.608, -0.0382, 0.134, 0.0179, 0.0711}, // <j0>
     {1.9049, 11.644, 1.3159, 4.357, 0.3146, 1.645, 0.0017, 0.0459},  // <j2>
     {0.4759, 14.046, 0.2747, 3.731, 0.2458, 1.25, 0.0057, 0.0282},   // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                       // <j6>
-double j_Co3[4][8] = {
+constexpr double j_Co3[4][8] = {
     {0.3902, 12.508, 0.6324, 4.457, -0.15, 0.034, 0.1272, 0.0515},   // <j0>
     {1.7058, 8.859, 1.1409, 3.309, 0.1474, 1.09, -0.0025, 0.0462},   // <j2>
     {-0.4466, 13.391, 0.1419, 3.011, 0.2773, 1.335, 0.0093, 0.0341}, // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                       // <j6>
-double j_Co4[4][8] = {
+constexpr double j_Co4[4][8] = {
     {0.3515, 10.778, 0.6778, 4.234, -0.0389, 0.241, 0.0098, 0.039},   // <j0>
     {1.311, 8.025, 1.1551, 3.179, 0.1608, 1.13, -0.0011, 0.0374},     // <j2>
     {-0.4091, 13.194, -0.0194, 3.417, 0.3534, 1.421, 0.0112, 0.0622}, // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                        // <j6>
-double j_Ni0[4][8] = {
+constexpr double j_Ni0[4][8] = {
     {-0.0172, 35.739, 0.3174, 14.269, 0.7136, 4.566, -0.0143, 0.1072}, // <j0>
     {1.0302, 12.252, 1.4669, 4.745, 0.4521, 1.744, 0.0036, 0.0338},    // <j2>
     {-0.4428, 14.485, 0.087, 3.234, 0.2932, 1.331, 0.0096, 0.0554},    // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                         // <j6>
-double j_Ni1[4][8] = {
+constexpr double j_Ni1[4][8] = {
     {0.0705, 35.856, 0.3984, 13.804, 0.5427, 4.397, -0.0118, 0.0738}, // <j0>
     {2.104, 14.866, 1.4302, 5.071, 0.4031, 1.778, 0.0034, 0.0561},    // <j2>
     {-0.3836, 13.425, 0.3116, 4.462, 0.2471, 1.309, 0.0079, 0.0515},  // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                        // <j6>
-double j_Ni2[4][8] = {
+constexpr double j_Ni2[4][8] = {
     {0.0163, 35.883, 0.3916, 13.223, 0.6052, 4.339, -0.0133, 0.0817}, // <j0>
     {1.708, 11.016, 1.2147, 4.103, 0.315, 1.533, 0.0018, 0.0446},     // <j2>
     {-0.3803, 10.403, 0.2838, 3.378, 0.2108, 1.104, 0.005, 0.0474},   // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                        // <j6>
-double j_Ni3[4][8] = {
+constexpr double j_Ni3[4][8] = {
     {0.0012, 35, 0.3468, 11.987, 0.6667, 4.252, -0.0148, 0.0883},   // <j0>
     {1.4683, 8.671, 0.1794, 1.106, 1.1068, 3.257, -0.0023, 0.0373}, // <j2>
     {-0.4014, 9.046, 0.2314, 3.075, 0.2192, 1.084, 0.006, 0.0323},  // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                      // <j6>
-double j_Ni4[4][8] = {
+constexpr double j_Ni4[4][8] = {
     {-0.009, 35.861, 0.2776, 11.79, 0.7474, 4.201, -0.0163, 0.0966}, // <j0>
     {1.1612, 7.7, 1.0027, 3.263, 0.2719, 1.378, 0.0025, 0.0326},     // <j2>
     {-0.3509, 8.157, 0.222, 2.106, 0.1567, 0.925, 0.0065, 0.0352},   // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                       // <j6>
-double j_Cu0[4][8] = {
+constexpr double j_Cu0[4][8] = {
     {0.0909, 34.984, 0.4088, 11.443, 0.5128, 3.825, -0.0124, 0.0513}, // <j0>
     {1.9182, 14.49, 1.3329, 4.73, 0.3842, 1.639, 0.0035, 0.0617},     // <j2>
     {-0.3204, 15.132, 0.2335, 4.021, 0.2312, 1.196, 0.0068, 0.0457},  // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                        // <j6>
-double j_Cu1[4][8] = {
+constexpr double j_Cu1[4][8] = {
     {0.0749, 34.966, 0.4147, 11.764, 0.5238, 3.85, -0.0127, 0.0591}, // <j0>
     {1.8814, 13.433, 1.2809, 4.545, 0.3646, 1.602, 0.0033, 0.059},   // <j2>
     {-0.3572, 15.125, 0.2336, 3.966, 0.2315, 1.197, 0.007, 0.0397},  // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                       // <j6>
-double j_Cu2[4][8] = {
+constexpr double j_Cu2[4][8] = {
     {0.0232, 34.969, 0.4023, 11.564, 0.5882, 3.843, -0.0137, 0.0532}, // <j0>
     {1.5189, 10.478, 1.1512, 3.813, 0.2918, 1.398, 0.0017, 0.0429},   // <j2>
     {-0.3914, 14.74, 0.1275, 3.384, 0.2548, 1.255, 0.0103, 0.0394},   // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                        // <j6>
-double j_Cu3[4][8] = {
+constexpr double j_Cu3[4][8] = {
     {0.0031, 34.907, 0.3582, 10.914, 0.6531, 3.828, -0.0147, 0.0665}, // <j0>
     {1.2797, 8.45, 1.0315, 3.28, 0.2401, 1.25, 0.0015, 0.0389},       // <j2>
     {-0.3671, 14.082, -0.0078, 3.315, 0.3154, 1.377, 0.0132, 0.0534}, // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                        // <j6>
-double j_Cu4[4][8] = {
+constexpr double j_Cu4[4][8] = {
     {-0.0132, 30.682, 0.2801, 11.163, 0.749, 3.817, -0.0165, 0.0767}, // <j0>
     {0.9568, 7.448, 0.9099, 3.396, 0.3729, 1.494, 0.0049, 0.033},     // <j2>
     {-0.2915, 14.124, -0.1065, 4.201, 0.3247, 1.352, 0.0148, 0.0579}, // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                        // <j6>
-double j_Y0[4][8] = {
+constexpr double j_Y0[4][8] = {
     {0.5915, 67.608, 1.5123, 17.9, -1.113, 14.136, 0.008, 0.3272},     // <j0>
     {14.4084, 44.658, 5.1045, 14.904, -0.0535, 3.319, 0.0028, 0.1093}, // <j2>
     {-8.0767, 32.201, 7.9197, 25.156, 1.4067, 6.827, -0.0001, 0.1031}, // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                         // <j6>
-double j_Zr0[4][8] = {
+constexpr double j_Zr0[4][8] = {
     {0.4106, 59.996, 1.0543, 18.648, -0.4751, 10.54, 0.0106, 0.3667},  // <j0>
     {10.1378, 35.337, 4.7734, 12.545, -0.0489, 2.672, 0.0036, 0.0912}, // <j2>
     {-5.2697, 32.868, 4.193, 24.183, 1.5202, 6.048, -0.0002, 0.0855},  // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                         // <j6>
-double j_Zr1[4][8] = {
+constexpr double j_Zr1[4][8] = {
     {0.4532, 59.595, 0.7834, 21.436, -0.2451, 9.036, 0.0098, 0.3639},  // <j0>
     {11.8722, 34.92, 4.0502, 12.127, -0.0632, 2.828, 0.0034, 0.0737},  // <j2>
     {-5.6384, 33.607, 4.6729, 22.338, 1.3258, 5.924, -0.0003, 0.0674}, // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                         // <j6>
-double j_Nb0[4][8] = {
+constexpr double j_Nb0[4][8] = {
     {0.3946, 49.23, 1.3197, 14.822, -0.7269, 9.616, 0.0129, 0.3659},  // <j0>
     {7.4796, 33.179, 5.0884, 11.571, -0.0281, 1.564, 0.0047, 0.0944}, // <j2>
     {-3.1377, 25.595, 2.3411, 16.569, 1.2304, 4.99, -0.0005, 0.0615}, // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                        // <j6>
-double j_Nb1[4][8] = {
+constexpr double j_Nb1[4][8] = {
     {0.4572, 49.918, 1.0274, 15.726, -0.4962, 9.157, 0.0118, 0.3403}, // <j0>
     {8.7735, 33.285, 4.6556, 11.605, -0.0268, 1.539, 0.0044, 0.0855}, // <j2>
     {-3.3598, 25.82, 2.8297, 16.427, 1.1203, 4.982, -0.0005, 0.0724}, // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                        // <j6>
-double j_Mo0[4][8] = {
+constexpr double j_Mo0[4][8] = {
     {0.1806, 49.057, 1.2306, 14.786, -0.4268, 6.987, 0.0171, 0.4135}, // <j0>
     {5.118, 23.422, 4.1809, 9.208, -0.0505, 1.743, 0.0053, 0.0655},   // <j2>
     {-2.886, 20.572, 1.813, 14.628, 1.1899, 4.264, -0.0008, 0.041},   // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                        // <j6>
-double j_Mo1[4][8] = {
+constexpr double j_Mo1[4][8] = {
     {0.35, 48.035, 1.0305, 15.06, -0.3929, 7.479, 0.0139, 0.351},      // <j0>
     {7.2367, 28.128, 4.0705, 9.923, -0.0317, 1.455, 0.0049, 0.0798},   // <j2>
     {-3.2618, 25.486, 2.3596, 16.462, 1.1164, 4.491, -0.0007, 0.0592}, // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                         // <j6>
-double j_Tc0[4][8] = {
+constexpr double j_Tc0[4][8] = {
     {0.1298, 49.661, 1.1656, 14.131, -0.3134, 5.513, 0.0195, 0.3869}, // <j0>
     {4.2441, 21.397, 3.9439, 8.375, -0.0371, 1.187, 0.0066, 0.0645},  // <j2>
     {-2.7975, 20.159, 1.652, 16.261, 1.1726, 3.943, -0.0008, 0.0657}, // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                        // <j6>
-double j_Tc1[4][8] = {
+constexpr double j_Tc1[4][8] = {
     {0.2674, 48.957, 0.9569, 15.141, -0.2387, 5.458, 0.016, 0.3412}, // <j0>
     {6.4056, 24.824, 3.54, 8.611, -0.0366, 1.485, 0.0044, 0.0806},   // <j2>
     {-2.047, 19.683, 1.6306, 11.592, 0.8698, 3.769, -0.001, 0.0723}, // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                       // <j6>
-double j_Ru0[4][8] = {
+constexpr double j_Ru0[4][8] = {
     {0.1069, 49.424, 1.1912, 12.742, -0.3176, 4.912, 0.0213, 0.3597}, // <j0>
     {3.7445, 18.613, 3.4749, 7.42, -0.0363, 1.007, 0.0073, 0.0533},   // <j2>
     {-1.5042, 17.949, 0.6027, 9.961, 0.97, 3.393, -0.001, 0.0338},    // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                        // <j6>
-double j_Ru1[4][8] = {
+constexpr double j_Ru1[4][8] = {
     {0.441, 33.309, 1.4775, 9.553, -0.9361, 6.722, 0.0176, 0.2608},   // <j0>
     {5.2826, 23.683, 3.5813, 8.152, -0.0257, 0.426, 0.0131, 0.083},   // <j2>
     {1.6278, 18.506, 1.1828, 10.189, 0.8138, 3.418, -0.0009, 0.0673}, // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                        // <j6>
-double j_Rh0[4][8] = {
+constexpr double j_Rh0[4][8] = {
     {0.0976, 49.882, 1.1601, 11.831, -0.2789, 4.127, 0.0234, 0.3263},  // <j0>
     {3.3651, 17.344, 3.2121, 6.804, -0.035, 0.503, 0.0146, 0.0545},    // <j2>
     {-1.3492, 17.577, 0.4527, 10.507, 0.9285, 3.155, -0.0009, 0.0483}, // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                         // <j6>
-double j_Rh1[4][8] = {
+constexpr double j_Rh1[4][8] = {
     {0.3342, 29.756, 1.2209, 9.438, -0.5755, 5.332, 0.021, 0.2574},   // <j0>
     {4.026, 18.95, 3.1663, 7, -0.0296, 0.486, 0.0127, 0.0629},        // <j2>
     {-1.4673, 17.957, 0.7381, 9.944, 0.8485, 3.126, -0.0012, 0.0487}, // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                        // <j6>
-double j_Pd0[4][8] = {
+constexpr double j_Pd0[4][8] = {
     {0.2003, 29.363, 1.1446, 9.599, -0.3689, 4.042, 0.0251, 0.2453},   // <j0>
     {3.3105, 14.726, 2.6332, 5.862, -0.0437, 1.13, 0.0053, 0.0492},    // <j2>
     {-1.1955, 17.628, 0.3183, 11.309, 0.8696, 2.909, -0.0006, 0.0555}, // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                         // <j6>
-double j_Pd1[4][8] = {
+constexpr double j_Pd1[4][8] = {
     {0.5033, 24.504, 1.9982, 6.908, -1.524, 5.513, 0.0213, 0.1909}, // <j0>
     {4.2749, 17.9, 2.7021, 6.354, -0.0258, 0.7, 0.0071, 0.0768},    // <j2>
     {-1.4098, 17.765, 0.7927, 9.999, 0.771, 2.93, -0.0006, 0.053},  // <j4>
     {0, 0, 0, 0, 0, 0, 0, 0}};                                      // <j6>
-double j_Ce2[4][8] = {
+constexpr double j_Ce2[4][8] = {
     {0.2953, 17.685, 0.2923, 6.733, 0.4313, 5.383, -0.0194, 0.0845},  // <j0>
     {0.9809, 18.063, 1.8413, 7.769, 0.9905, 2.845, 0.012, 0.0448},    // <j2>
     {-0.6468, 10.533, 0.4052, 5.624, 0.3412, 1.535, 0.008, 0.0522},   // <j4>
     {-0.1212, 7.994, -0.0639, 4.024, 0.1519, 1.096, 0.0078, 0.0388}}; // <j6>
-double j_Nd2[4][8] = {
+constexpr double j_Nd2[4][8] = {
     {0.1645, 25.045, 0.2522, 11.978, 0.6012, 4.946, -0.018, 0.0668}, // <j0>
     {1.453, 18.34, 1.6196, 7.285, 0.8752, 2.622, 0.0126, 0.0461},    // <j2>
     {-0.5416, 12.204, 0.3571, 6.169, 0.3154, 1.485, 0.0098, 0.0519}, // <j4>
     {-0.16, 8.009, 0.0272, 4.028, 0.1104, 1.068, 0.0139, 0.0363}};   // <j6>
-double j_Nd3[4][8] = {
+constexpr double j_Nd3[4][8] = {
     {0.054, 25.029, 0.3101, 12.102, 0.6575, 4.722, -0.0216, 0.0478}, // <j0>
     {0.6751, 18.342, 1.6272, 7.26, 0.9644, 2.602, 0.015, 0.045},     // <j2>
     {-0.4053, 14.014, 0.0329, 7.005, 0.3759, 1.707, 0.0209, 0.0372}, // <j4>
     {0.0416, 8.014, -0.1261, 4.04, 0.14, 1.087, 0.0102, 0.0367}};    // <j6>
-double j_Sm2[4][8] = {
+constexpr double j_Sm2[4][8] = {
     {0.0909, 25.203, 0.3037, 11.856, 0.625, 4.237, -0.02, 0.0408},  // <j0>
     {1.036, 18.425, 1.4769, 7.032, 0.881, 2.437, 0.0152, 0.0345},   // <j2>
     {-0.415, 14.057, 0.1368, 7.032, 0.3272, 1.582, 0.0192, 0.0319}, // <j4>
     {0.1428, 6.041, 0.0723, 2.033, 0.055, 0.513, 0.0081, 0.045}};   // <j6>
-double j_Sm3[4][8] = {
+constexpr double j_Sm3[4][8] = {
     {0.0288, 25.207, 0.2973, 11.831, 0.6954, 4.212, -0.0213, 0.051},  // <j0>
     {0.4707, 18.43, 1.4261, 7.034, 0.9574, 2.439, 0.0182, 0.051},     // <j2>
     {-0.4288, 10.052, 0.1782, 5.019, 0.2833, 1.236, 0.0088, 0.0328},  // <j4>
     {-0.0944, 6.03, -0.0498, 2.074, 0.1372, 0.645, -0.0132, 0.0387}}; // <j6>
-double j_Eu2[4][8] = {
+constexpr double j_Eu2[4][8] = {
     {0.0755, 25.296, 0.3001, 11.599, 0.6438, 4.025, -0.0196, 0.0488}, // <j0>
     {0.897, 18.443, 1.3769, 7.005, 0.906, 2.421, 0.019, 0.0511},      // <j2>
     {-0.4145, 10.193, 0.2447, 5.164, 0.2661, 1.205, 0.0065, 0.0516},  // <j4>
     {-0.1252, 6.049, 0.0507, 2.085, 0.0572, 0.646, 0.0132, 0.0403}};  // <j6>
-double j_Eu3[4][8] = {
+constexpr double j_Eu3[4][8] = {
     {0.0204, 25.308, 0.301, 11.474, 0.7005, 3.942, -0.022, 0.0356},   // <j0>
     {0.3985, 18.451, 1.3307, 6.956, 0.9603, 2.378, 0.0197, 0.0447},   // <j2>
     {-0.4095, 10.211, 0.1485, 5.175, 0.272, 1.237, 0.0131, 0.0494},   // <j4>
     {-0.0817, 6.039, -0.0596, 2.12, 0.1243, 0.764, -0.0001, 0.0206}}; // <j6>
-double j_Gd2[4][8] = {
+constexpr double j_Gd2[4][8] = {
     {0.0636, 25.382, 0.3033, 11.212, 0.6528, 3.788, -0.0199, 0.0486}, // <j0>
     {0.7756, 18.469, 1.3124, 6.899, 0.8956, 2.338, 0.0199, 0.0441},   // <j2>
     {-0.3824, 10.344, 0.1955, 5.306, 0.2622, 1.203, 0.0097, 0.0363},  // <j4>
     {-0.1351, 5.03, 0.0828, 2.025, 0.0315, 0.503, 0.0187, 0.0453}};   // <j6>
-double j_Gd3[4][8] = {
+constexpr double j_Gd3[4][8] = {
     {0.0186, 25.387, 0.2895, 11.142, 0.7135, 3.752, -0.0217, 0.0489}, // <j0>
     {0.3347, 18.476, 1.2465, 6.877, 0.9537, 2.318, 0.0217, 0.0484},   // <j2>
     {-0.3621, 10.353, 0.1016, 5.31, 0.2649, 1.219, 0.0147, 0.0494},   // <j4>
     {-0.0662, 6.031, -0.085, 2.154, 0.1323, 0.891, 0.0048, 0.0371}};  // <j6>
-double j_Tb2[4][8] = {
+constexpr double j_Tb2[4][8] = {
     {0.0547, 25.509, 0.3171, 10.591, 0.649, 3.517, -0.0212, 0.0342}, // <j0>
     {0.6688, 18.491, 1.2487, 6.822, 0.8888, 2.275, 0.0215, 0.0439},  // <j2>
     {-0.3443, 10.469, 0.1481, 5.416, 0.2575, 1.182, 0.0104, 0.028},  // <j4>
     {-0.0758, 6.032, -0.054, 2.158, 0.1199, 0.89, 0.0051, 0.0488}};  // <j6>
-double j_Tb3[4][8] = {
+constexpr double j_Tb3[4][8] = {
     {0.0177, 25.51, 0.2921, 10.577, 0.7133, 3.512, -0.0231, 0.0512}, // <j0>
     {0.2892, 18.497, 1.1678, 6.797, 0.9437, 2.257, 0.0232, 0.0458},  // <j2>
     {-0.3228, 10.476, 0.0638, 5.419, 0.2566, 1.196, 0.0159, 0.0439}, // <j4>
     {-0.0559, 6.031, -0.102, 2.237, 0.1264, 1.107, 0.0167, 0.017}};  // <j6>
-double j_Dy2[4][8] = {
+constexpr double j_Dy2[4][8] = {
     {0.1308, 18.316, 0.3118, 7.665, 0.5795, 3.147, -0.0226, 0.0315}, // <j0>
     {0.5917, 18.511, 1.1828, 6.747, 0.8801, 2.214, 0.0229, 0.0439},  // <j2>
     {-0.3206, 12.071, 0.0904, 8.026, 0.2616, 1.23, 0.0143, 0.0767},  // <j4>
     {-0.0568, 6.032, -0.1003, 2.24, 0.1401, 1.106, 0.0109, 0.0463}}; // <j6>
-double j_Dy3[4][8] = {
+constexpr double j_Dy3[4][8] = {
     {0.1157, 15.073, 0.327, 6.799, 0.5821, 3.02, -0.0249, 0.0146},  // <j0>
     {0.2523, 18.517, 1.0914, 6.736, 0.9345, 2.208, 0.025, 0.0476},  // <j2>
     {-0.2829, 9.525, 0.0565, 4.429, 0.2437, 1.066, 0.0092, 0.0181}, // <j4>
     {-0.0423, 6.038, -0.1248, 2.244, 0.1359, 1.2, 0.0188, 0.035}};  // <j6>
-double j_Ho2[4][8] = {
+constexpr double j_Ho2[4][8] = {
     {0.0995, 18.176, 0.3305, 7.856, 0.5921, 2.98, -0.023, 0.124},     // <j0>
     {0.5094, 18.515, 1.1234, 6.706, 0.8727, 2.159, 0.0242, 0.056},    // <j2>
     {-0.2976, 9.719, 0.1224, 4.635, 0.2279, 1.005, 0.0063, 0.0452},   // <j4>
     {-0.0725, 6.045, -0.0318, 2.243, 0.0738, 1.202, 0.0252, 0.0634}}; // <j6>
-double j_Ho3[4][8] = {
+constexpr double j_Ho3[4][8] = {
     {0.0566, 18.318, 0.3365, 7.688, 0.6317, 2.943, -0.0248, 0.0068}, // <j0>
     {0.2188, 18.516, 1.024, 6.707, 0.9251, 2.161, 0.0268, 0.0503},   // <j2>
     {-0.2717, 9.731, 0.0474, 4.638, 0.2292, 1.047, 0.0124, 0.031},   // <j4>
     {-0.0289, 6.05, -0.1545, 2.23, 0.155, 1.26, 0.0177, 0.0351}};    // <j6>
-double j_Er2[4][8] = {
+constexpr double j_Er2[4][8] = {
     {0.1122, 18.122, 0.3462, 6.911, 0.5649, 2.761, -0.0235, 0.0207}, // <j0>
     {0.4693, 18.528, 1.0545, 6.649, 0.8679, 2.12, 0.0261, 0.0413},   // <j2>
     {-0.2975, 9.829, 0.1189, 4.741, 0.2116, 1.004, 0.0117, 0.0524},  // <j4>
     {0.0648, 6.056, -0.0515, 2.23, 0.0825, 1.264, 0.025, 0.0409}};   // <j6>
-double j_Er3[4][8] = {
+constexpr double j_Er3[4][8] = {
     {0.0586, 17.98, 0.354, 7.096, 0.6126, 2.748, -0.0251, 0.0171},   // <j0>
     {0.171, 18.534, 0.9879, 6.625, 0.9044, 2.1, 0.0278, 0.0489},     // <j2>
     {-0.2568, 9.834, 0.0356, 4.741, 0.2172, 1.028, 0.0148, 0.0434},  // <j4>
     {-0.011, 6.061, -0.1954, 2.224, 0.1818, 1.296, 0.0149, 0.0455}}; // <j6>
-double j_Tm2[4][8] = {
+constexpr double j_Tm2[4][8] = {
     {0.0983, 18.324, 0.338, 6.918, 0.5875, 2.662, -0.0241, 0.0404}, // <j0>
     {0.4198, 18.542, 0.9959, 6.6, 0.8593, 2.082, 0.0284, 0.0457},   // <j2>
     {-0.2677, 9.888, 0.0925, 4.784, 0.2056, 0.99, 0.0124, 0.0396},  // <j4>
     {0.0842, 4.07, 0.0807, 0.849, -0.2087, 0.039, 0.2095, 0.036}};  // <j6>
-double j_Tm3[4][8] = {
+constexpr double j_Tm3[4][8] = {
     {0.0581, 15.092, 0.2787, 7.801, 0.6854, 2.793, -0.0224, 0.0351}, // <j0>
     {0.176, 18.542, 0.9105, 6.579, 0.897, 2.062, 0.0294, 0.0468},    // <j2>
     {-0.2292, 9.895, 0.0124, 4.785, 0.2108, 1.007, 0.0151, 0.0334},  // <j4>
     {0.0727, 4.073, 0.0243, 0.689, 3.9459, 0.002, -3.9076, 0.0502}}; // <j6>
-double j_Yb2[4][8] = {
+constexpr double j_Yb2[4][8] = {
     {0.0855, 18.512, 0.2943, 7.373, 0.6412, 2.678, -0.0213, 0.0421}, // <j0>
     {0.3852, 18.55, 0.9415, 6.551, 0.8492, 2.043, 0.0301, 0.0478},   // <j2>
     {-0.2393, 9.947, 0.0663, 4.823, 0.2009, 0.965, 0.0122, 0.0311},  // <j4>
     {-0.0739, 5.031, 0.014, 2.03, 0.0351, 0.508, 0.0174, 0.0434}};   // <j6>
-double j_Yb3[4][8] = {
+constexpr double j_Yb3[4][8] = {
     {0.0416, 16.095, 0.2849, 7.834, 0.6961, 2.672, -0.0229, 0.0344},  // <j0>
     {0.157, 18.555, 0.8484, 6.54, 0.888, 2.037, 0.0318, 0.0498},      // <j2>
     {-0.2121, 8.197, 0.0325, 3.153, 0.1975, 0.884, 0.0093, 0.0435},   // <j4>
     {-0.0345, 5.007, -0.0677, 2.02, 0.0985, 0.549, -0.0076, 0.0359}}; // <j6>
-double j_U3[4][8] = {
+constexpr double j_U3[4][8] = {
     {0.5058, 23.288, 1.3464, 7.003, -0.8724, 4.868, 0.0192, 0.1507}, // <j0>
     {4.1582, 16.534, 2.4675, 5.952, -0.0252, 0.765, 0.0057, 0.0822}, // <j2>
     {-0.9859, 16.601, 0.6116, 6.515, 0.602, 2.597, -0.001, 0.0599},  // <j4>
     {-0.3797, 9.953, 0.0459, 5.038, 0.2748, 1.607, 0.0016, 0.0345}}; // <j6>
-double j_U4[4][8] = {
+constexpr double j_U4[4][8] = {
     {0.3291, 23.548, 1.0836, 8.454, -0.434, 4.12, 0.0214, 0.1757},    // <j0>
     {3.7449, 13.894, 2.6453, 4.863, -0.5218, 3.192, 0.0009, 0.0928},  // <j2>
     {-1.054, 16.605, 0.4339, 6.512, 0.6746, 2.599, -0.0011, 0.0471},  // <j4>
     {-0.1793, 11.896, -0.2269, 5.428, 0.3291, 1.701, 0.003, 0.0472}}; // <j6>
-double j_U5[4][8] = {
+constexpr double j_U5[4][8] = {
     {0.365, 19.804, 3.2199, 6.282, -2.6077, 5.301, 0.0233, 0.175},   // <j0>
     {3.0724, 12.546, 2.3076, 5.231, -0.0644, 1.474, 0.0035, 0.0477}, // <j2>
     {-0.9588, 16.485, 0.1576, 6.44, 0.7785, 2.64, -0.001, 0.0493},   // <j4>
     {-0.0399, 11.891, -0.3458, 5.58, 0.334, 1.645, 0.0029, 0.0444}}; // <j6>
-double j_Np3[4][8] = {
+constexpr double j_Np3[4][8] = {
     {0.5157, 20.865, 2.2784, 5.893, -1.8163, 4.846, 0.0211, 0.1378},   // <j0>
     {3.717, 15.133, 2.3216, 5.503, -0.0275, 0.8, 0.0052, 0.0948},      // <j2>
     {0.9029, 16.586, 0.4006, 6.47, 0.6545, 2.563, -0.0004, 0.047},     // <j4>
     {-0.2427, 11.844, -0.1129, 5.377, 0.2848, 1.568, 0.0022, 0.0368}}; // <j6>
-double j_Np4[4][8] = {
+constexpr double j_Np4[4][8] = {
     {0.4206, 19.805, 2.8004, 5.978, -2.2436, 4.985, 0.0228, 0.1408},  // <j0>
     {2.9203, 14.646, 2.5979, 5.559, -0.0301, 0.367, 0.0141, 0.0532},  // <j2>
     {-0.9887, 12.441, 0.5918, 5.294, 0.5306, 2.263, -0.0021, 0.0583}, // <j4>
     {-0.2436, 9.599, -0.1317, 4.101, 0.3029, 1.545, 0.0019, 0.05}};   // <j6>
-double j_Np5[4][8] = {
+constexpr double j_Np5[4][8] = {
     {0.3692, 18.19, 3.151, 5.85, -2.5446, 4.916, 0.0248, 0.1515},    // <j0>
     {2.3308, 13.654, 2.7219, 5.494, -0.1357, 0.049, 0.1224, 0.0553}, // <j2>
     {-0.8146, 16.581, -0.0055, 6.475, 0.7956, 2.562, -0.0004, 0.06}, // <j4>
     {-0.1157, 9.565, -0.2654, 4.26, 0.3298, 1.549, 0.0025, 0.0495}}; // <j6>
-double j_Np6[4][8] = {
+constexpr double j_Np6[4][8] = {
     {0.2929, 17.561, 3.4866, 5.785, -2.8066, 4.871, 0.0267, 0.1698},  // <j0>
     {1.8245, 13.18, 2.8508, 5.407, -0.1579, 0.044, 0.1438, 0.0585},   // <j2>
     {0.6738, 16.553, -0.2297, 6.505, 0.8513, 2.553, -0.0003, 0.0623}, // <j4>
     {-0.0128, 9.569, -0.3611, 4.304, 0.3419, 1.541, 0.0032, 0.052}};  // <j6>
-double j_Pu3[4][8] = {
+constexpr double j_Pu3[4][8] = {
     {0.384, 16.679, 3.1049, 5.421, -2.5148, 4.551, 0.0263, 0.128},   // <j0>
     {2.0885, 12.871, 2.5961, 5.19, -0.1465, 0.039, 0.1343, 0.0866},  // <j2>
     {-0.7014, 16.369, -0.1162, 6.697, 0.7778, 2.45, 0, 0.0546},      // <j4>
     {-0.0364, 9.572, -0.3181, 4.342, 0.321, 1.523, 0.0041, 0.0496}}; // <j6>
-double j_Pu4[4][8] = {
+constexpr double j_Pu4[4][8] = {
     {0.4934, 16.836, 1.6394, 5.638, -1.1581, 4.14, 0.0248, 0.1242},   // <j0>
     {2.7244, 12.926, 2.3387, 5.163, -0.13, 0.046, 0.1177, 0.049},     // <j2>
     {-0.916, 12.203, 0.4891, 5.127, 0.529, 2.149, -0.0022, 0.052},    // <j4>
     {-0.2394, 7.837, -0.0785, 4.024, 0.2643, 1.378, 0.0012, 0.0414}}; // <j6>
-double j_Pu5[4][8] = {
+constexpr double j_Pu5[4][8] = {
     {0.3888, 16.559, 2.0362, 5.657, -1.4515, 4.255, 0.0267, 0.1287}, // <j0>
     {2.1409, 12.832, 2.5664, 5.152, -0.1338, 0.046, 0.121, 0.0491},  // <j2>
     {-0.7035, 16.36, -0.0979, 6.706, 0.7726, 2.447, 0, 0.061},       // <j4>
     {-0.109, 7.819, -0.2243, 4.1, 0.2947, 1.404, 0.0015, 0.0477}};   // <j6>
-double j_Pu6[4][8] = {
+constexpr double j_Pu6[4][8] = {
     {0.3172, 16.051, 3.4654, 5.351, -2.8102, 4.513, 0.0281, 0.1382}, // <j0>
     {1.7262, 12.324, 2.6652, 5.066, -0.1695, 0.041, 0.155, 0.0502},  // <j2>
     {-0.556, 16.322, -0.3046, 6.768, 0.8146, 2.426, 0.0001, 0.0596}, // <j4>
     {-0.0001, 7.82, -0.3354, 4.144, 0.3097, 1.403, 0.002, 0.0513}};  // <j6>
-double j_Am2[4][8] = {
+constexpr double j_Am2[4][8] = {
     {0.4743, 21.776, 1.58, 5.69, -1.0779, 4.145, 0.0218, 0.1253},    // <j0>
     {3.5237, 15.955, 2.2855, 5.195, -0.0142, 0.585, 0.0033, 0.112},  // <j2>
     {-0.7433, 16.416, 0.3481, 6.788, 0.6014, 2.346, 0, 0.0566},      // <j4>
     {-0.3176, 7.864, 0.0771, 4.161, 0.2194, 1.339, 0.0018, 0.0374}}; // <j6>
-double j_Am3[4][8] = {
+constexpr double j_Am3[4][8] = {
     {0.4239, 19.574, 1.4573, 5.872, -0.9052, 3.968, 0.0238, 0.1054},  // <j0>
     {2.8622, 14.733, 2.4099, 5.144, -0.1326, 0.031, 0.1233, 0.0727},  // <j2>
     {0.8092, 12.854, 0.4161, 5.459, 0.5476, 2.172, -0.0011, 0.053},   // <j4>
     {-0.3159, 6.982, 0.0682, 3.995, 0.2141, 1.188, -0.0015, 0.0281}}; // <j6>
-double j_Am4[4][8] = {
+constexpr double j_Am4[4][8] = {
     {0.3737, 17.862, 1.3521, 6.043, -0.7514, 3.72, 0.0258, 0.1113},   // <j0>
     {2.4141, 12.948, 2.3687, 4.945, -0.249, 0.022, 0.2371, 0.0502},   // <j2>
     {-0.8548, 12.226, 0.3037, 5.909, 0.6173, 2.188, -0.0016, 0.0456}, // <j4>
     {-0.1787, 7.88, -0.1274, 4.09, 0.2565, 1.315, 0.0017, 0.0419}};   // <j6>
-double j_Am5[4][8] = {
+constexpr double j_Am5[4][8] = {
     {0.2956, 17.372, 1.4525, 6.073, -0.7755, 3.662, 0.0277, 0.1202},  // <j0>
     {2.0109, 12.053, 2.4155, 4.836, -0.2264, 0.027, 0.2128, 0.0414},  // <j2>
     {-0.6538, 15.462, -0.0948, 5.997, 0.7295, 2.297, 0, 0.0594},      // <j4>
     {-0.0927, 6.073, -0.2227, 3.784, 0.2916, 1.372, 0.0026, 0.0485}}; // <j6>
-double j_Am6[4][8] = {
+constexpr double j_Am6[4][8] = {
     {0.2302, 16.953, 1.4864, 6.116, -0.7457, 3.543, 0.0294, 0.1323}, // <j0>
     {1.6778, 11.337, 2.4531, 4.725, -0.2043, 0.034, 0.1892, 0.0387}, // <j2>
     {-0.539, 15.449, -0.2689, 6.017, 0.7711, 2.297, 0.0002, 0.0729}, // <j4>
     {0.0152, 6.079, -0.3549, 3.861, 0.3125, 1.403, 0.0036, 0.0732}}; // <j6>
-double j_Am7[4][8] = {
+constexpr double j_Am7[4][8] = {
     {0.3601, 12.73, 1.964, 5.12, -1.356, 3.714, 0.0316, 0.1232},       // <j0>
     {1.8845, 9.161, 2.0746, 4.042, -0.1318, 1.723, 0.002, 0.0379},     // <j2>
     {-0.4688, 12.019, -0.2692, 7.042, 0.7297, 2.164, -0.0011, 0.0262}, // <j4>
@@ -557,7 +558,7 @@ double j_Am7[4][8] = {
 }
 
 /// Typedef the map type
-typedef std::map<std::string, MagneticIon> IonIndex;
+typedef std::unordered_map<std::string, MagneticIon> IonIndex;
 
 /// Forward decalre intializer
 void createIonLookup(IonIndex &ion_map);
@@ -576,290 +577,290 @@ const IonIndex &ionMap() {
  * @param ion_map A reference to the static lookup
  */
 void createIonLookup(IonIndex &ion_map) {
-  static const MagneticIon Sc0((std::string) "Sc", static_cast<uint16_t>(0),
-                               j_Sc0[0], j_Sc0[1], j_Sc0[2], j_Sc0[3]);
+  static const MagneticIon Sc0("Sc", static_cast<uint16_t>(0), j_Sc0[0],
+                               j_Sc0[1], j_Sc0[2], j_Sc0[3]);
   ion_map["Sc0"] = Sc0;
-  static const MagneticIon Sc1((std::string) "Sc", static_cast<uint16_t>(1),
-                               j_Sc1[0], j_Sc1[1], j_Sc1[2], j_Sc1[3]);
+  static const MagneticIon Sc1("Sc", static_cast<uint16_t>(1), j_Sc1[0],
+                               j_Sc1[1], j_Sc1[2], j_Sc1[3]);
   ion_map["Sc1"] = Sc1;
-  static const MagneticIon Sc2((std::string) "Sc", static_cast<uint16_t>(2),
-                               j_Sc2[0], j_Sc2[1], j_Sc2[2], j_Sc2[3]);
+  static const MagneticIon Sc2("Sc", static_cast<uint16_t>(2), j_Sc2[0],
+                               j_Sc2[1], j_Sc2[2], j_Sc2[3]);
   ion_map["Sc2"] = Sc2;
-  static const MagneticIon Ti0((std::string) "Ti", static_cast<uint16_t>(0),
-                               j_Ti0[0], j_Ti0[1], j_Ti0[2], j_Ti0[3]);
+  static const MagneticIon Ti0("Ti", static_cast<uint16_t>(0), j_Ti0[0],
+                               j_Ti0[1], j_Ti0[2], j_Ti0[3]);
   ion_map["Ti0"] = Ti0;
-  static const MagneticIon Ti1((std::string) "Ti", static_cast<uint16_t>(1),
-                               j_Ti1[0], j_Ti1[1], j_Ti1[2], j_Ti1[3]);
+  static const MagneticIon Ti1("Ti", static_cast<uint16_t>(1), j_Ti1[0],
+                               j_Ti1[1], j_Ti1[2], j_Ti1[3]);
   ion_map["Ti1"] = Ti1;
-  static const MagneticIon Ti2((std::string) "Ti", static_cast<uint16_t>(2),
-                               j_Ti2[0], j_Ti2[1], j_Ti2[2], j_Ti2[3]);
+  static const MagneticIon Ti2("Ti", static_cast<uint16_t>(2), j_Ti2[0],
+                               j_Ti2[1], j_Ti2[2], j_Ti2[3]);
   ion_map["Ti2"] = Ti2;
-  static const MagneticIon Ti3((std::string) "Ti", static_cast<uint16_t>(3),
-                               j_Ti3[0], j_Ti3[1], j_Ti3[2], j_Ti3[3]);
+  static const MagneticIon Ti3("Ti", static_cast<uint16_t>(3), j_Ti3[0],
+                               j_Ti3[1], j_Ti3[2], j_Ti3[3]);
   ion_map["Ti3"] = Ti3;
-  static const MagneticIon V0((std::string) "V", static_cast<uint16_t>(0),
-                              j_V0[0], j_V0[1], j_V0[2], j_V0[3]);
+  static const MagneticIon V0("V", static_cast<uint16_t>(0), j_V0[0], j_V0[1],
+                              j_V0[2], j_V0[3]);
   ion_map["V0"] = V0;
-  static const MagneticIon V1((std::string) "V", static_cast<uint16_t>(1),
-                              j_V1[0], j_V1[1], j_V1[2], j_V1[3]);
+  static const MagneticIon V1("V", static_cast<uint16_t>(1), j_V1[0], j_V1[1],
+                              j_V1[2], j_V1[3]);
   ion_map["V1"] = V1;
-  static const MagneticIon V2((std::string) "V", static_cast<uint16_t>(2),
-                              j_V2[0], j_V2[1], j_V2[2], j_V2[3]);
+  static const MagneticIon V2("V", static_cast<uint16_t>(2), j_V2[0], j_V2[1],
+                              j_V2[2], j_V2[3]);
   ion_map["V2"] = V2;
-  static const MagneticIon V3((std::string) "V", static_cast<uint16_t>(3),
-                              j_V3[0], j_V3[1], j_V3[2], j_V3[3]);
+  static const MagneticIon V3("V", static_cast<uint16_t>(3), j_V3[0], j_V3[1],
+                              j_V3[2], j_V3[3]);
   ion_map["V3"] = V3;
-  static const MagneticIon V4((std::string) "V", static_cast<uint16_t>(4),
-                              j_V4[0], j_V4[1], j_V4[2], j_V4[3]);
+  static const MagneticIon V4("V", static_cast<uint16_t>(4), j_V4[0], j_V4[1],
+                              j_V4[2], j_V4[3]);
   ion_map["V4"] = V4;
-  static const MagneticIon Cr0((std::string) "Cr", static_cast<uint16_t>(0),
-                               j_Cr0[0], j_Cr0[1], j_Cr0[2], j_Cr0[3]);
+  static const MagneticIon Cr0("Cr", static_cast<uint16_t>(0), j_Cr0[0],
+                               j_Cr0[1], j_Cr0[2], j_Cr0[3]);
   ion_map["Cr0"] = Cr0;
-  static const MagneticIon Cr1((std::string) "Cr", static_cast<uint16_t>(1),
-                               j_Cr1[0], j_Cr1[1], j_Cr1[2], j_Cr1[3]);
+  static const MagneticIon Cr1("Cr", static_cast<uint16_t>(1), j_Cr1[0],
+                               j_Cr1[1], j_Cr1[2], j_Cr1[3]);
   ion_map["Cr1"] = Cr1;
-  static const MagneticIon Cr2((std::string) "Cr", static_cast<uint16_t>(2),
-                               j_Cr2[0], j_Cr2[1], j_Cr2[2], j_Cr2[3]);
+  static const MagneticIon Cr2("Cr", static_cast<uint16_t>(2), j_Cr2[0],
+                               j_Cr2[1], j_Cr2[2], j_Cr2[3]);
   ion_map["Cr2"] = Cr2;
-  static const MagneticIon Cr3((std::string) "Cr", static_cast<uint16_t>(3),
-                               j_Cr3[0], j_Cr3[1], j_Cr3[2], j_Cr3[3]);
+  static const MagneticIon Cr3("Cr", static_cast<uint16_t>(3), j_Cr3[0],
+                               j_Cr3[1], j_Cr3[2], j_Cr3[3]);
   ion_map["Cr3"] = Cr3;
-  static const MagneticIon Cr4((std::string) "Cr", static_cast<uint16_t>(4),
-                               j_Cr4[0], j_Cr4[1], j_Cr4[2], j_Cr4[3]);
+  static const MagneticIon Cr4("Cr", static_cast<uint16_t>(4), j_Cr4[0],
+                               j_Cr4[1], j_Cr4[2], j_Cr4[3]);
   ion_map["Cr4"] = Cr4;
-  static const MagneticIon Mn0((std::string) "Mn", static_cast<uint16_t>(0),
-                               j_Mn0[0], j_Mn0[1], j_Mn0[2], j_Mn0[3]);
+  static const MagneticIon Mn0("Mn", static_cast<uint16_t>(0), j_Mn0[0],
+                               j_Mn0[1], j_Mn0[2], j_Mn0[3]);
   ion_map["Mn0"] = Mn0;
-  static const MagneticIon Mn1((std::string) "Mn", static_cast<uint16_t>(1),
-                               j_Mn1[0], j_Mn1[1], j_Mn1[2], j_Mn1[3]);
+  static const MagneticIon Mn1("Mn", static_cast<uint16_t>(1), j_Mn1[0],
+                               j_Mn1[1], j_Mn1[2], j_Mn1[3]);
   ion_map["Mn1"] = Mn1;
-  static const MagneticIon Mn2((std::string) "Mn", static_cast<uint16_t>(2),
-                               j_Mn2[0], j_Mn2[1], j_Mn2[2], j_Mn2[3]);
+  static const MagneticIon Mn2("Mn", static_cast<uint16_t>(2), j_Mn2[0],
+                               j_Mn2[1], j_Mn2[2], j_Mn2[3]);
   ion_map["Mn2"] = Mn2;
-  static const MagneticIon Mn3((std::string) "Mn", static_cast<uint16_t>(3),
-                               j_Mn3[0], j_Mn3[1], j_Mn3[2], j_Mn3[3]);
+  static const MagneticIon Mn3("Mn", static_cast<uint16_t>(3), j_Mn3[0],
+                               j_Mn3[1], j_Mn3[2], j_Mn3[3]);
   ion_map["Mn3"] = Mn3;
-  static const MagneticIon Mn4((std::string) "Mn", static_cast<uint16_t>(4),
-                               j_Mn4[0], j_Mn4[1], j_Mn4[2], j_Mn4[3]);
+  static const MagneticIon Mn4("Mn", static_cast<uint16_t>(4), j_Mn4[0],
+                               j_Mn4[1], j_Mn4[2], j_Mn4[3]);
   ion_map["Mn4"] = Mn4;
-  static const MagneticIon Fe0((std::string) "Fe", static_cast<uint16_t>(0),
-                               j_Fe0[0], j_Fe0[1], j_Fe0[2], j_Fe0[3]);
+  static const MagneticIon Fe0("Fe", static_cast<uint16_t>(0), j_Fe0[0],
+                               j_Fe0[1], j_Fe0[2], j_Fe0[3]);
   ion_map["Fe0"] = Fe0;
-  static const MagneticIon Fe1((std::string) "Fe", static_cast<uint16_t>(1),
-                               j_Fe1[0], j_Fe1[1], j_Fe1[2], j_Fe1[3]);
+  static const MagneticIon Fe1("Fe", static_cast<uint16_t>(1), j_Fe1[0],
+                               j_Fe1[1], j_Fe1[2], j_Fe1[3]);
   ion_map["Fe1"] = Fe1;
-  static const MagneticIon Fe2((std::string) "Fe", static_cast<uint16_t>(2),
-                               j_Fe2[0], j_Fe2[1], j_Fe2[2], j_Fe2[3]);
+  static const MagneticIon Fe2("Fe", static_cast<uint16_t>(2), j_Fe2[0],
+                               j_Fe2[1], j_Fe2[2], j_Fe2[3]);
   ion_map["Fe2"] = Fe2;
-  static const MagneticIon Fe3((std::string) "Fe", static_cast<uint16_t>(3),
-                               j_Fe3[0], j_Fe3[1], j_Fe3[2], j_Fe3[3]);
+  static const MagneticIon Fe3("Fe", static_cast<uint16_t>(3), j_Fe3[0],
+                               j_Fe3[1], j_Fe3[2], j_Fe3[3]);
   ion_map["Fe3"] = Fe3;
-  static const MagneticIon Fe4((std::string) "Fe", static_cast<uint16_t>(4),
-                               j_Fe4[0], j_Fe4[1], j_Fe4[2], j_Fe4[3]);
+  static const MagneticIon Fe4("Fe", static_cast<uint16_t>(4), j_Fe4[0],
+                               j_Fe4[1], j_Fe4[2], j_Fe4[3]);
   ion_map["Fe4"] = Fe4;
-  static const MagneticIon Co0((std::string) "Co", static_cast<uint16_t>(0),
-                               j_Co0[0], j_Co0[1], j_Co0[2], j_Co0[3]);
+  static const MagneticIon Co0("Co", static_cast<uint16_t>(0), j_Co0[0],
+                               j_Co0[1], j_Co0[2], j_Co0[3]);
   ion_map["Co0"] = Co0;
-  static const MagneticIon Co1((std::string) "Co", static_cast<uint16_t>(1),
-                               j_Co1[0], j_Co1[1], j_Co1[2], j_Co1[3]);
+  static const MagneticIon Co1("Co", static_cast<uint16_t>(1), j_Co1[0],
+                               j_Co1[1], j_Co1[2], j_Co1[3]);
   ion_map["Co1"] = Co1;
-  static const MagneticIon Co2((std::string) "Co", static_cast<uint16_t>(2),
-                               j_Co2[0], j_Co2[1], j_Co2[2], j_Co2[3]);
+  static const MagneticIon Co2("Co", static_cast<uint16_t>(2), j_Co2[0],
+                               j_Co2[1], j_Co2[2], j_Co2[3]);
   ion_map["Co2"] = Co2;
-  static const MagneticIon Co3((std::string) "Co", static_cast<uint16_t>(3),
-                               j_Co3[0], j_Co3[1], j_Co3[2], j_Co3[3]);
+  static const MagneticIon Co3("Co", static_cast<uint16_t>(3), j_Co3[0],
+                               j_Co3[1], j_Co3[2], j_Co3[3]);
   ion_map["Co3"] = Co3;
-  static const MagneticIon Co4((std::string) "Co", static_cast<uint16_t>(4),
-                               j_Co4[0], j_Co4[1], j_Co4[2], j_Co4[3]);
+  static const MagneticIon Co4("Co", static_cast<uint16_t>(4), j_Co4[0],
+                               j_Co4[1], j_Co4[2], j_Co4[3]);
   ion_map["Co4"] = Co4;
-  static const MagneticIon Ni0((std::string) "Ni", static_cast<uint16_t>(0),
-                               j_Ni0[0], j_Ni0[1], j_Ni0[2], j_Ni0[3]);
+  static const MagneticIon Ni0("Ni", static_cast<uint16_t>(0), j_Ni0[0],
+                               j_Ni0[1], j_Ni0[2], j_Ni0[3]);
   ion_map["Ni0"] = Ni0;
-  static const MagneticIon Ni1((std::string) "Ni", static_cast<uint16_t>(1),
-                               j_Ni1[0], j_Ni1[1], j_Ni1[2], j_Ni1[3]);
+  static const MagneticIon Ni1("Ni", static_cast<uint16_t>(1), j_Ni1[0],
+                               j_Ni1[1], j_Ni1[2], j_Ni1[3]);
   ion_map["Ni1"] = Ni1;
-  static const MagneticIon Ni2((std::string) "Ni", static_cast<uint16_t>(2),
-                               j_Ni2[0], j_Ni2[1], j_Ni2[2], j_Ni2[3]);
+  static const MagneticIon Ni2("Ni", static_cast<uint16_t>(2), j_Ni2[0],
+                               j_Ni2[1], j_Ni2[2], j_Ni2[3]);
   ion_map["Ni2"] = Ni2;
-  static const MagneticIon Ni3((std::string) "Ni", static_cast<uint16_t>(3),
-                               j_Ni3[0], j_Ni3[1], j_Ni3[2], j_Ni3[3]);
+  static const MagneticIon Ni3("Ni", static_cast<uint16_t>(3), j_Ni3[0],
+                               j_Ni3[1], j_Ni3[2], j_Ni3[3]);
   ion_map["Ni3"] = Ni3;
-  static const MagneticIon Ni4((std::string) "Ni", static_cast<uint16_t>(4),
-                               j_Ni4[0], j_Ni4[1], j_Ni4[2], j_Ni4[3]);
+  static const MagneticIon Ni4("Ni", static_cast<uint16_t>(4), j_Ni4[0],
+                               j_Ni4[1], j_Ni4[2], j_Ni4[3]);
   ion_map["Ni4"] = Ni4;
-  static const MagneticIon Cu0((std::string) "Cu", static_cast<uint16_t>(0),
-                               j_Cu0[0], j_Cu0[1], j_Cu0[2], j_Cu0[3]);
+  static const MagneticIon Cu0("Cu", static_cast<uint16_t>(0), j_Cu0[0],
+                               j_Cu0[1], j_Cu0[2], j_Cu0[3]);
   ion_map["Cu0"] = Cu0;
-  static const MagneticIon Cu1((std::string) "Cu", static_cast<uint16_t>(1),
-                               j_Cu1[0], j_Cu1[1], j_Cu1[2], j_Cu1[3]);
+  static const MagneticIon Cu1("Cu", static_cast<uint16_t>(1), j_Cu1[0],
+                               j_Cu1[1], j_Cu1[2], j_Cu1[3]);
   ion_map["Cu1"] = Cu1;
-  static const MagneticIon Cu2((std::string) "Cu", static_cast<uint16_t>(2),
-                               j_Cu2[0], j_Cu2[1], j_Cu2[2], j_Cu2[3]);
+  static const MagneticIon Cu2("Cu", static_cast<uint16_t>(2), j_Cu2[0],
+                               j_Cu2[1], j_Cu2[2], j_Cu2[3]);
   ion_map["Cu2"] = Cu2;
-  static const MagneticIon Cu3((std::string) "Cu", static_cast<uint16_t>(3),
-                               j_Cu3[0], j_Cu3[1], j_Cu3[2], j_Cu3[3]);
+  static const MagneticIon Cu3("Cu", static_cast<uint16_t>(3), j_Cu3[0],
+                               j_Cu3[1], j_Cu3[2], j_Cu3[3]);
   ion_map["Cu3"] = Cu3;
-  static const MagneticIon Cu4((std::string) "Cu", static_cast<uint16_t>(4),
-                               j_Cu4[0], j_Cu4[1], j_Cu4[2], j_Cu4[3]);
+  static const MagneticIon Cu4("Cu", static_cast<uint16_t>(4), j_Cu4[0],
+                               j_Cu4[1], j_Cu4[2], j_Cu4[3]);
   ion_map["Cu4"] = Cu4;
-  static const MagneticIon Y0((std::string) "Y", static_cast<uint16_t>(0),
-                              j_Y0[0], j_Y0[1], j_Y0[2], j_Y0[3]);
+  static const MagneticIon Y0("Y", static_cast<uint16_t>(0), j_Y0[0], j_Y0[1],
+                              j_Y0[2], j_Y0[3]);
   ion_map["Y0"] = Y0;
-  static const MagneticIon Zr0((std::string) "Zr", static_cast<uint16_t>(0),
-                               j_Zr0[0], j_Zr0[1], j_Zr0[2], j_Zr0[3]);
+  static const MagneticIon Zr0("Zr", static_cast<uint16_t>(0), j_Zr0[0],
+                               j_Zr0[1], j_Zr0[2], j_Zr0[3]);
   ion_map["Zr0"] = Zr0;
-  static const MagneticIon Zr1((std::string) "Zr", static_cast<uint16_t>(1),
-                               j_Zr1[0], j_Zr1[1], j_Zr1[2], j_Zr1[3]);
+  static const MagneticIon Zr1("Zr", static_cast<uint16_t>(1), j_Zr1[0],
+                               j_Zr1[1], j_Zr1[2], j_Zr1[3]);
   ion_map["Zr1"] = Zr1;
-  static const MagneticIon Nb0((std::string) "Nb", static_cast<uint16_t>(0),
-                               j_Nb0[0], j_Nb0[1], j_Nb0[2], j_Nb0[3]);
+  static const MagneticIon Nb0("Nb", static_cast<uint16_t>(0), j_Nb0[0],
+                               j_Nb0[1], j_Nb0[2], j_Nb0[3]);
   ion_map["Nb0"] = Nb0;
-  static const MagneticIon Nb1((std::string) "Nb", static_cast<uint16_t>(1),
-                               j_Nb1[0], j_Nb1[1], j_Nb1[2], j_Nb1[3]);
+  static const MagneticIon Nb1("Nb", static_cast<uint16_t>(1), j_Nb1[0],
+                               j_Nb1[1], j_Nb1[2], j_Nb1[3]);
   ion_map["Nb1"] = Nb1;
-  static const MagneticIon Mo0((std::string) "Mo", static_cast<uint16_t>(0),
-                               j_Mo0[0], j_Mo0[1], j_Mo0[2], j_Mo0[3]);
+  static const MagneticIon Mo0("Mo", static_cast<uint16_t>(0), j_Mo0[0],
+                               j_Mo0[1], j_Mo0[2], j_Mo0[3]);
   ion_map["Mo0"] = Mo0;
-  static const MagneticIon Mo1((std::string) "Mo", static_cast<uint16_t>(1),
-                               j_Mo1[0], j_Mo1[1], j_Mo1[2], j_Mo1[3]);
+  static const MagneticIon Mo1("Mo", static_cast<uint16_t>(1), j_Mo1[0],
+                               j_Mo1[1], j_Mo1[2], j_Mo1[3]);
   ion_map["Mo1"] = Mo1;
-  static const MagneticIon Tc0((std::string) "Tc", static_cast<uint16_t>(0),
-                               j_Tc0[0], j_Tc0[1], j_Tc0[2], j_Tc0[3]);
+  static const MagneticIon Tc0("Tc", static_cast<uint16_t>(0), j_Tc0[0],
+                               j_Tc0[1], j_Tc0[2], j_Tc0[3]);
   ion_map["Tc0"] = Tc0;
-  static const MagneticIon Tc1((std::string) "Tc", static_cast<uint16_t>(1),
-                               j_Tc1[0], j_Tc1[1], j_Tc1[2], j_Tc1[3]);
+  static const MagneticIon Tc1("Tc", static_cast<uint16_t>(1), j_Tc1[0],
+                               j_Tc1[1], j_Tc1[2], j_Tc1[3]);
   ion_map["Tc1"] = Tc1;
-  static const MagneticIon Ru0((std::string) "Ru", static_cast<uint16_t>(0),
-                               j_Ru0[0], j_Ru0[1], j_Ru0[2], j_Ru0[3]);
+  static const MagneticIon Ru0("Ru", static_cast<uint16_t>(0), j_Ru0[0],
+                               j_Ru0[1], j_Ru0[2], j_Ru0[3]);
   ion_map["Ru0"] = Ru0;
-  static const MagneticIon Ru1((std::string) "Ru", static_cast<uint16_t>(1),
-                               j_Ru1[0], j_Ru1[1], j_Ru1[2], j_Ru1[3]);
+  static const MagneticIon Ru1("Ru", static_cast<uint16_t>(1), j_Ru1[0],
+                               j_Ru1[1], j_Ru1[2], j_Ru1[3]);
   ion_map["Ru1"] = Ru1;
-  static const MagneticIon Rh0((std::string) "Rh", static_cast<uint16_t>(0),
-                               j_Rh0[0], j_Rh0[1], j_Rh0[2], j_Rh0[3]);
+  static const MagneticIon Rh0("Rh", static_cast<uint16_t>(0), j_Rh0[0],
+                               j_Rh0[1], j_Rh0[2], j_Rh0[3]);
   ion_map["Rh0"] = Rh0;
-  static const MagneticIon Rh1((std::string) "Rh", static_cast<uint16_t>(1),
-                               j_Rh1[0], j_Rh1[1], j_Rh1[2], j_Rh1[3]);
+  static const MagneticIon Rh1("Rh", static_cast<uint16_t>(1), j_Rh1[0],
+                               j_Rh1[1], j_Rh1[2], j_Rh1[3]);
   ion_map["Rh1"] = Rh1;
-  static const MagneticIon Pd0((std::string) "Pd", static_cast<uint16_t>(0),
-                               j_Pd0[0], j_Pd0[1], j_Pd0[2], j_Pd0[3]);
+  static const MagneticIon Pd0("Pd", static_cast<uint16_t>(0), j_Pd0[0],
+                               j_Pd0[1], j_Pd0[2], j_Pd0[3]);
   ion_map["Pd0"] = Pd0;
-  static const MagneticIon Pd1((std::string) "Pd", static_cast<uint16_t>(1),
-                               j_Pd1[0], j_Pd1[1], j_Pd1[2], j_Pd1[3]);
+  static const MagneticIon Pd1("Pd", static_cast<uint16_t>(1), j_Pd1[0],
+                               j_Pd1[1], j_Pd1[2], j_Pd1[3]);
   ion_map["Pd1"] = Pd1;
-  static const MagneticIon Ce2((std::string) "Ce", static_cast<uint16_t>(2),
-                               j_Ce2[0], j_Ce2[1], j_Ce2[2], j_Ce2[3]);
+  static const MagneticIon Ce2("Ce", static_cast<uint16_t>(2), j_Ce2[0],
+                               j_Ce2[1], j_Ce2[2], j_Ce2[3]);
   ion_map["Ce2"] = Ce2;
-  static const MagneticIon Nd2((std::string) "Nd", static_cast<uint16_t>(2),
-                               j_Nd2[0], j_Nd2[1], j_Nd2[2], j_Nd2[3]);
+  static const MagneticIon Nd2("Nd", static_cast<uint16_t>(2), j_Nd2[0],
+                               j_Nd2[1], j_Nd2[2], j_Nd2[3]);
   ion_map["Nd2"] = Nd2;
-  static const MagneticIon Nd3((std::string) "Nd", static_cast<uint16_t>(3),
-                               j_Nd3[0], j_Nd3[1], j_Nd3[2], j_Nd3[3]);
+  static const MagneticIon Nd3("Nd", static_cast<uint16_t>(3), j_Nd3[0],
+                               j_Nd3[1], j_Nd3[2], j_Nd3[3]);
   ion_map["Nd3"] = Nd3;
-  static const MagneticIon Sm2((std::string) "Sm", static_cast<uint16_t>(2),
-                               j_Sm2[0], j_Sm2[1], j_Sm2[2], j_Sm2[3]);
+  static const MagneticIon Sm2("Sm", static_cast<uint16_t>(2), j_Sm2[0],
+                               j_Sm2[1], j_Sm2[2], j_Sm2[3]);
   ion_map["Sm2"] = Sm2;
-  static const MagneticIon Sm3((std::string) "Sm", static_cast<uint16_t>(3),
-                               j_Sm3[0], j_Sm3[1], j_Sm3[2], j_Sm3[3]);
+  static const MagneticIon Sm3("Sm", static_cast<uint16_t>(3), j_Sm3[0],
+                               j_Sm3[1], j_Sm3[2], j_Sm3[3]);
   ion_map["Sm3"] = Sm3;
-  static const MagneticIon Eu2((std::string) "Eu", static_cast<uint16_t>(2),
-                               j_Eu2[0], j_Eu2[1], j_Eu2[2], j_Eu2[3]);
+  static const MagneticIon Eu2("Eu", static_cast<uint16_t>(2), j_Eu2[0],
+                               j_Eu2[1], j_Eu2[2], j_Eu2[3]);
   ion_map["Eu2"] = Eu2;
-  static const MagneticIon Eu3((std::string) "Eu", static_cast<uint16_t>(3),
-                               j_Eu3[0], j_Eu3[1], j_Eu3[2], j_Eu3[3]);
+  static const MagneticIon Eu3("Eu", static_cast<uint16_t>(3), j_Eu3[0],
+                               j_Eu3[1], j_Eu3[2], j_Eu3[3]);
   ion_map["Eu3"] = Eu3;
-  static const MagneticIon Gd2((std::string) "Gd", static_cast<uint16_t>(2),
-                               j_Gd2[0], j_Gd2[1], j_Gd2[2], j_Gd2[3]);
+  static const MagneticIon Gd2("Gd", static_cast<uint16_t>(2), j_Gd2[0],
+                               j_Gd2[1], j_Gd2[2], j_Gd2[3]);
   ion_map["Gd2"] = Gd2;
-  static const MagneticIon Gd3((std::string) "Gd", static_cast<uint16_t>(3),
-                               j_Gd3[0], j_Gd3[1], j_Gd3[2], j_Gd3[3]);
+  static const MagneticIon Gd3("Gd", static_cast<uint16_t>(3), j_Gd3[0],
+                               j_Gd3[1], j_Gd3[2], j_Gd3[3]);
   ion_map["Gd3"] = Gd3;
-  static const MagneticIon Tb2((std::string) "Tb", static_cast<uint16_t>(2),
-                               j_Tb2[0], j_Tb2[1], j_Tb2[2], j_Tb2[3]);
+  static const MagneticIon Tb2("Tb", static_cast<uint16_t>(2), j_Tb2[0],
+                               j_Tb2[1], j_Tb2[2], j_Tb2[3]);
   ion_map["Tb2"] = Tb2;
-  static const MagneticIon Tb3((std::string) "Tb", static_cast<uint16_t>(3),
-                               j_Tb3[0], j_Tb3[1], j_Tb3[2], j_Tb3[3]);
+  static const MagneticIon Tb3("Tb", static_cast<uint16_t>(3), j_Tb3[0],
+                               j_Tb3[1], j_Tb3[2], j_Tb3[3]);
   ion_map["Tb3"] = Tb3;
-  static const MagneticIon Dy2((std::string) "Dy", static_cast<uint16_t>(2),
-                               j_Dy2[0], j_Dy2[1], j_Dy2[2], j_Dy2[3]);
+  static const MagneticIon Dy2("Dy", static_cast<uint16_t>(2), j_Dy2[0],
+                               j_Dy2[1], j_Dy2[2], j_Dy2[3]);
   ion_map["Dy2"] = Dy2;
-  static const MagneticIon Dy3((std::string) "Dy", static_cast<uint16_t>(3),
-                               j_Dy3[0], j_Dy3[1], j_Dy3[2], j_Dy3[3]);
+  static const MagneticIon Dy3("Dy", static_cast<uint16_t>(3), j_Dy3[0],
+                               j_Dy3[1], j_Dy3[2], j_Dy3[3]);
   ion_map["Dy3"] = Dy3;
-  static const MagneticIon Ho2((std::string) "Ho", static_cast<uint16_t>(2),
-                               j_Ho2[0], j_Ho2[1], j_Ho2[2], j_Ho2[3]);
+  static const MagneticIon Ho2("Ho", static_cast<uint16_t>(2), j_Ho2[0],
+                               j_Ho2[1], j_Ho2[2], j_Ho2[3]);
   ion_map["Ho2"] = Ho2;
-  static const MagneticIon Ho3((std::string) "Ho", static_cast<uint16_t>(3),
-                               j_Ho3[0], j_Ho3[1], j_Ho3[2], j_Ho3[3]);
+  static const MagneticIon Ho3("Ho", static_cast<uint16_t>(3), j_Ho3[0],
+                               j_Ho3[1], j_Ho3[2], j_Ho3[3]);
   ion_map["Ho3"] = Ho3;
-  static const MagneticIon Er2((std::string) "Er", static_cast<uint16_t>(2),
-                               j_Er2[0], j_Er2[1], j_Er2[2], j_Er2[3]);
+  static const MagneticIon Er2("Er", static_cast<uint16_t>(2), j_Er2[0],
+                               j_Er2[1], j_Er2[2], j_Er2[3]);
   ion_map["Er2"] = Er2;
-  static const MagneticIon Er3((std::string) "Er", static_cast<uint16_t>(3),
-                               j_Er3[0], j_Er3[1], j_Er3[2], j_Er3[3]);
+  static const MagneticIon Er3("Er", static_cast<uint16_t>(3), j_Er3[0],
+                               j_Er3[1], j_Er3[2], j_Er3[3]);
   ion_map["Er3"] = Er3;
-  static const MagneticIon Tm2((std::string) "Tm", static_cast<uint16_t>(2),
-                               j_Tm2[0], j_Tm2[1], j_Tm2[2], j_Tm2[3]);
+  static const MagneticIon Tm2("Tm", static_cast<uint16_t>(2), j_Tm2[0],
+                               j_Tm2[1], j_Tm2[2], j_Tm2[3]);
   ion_map["Tm2"] = Tm2;
-  static const MagneticIon Tm3((std::string) "Tm", static_cast<uint16_t>(3),
-                               j_Tm3[0], j_Tm3[1], j_Tm3[2], j_Tm3[3]);
+  static const MagneticIon Tm3("Tm", static_cast<uint16_t>(3), j_Tm3[0],
+                               j_Tm3[1], j_Tm3[2], j_Tm3[3]);
   ion_map["Tm3"] = Tm3;
-  static const MagneticIon Yb2((std::string) "Yb", static_cast<uint16_t>(2),
-                               j_Yb2[0], j_Yb2[1], j_Yb2[2], j_Yb2[3]);
+  static const MagneticIon Yb2("Yb", static_cast<uint16_t>(2), j_Yb2[0],
+                               j_Yb2[1], j_Yb2[2], j_Yb2[3]);
   ion_map["Yb2"] = Yb2;
-  static const MagneticIon Yb3((std::string) "Yb", static_cast<uint16_t>(3),
-                               j_Yb3[0], j_Yb3[1], j_Yb3[2], j_Yb3[3]);
+  static const MagneticIon Yb3("Yb", static_cast<uint16_t>(3), j_Yb3[0],
+                               j_Yb3[1], j_Yb3[2], j_Yb3[3]);
   ion_map["Yb3"] = Yb3;
-  static const MagneticIon U3((std::string) "U", static_cast<uint16_t>(3),
-                              j_U3[0], j_U3[1], j_U3[2], j_U3[3]);
+  static const MagneticIon U3("U", static_cast<uint16_t>(3), j_U3[0], j_U3[1],
+                              j_U3[2], j_U3[3]);
   ion_map["U3"] = U3;
-  static const MagneticIon U4((std::string) "U", static_cast<uint16_t>(4),
-                              j_U4[0], j_U4[1], j_U4[2], j_U4[3]);
+  static const MagneticIon U4("U", static_cast<uint16_t>(4), j_U4[0], j_U4[1],
+                              j_U4[2], j_U4[3]);
   ion_map["U4"] = U4;
-  static const MagneticIon U5((std::string) "U", static_cast<uint16_t>(5),
-                              j_U5[0], j_U5[1], j_U5[2], j_U5[3]);
+  static const MagneticIon U5("U", static_cast<uint16_t>(5), j_U5[0], j_U5[1],
+                              j_U5[2], j_U5[3]);
   ion_map["U5"] = U5;
-  static const MagneticIon Np3((std::string) "Np", static_cast<uint16_t>(3),
-                               j_Np3[0], j_Np3[1], j_Np3[2], j_Np3[3]);
+  static const MagneticIon Np3("Np", static_cast<uint16_t>(3), j_Np3[0],
+                               j_Np3[1], j_Np3[2], j_Np3[3]);
   ion_map["Np3"] = Np3;
-  static const MagneticIon Np4((std::string) "Np", static_cast<uint16_t>(4),
-                               j_Np4[0], j_Np4[1], j_Np4[2], j_Np4[3]);
+  static const MagneticIon Np4("Np", static_cast<uint16_t>(4), j_Np4[0],
+                               j_Np4[1], j_Np4[2], j_Np4[3]);
   ion_map["Np4"] = Np4;
-  static const MagneticIon Np5((std::string) "Np", static_cast<uint16_t>(5),
-                               j_Np5[0], j_Np5[1], j_Np5[2], j_Np5[3]);
+  static const MagneticIon Np5("Np", static_cast<uint16_t>(5), j_Np5[0],
+                               j_Np5[1], j_Np5[2], j_Np5[3]);
   ion_map["Np5"] = Np5;
-  static const MagneticIon Np6((std::string) "Np", static_cast<uint16_t>(6),
-                               j_Np6[0], j_Np6[1], j_Np6[2], j_Np6[3]);
+  static const MagneticIon Np6("Np", static_cast<uint16_t>(6), j_Np6[0],
+                               j_Np6[1], j_Np6[2], j_Np6[3]);
   ion_map["Np6"] = Np6;
-  static const MagneticIon Pu3((std::string) "Pu", static_cast<uint16_t>(3),
-                               j_Pu3[0], j_Pu3[1], j_Pu3[2], j_Pu3[3]);
+  static const MagneticIon Pu3("Pu", static_cast<uint16_t>(3), j_Pu3[0],
+                               j_Pu3[1], j_Pu3[2], j_Pu3[3]);
   ion_map["Pu3"] = Pu3;
-  static const MagneticIon Pu4((std::string) "Pu", static_cast<uint16_t>(4),
-                               j_Pu4[0], j_Pu4[1], j_Pu4[2], j_Pu4[3]);
+  static const MagneticIon Pu4("Pu", static_cast<uint16_t>(4), j_Pu4[0],
+                               j_Pu4[1], j_Pu4[2], j_Pu4[3]);
   ion_map["Pu4"] = Pu4;
-  static const MagneticIon Pu5((std::string) "Pu", static_cast<uint16_t>(5),
-                               j_Pu5[0], j_Pu5[1], j_Pu5[2], j_Pu5[3]);
+  static const MagneticIon Pu5("Pu", static_cast<uint16_t>(5), j_Pu5[0],
+                               j_Pu5[1], j_Pu5[2], j_Pu5[3]);
   ion_map["Pu5"] = Pu5;
-  static const MagneticIon Pu6((std::string) "Pu", static_cast<uint16_t>(6),
-                               j_Pu6[0], j_Pu6[1], j_Pu6[2], j_Pu6[3]);
+  static const MagneticIon Pu6("Pu", static_cast<uint16_t>(6), j_Pu6[0],
+                               j_Pu6[1], j_Pu6[2], j_Pu6[3]);
   ion_map["Pu6"] = Pu6;
-  static const MagneticIon Am2((std::string) "Am", static_cast<uint16_t>(2),
-                               j_Am2[0], j_Am2[1], j_Am2[2], j_Am2[3]);
+  static const MagneticIon Am2("Am", static_cast<uint16_t>(2), j_Am2[0],
+                               j_Am2[1], j_Am2[2], j_Am2[3]);
   ion_map["Am2"] = Am2;
-  static const MagneticIon Am3((std::string) "Am", static_cast<uint16_t>(3),
-                               j_Am3[0], j_Am3[1], j_Am3[2], j_Am3[3]);
+  static const MagneticIon Am3("Am", static_cast<uint16_t>(3), j_Am3[0],
+                               j_Am3[1], j_Am3[2], j_Am3[3]);
   ion_map["Am3"] = Am3;
-  static const MagneticIon Am4((std::string) "Am", static_cast<uint16_t>(4),
-                               j_Am4[0], j_Am4[1], j_Am4[2], j_Am4[3]);
+  static const MagneticIon Am4("Am", static_cast<uint16_t>(4), j_Am4[0],
+                               j_Am4[1], j_Am4[2], j_Am4[3]);
   ion_map["Am4"] = Am4;
-  static const MagneticIon Am5((std::string) "Am", static_cast<uint16_t>(5),
-                               j_Am5[0], j_Am5[1], j_Am5[2], j_Am5[3]);
+  static const MagneticIon Am5("Am", static_cast<uint16_t>(5), j_Am5[0],
+                               j_Am5[1], j_Am5[2], j_Am5[3]);
   ion_map["Am5"] = Am5;
-  static const MagneticIon Am6((std::string) "Am", static_cast<uint16_t>(6),
-                               j_Am6[0], j_Am6[1], j_Am6[2], j_Am6[3]);
+  static const MagneticIon Am6("Am", static_cast<uint16_t>(6), j_Am6[0],
+                               j_Am6[1], j_Am6[2], j_Am6[3]);
   ion_map["Am6"] = Am6;
-  static const MagneticIon Am7((std::string) "Am", static_cast<uint16_t>(7),
-                               j_Am7[0], j_Am7[1], j_Am7[2], j_Am7[3]);
+  static const MagneticIon Am7("Am", static_cast<uint16_t>(7), j_Am7[0],
+                               j_Am7[1], j_Am7[2], j_Am7[3]);
   ion_map["Am7"] = Am7;
 }
 
diff --git a/Framework/Kernel/src/Matrix.cpp b/Framework/Kernel/src/Matrix.cpp
index d34de6871af9eb1f3f6ec10981b47e27933ce00c..d44a14762b24da8e66c53b2e65ad135e30766723 100644
--- a/Framework/Kernel/src/Matrix.cpp
+++ b/Framework/Kernel/src/Matrix.cpp
@@ -636,7 +636,7 @@ void Matrix<T>::identityMatrix()
   if (nx * ny) {
     for (size_t i = 0; i < nx; i++) {
       for (size_t j = 0; j < ny; j++) {
-        V[i][j] = (T)((j == i) ? 1 : 0);
+        V[i][j] = static_cast<T>(j == i);
       }
     }
   }
@@ -1422,7 +1422,7 @@ std::vector<T> Matrix<T>::toRotation()
   *this = this->operator*(scalingMatrix);
   if (this->determinant() < 0.) {
     scale[0] = -scale[0];
-    change[0][0] = (T)(-1);
+    change[0][0] = static_cast<T>(-1);
     *this = this->operator*(change);
   }
   return scale;
diff --git a/Framework/Kernel/src/NetworkProxyOSX.cpp b/Framework/Kernel/src/NetworkProxyOSX.cpp
index ee6af9117c5a509a306693c36b1a56a462d4790d..1d2e28a3ee8fd9c111ae6d2958af0e4ee706a0f5 100644
--- a/Framework/Kernel/src/NetworkProxyOSX.cpp
+++ b/Framework/Kernel/src/NetworkProxyOSX.cpp
@@ -124,7 +124,8 @@ ProxyInfoVec proxyInformationFromPac(CFDictionaryRef dict,
           kCFAllocatorDefault, pacData, kCFStringEncodingISOLatin1);
 
       CFURLRef targetURL = CFURLCreateWithBytes(
-          kCFAllocatorDefault, (UInt8 *)targetURLString.c_str(),
+          kCFAllocatorDefault, reinterpret_cast<UInt8 *>(
+                                   const_cast<char *>(targetURLString.c_str())),
           targetURLString.size(), kCFStringEncodingUTF8, nullptr);
       if (!targetURL) {
         logger.debug("Problem with Target URI for proxy script");
diff --git a/Framework/Kernel/src/PropertyManager.cpp b/Framework/Kernel/src/PropertyManager.cpp
index 303b452b393ea7084250e8eafa57b3795bf34ffd..f5aabcf7e43b0b5f9804b4fcbf514f494f860241 100644
--- a/Framework/Kernel/src/PropertyManager.cpp
+++ b/Framework/Kernel/src/PropertyManager.cpp
@@ -217,7 +217,7 @@ void PropertyManager::declareProperty(Property *p, const std::string &doc) {
  */
 void PropertyManager::setProperties(
     const std::string &propertiesJson,
-    const std::set<std::string> &ignoreProperties) {
+    const std::unordered_set<std::string> &ignoreProperties) {
   setProperties(propertiesJson, this, ignoreProperties);
 }
 //-----------------------------------------------------------------------------------------------
@@ -235,7 +235,7 @@ void PropertyManager::setProperties(
  */
 void PropertyManager::setProperties(
     const std::string &propertiesJson, IPropertyManager *targetPropertyManager,
-    const std::set<std::string> &ignoreProperties) {
+    const std::unordered_set<std::string> &ignoreProperties) {
   ::Json::Reader reader;
   ::Json::Value jsonValue;
 
@@ -254,7 +254,7 @@ void PropertyManager::setProperties(
  */
 void PropertyManager::setProperties(
     const ::Json::Value &jsonValue,
-    const std::set<std::string> &ignoreProperties) {
+    const std::unordered_set<std::string> &ignoreProperties) {
   setProperties(jsonValue, this, ignoreProperties);
 }
 
@@ -269,7 +269,7 @@ void PropertyManager::setProperties(
  */
 void PropertyManager::setProperties(
     const ::Json::Value &jsonValue, IPropertyManager *targetPropertyManager,
-    const std::set<std::string> &ignoreProperties) {
+    const std::unordered_set<std::string> &ignoreProperties) {
   if (jsonValue.type() == ::Json::ValueType::objectValue) {
 
     // Some algorithms require Filename to be set first do that here
@@ -302,7 +302,7 @@ void PropertyManager::setProperties(
 */
 void PropertyManager::setPropertiesWithSimpleString(
     const std::string &propertiesString,
-    const std::set<std::string> &ignoreProperties) {
+    const std::unordered_set<std::string> &ignoreProperties) {
   ::Json::Value propertyJson;
   // Split up comma-separated properties
   typedef boost::tokenizer<boost::char_separator<char>> tokenizer;
diff --git a/Framework/Kernel/src/PropertyManagerOwner.cpp b/Framework/Kernel/src/PropertyManagerOwner.cpp
index 08ad8bd11c33515b1a3be70c3554ef1a019cda52..318325b6a72bbf5e65730b533481c4cde3717620 100644
--- a/Framework/Kernel/src/PropertyManagerOwner.cpp
+++ b/Framework/Kernel/src/PropertyManagerOwner.cpp
@@ -53,7 +53,7 @@ void PropertyManagerOwner::declareProperty(Property *p,
  */
 void PropertyManagerOwner::setProperties(
     const std::string &propertiesJson,
-    const std::set<std::string> &ignoreProperties) {
+    const std::unordered_set<std::string> &ignoreProperties) {
   m_properties->setProperties(propertiesJson, this, ignoreProperties);
 }
 
@@ -64,7 +64,7 @@ void PropertyManagerOwner::setProperties(
   */
 void PropertyManagerOwner::setProperties(
     const ::Json::Value &jsonValue,
-    const std::set<std::string> &ignoreProperties) {
+    const std::unordered_set<std::string> &ignoreProperties) {
   m_properties->setProperties(jsonValue, this, ignoreProperties);
 }
 
@@ -76,7 +76,7 @@ void PropertyManagerOwner::setProperties(
 */
 void PropertyManagerOwner::setPropertiesWithSimpleString(
     const std::string &propertiesString,
-    const std::set<std::string> &ignoreProperties) {
+    const std::unordered_set<std::string> &ignoreProperties) {
   m_properties->setPropertiesWithSimpleString(propertiesString,
                                               ignoreProperties);
 }
diff --git a/Framework/Kernel/src/Statistics.cpp b/Framework/Kernel/src/Statistics.cpp
index 5620cb71d827f3fbbe9454c7b0803ac67de55b61..7c5909edf757c4aac1f8c3b183bed1bc9de33248 100644
--- a/Framework/Kernel/src/Statistics.cpp
+++ b/Framework/Kernel/src/Statistics.cpp
@@ -11,6 +11,12 @@
 #include <stdexcept>
 #include <functional>
 
+#include <boost/accumulators/accumulators.hpp>
+#include <boost/accumulators/statistics/stats.hpp>
+#include <boost/accumulators/statistics/min.hpp>
+#include <boost/accumulators/statistics/max.hpp>
+#include <boost/accumulators/statistics/variance.hpp>
+
 namespace Mantid {
 namespace Kernel {
 
@@ -44,7 +50,7 @@ double getMedian(const vector<TYPE> &data, const size_t num_data,
   if (num_data == 1)
     return static_cast<double>(*(data.begin()));
 
-  bool is_even = ((num_data % 2) == 0);
+  bool is_even = ((num_data & 1) == 0);
   if (is_even) {
     double left = 0.0;
     double right = 0.0;
@@ -81,6 +87,7 @@ double getMedian(const vector<TYPE> &data, const size_t num_data,
     }
   }
 }
+
 /**
  * There are enough special cases in determining the Z score where it useful to
  * put it in a single function.
@@ -145,42 +152,47 @@ std::vector<double> getModifiedZscore(const vector<TYPE> &data,
  */
 template <typename TYPE>
 Statistics getStatistics(const vector<TYPE> &data, const unsigned int flags) {
-  Statistics stats = getNanStatistics();
+  Statistics statistics = getNanStatistics();
   size_t num_data = data.size(); // cache since it is frequently used
   if (num_data == 0) {           // don't do anything
-    return stats;
+    return statistics;
   }
-
   // calculate the mean if this or the stddev is requested
   const bool stddev = ((flags & StatOptions::UncorrectedStdDev) ||
                        (flags & StatOptions::CorrectedStdDev));
-  if ((flags & StatOptions::Mean) || stddev) {
-    const TYPE sum = std::accumulate(data.begin(), data.end(),
-                                     static_cast<TYPE>(0), std::plus<TYPE>());
-    stats.mean = static_cast<double>(sum) / (static_cast<double>(num_data));
-    if (stddev) {
-      // calculate the standard deviation, min, max
-      stats.minimum = stats.mean;
-      stats.maximum = stats.mean;
-      double stddev = 0.;
-      for (auto it = data.cbegin(); it != data.cend(); ++it) {
-        double temp = static_cast<double>(*it);
-        stddev += ((temp - stats.mean) * (temp - stats.mean));
-        if (temp > stats.maximum)
-          stats.maximum = temp;
-        if (temp < stats.minimum)
-          stats.minimum = temp;
-      }
-      size_t ndofs =
-          (flags & StatOptions::CorrectedStdDev) ? num_data - 1 : num_data;
-      stats.standard_deviation = sqrt(stddev / (static_cast<double>(ndofs)));
+  if (stddev) {
+    using namespace boost::accumulators;
+    accumulator_set<double, stats<tag::min, tag::max, tag::variance>> acc;
+    for (auto &value : data) {
+      acc(static_cast<double>(value));
+    }
+    statistics.minimum = min(acc);
+    statistics.maximum = max(acc);
+    statistics.mean = mean(acc);
+    double var = variance(acc);
+
+    if (flags & StatOptions::CorrectedStdDev) {
+      double ndofs = static_cast<double>(data.size());
+      var *= ndofs / (ndofs - 1.0);
     }
+    statistics.standard_deviation = std::sqrt(var);
+
+  } else if (flags & StatOptions::Mean) {
+    using namespace boost::accumulators;
+    accumulator_set<double, stats<tag::mean>> acc;
+    for (auto &value : data) {
+      acc(static_cast<double>(value));
+    }
+    statistics.mean = mean(acc);
   }
+
   // calculate the median if requested
   if (flags & StatOptions::Median) {
-    stats.median = getMedian(data, num_data, flags & StatOptions::SortedData);
+    statistics.median =
+        getMedian(data, num_data, flags & StatOptions::SortedData);
   }
-  return stats;
+
+  return statistics;
 }
 
 /// Getting statistics of a string array should just give a bunch of NaNs
diff --git a/Framework/Kernel/src/StringTokenizer.cpp b/Framework/Kernel/src/StringTokenizer.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..a7f1ae80071e407decb7a7a74fce8c181cc07903
--- /dev/null
+++ b/Framework/Kernel/src/StringTokenizer.cpp
@@ -0,0 +1,165 @@
+#include "MantidKernel/StringTokenizer.h"
+#include <algorithm>
+#include <functional>
+#include <cassert>
+#include <iterator> //cbegin,cend
+
+namespace {
+
+// implement our own trim function to avoid the locale overhead in boost::trim.
+
+// trim from start
+void trimTokenFromStart(std::string &s) {
+  s.erase(s.begin(), std::find_if_not(s.begin(), s.end(), ::isspace));
+}
+
+// trim from end
+void trimTokenFromEnd(std::string &s) {
+  s.erase(std::find_if_not(s.rbegin(), s.rend(), ::isspace).base(), s.end());
+}
+
+// trim from both ends
+void trimToken(std::string &s) {
+  trimTokenFromStart(s);
+  trimTokenFromEnd(s);
+}
+
+// If the final character is a separator, we need to add an empty string to
+// tokens.
+void addEmptyFinalToken(const std::string &str, const std::string &delims,
+                        std::vector<std::string> &tokens) {
+
+  const auto pos = std::find(delims.cbegin(), delims.cend(), str.back());
+
+  if (pos != delims.cend()) {
+    tokens.emplace_back();
+  }
+}
+
+// generic tokenizer using std::find_first_of modelled after
+// http://tcbrindle.github.io/posts/a-quicker-study-on-tokenising/
+// MIT licensed.
+template <class InputIt, class ForwardIt, class BinOp>
+void for_each_token(InputIt first, InputIt last, ForwardIt s_first,
+                    ForwardIt s_last, BinOp binary_op) {
+  while (first != last) {
+    const auto pos = std::find_first_of(first, last, s_first, s_last);
+    binary_op(first, pos);
+    if (pos == last)
+      break;
+    first = std::next(pos);
+  }
+}
+
+std::vector<std::string>
+splitKeepingWhitespaceEmptyTokens(const std::string &str,
+                                  const std::string &delims) {
+  std::vector<std::string> output;
+  for_each_token(str.cbegin(), str.cend(), delims.cbegin(), delims.cend(),
+                 [&output](std::string::const_iterator first,
+                           std::string::const_iterator second) {
+                   output.emplace_back(first, second);
+                 });
+  return output;
+}
+
+std::vector<std::string>
+splitKeepingWhitespaceIgnoringEmptyTokens(const std::string &str,
+                                          const std::string &delims) {
+  std::vector<std::string> output;
+  for_each_token(str.cbegin(), str.cend(), delims.cbegin(), delims.cend(),
+                 [&output](std::string::const_iterator first,
+                           std::string::const_iterator second) {
+                   if (first != second)
+                     output.emplace_back(first, second);
+                 });
+  return output;
+}
+
+std::vector<std::string>
+splitIgnoringWhitespaceKeepingEmptyTokens(const std::string &str,
+                                          const std::string &delims) {
+  std::vector<std::string> output;
+  for_each_token(str.cbegin(), str.cend(), delims.cbegin(), delims.cend(),
+                 [&output](std::string::const_iterator first,
+                           std::string::const_iterator second) {
+                   output.emplace_back(first, second);
+                   trimToken(output.back());
+                 });
+  return output;
+}
+
+std::vector<std::string>
+splitIgnoringWhitespaceEmptyTokens(const std::string &str,
+                                   const std::string &delims) {
+  std::vector<std::string> output;
+  for_each_token(str.cbegin(), str.cend(), delims.cbegin(), delims.cend(),
+                 [&output](std::string::const_iterator first,
+                           std::string::const_iterator second) {
+                   if (first != second) {
+                     output.emplace_back(first, second);
+                     trimToken(output.back());
+                     if (output.back().empty())
+                       output.pop_back();
+                   }
+                 });
+  return output;
+}
+}
+
+/**
+ * Constructor requiring a string to tokenize and a string of separators.
+ * @param str Input string to be separated into tokens.
+ * @param separators List of characters used to separate the input string.
+ * @param options  tokenizer settings. The number can be found using the
+ * StringTokenizer::Options enum
+ * @throw Throws std::runtime_error if options > 7.
+ * @return a const reference to the index'th token.
+ */
+Mantid::Kernel::StringTokenizer::StringTokenizer(const std::string &str,
+                                                 const std::string &separators,
+                                                 unsigned options) {
+
+  // if str is empty, then there is no work to do. exit early.
+  if (str.empty())
+    return;
+
+  // see comments above for the different options split0,split1,split2 and
+  // split3 implement.
+  // cases 0-3 will check for a separator in the last place and insert an empty
+  // token at the end.
+  // cases 4-7 will not check and ignore a potential empty token at the end.
+  switch (options) {
+  case 0:
+    m_tokens = splitKeepingWhitespaceEmptyTokens(str, separators);
+    addEmptyFinalToken(str, separators, m_tokens);
+    return;
+  case TOK_IGNORE_EMPTY:
+    m_tokens = splitKeepingWhitespaceIgnoringEmptyTokens(str, separators);
+    return;
+  case TOK_TRIM:
+    m_tokens = splitIgnoringWhitespaceKeepingEmptyTokens(str, separators);
+    addEmptyFinalToken(str, separators, m_tokens);
+    return;
+  case (TOK_TRIM | TOK_IGNORE_EMPTY):
+    m_tokens = splitIgnoringWhitespaceEmptyTokens(str, separators);
+    return;
+  case TOK_IGNORE_FINAL_EMPTY_TOKEN:
+    m_tokens = splitKeepingWhitespaceEmptyTokens(str, separators);
+    return;
+  case (TOK_IGNORE_FINAL_EMPTY_TOKEN | TOK_IGNORE_EMPTY):
+    m_tokens = splitKeepingWhitespaceIgnoringEmptyTokens(str, separators);
+    return;
+  case (TOK_IGNORE_FINAL_EMPTY_TOKEN | TOK_TRIM):
+    m_tokens = splitIgnoringWhitespaceKeepingEmptyTokens(str, separators);
+    return;
+  case (TOK_IGNORE_FINAL_EMPTY_TOKEN | TOK_TRIM | TOK_IGNORE_EMPTY):
+    m_tokens = splitIgnoringWhitespaceEmptyTokens(str, separators);
+    return;
+  }
+
+  // This point is reached only if options > 7.
+  throw std::runtime_error(
+      "Invalid option passed to Mantid::Kernel::StringTokenizer:" +
+      std::to_string(options));
+}
diff --git a/Framework/Kernel/src/Strings.cpp b/Framework/Kernel/src/Strings.cpp
index 99e69ed0887a501c1af41de9f67b573d0acfc85f..ae37950183dd938f9a61993760280f37054e7178 100644
--- a/Framework/Kernel/src/Strings.cpp
+++ b/Framework/Kernel/src/Strings.cpp
@@ -1,7 +1,7 @@
 #include "MantidKernel/Strings.h"
 #include "MantidKernel/UnitLabel.h"
+#include "MantidKernel/StringTokenizer.h"
 
-#include <Poco/StringTokenizer.h>
 #include <Poco/Path.h>
 
 #include <boost/algorithm/string.hpp>
@@ -436,11 +436,12 @@ std::map<std::string, std::string>
 splitToKeyValues(const std::string &input, const std::string &keyValSep,
                  const std::string &listSep) {
   std::map<std::string, std::string> keyValues;
-  const int splitOptions =
-      Poco::StringTokenizer::TOK_IGNORE_EMPTY + Poco::StringTokenizer::TOK_TRIM;
-  Poco::StringTokenizer listSplitter(input, listSep);
+  const int splitOptions = Mantid::Kernel::StringTokenizer::TOK_IGNORE_EMPTY +
+                           Mantid::Kernel::StringTokenizer::TOK_TRIM;
+  Mantid::Kernel::StringTokenizer listSplitter(input, listSep);
   for (const auto &iter : listSplitter) {
-    Poco::StringTokenizer keyValSplitter(iter, keyValSep, splitOptions);
+    Mantid::Kernel::StringTokenizer keyValSplitter(iter, keyValSep,
+                                                   splitOptions);
     if (keyValSplitter.count() == 2) {
       keyValues[keyValSplitter[0]] = keyValSplitter[1];
     }
@@ -1045,39 +1046,33 @@ int isMember(const std::vector<std::string> &group,
  */
 std::vector<int> parseRange(const std::string &str, const std::string &elemSep,
                             const std::string &rangeSep) {
-  typedef Poco::StringTokenizer Tokenizer;
+  typedef Mantid::Kernel::StringTokenizer Tokenizer;
 
-  boost::shared_ptr<Tokenizer> elements;
+  Tokenizer elements;
 
   if (elemSep.find(' ') != std::string::npos) {
     // If element separator contains space character it's a special case,
     // because in that case
     // it is allowed to have element separator inside a range, e.g. "4 - 5", but
     // not "4,-5"
-
-    // Space is added so that last empty element of the "1,2,3-" is not ignored
-    // and we can
-    // spot the error. Behaviour is changed in Poco 1.5 and this will not be
-    // needed.
-    Tokenizer ranges(str + " ", rangeSep, Tokenizer::TOK_TRIM);
+    Tokenizer ranges(str, rangeSep, Tokenizer::TOK_TRIM);
     std::string new_str =
         join(ranges.begin(), ranges.end(), rangeSep.substr(0, 1));
-
-    elements = boost::make_shared<Tokenizer>(
-        new_str, elemSep, Tokenizer::TOK_IGNORE_EMPTY | Tokenizer::TOK_TRIM);
+    elements = Tokenizer(new_str, elemSep,
+                         Tokenizer::TOK_IGNORE_EMPTY | Tokenizer::TOK_TRIM);
   } else {
-    elements = boost::make_shared<Tokenizer>(
-        str, elemSep, Tokenizer::TOK_IGNORE_EMPTY | Tokenizer::TOK_TRIM);
+    elements = Tokenizer(str, elemSep,
+                         Tokenizer::TOK_IGNORE_EMPTY | Tokenizer::TOK_TRIM);
   }
 
   std::vector<int> result;
 
   // Estimation of the resulting number of elements
-  result.reserve(elements->count());
+  result.reserve(elements.count());
 
-  for (const auto &elementString : *elements) {
+  for (const auto &elementString : elements) {
     // See above for the reason space is added
-    Tokenizer rangeElements(elementString + " ", rangeSep, Tokenizer::TOK_TRIM);
+    Tokenizer rangeElements(elementString, rangeSep, Tokenizer::TOK_TRIM);
 
     size_t noOfRangeElements = rangeElements.count();
 
diff --git a/Framework/Kernel/src/TimeSeriesProperty.cpp b/Framework/Kernel/src/TimeSeriesProperty.cpp
index bcc59cd5ba6d24beea5d79a4726a2ef80b9953b5..1a99aacc02c0cdb1e1b4ea84d601d55ccbcc1f3e 100644
--- a/Framework/Kernel/src/TimeSeriesProperty.cpp
+++ b/Framework/Kernel/src/TimeSeriesProperty.cpp
@@ -3,6 +3,7 @@
 #include "MantidKernel/Exception.h"
 #include "MantidKernel/Logger.h"
 #include "MantidKernel/TimeSplitter.h"
+#include "MantidKernel/make_unique.h"
 
 #if !(defined __APPLE__ && defined __INTEL_COMPILER)
 #else
@@ -80,8 +81,8 @@ TimeSeriesProperty<TYPE>::getDerivative() const {
   TYPE v0 = it->value();
 
   it++;
-  auto timeSeriesDeriv = std::unique_ptr<TimeSeriesProperty<double>>(
-      new TimeSeriesProperty<double>(this->name() + "_derivative"));
+  auto timeSeriesDeriv = Kernel::make_unique<TimeSeriesProperty<double>>(
+      this->name() + "_derivative");
   timeSeriesDeriv->reserve(this->m_values.size() - 1);
   for (; it != m_values.end(); it++) {
     TYPE v1 = it->value();
@@ -278,17 +279,13 @@ void TimeSeriesProperty<TYPE>::filterByTime(const Kernel::DateAndTime &start,
     // "start time" is behind time-series's starting time
     iterhead = m_values.begin() + istart;
 
-    bool useprefiltertime;
-    if (m_values[istart].time() == start) {
-      // The filter time is on the mark.  Erase [begin(),  istart)
-      useprefiltertime = false;
-    } else {
-      // The filter time is larger than T[istart]. Erase[begin(), istart) ...
-      // filter start(time)
-      // and move istart to filter startime
-      useprefiltertime = true;
-    }
+    // false: The filter time is on the mark.  Erase [begin(),  istart)
 
+    // true: The filter time is larger than T[istart]. Erase[begin(), istart)
+    // ...
+    // filter start(time)
+    // and move istart to filter startime
+    bool useprefiltertime = !(m_values[istart].time() == start);
     // Remove the series
     m_values.erase(m_values.begin(), iterhead);
 
diff --git a/Framework/Kernel/test/BinaryFileTest.h b/Framework/Kernel/test/BinaryFileTest.h
index b81bc7dd095b01adadc1fca8878e9cedd98a59c0..ba5c733fc21dfbebc3f8f5f4f2fbf7a5ab21f6db 100644
--- a/Framework/Kernel/test/BinaryFileTest.h
+++ b/Framework/Kernel/test/BinaryFileTest.h
@@ -94,7 +94,7 @@ public:
     Poco::File(dummy_file).remove();
   }
 
-  void testLoadAllInto() {
+  void testLoadAllIntoVector() {
     MakeDummyFile(dummy_file, 20 * 8);
     file.open(dummy_file);
 
@@ -103,7 +103,7 @@ public:
     TS_ASSERT_EQUALS(file.getNumElements(), num);
     // Get it
     std::vector<DasEvent> data;
-    TS_ASSERT_THROWS_NOTHING(file.loadAllInto(data));
+    TS_ASSERT_THROWS_NOTHING(data = file.loadAllIntoVector());
     TS_ASSERT_EQUALS(data.size(), num);
     // Check the first event
     TS_ASSERT_EQUALS(data.at(0).tof, 0);
@@ -187,7 +187,7 @@ public:
     DasEvent *buffer = NULL;
     TS_ASSERT_EQUALS(file2.getNumElements(), 0);
     TS_ASSERT_THROWS(file2.loadAll(), std::runtime_error);
-    TS_ASSERT_THROWS(file2.loadAllInto(data), std::runtime_error);
+    TS_ASSERT_THROWS(data = file2.loadAllIntoVector(), std::runtime_error);
     TS_ASSERT_THROWS(file2.loadBlock(buffer, 10), std::runtime_error);
   }
 };
diff --git a/Framework/Kernel/test/ChebyshevPolyFitTest.h b/Framework/Kernel/test/ChebyshevPolyFitTest.h
index 8f977f69207587d6c728888454e5e1b9fed13601..9d3fe39b69fa66c4f038e34164f0b68892ace8b6 100644
--- a/Framework/Kernel/test/ChebyshevPolyFitTest.h
+++ b/Framework/Kernel/test/ChebyshevPolyFitTest.h
@@ -4,7 +4,6 @@
 #include <cxxtest/TestSuite.h>
 
 #include "MantidKernel/Math/ChebyshevPolyFit.h"
-#include <boost/assign/list_of.hpp>
 
 using Mantid::Kernel::ChebyshevPolyFit;
 
@@ -18,10 +17,9 @@ public:
   static void destroySuite(ChebyshevPolyFitTest *suite) { delete suite; }
 
   void test_case_with_quadratic_polynomial() {
-    using namespace boost::assign;
-    const std::vector<double> xs = list_of(1.0)(2.0)(3.0)(4.0)(5.0);
-    const std::vector<double> ys = list_of(1.0)(4.0)(9.0)(16.0)(25.0);
-    const std::vector<double> wgts = list_of(1.0)(0.9)(0.5)(0.2)(0.05);
+    const std::vector<double> xs = {1.0, 2.0, 3.0, 4.0, 5.0};
+    const std::vector<double> ys = {1.0, 4.0, 9.0, 16.0, 25.0};
+    const std::vector<double> wgts = {1.0, 0.9, 0.5, 0.2, 0.05};
 
     ChebyshevPolyFit polyfit(2);
     auto coeffs = polyfit(xs, ys, wgts);
diff --git a/Framework/Kernel/test/ChebyshevSeriesTest.h b/Framework/Kernel/test/ChebyshevSeriesTest.h
index a09caeba909edb6361ec7b4626fd7a86f4e7ed67..c58e33434777b943e950d224bf8c7a37562153f3 100644
--- a/Framework/Kernel/test/ChebyshevSeriesTest.h
+++ b/Framework/Kernel/test/ChebyshevSeriesTest.h
@@ -4,7 +4,6 @@
 #include <cxxtest/TestSuite.h>
 
 #include "MantidKernel/Math/Distributions/ChebyshevSeries.h"
-#include <boost/assign/list_of.hpp>
 
 using Mantid::Kernel::ChebyshevSeries;
 
@@ -18,9 +17,8 @@ public:
   static void destroySuite(ChebyshevSeriesTest *suite) { delete suite; }
 
   void test_expected_values_for_x_in_range() {
-    using namespace boost::assign;
     const double delta(1e-12);
-    std::vector<double> coeffs = list_of(0.5)(2.4)(-3.2)(-1.7)(2.1);
+    std::vector<double> coeffs = {0.5, 2.4, -3.2, -1.7, 2.1};
 
     const double x(0.75);
     // Expected values computed on paper using reccurrence relation
diff --git a/Framework/Kernel/test/InstrumentInfoTest.h b/Framework/Kernel/test/InstrumentInfoTest.h
index 5f7ba970bef478af4e9731849d5feb4ec2fb0f18..d859873ddbae3baf3862ac085a123d9c7b367467 100644
--- a/Framework/Kernel/test/InstrumentInfoTest.h
+++ b/Framework/Kernel/test/InstrumentInfoTest.h
@@ -124,10 +124,12 @@ public:
     TS_ASSERT_EQUALS(inst.liveListener(), "AListener");
     TS_ASSERT_EQUALS(inst.liveDataAddress(), "myinst.facility.gov:99");
     auto techniques = inst.techniques();
-    auto tech_it = techniques.begin();
+    auto tech_it_end = techniques.end();
     TS_ASSERT_EQUALS(techniques.size(), 2);
-    TS_ASSERT_EQUALS(*tech_it, "Doing Stuff");
-    TS_ASSERT_EQUALS(*++tech_it, "Measuring Stuff");
+    TSM_ASSERT_DIFFERS("Techniques should contain 'Doing Stuff'",
+                       techniques.find("Doing Stuff"), tech_it_end)
+    TSM_ASSERT_DIFFERS("Techniques should contain 'Measuring Stuff'",
+                       techniques.find("Measuring Stuff"), tech_it_end)
     TS_ASSERT_EQUALS(&inst.facility(), fac);
 
     std::stringstream ss;
diff --git a/Framework/Kernel/test/StringTokenizerTest.h b/Framework/Kernel/test/StringTokenizerTest.h
new file mode 100644
index 0000000000000000000000000000000000000000..9faef68366b756f27b3433cbb27e5cf85f5cbbd1
--- /dev/null
+++ b/Framework/Kernel/test/StringTokenizerTest.h
@@ -0,0 +1,227 @@
+#ifndef MANTID_SUPPORTTEST_H_
+#define MANTID_SUPPORTTEST_H_
+
+#include <cxxtest/TestSuite.h>
+#include <random>
+#include <array>
+#include "MantidKernel/StringTokenizer.h"
+
+/**
+   \class StringTokenizerTest
+   Checks the basic string operations in StringTokenizer
+*/
+
+class StringTokenizerTest : public CxxTest::TestSuite {
+public:
+  void test_StringTokenizer_key_value() {
+    auto tokenizer1 = Mantid::Kernel::StringTokenizer(
+        "key1=value1: key2=value2", ":",
+        Mantid::Kernel::StringTokenizer::TOK_TRIM);
+    std::vector<std::string> expected{"key1=value1", "key2=value2"};
+    TS_ASSERT_EQUALS(tokenizer1.asVector(), expected);
+    auto tokenizer2 = Mantid::Kernel::StringTokenizer(
+        tokenizer1[0], "=", Mantid::Kernel::StringTokenizer::TOK_TRIM);
+    expected = {"key1", "value1"};
+    TS_ASSERT_EQUALS(tokenizer1.count(), 2);
+    TS_ASSERT_EQUALS(tokenizer2.asVector(), expected);
+    tokenizer2 = Mantid::Kernel::StringTokenizer(
+        tokenizer1[1], "=", Mantid::Kernel::StringTokenizer::TOK_TRIM);
+    expected = {"key2", "value2"};
+    TS_ASSERT_EQUALS(tokenizer2.asVector(), expected);
+  }
+
+  void test_StringTokenizer_key_value_with_spaces() {
+    auto tokenizer1 =
+        Mantid::Kernel::StringTokenizer("key 1@value1: key2@value 2", ":");
+    std::vector<std::string> expected1{"key 1@value1", " key2@value 2"};
+    TS_ASSERT_EQUALS(tokenizer1.asVector(), expected1);
+    TS_ASSERT_EQUALS(tokenizer1.count(), 2);
+
+    auto tokenizer2 = Mantid::Kernel::StringTokenizer(tokenizer1[0], "@");
+    std::vector<std::string> expected2{"key 1", "value1"};
+    TS_ASSERT_EQUALS(tokenizer2.asVector(), expected2);
+
+    tokenizer2 = Mantid::Kernel::StringTokenizer(tokenizer1.at(0), "@");
+    expected2 = {"key 1", "value1"};
+    TS_ASSERT_EQUALS(tokenizer2.asVector(), expected2);
+
+    tokenizer2 = Mantid::Kernel::StringTokenizer(tokenizer1[1], "@");
+    expected2 = {" key2", "value 2"};
+    TS_ASSERT_EQUALS(tokenizer2.asVector(), expected2);
+
+    tokenizer2 = Mantid::Kernel::StringTokenizer(tokenizer1.at(1), "@");
+    expected2 = {" key2", "value 2"};
+    TS_ASSERT_EQUALS(tokenizer2.asVector(), expected2);
+
+    TS_ASSERT_THROWS_ANYTHING(tokenizer1.at(3));
+  }
+
+  void test_StringTokenizer_parseRange_simple() {
+    auto tokenizer = Mantid::Kernel::StringTokenizer("3,1,4,0,2,5", ",");
+    std::vector<std::string> expected{"3", "1", "4", "0", "2", "5"};
+    TS_ASSERT_EQUALS(tokenizer.asVector(), expected);
+    tokenizer = Mantid::Kernel::StringTokenizer("3,1,4,0,2,5,", ",");
+    expected = {"3", "1", "4", "0", "2", "5", ""};
+    TS_ASSERT_EQUALS(tokenizer.asVector(), expected);
+    tokenizer = Mantid::Kernel::StringTokenizer(
+        "3,1,4,0,2,5,", ",",
+        Mantid::Kernel::StringTokenizer::TOK_IGNORE_FINAL_EMPTY_TOKEN);
+    expected = {"3", "1", "4", "0", "2", "5"};
+    TS_ASSERT_EQUALS(tokenizer.asVector(), expected);
+  }
+
+  void test_StringTokenizer_parseRange_ranges() {
+    auto tokenizer = Mantid::Kernel::StringTokenizer(
+        "  1, 2 - 5,   6   ,7,8,    9,10-12", ",",
+        Mantid::Kernel::StringTokenizer::TOK_TRIM |
+            Mantid::Kernel::StringTokenizer::TOK_IGNORE_EMPTY);
+    std::vector<std::string> expected{"1", "2 - 5", "6",    "7",
+                                      "8", "9",     "10-12"};
+    TS_ASSERT_EQUALS(tokenizer.asVector(), expected);
+  }
+
+  void test_StringTokenizer_parseRange_emptyElements() {
+    auto tokenizer = Mantid::Kernel::StringTokenizer(
+        ",1,2,3", ",", Mantid::Kernel::StringTokenizer::TOK_TRIM |
+                           Mantid::Kernel::StringTokenizer::TOK_IGNORE_EMPTY);
+    std::vector<std::string> expected{"1", "2", "3"};
+    TS_ASSERT_EQUALS(tokenizer.asVector(), expected);
+
+    tokenizer = Mantid::Kernel::StringTokenizer(
+        "1,2,3,", ",", Mantid::Kernel::StringTokenizer::TOK_TRIM);
+    expected = {"1", "2", "3", ""};
+    TS_ASSERT_EQUALS(tokenizer.asVector(), expected);
+
+    tokenizer = Mantid::Kernel::StringTokenizer(
+        "1,2,,,,3", ",", Mantid::Kernel::StringTokenizer::TOK_TRIM);
+    expected = {"1", "2", "", "", "", "3"};
+    TS_ASSERT_EQUALS(tokenizer.asVector(), expected);
+  }
+
+  void test_StringTokenizer_parseRange_mapStyleSimple() {
+    auto tokenizer = Mantid::Kernel::StringTokenizer(
+        "   52   53   54   55   56   57   58   192", " ",
+        Mantid::Kernel::StringTokenizer::TOK_TRIM |
+            Mantid::Kernel::StringTokenizer::TOK_IGNORE_EMPTY);
+    std::vector<std::string> expected{"52", "53", "54", "55",
+                                      "56", "57", "58", "192"};
+    TS_ASSERT_EQUALS(tokenizer.count(), 8);
+    TS_ASSERT_EQUALS(tokenizer.asVector(), expected);
+  }
+
+  void test_StringTokenizer_parseRange_customRangeSep() {
+    auto tokenizer = Mantid::Kernel::StringTokenizer("1-2,3:5,6-7,8:10", ",");
+    std::vector<std::string> expected{"1-2", "3:5", "6-7", "8:10"};
+    TS_ASSERT_EQUALS(tokenizer.asVector(), expected);
+  }
+
+  void test_StringTokenizer_parseRange_emptyString() {
+    auto tokenizer = Mantid::Kernel::StringTokenizer("", "-:");
+    TS_ASSERT_EQUALS(tokenizer.count(), 0);
+    TS_ASSERT_EQUALS(tokenizer.asVector(), std::vector<std::string>());
+  }
+
+  void test_StringTokenizer_parseRange_invalidRange() {
+    auto tokenizer = Mantid::Kernel::StringTokenizer("1,2,3,-5,6", ",");
+    std::vector<std::string> expected{"1", "2", "3", "-5", "6"};
+    TS_ASSERT_EQUALS(tokenizer.asVector(), expected);
+  }
+
+  void test_StringTokenizer_parseRange_invalidRange2() {
+    auto tokenizer = Mantid::Kernel::StringTokenizer("-5", "-");
+    std::vector<std::string> expected{"", "5"};
+    TS_ASSERT_EQUALS(tokenizer.asVector(), expected);
+  }
+
+  void test_StringTokenizer_parseRange_invalidRange3() {
+    auto tokenizer = Mantid::Kernel::StringTokenizer("2-", "-");
+    std::vector<std::string> expected{"2", ""};
+    TS_ASSERT_EQUALS(tokenizer.asVector(), expected);
+    tokenizer = Mantid::Kernel::StringTokenizer(
+        "2-", "-",
+        Mantid::Kernel::StringTokenizer::TOK_IGNORE_FINAL_EMPTY_TOKEN);
+    expected = {"2"};
+    TS_ASSERT_EQUALS(tokenizer.asVector(), expected);
+  }
+
+  void test_StringTokenizer_invalidOptionThrows() {
+    TS_ASSERT_THROWS_ANYTHING(Mantid::Kernel::StringTokenizer(" ", "-:", 8));
+  }
+
+  void test_StringTokenizer_multipleSeparators() {
+    auto tokenizer = Mantid::Kernel::StringTokenizer("1,2,3,-5,6", ",-");
+    std::vector<std::string> expected{"1", "2", "3", "", "5", "6"};
+    TS_ASSERT_EQUALS(tokenizer.asVector(), expected);
+  }
+
+  void test_StringTokenizer_emptySeparators() {
+    auto tokenizer = Mantid::Kernel::StringTokenizer("1,2,3,-5,6", "");
+    std::vector<std::string> expected{"1,2,3,-5,6"};
+    TS_ASSERT_EQUALS(tokenizer.asVector(), expected);
+  }
+};
+
+class RandomCharacter {
+public:
+  RandomCharacter() {
+    const size_t maxIndex = (sizeof(m_characterSet) - 1);
+    m_distribution = std::uniform_int_distribution<unsigned>(0, maxIndex);
+  };
+  char operator()() { return m_characterSet[m_distribution(m_generator)]; };
+
+private:
+  std::array<char, 62> m_characterSet{
+      {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D',
+       'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',
+       'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
+       'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
+       'u', 'v', 'w', 'x', 'y', 'z'}};
+  std::mt19937 m_generator;
+  std::uniform_int_distribution<unsigned> m_distribution;
+};
+
+std::string randomString(size_t length) {
+  RandomCharacter randChar;
+  std::string str(length, 0);
+  for (auto &character : str) {
+    character = randChar();
+  }
+  return str;
+}
+
+class StringTokenizerTestPerformance : public CxxTest::TestSuite {
+private:
+  std::string m_bigString;
+  std::size_t m_length = 50000000;
+
+public:
+  StringTokenizerTestPerformance() {
+    m_bigString = randomString(m_length);
+    for (size_t i = 2; i < m_length; i += 10) {
+      m_bigString[i - 2] = ';';
+      m_bigString[i - 1] = ' ';
+      m_bigString[i] = ';';
+    }
+  };
+
+  void test_oneLargeString() {
+    auto tokenizer1 = Mantid::Kernel::StringTokenizer(m_bigString, ";", 0);
+    TS_ASSERT_EQUALS(tokenizer1.count(), m_length / 5 + 1);
+  }
+
+  void test_oneLargeString_trim() {
+    auto tokenizer1 = Mantid::Kernel::StringTokenizer(
+        m_bigString, ";", Mantid::Kernel::StringTokenizer::TOK_TRIM);
+    TS_ASSERT_EQUALS(tokenizer1.count(), m_length / 5 + 1);
+  }
+
+  void test_oneLargeString_trim_ignoreEmpty() {
+    auto tokenizer1 = Mantid::Kernel::StringTokenizer(
+        m_bigString, ";",
+        Mantid::Kernel::StringTokenizer::TOK_TRIM |
+            Mantid::Kernel::StringTokenizer::TOK_IGNORE_EMPTY);
+    TS_ASSERT_EQUALS(tokenizer1.count(), m_length / 10);
+  }
+};
+
+#endif // MANTID_SUPPORTTEST_H_
diff --git a/Framework/Kernel/test/UtilsTest.h b/Framework/Kernel/test/UtilsTest.h
index 767a1a4b4dd2835ff42151c18dfe8cc4ce5df69f..9dd46c4a7a3b83c59b884343d53e9e4777cd3e1d 100644
--- a/Framework/Kernel/test/UtilsTest.h
+++ b/Framework/Kernel/test/UtilsTest.h
@@ -150,13 +150,12 @@ public:
     numBins[1] = 20;
     numBins[2] = 5;
 
-    std::vector<size_t> indexes;
     size_t ic(0);
 
     for (size_t k = 0; k < numBins[2]; k++) {
       for (size_t j = 0; j < numBins[1]; j++) {
         for (size_t i = 0; i < numBins[0]; i++) {
-          Utils::getIndicesFromLinearIndex(ic, numBins, indexes);
+          auto indexes = Utils::getIndicesFromLinearIndex(ic, numBins);
           ic++;
 
           TS_ASSERT_EQUALS(indexes[0], i);
@@ -172,13 +171,12 @@ public:
     numBins[1] = 1; // there can not be 0, shluld be at least 1
     numBins[2] = 5;
 
-    std::vector<size_t> indexes;
     size_t ic(0);
 
     for (size_t k = 0; k < numBins[2]; k++) {
       for (size_t j = 0; j < numBins[1]; j++) {
         for (size_t i = 0; i < numBins[0]; i++) {
-          Utils::getIndicesFromLinearIndex(ic, numBins, indexes);
+          auto indexes = Utils::getIndicesFromLinearIndex(ic, numBins);
           ic++;
 
           TS_ASSERT_EQUALS(indexes[0], i);
diff --git a/Framework/Kernel/test/VectorHelperTest.h b/Framework/Kernel/test/VectorHelperTest.h
index 36ac636a8f3644be183ca269644490a15f7f741e..631f958064b6854efbdaf03e437e6d6569fbb9d3 100644
--- a/Framework/Kernel/test/VectorHelperTest.h
+++ b/Framework/Kernel/test/VectorHelperTest.h
@@ -6,7 +6,6 @@
 #include "MantidKernel/VectorHelper.h"
 #include <cxxtest/TestSuite.h>
 #include <cstdlib>
-#include <boost/assign/list_of.hpp>
 
 using namespace Mantid::Kernel;
 
@@ -55,56 +54,52 @@ public:
   }
 
   void test_CreateAxisFromRebinParams_SingleStep() {
-    std::vector<double> rbParams = boost::assign::list_of(0)(2)(5);
+    std::vector<double> rbParams = {0, 2, 5};
 
     std::vector<double> axis;
     VectorHelper::createAxisFromRebinParams(rbParams, axis, true);
 
-    std::vector<double> expectedAxis = boost::assign::list_of(0)(2)(4)(5);
+    std::vector<double> expectedAxis = {0, 2, 4, 5};
     TS_ASSERT_EQUALS(axis, expectedAxis);
   }
 
   void test_CreateAxisFromRebinParams_SingleStep_LastBinTooSmall() {
-    std::vector<double> rbParams = boost::assign::list_of(0.0)(2.0)(4.1);
+    std::vector<double> rbParams = {0.0, 2.0, 4.1};
 
     std::vector<double> axis;
     VectorHelper::createAxisFromRebinParams(rbParams, axis, true);
 
-    std::vector<double> expectedAxis = boost::assign::list_of(0.0)(2.0)(4.1);
+    std::vector<double> expectedAxis = {0.0, 2.0, 4.1};
     TS_ASSERT_EQUALS(axis, expectedAxis);
   }
 
   void test_CreateAxisFromRebinParams_MultipleSteps() {
-    std::vector<double> rbParams =
-        boost::assign::list_of(0)(2)(5)(3)(10)(1)(12);
+    std::vector<double> rbParams = {0, 2, 5, 3, 10, 1, 12};
 
     std::vector<double> axis;
     VectorHelper::createAxisFromRebinParams(rbParams, axis, true);
 
-    std::vector<double> expectedAxis =
-        boost::assign::list_of(0)(2)(4)(5)(8)(10)(11)(12);
+    std::vector<double> expectedAxis = {0, 2, 4, 5, 8, 10, 11, 12};
     TS_ASSERT_EQUALS(axis, expectedAxis);
   }
 
   void test_CreateAxisFromRebinParams_FullBinsOnly_SingleStep() {
-    std::vector<double> rbParams = boost::assign::list_of(0)(2)(5);
+    std::vector<double> rbParams = {0, 2, 5};
 
     std::vector<double> axis;
     VectorHelper::createAxisFromRebinParams(rbParams, axis, true, true);
 
-    std::vector<double> expectedAxis = boost::assign::list_of(0)(2)(4);
+    std::vector<double> expectedAxis = {0, 2, 4};
     TS_ASSERT_EQUALS(axis, expectedAxis);
   }
 
   void test_CreateAxisFromRebinParams_FullBinsOnly_MultipleSteps() {
-    std::vector<double> rbParams =
-        boost::assign::list_of(0)(2)(5)(3)(10)(1)(12);
+    std::vector<double> rbParams = {0, 2, 5, 3, 10, 1, 12};
 
     std::vector<double> axis;
     VectorHelper::createAxisFromRebinParams(rbParams, axis, true, true);
 
-    std::vector<double> expectedAxis =
-        boost::assign::list_of(0)(2)(4)(7)(10)(11)(12);
+    std::vector<double> expectedAxis = {0, 2, 4, 7, 10, 11, 12};
     TS_ASSERT_EQUALS(axis, expectedAxis);
   }
 
@@ -117,7 +112,7 @@ public:
   }
 
   void test_ConvertToBinBoundary_Size1InputVector() {
-    std::vector<double> bin_centers = boost::assign::list_of(0.4);
+    std::vector<double> bin_centers = {0.4};
     std::vector<double> bin_edges;
     VectorHelper::convertToBinBoundary(bin_centers, bin_edges);
 
@@ -128,7 +123,7 @@ public:
   }
 
   void test_ConvertToBinBoundary_Size2InputVector() {
-    std::vector<double> bin_centers = boost::assign::list_of(0.5)(1.5);
+    std::vector<double> bin_centers = {0.5, 1.5};
     std::vector<double> bin_edges;
 
     VectorHelper::convertToBinBoundary(bin_centers, bin_edges);
diff --git a/Framework/LiveData/inc/MantidLiveData/ADARA/ADARAPackets.h b/Framework/LiveData/inc/MantidLiveData/ADARA/ADARAPackets.h
index 60363654e9615e4c09dec268b3ad07d663ddbbcd..f5313007856d69821d97ed56c96071392206f2e2 100644
--- a/Framework/LiveData/inc/MantidLiveData/ADARA/ADARAPackets.h
+++ b/Framework/LiveData/inc/MantidLiveData/ADARA/ADARAPackets.h
@@ -14,7 +14,7 @@ namespace ADARA {
 class DLLExport PacketHeader {
 public:
   PacketHeader(const uint8_t *data) {
-    const uint32_t *field = (const uint32_t *)data;
+    const uint32_t *field = reinterpret_cast<const uint32_t *>(data);
 
     m_payload_len = field[0];
     m_type = field[1];
@@ -191,7 +191,9 @@ class DLLExport SourceListPkt : public Packet {
 public:
   SourceListPkt(const SourceListPkt &pkt);
 
-  const uint32_t *ids(void) const { return (const uint32_t *)payload(); }
+  const uint32_t *ids(void) const {
+    return reinterpret_cast<const uint32_t *>(payload());
+  }
   uint32_t num_ids(void) const {
     return (uint32_t)payload_length() / (uint32_t)sizeof(uint32_t);
   }
@@ -510,7 +512,7 @@ public:
 
   double distance(uint32_t index) const {
     if (index < beamMonCount())
-      return *(const double *)&m_fields[(index * 6) + 5];
+      return *reinterpret_cast<const double *>(&m_fields[(index * 6) + 5]);
     else
       return (0.0);
   }
@@ -581,7 +583,7 @@ public:
                                          m_name_offset + 2];
     } else {
       // Shouldn't be asking for this if bankCount() returned 0...!
-      return ((const uint32_t *)NULL);
+      return ((const uint32_t *)nullptr);
     }
   }
 
@@ -608,7 +610,8 @@ public:
 
   double throttle(uint32_t index) const {
     if (index < detBankSetCount()) {
-      return *(const double *)&m_fields[m_after_banks_offset[index] + 3];
+      return *reinterpret_cast<const double *>(
+                 &m_fields[m_after_banks_offset[index] + 3]);
     } else
       return (0.0);
   }
@@ -664,7 +667,8 @@ public:
   const std::string &description(void) const { return m_desc; }
 
   void remapDevice(uint32_t dev) {
-    uint32_t *fields = (uint32_t *)const_cast<uint8_t *>(payload());
+    uint32_t *fields =
+        reinterpret_cast<uint32_t *>(const_cast<uint8_t *>(payload()));
     fields[0] = dev;
     m_devId = dev;
   };
@@ -693,7 +697,8 @@ public:
   uint32_t value(void) const { return m_fields[3]; }
 
   void remapDeviceId(uint32_t dev) {
-    uint32_t *fields = (uint32_t *)const_cast<uint8_t *>(payload());
+    uint32_t *fields =
+        reinterpret_cast<uint32_t *>(const_cast<uint8_t *>(payload()));
     fields[0] = dev;
   };
 
@@ -717,10 +722,13 @@ public:
   VariableSeverity::Enum severity(void) const {
     return static_cast<VariableSeverity::Enum>(m_fields[2] & 0xffff);
   }
-  double value(void) const { return *(const double *)&m_fields[3]; }
+  double value(void) const {
+    return *reinterpret_cast<const double *>(&m_fields[3]);
+  }
 
   void remapDeviceId(uint32_t dev) {
-    uint32_t *fields = (uint32_t *)const_cast<uint8_t *>(payload());
+    uint32_t *fields =
+        reinterpret_cast<uint32_t *>(const_cast<uint8_t *>(payload()));
     fields[0] = dev;
   };
 
@@ -747,7 +755,8 @@ public:
   const std::string &value(void) const { return m_val; }
 
   void remapDeviceId(uint32_t dev) {
-    uint32_t *fields = (uint32_t *)const_cast<uint8_t *>(payload());
+    uint32_t *fields =
+        reinterpret_cast<uint32_t *>(const_cast<uint8_t *>(payload()));
     fields[0] = dev;
   };
 
diff --git a/Framework/LiveData/inc/MantidLiveData/ADARA/ADARAParser.h b/Framework/LiveData/inc/MantidLiveData/ADARA/ADARAParser.h
index aade2bfff8df22925c62c29607f3a73e3425a55d..8abee585de96c04556870ae68a287bfb0379e10e 100644
--- a/Framework/LiveData/inc/MantidLiveData/ADARA/ADARAParser.h
+++ b/Framework/LiveData/inc/MantidLiveData/ADARA/ADARAParser.h
@@ -74,7 +74,7 @@ protected:
   uint8_t *bufferFillAddress(void) const {
     if (bufferFillLength())
       return m_buffer + m_len;
-    return NULL;
+    return nullptr;
   }
 
   unsigned int bufferFillLength(void) const { return m_size - m_len; }
diff --git a/Framework/LiveData/src/ADARA/ADARAPackets.cpp b/Framework/LiveData/src/ADARA/ADARAPackets.cpp
index a6134150520dcaf15e780090ab766534b7e50e5a..10a83ce5e0422468e9a93c59e737a1a1a8b05cb8 100644
--- a/Framework/LiveData/src/ADARA/ADARAPackets.cpp
+++ b/Framework/LiveData/src/ADARA/ADARAPackets.cpp
@@ -667,9 +667,9 @@ DetectorBankSetsPkt::DetectorBankSetsPkt(const uint8_t *data, uint32_t len)
       msg += " payload_len=";
       msg += boost::lexical_cast<std::string>(m_payload_len);
       delete[] m_sectionOffsets;
-      m_sectionOffsets = (uint32_t *)NULL;
+      m_sectionOffsets = nullptr;
       delete[] m_after_banks_offset;
-      m_after_banks_offset = (uint32_t *)NULL;
+      m_after_banks_offset = nullptr;
       throw invalid_packet(msg);
     } else if (m_version > ADARA::PacketType::DETECTOR_BANK_SETS_VERSION &&
                m_payload_len < ((sectionOffset + baseSectionOffsetNoBanks) *
@@ -685,9 +685,9 @@ DetectorBankSetsPkt::DetectorBankSetsPkt(const uint8_t *data, uint32_t len)
       msg += " payload_len=";
       msg += boost::lexical_cast<std::string>(m_payload_len);
       delete[] m_sectionOffsets;
-      m_sectionOffsets = (uint32_t *)nullptr;
+      m_sectionOffsets = nullptr;
       delete[] m_after_banks_offset;
-      m_after_banks_offset = (uint32_t *)nullptr;
+      m_after_banks_offset = nullptr;
       throw invalid_packet(msg);
     }
 
@@ -714,9 +714,9 @@ DetectorBankSetsPkt::DetectorBankSetsPkt(const uint8_t *data, uint32_t len)
     msg += " payload_len=";
     msg += boost::lexical_cast<std::string>(m_payload_len);
     delete[] m_sectionOffsets;
-    m_sectionOffsets = (uint32_t *)NULL;
+    m_sectionOffsets = nullptr;
     delete[] m_after_banks_offset;
-    m_after_banks_offset = (uint32_t *)NULL;
+    m_after_banks_offset = nullptr;
     throw invalid_packet(msg);
   } else if (m_version > ADARA::PacketType::DETECTOR_BANK_SETS_VERSION &&
              m_payload_len < (sectionOffset * sizeof(uint32_t))) {
@@ -730,9 +730,9 @@ DetectorBankSetsPkt::DetectorBankSetsPkt(const uint8_t *data, uint32_t len)
     msg += " payload_len=";
     msg += boost::lexical_cast<std::string>(m_payload_len);
     delete[] m_sectionOffsets;
-    m_sectionOffsets = (uint32_t *)nullptr;
+    m_sectionOffsets = nullptr;
     delete[] m_after_banks_offset;
-    m_after_banks_offset = (uint32_t *)nullptr;
+    m_after_banks_offset = nullptr;
     throw invalid_packet(msg);
   }
 }
diff --git a/Framework/LiveData/src/ISISHistoDataListener.cpp b/Framework/LiveData/src/ISISHistoDataListener.cpp
index 8e9c6047274622922ed5401843e279ca754acebc..86d80efb25a2d55f02f96b30bd9da70c3fc5c32c 100644
--- a/Framework/LiveData/src/ISISHistoDataListener.cpp
+++ b/Framework/LiveData/src/ISISHistoDataListener.cpp
@@ -273,7 +273,8 @@ std::string ISISHistoDataListener::getString(const std::string &par) const {
   const int maxSize = 1024;
   char buffer[maxSize];
   int dim = maxSize, ndims = 1;
-  if (IDCgetparc(m_daeHandle, par.c_str(), (char *)buffer, &dim, &ndims) != 0) {
+  if (IDCgetparc(m_daeHandle, par.c_str(), static_cast<char *>(buffer), &dim,
+                 &ndims) != 0) {
     g_log.error("Unable to read " + par + " from DAE " + m_daeName);
     throw Kernel::Exception::FileError("Unable to read " + par + " from DAE ",
                                        m_daeName);
diff --git a/Framework/LiveData/src/LiveDataAlgorithm.cpp b/Framework/LiveData/src/LiveDataAlgorithm.cpp
index b6b391094fb6080e4211299fae2a6a924451438f..dccf0728f75c16f0c9185b97949c85e14ed4c381 100644
--- a/Framework/LiveData/src/LiveDataAlgorithm.cpp
+++ b/Framework/LiveData/src/LiveDataAlgorithm.cpp
@@ -9,6 +9,7 @@
 
 #include "boost/tokenizer.hpp"
 #include <boost/algorithm/string/trim.hpp>
+#include <unordered_set>
 
 using namespace Mantid::Kernel;
 using namespace Mantid::API;
@@ -241,7 +242,7 @@ IAlgorithm_sptr LiveDataAlgorithm::makeAlgorithm(bool postProcessing) {
     IAlgorithm_sptr alg = this->createChildAlgorithm(algoName);
 
     // Skip some of the properties when setting
-    std::set<std::string> ignoreProps;
+    std::unordered_set<std::string> ignoreProps;
     ignoreProps.insert("InputWorkspace");
     ignoreProps.insert("OutputWorkspace");
 
diff --git a/Framework/LiveData/test/CMakeLists.txt b/Framework/LiveData/test/CMakeLists.txt
index 2854ce66f5793ac1c2c2d64cdf8d288fd97333df..f21580ced25c9c620bd0332a3d80770163123ea7 100644
--- a/Framework/LiveData/test/CMakeLists.txt
+++ b/Framework/LiveData/test/CMakeLists.txt
@@ -8,6 +8,7 @@ if ( CXXTEST_FOUND )
                         TestGroupDataListener.cpp
                         ../../TestHelpers/src/TearDownWorld.cpp
                         ../../TestHelpers/src/ComponentCreationHelper.cpp
+                        ../../TestHelpers/src/InstrumentCreationHelper.cpp
                         ../../TestHelpers/src/WorkspaceCreationHelper.cpp
                         ../../TestHelpers/src/StartFrameworkManager.cpp
       )
diff --git a/Framework/MDAlgorithms/inc/MantidMDAlgorithms/AccumulateMD.h b/Framework/MDAlgorithms/inc/MantidMDAlgorithms/AccumulateMD.h
index b2d5f228a73d5ef1e1cb88e26788ff5289efd3fb..787c47475950bcfa7390aff3adaa1eeee6083420 100644
--- a/Framework/MDAlgorithms/inc/MantidMDAlgorithms/AccumulateMD.h
+++ b/Framework/MDAlgorithms/inc/MantidMDAlgorithms/AccumulateMD.h
@@ -51,7 +51,7 @@ getHistoricalDataSources(const API::WorkspaceHistory &ws_history,
 /// historical data sources
 void MANTID_MDALGORITHMS_DLL
 insertDataSources(const std::string &data_sources,
-                  std::set<std::string> &historical_data_sources);
+                  std::unordered_set<std::string> &historical_data_sources);
 
 /// Test if a file with the given full path name exists
 bool fileExists(const std::string &filename);
diff --git a/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertSpiceDataToRealSpace.h b/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertSpiceDataToRealSpace.h
index 0555024eaf3d35c94a71d04d128fb8e131559dc8..53049b25ed118b68206500c04e5127e2b10b9acd 100644
--- a/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertSpiceDataToRealSpace.h
+++ b/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertSpiceDataToRealSpace.h
@@ -120,9 +120,8 @@ private:
                    const std::vector<Kernel::DateAndTime> &vectimes);
 
   /// Parse detector efficiency table workspace to map
-  void
-  parseDetectorEfficiencyTable(DataObjects::TableWorkspace_sptr detefftablews,
-                               std::map<detid_t, double> &deteffmap);
+  std::map<detid_t, double>
+  parseDetectorEfficiencyTable(DataObjects::TableWorkspace_sptr detefftablews);
 
   /// Apply the detector's efficiency correction to
   void
diff --git a/Framework/MDAlgorithms/inc/MantidMDAlgorithms/FitMD.h b/Framework/MDAlgorithms/inc/MantidMDAlgorithms/FitMD.h
index 3d3baa7a1065a327a1f282a23e528fe1a5104d23..069d0cb70ca8293cccbe71aa5e869cfb88c397cd 100644
--- a/Framework/MDAlgorithms/inc/MantidMDAlgorithms/FitMD.h
+++ b/Framework/MDAlgorithms/inc/MantidMDAlgorithms/FitMD.h
@@ -53,7 +53,7 @@ public:
         DomainType domainType = Simple);
   /// Constructor
   FitMD(DomainType domainType)
-      : API::IDomainCreator(NULL, std::vector<std::string>(), domainType),
+      : API::IDomainCreator(nullptr, std::vector<std::string>(), domainType),
         m_startIndex(0), m_count(0) {}
   /// Initialize
   void initialize(Kernel::IPropertyManager *pm,
diff --git a/Framework/MDAlgorithms/src/AccumulateMD.cpp b/Framework/MDAlgorithms/src/AccumulateMD.cpp
index eae50b905b07d3af70da7d7c96bf4681fce40a92..ad54b693b290996e9cb9e157863ddaf99bcf165c 100644
--- a/Framework/MDAlgorithms/src/AccumulateMD.cpp
+++ b/Framework/MDAlgorithms/src/AccumulateMD.cpp
@@ -142,7 +142,7 @@ getHistoricalDataSources(const WorkspaceHistory &ws_history,
                          const std::string &create_alg_name,
                          const std::string &accumulate_alg_name) {
   // Using a set so we only insert unique names
-  std::set<std::string> historical_data_sources;
+  std::unordered_set<std::string> historical_data_sources;
 
   // Get previously added data sources from DataSources property of the original
   // call of CreateMD and any subsequent calls of AccumulateMD
@@ -175,8 +175,9 @@ getHistoricalDataSources(const WorkspaceHistory &ws_history,
  * sources
  * @param historical_data_sources :: set of data sources
 */
-void insertDataSources(const std::string &data_sources,
-                       std::set<std::string> &historical_data_sources) {
+void insertDataSources(
+    const std::string &data_sources,
+    std::unordered_set<std::string> &historical_data_sources) {
   // Split the property string into a vector of data sources
   std::vector<std::string> data_split;
   boost::split(data_split, data_sources, boost::is_any_of(","));
diff --git a/Framework/MDAlgorithms/src/BoxControllerSettingsAlgorithm.cpp b/Framework/MDAlgorithms/src/BoxControllerSettingsAlgorithm.cpp
index dde3bb14ec37c4be71754f404d39c14382d6238b..2be2c69ade27fa0986c600d635c87db8e0560210 100644
--- a/Framework/MDAlgorithms/src/BoxControllerSettingsAlgorithm.cpp
+++ b/Framework/MDAlgorithms/src/BoxControllerSettingsAlgorithm.cpp
@@ -35,7 +35,7 @@ void BoxControllerSettingsAlgorithm::initBoxControllerProps(
   mustBeMoreThen1->setLower(1);
 
   // Split up comma-separated properties
-  typedef Poco::StringTokenizer tokenizer;
+  typedef Mantid::Kernel::StringTokenizer tokenizer;
   tokenizer values(SplitInto, ",",
                    tokenizer::TOK_IGNORE_EMPTY | tokenizer::TOK_TRIM);
   std::vector<int> valueVec;
diff --git a/Framework/MDAlgorithms/src/ConvertMDHistoToMatrixWorkspace.cpp b/Framework/MDAlgorithms/src/ConvertMDHistoToMatrixWorkspace.cpp
index 6fc325febe5abda2103b3e0c93b90089098e1416..d36143163fea54124eb2ca641a9de183f5612f66 100644
--- a/Framework/MDAlgorithms/src/ConvertMDHistoToMatrixWorkspace.cpp
+++ b/Framework/MDAlgorithms/src/ConvertMDHistoToMatrixWorkspace.cpp
@@ -187,16 +187,12 @@ void ConvertMDHistoToMatrixWorkspace::make1DWorkspace() {
     normalization = NoNormalization;
   }
 
-  std::vector<Mantid::coord_t> X;
-  std::vector<Mantid::signal_t> Y;
-  std::vector<Mantid::signal_t> E;
+  auto line = inputWorkspace->getLineData(start, end, normalization);
 
-  inputWorkspace->getLineData(start, end, normalization, X, Y, E);
-
-  MatrixWorkspace_sptr outputWorkspace =
-      WorkspaceFactory::Instance().create("Workspace2D", 1, X.size(), Y.size());
-  outputWorkspace->dataY(0).assign(Y.begin(), Y.end());
-  outputWorkspace->dataE(0).assign(E.begin(), E.end());
+  MatrixWorkspace_sptr outputWorkspace = WorkspaceFactory::Instance().create(
+      "Workspace2D", 1, line.x.size(), line.y.size());
+  outputWorkspace->dataY(0).assign(line.y.begin(), line.y.end());
+  outputWorkspace->dataE(0).assign(line.e.begin(), line.e.end());
 
   const size_t numberTransformsToOriginal =
       inputWorkspace->getNumberTransformsToOriginal();
@@ -210,7 +206,7 @@ void ConvertMDHistoToMatrixWorkspace::make1DWorkspace() {
         NullDeleter());
   }
 
-  assert(X.size() == outputWorkspace->dataX(0).size());
+  assert(line.x.size() == outputWorkspace->dataX(0).size());
 
   std::string xAxisLabel = inputWorkspace->getDimension(id)->getName();
   const bool autoFind = this->getProperty("FindXAxis");
@@ -221,9 +217,9 @@ void ConvertMDHistoToMatrixWorkspace::make1DWorkspace() {
                    xAxisLabel);
   }
 
-  for (size_t i = 0; i < X.size(); ++i) {
+  for (size_t i = 0; i < line.x.size(); ++i) {
     // Coordinates in the workspace being plotted
-    VMD wsCoord = start + dir * X[i];
+    VMD wsCoord = start + dir * line.x[i];
 
     VMD inTargetCoord = transform->applyVMD(wsCoord);
     outputWorkspace->dataX(0)[i] = inTargetCoord[id];
diff --git a/Framework/MDAlgorithms/src/ConvertSpiceDataToRealSpace.cpp b/Framework/MDAlgorithms/src/ConvertSpiceDataToRealSpace.cpp
index a740194d5b0aa3a61474c8504af2d9072af99d96..a31d3a93e16a3e050ee73ea1c2818cb70a1c7822 100644
--- a/Framework/MDAlgorithms/src/ConvertSpiceDataToRealSpace.cpp
+++ b/Framework/MDAlgorithms/src/ConvertSpiceDataToRealSpace.cpp
@@ -114,7 +114,7 @@ void ConvertSpiceDataToRealSpace::exec() {
       getProperty("DetectorEfficiencyTableWorkspace");
   std::map<detid_t, double> detEffMap; // map for detector efficiency
   if (detEffTableWS) {
-    parseDetectorEfficiencyTable(detEffTableWS, detEffMap);
+    detEffMap = parseDetectorEfficiencyTable(detEffTableWS);
   }
 
   // Check whether parent workspace has run start: order (1) parent ws, (2) user
@@ -744,14 +744,13 @@ IMDEventWorkspace_sptr ConvertSpiceDataToRealSpace::createMonitorMDWorkspace(
 //------------------------------------------------------------------------------------------------
 /** Parse detector efficiency from table workspace to map
  * @brief ConvertSpiceDataToRealSpace::parseDetectorEfficiencyTable
- * @param detefftablews
- * @param deteffmap
+ * @param detefftablews :: [input] detector efficiency table workspace
+ * @returns detector efficiency map
  */
-void ConvertSpiceDataToRealSpace::parseDetectorEfficiencyTable(
-    DataObjects::TableWorkspace_sptr detefftablews,
-    std::map<detid_t, double> &deteffmap) {
-  // clear map
-  deteffmap.clear();
+std::map<detid_t, double>
+ConvertSpiceDataToRealSpace::parseDetectorEfficiencyTable(
+    DataObjects::TableWorkspace_sptr detefftablews) {
+  std::map<detid_t, double> deteffmap;
 
   // check table workspace
   size_t numcols = detefftablews->columnCount();
@@ -767,7 +766,7 @@ void ConvertSpiceDataToRealSpace::parseDetectorEfficiencyTable(
     deteffmap.emplace(detid, deteff);
   }
 
-  return;
+  return deteffmap;
 }
 
 //------------------------------------------------------------------------------------------------
diff --git a/Framework/MDAlgorithms/src/ConvertToDetectorFaceMD.cpp b/Framework/MDAlgorithms/src/ConvertToDetectorFaceMD.cpp
index d04ed98cd853a67f036f21e73ffa8da9daf6bc03..32450193758d9328d64c57c4016c6f258c77d637 100644
--- a/Framework/MDAlgorithms/src/ConvertToDetectorFaceMD.cpp
+++ b/Framework/MDAlgorithms/src/ConvertToDetectorFaceMD.cpp
@@ -197,8 +197,8 @@ void ConvertToDetectorFaceMD::exec() {
     throw std::runtime_error("InputWorkspace is not an EventWorkspace");
 
   // Fill the map, throw if there are grouped pixels.
-  in_ws->getDetectorIDToWorkspaceIndexVector(m_detID_to_WI,
-                                             m_detID_to_WI_offset, true);
+  m_detID_to_WI =
+      in_ws->getDetectorIDToWorkspaceIndexVector(m_detID_to_WI_offset, true);
 
   // Get the map of the banks we'll display
   std::map<int, RectangularDetector_const_sptr> banks = this->getBanks();
diff --git a/Framework/MDAlgorithms/src/ConvertToDiffractionMDWorkspace.cpp b/Framework/MDAlgorithms/src/ConvertToDiffractionMDWorkspace.cpp
index 648336646630b9aa86837bf49ccf97671155208b..bc5896fc2d36ed391656df69b587d406e21b278b 100644
--- a/Framework/MDAlgorithms/src/ConvertToDiffractionMDWorkspace.cpp
+++ b/Framework/MDAlgorithms/src/ConvertToDiffractionMDWorkspace.cpp
@@ -190,7 +190,7 @@ void ConvertToDiffractionMDWorkspace::convertEventList(int workspaceIndex,
   DataObjects::MDBoxBase<DataObjects::MDLeanEvent<3>, 3> *box = ws->getBox();
 
   // Get the position of the detector there.
-  const std::set<detid_t> &detectors = el.getDetectorIDs();
+  const auto &detectors = el.getDetectorIDs();
   if (!detectors.empty()) {
     // Get the detector (might be a detectorGroup for multiple detectors)
     // or might return an exception if the detector is not in the instrument
diff --git a/Framework/MDAlgorithms/src/IntegrateFlux.cpp b/Framework/MDAlgorithms/src/IntegrateFlux.cpp
index 982be8f94a8d012d1e703f35041f7a84bcba5b44..6b08f05342920b69e7b1fc4caa55fce1e303eca5 100644
--- a/Framework/MDAlgorithms/src/IntegrateFlux.cpp
+++ b/Framework/MDAlgorithms/src/IntegrateFlux.cpp
@@ -65,7 +65,7 @@ void IntegrateFlux::init() {
  */
 void IntegrateFlux::exec() {
   API::MatrixWorkspace_sptr inputWS = getProperty("InputWorkspace");
-  size_t nX = static_cast<size_t>((int)getProperty("NPoints"));
+  size_t nX = static_cast<size_t>(static_cast<int>(getProperty("NPoints")));
 
   auto outputWS = createOutputWorkspace(*inputWS, nX);
 
diff --git a/Framework/MDAlgorithms/src/MDWSTransform.cpp b/Framework/MDAlgorithms/src/MDWSTransform.cpp
index c21fd174d8e9cfe8456686ba83addde88d0c921a..8c3ed24ff0065754c5bf6ca3329702e81267934f 100644
--- a/Framework/MDAlgorithms/src/MDWSTransform.cpp
+++ b/Framework/MDAlgorithms/src/MDWSTransform.cpp
@@ -342,7 +342,8 @@ void MDWSTransform::setQ3DDimensionsNames(
     dimNames[1] = "K";
     dimNames[2] = "L";
 
-    Kernel::MDUnit_uptr mdUnit(new Kernel::InverseAngstromsUnit);
+    Kernel::MDUnit_uptr mdUnit =
+        Kernel::make_unique<Kernel::InverseAngstromsUnit>();
     TargWSDescription.setCoordinateSystem(Mantid::Kernel::HKL);
     TargWSDescription.setFrame(Geometry::HKL::HKLName);
     break;
diff --git a/Framework/MDAlgorithms/src/TransformMD.cpp b/Framework/MDAlgorithms/src/TransformMD.cpp
index fb7febe455abb9042ddb8618e835bd03f6f4389f..ac6704a5121085f8df18f083e367f1543104ff00 100644
--- a/Framework/MDAlgorithms/src/TransformMD.cpp
+++ b/Framework/MDAlgorithms/src/TransformMD.cpp
@@ -175,7 +175,7 @@ void TransformMD::exec() {
   } else if (event) {
     // Call the method for this type of MDEventWorkspace.
     CALL_MDEVENT_FUNCTION(this->doTransform, outWS);
-    Progress *prog2 = NULL;
+    Progress *prog2 = nullptr;
     ThreadScheduler *ts = new ThreadSchedulerFIFO();
     ThreadPool tp(ts, 0, prog2);
     event->splitAllIfNeeded(ts);
diff --git a/Framework/MDAlgorithms/test/AccumulateMDTest.h b/Framework/MDAlgorithms/test/AccumulateMDTest.h
index 4f412cd7b9ce6b0a7d619ac1e614d1bde1298dcc..a92680b2e974dd347d62ca91d7430a4080393480 100644
--- a/Framework/MDAlgorithms/test/AccumulateMDTest.h
+++ b/Framework/MDAlgorithms/test/AccumulateMDTest.h
@@ -191,12 +191,11 @@ public:
 
   void test_insert_data_sources() {
     std::string data_sources = "test1,test2,test3";
-    std::set<std::string> data_sources_set;
+    std::unordered_set<std::string> data_sources_set;
     Mantid::MDAlgorithms::insertDataSources(data_sources, data_sources_set);
 
     // Check set contains "test1", "test2" and "test3"
-    std::set<std::string>::iterator iter;
-    iter = data_sources_set.find("test1");
+    auto iter = data_sources_set.find("test1");
     TS_ASSERT(iter != data_sources_set.end());
 
     iter = data_sources_set.find("test2");
@@ -208,12 +207,11 @@ public:
 
   void test_insert_data_sources_with_whitespace() {
     std::string data_sources = " test1,test2 , test3";
-    std::set<std::string> data_sources_set;
+    std::unordered_set<std::string> data_sources_set;
     Mantid::MDAlgorithms::insertDataSources(data_sources, data_sources_set);
 
     // Check set contains "test1", "test2" and "test3"
-    std::set<std::string>::iterator iter;
-    iter = data_sources_set.find("test1");
+    auto iter = data_sources_set.find("test1");
     TS_ASSERT(iter != data_sources_set.end());
 
     iter = data_sources_set.find("test2");
diff --git a/Framework/MDAlgorithms/test/BinMDTest.h b/Framework/MDAlgorithms/test/BinMDTest.h
index 7217c4292bb743e63dccd2edd10f7a6fa0507fa9..4410a2d70d693fabb0744ba5770ae0c0b5d2b680 100644
--- a/Framework/MDAlgorithms/test/BinMDTest.h
+++ b/Framework/MDAlgorithms/test/BinMDTest.h
@@ -313,13 +313,13 @@ public:
     TS_ASSERT_EQUALS(out->getNEvents(), 1000);
 
     double expected_signal(2.);
-    std::vector<size_t> nBins(3), indexes(3);
+    std::vector<size_t> nBins(3);
     nBins[0] = 40;
     nBins[1] = 5;
     nBins[2] = 20;
 
     for (size_t i = 0; i < out->getNPoints(); i++) {
-      Utils::getIndicesFromLinearIndex(i, nBins, indexes);
+      auto indexes = Utils::getIndicesFromLinearIndex(i, nBins);
       if (etta(int(indexes[0]), 4) && etta(int(indexes[2]), 2)) {
         TS_ASSERT_DELTA(out->getSignalAt(i), expected_signal, 1e-5);
         TS_ASSERT_DELTA(out->getNumEventsAt(i), expected_signal, 1e-5);
diff --git a/Framework/MDAlgorithms/test/CMakeLists.txt b/Framework/MDAlgorithms/test/CMakeLists.txt
index 694c59da7e2f049d5c5bd84af4f00226cd4ba569..d5718355ac3d6bfa5b1ed32bee2c0441d1c2e0e7 100644
--- a/Framework/MDAlgorithms/test/CMakeLists.txt
+++ b/Framework/MDAlgorithms/test/CMakeLists.txt
@@ -10,6 +10,7 @@ if ( CXXTEST_FOUND )
                         ../../TestHelpers/src/MDAlgorithmsTestHelper.cpp
                         ../../TestHelpers/src/MDEventsTestHelper.cpp
                         ../../TestHelpers/src/ScopedFileHelper.cpp
+                        ../../TestHelpers/src/InstrumentCreationHelper.cpp
                         ../../TestHelpers/src/WorkspaceCreationHelper.cpp
                          )
 
diff --git a/Framework/MDAlgorithms/test/ConvertToReflectometryQTest.h b/Framework/MDAlgorithms/test/ConvertToReflectometryQTest.h
index 2804987b76ddcb4959bc4d720b36597272997fb3..93a3ca362eb34e90b8102c60a99b361440b3c0f4 100644
--- a/Framework/MDAlgorithms/test/ConvertToReflectometryQTest.h
+++ b/Framework/MDAlgorithms/test/ConvertToReflectometryQTest.h
@@ -16,8 +16,6 @@
 #include "MantidGeometry/MDGeometry/GeneralFrame.h"
 #include "MantidGeometry/MDGeometry/QLab.h"
 
-#include <boost/assign.hpp>
-
 #include <cxxtest/TestSuite.h>
 
 using namespace Mantid::API;
@@ -271,11 +269,10 @@ public:
 
     const int splitThreshold = 3;
     const int splitInto = 6;
+    const std::vector<int> splitIntoVec = {splitInto};
     const int maxDepth = 12;
     alg->setProperty("SplitThreshold", splitThreshold);
-    alg->setProperty("SplitInto",
-                     boost::assign::list_of(splitInto)
-                         .convert_to_container<std::vector<int>>());
+    alg->setProperty("SplitInto", splitIntoVec);
     alg->setProperty("MaxRecursionDepth", maxDepth);
 
     TS_ASSERT_THROWS_NOTHING(alg->execute());
diff --git a/Framework/MDAlgorithms/test/CutMDTest.h b/Framework/MDAlgorithms/test/CutMDTest.h
index 54a7ef983c963a13d3916430ab2d02657eb1a029..c45e4ccad65076751c1497a4acaa2d00afa5b739 100644
--- a/Framework/MDAlgorithms/test/CutMDTest.h
+++ b/Framework/MDAlgorithms/test/CutMDTest.h
@@ -13,7 +13,6 @@
 #include "MantidTestHelpers/MDEventsTestHelper.h"
 
 #include <cxxtest/TestSuite.h>
-#include <boost/assign/list_of.hpp>
 
 using namespace Mantid::MDAlgorithms;
 using namespace Mantid::API;
@@ -512,10 +511,11 @@ public:
     alg.setProperty("InputWorkspace", ws);
     const double min = 1.1;
     const double max = 7.1; // 7.1 - 1.1 = 6
+    const std::vector<double> minMaxVec = {min, max};
+
     alg.setProperty("P1Bin", std::vector<double>(
                                  0)); // Pass through. Do not change binning.
-    alg.setProperty("P2Bin", boost::assign::list_of(min)(max)
-                                 .convert_to_container<std::vector<double>>());
+    alg.setProperty("P2Bin", minMaxVec);
     alg.setPropertyValue("OutputWorkspace", "dummy");
     alg.execute();
     IMDWorkspace_sptr outWS = alg.getProperty("OutputWorkspace");
diff --git a/Framework/MDAlgorithms/test/IntegrateMDHistoWorkspaceTest.h b/Framework/MDAlgorithms/test/IntegrateMDHistoWorkspaceTest.h
index 89519a95c46b9e73dd092cdec7055e2095b30849..0a4471041a4567fbf34bf8e478fbed561f11dfd3 100644
--- a/Framework/MDAlgorithms/test/IntegrateMDHistoWorkspaceTest.h
+++ b/Framework/MDAlgorithms/test/IntegrateMDHistoWorkspaceTest.h
@@ -2,7 +2,6 @@
 #define MANTID_MDALGORITHMS_INTEGRATEMDHISTOWORKSPACETEST_H_
 
 #include <cxxtest/TestSuite.h>
-#include <boost/assign/list_of.hpp>
 
 #include "MantidMDAlgorithms/IntegrateMDHistoWorkspace.h"
 #include "MantidDataObjects/MDEventWorkspace.h"
@@ -54,8 +53,8 @@ public:
     alg.initialize();
     alg.setProperty("InputWorkspace", ws);
     const double step = 0.1;
-    alg.setProperty("P1Bin", boost::assign::list_of(0.0)(step)(1.0)
-                                 .convert_to_container<std::vector<double>>());
+    std::vector<double> p1BinVec = {(0.0), (step), (1.0)};
+    alg.setProperty("P1Bin", p1BinVec);
     alg.setPropertyValue("OutputWorkspace", "dummy");
     TSM_ASSERT("Expect validation errors", alg.validateInputs().size() > 0);
     TSM_ASSERT_THROWS("No new steps allowed", alg.execute(),
@@ -78,15 +77,15 @@ public:
 
     // Test equal to
     double max = min;
-    alg.setProperty("P1Bin", boost::assign::list_of(min)(max)
-                                 .convert_to_container<std::vector<double>>());
+    std::vector<double> p1BinVec = {min, max};
+    alg.setProperty("P1Bin", p1BinVec);
     TSM_ASSERT("Expect validation errors", alg.validateInputs().size() > 0);
     TSM_ASSERT_THROWS("Incorrect limits", alg.execute(), std::runtime_error &);
 
     // Test less than
     max = min - 0.01;
-    alg.setProperty("P1Bin", boost::assign::list_of(min)(max)
-                                 .convert_to_container<std::vector<double>>());
+    p1BinVec = {min, max};
+    alg.setProperty("P1Bin", p1BinVec);
     TSM_ASSERT("Expect validation errors", alg.validateInputs().size() > 0);
     TSM_ASSERT_THROWS("Incorrect limits", alg.execute(), std::runtime_error &);
   }
@@ -107,22 +106,22 @@ public:
     double step = 0;
     // Test equal to
     double max = min;
-    alg.setProperty("P1Bin", boost::assign::list_of(min)(step)(max)
-                                 .convert_to_container<std::vector<double>>());
+    std::vector<double> p1BinVec = {min, step, max};
+    alg.setProperty("P1Bin", p1BinVec);
     TSM_ASSERT("Expect validation errors", alg.validateInputs().size() > 0);
     TSM_ASSERT_THROWS("Incorrect limits", alg.execute(), std::runtime_error &);
 
     // Test less than
     max = min - 0.01;
-    alg.setProperty("P1Bin", boost::assign::list_of(min)(step)(max)
-                                 .convert_to_container<std::vector<double>>());
+    p1BinVec = {min, max};
+    alg.setProperty("P1Bin", p1BinVec);
     TSM_ASSERT("Expect validation errors", alg.validateInputs().size() > 0);
     TSM_ASSERT_THROWS("Incorrect limits", alg.execute(), std::runtime_error &);
 
     // Test non-zero step. ZERO means copy!
     max = min - 0.01;
-    alg.setProperty("P1Bin", boost::assign::list_of(min)(1.0)(max)
-                                 .convert_to_container<std::vector<double>>());
+    p1BinVec = {min, max};
+    alg.setProperty("P1Bin", p1BinVec);
     TSM_ASSERT("Expect validation errors", alg.validateInputs().size() > 0);
     TSM_ASSERT_THROWS("Step has been specified", alg.execute(),
                       std::runtime_error &);
@@ -181,8 +180,8 @@ public:
     alg.setProperty("InputWorkspace", ws);
     const double min = 0;
     const double max = 5;
-    alg.setProperty("P1Bin", boost::assign::list_of(min)(max)
-                                 .convert_to_container<std::vector<double>>());
+    std::vector<double> p1BinVec = {min, max};
+    alg.setProperty("P1Bin", p1BinVec);
     alg.setPropertyValue("OutputWorkspace", "dummy");
     alg.execute();
     IMDHistoWorkspace_sptr outWS = alg.getProperty("OutputWorkspace");
@@ -229,8 +228,8 @@ public:
     alg.setProperty("InputWorkspace", ws);
     const double min = 0.75;
     const double max = 4.25;
-    alg.setProperty("P1Bin", boost::assign::list_of(min)(max)
-                                 .convert_to_container<std::vector<double>>());
+    std::vector<double> p1BinVec = {min, max};
+    alg.setProperty("P1Bin", p1BinVec);
     alg.setPropertyValue("OutputWorkspace", "dummy");
     alg.execute();
     IMDHistoWorkspace_sptr outWS = alg.getProperty("OutputWorkspace");
@@ -282,8 +281,8 @@ public:
     alg.setProperty("InputWorkspace", ws);
     const double min = 0.75;
     const double max = 4.25;
-    alg.setProperty("P1Bin", boost::assign::list_of(min)(0.0)(max)
-                                 .convert_to_container<std::vector<double>>());
+    std::vector<double> p1BinVec = {min, 0.0, max};
+    alg.setProperty("P1Bin", p1BinVec);
     alg.setPropertyValue("OutputWorkspace", "dummy");
     alg.execute();
     IMDHistoWorkspace_sptr outWS = alg.getProperty("OutputWorkspace");
@@ -338,8 +337,8 @@ public:
     alg.setProperty("InputWorkspace", ws);
     const double min = 0;
     const double max = 5;
-    alg.setProperty("P1Bin", boost::assign::list_of(min)(max)
-                                 .convert_to_container<std::vector<double>>());
+    std::vector<double> p1BinVec = {min, max};
+    alg.setProperty("P1Bin", p1BinVec);
     alg.setPropertyValue("OutputWorkspace", "dummy");
     alg.execute();
     IMDHistoWorkspace_sptr outWS = alg.getProperty("OutputWorkspace");
@@ -411,8 +410,8 @@ public:
     const double max = 7.1; // 7.1 - 1.1 = 6
     alg.setProperty("P1Bin", std::vector<double>(
                                  0)); // Pass through. Do not change binning.
-    alg.setProperty("P2Bin", boost::assign::list_of(min)(max)
-                                 .convert_to_container<std::vector<double>>());
+    std::vector<double> p1BinVec = {min, max};
+    alg.setProperty("P2Bin", p1BinVec);
     alg.setPropertyValue("OutputWorkspace", "dummy");
     alg.execute();
     IMDHistoWorkspace_sptr outWS = alg.getProperty("OutputWorkspace");
@@ -483,8 +482,8 @@ public:
     alg.setProperty("InputWorkspace", ws);
     const double min = 0.75;
     const double max = 4.25;
-    alg.setProperty("P1Bin", boost::assign::list_of(min)(max)
-                                 .convert_to_container<std::vector<double>>());
+    std::vector<double> p1BinVec = {min, max};
+    alg.setProperty("P1Bin", p1BinVec);
     alg.setPropertyValue("OutputWorkspace", "dummy");
     alg.execute();
     IMDHistoWorkspace_sptr outWS = alg.getProperty("OutputWorkspace");
@@ -547,8 +546,8 @@ public:
     alg.setRethrows(true);
     alg.initialize();
     alg.setProperty("InputWorkspace", ws);
-    alg.setProperty("P1Bin", boost::assign::list_of(pMin)(0.0)(pMax)
-                                 .convert_to_container<std::vector<double>>());
+    std::vector<double> p1BinVec = {pMin, 0.0, pMax};
+    alg.setProperty("P1Bin", p1BinVec);
     alg.setPropertyValue("OutputWorkspace", "dummy");
     alg.execute();
     IMDHistoWorkspace_sptr outWS = alg.getProperty("OutputWorkspace");
@@ -630,8 +629,8 @@ public:
     alg.setRethrows(true);
     alg.initialize();
     alg.setProperty("InputWorkspace", ws);
-    alg.setProperty("P1Bin", boost::assign::list_of(pMin)(0.0)(pMax)
-                                 .convert_to_container<std::vector<double>>());
+    std::vector<double> p1BinVec = {pMin, 0.0, pMax};
+    alg.setProperty("P1Bin", p1BinVec);
     alg.setPropertyValue("OutputWorkspace", "dummy");
     alg.execute();
     IMDHistoWorkspace_sptr outWS = alg.getProperty("OutputWorkspace");
@@ -692,8 +691,8 @@ public:
     alg.setRethrows(true);
     alg.initialize();
     alg.setProperty("InputWorkspace", ws);
-    alg.setProperty("P1Bin", boost::assign::list_of(pMin)(0.0)(pMax)
-                                 .convert_to_container<std::vector<double>>());
+    std::vector<double> p1BinVec = {pMin, 0.0, pMax};
+    alg.setProperty("P1Bin", p1BinVec);
     alg.setPropertyValue("OutputWorkspace", "dummy");
     alg.execute();
     IMDHistoWorkspace_sptr outWS = alg.getProperty("OutputWorkspace");
@@ -754,8 +753,8 @@ public:
     alg.setRethrows(true);
     alg.initialize();
     alg.setProperty("InputWorkspace", ws);
-    alg.setProperty("P1Bin", boost::assign::list_of(pMin)(0.0)(pMax)
-                                 .convert_to_container<std::vector<double>>());
+    std::vector<double> p1BinVec = {pMin, 0.0, pMax};
+    alg.setProperty("P1Bin", p1BinVec);
     alg.setPropertyValue("OutputWorkspace", "dummy");
     alg.execute();
     IMDHistoWorkspace_sptr outWS = alg.getProperty("OutputWorkspace");
@@ -808,14 +807,11 @@ public:
     const double min = 0;
     const double max = 1;
     alg.setProperty("InputWorkspace", m_ws);
-    alg.setProperty("P1Bin", boost::assign::list_of(min)(max)
-                                 .convert_to_container<std::vector<double>>());
-    alg.setProperty("P2Bin", boost::assign::list_of(min)(max)
-                                 .convert_to_container<std::vector<double>>());
-    alg.setProperty("P3Bin", boost::assign::list_of(min)(max)
-                                 .convert_to_container<std::vector<double>>());
-    alg.setProperty("P4Bin", boost::assign::list_of(min)(max)
-                                 .convert_to_container<std::vector<double>>());
+    std::vector<double> p1BinVec = {min, max};
+    alg.setProperty("P1Bin", p1BinVec);
+    alg.setProperty("P2Bin", p1BinVec);
+    alg.setProperty("P3Bin", p1BinVec);
+    alg.setProperty("P4Bin", p1BinVec);
     alg.setPropertyValue("OutputWorkspace", "dummy");
     alg.execute();
     IMDHistoWorkspace_sptr outWS = alg.getProperty("OutputWorkspace");
diff --git a/Framework/MDAlgorithms/test/ReplicateMDTest.h b/Framework/MDAlgorithms/test/ReplicateMDTest.h
index 4b415bad15fa53a470d07d97ff6b67620212dbc0..4e3ac847c6ef82433dcb7c7c131a57079a2e90d3 100644
--- a/Framework/MDAlgorithms/test/ReplicateMDTest.h
+++ b/Framework/MDAlgorithms/test/ReplicateMDTest.h
@@ -11,7 +11,6 @@
 #include "MantidTestHelpers/MDEventsTestHelper.h"
 #include <string>
 #include <vector>
-#include <boost/assign/list_of.hpp>
 
 using namespace Mantid::MDAlgorithms;
 using namespace Mantid::DataObjects;
@@ -185,10 +184,10 @@ public:
 
   void test_replicate_1d_vertical() {
 
-    std::vector<int> shapeShape = boost::assign::list_of(10)(10);
+    std::vector<int> shapeShape = {10, 10};
     auto shapeWS = makeHistoWorkspace(shapeShape);
 
-    std::vector<int> dataShape = boost::assign::list_of(1)(10);
+    std::vector<int> dataShape = {1, 10};
     auto dataWS = makeHistoWorkspace(dataShape);
     for (int i = 0; i < dataShape[1]; ++i) {
       dataWS->setSignalAt(i, i); // Vertically increasing.
@@ -225,10 +224,10 @@ public:
 
   void test_replicate_1d_horizontal() {
 
-    std::vector<int> shapeShape = boost::assign::list_of(10)(10);
+    std::vector<int> shapeShape = {10, 10};
     auto shapeWS = makeHistoWorkspace(shapeShape);
 
-    std::vector<int> dataShape = boost::assign::list_of(10)(1);
+    std::vector<int> dataShape = {10, 1};
     auto dataWS = makeHistoWorkspace(dataShape);
     for (int i = 0; i < dataShape[0]; ++i) {
       dataWS->setSignalAt(i, i); // Horizontally increasing.
@@ -263,10 +262,10 @@ public:
 
   void test_auto_transpose_2d() {
 
-    std::vector<int> shapeShape = boost::assign::list_of(10)(20)(10);
+    std::vector<int> shapeShape = {10, 20, 10};
     auto shapeWS = makeHistoWorkspace(shapeShape);
 
-    std::vector<int> dataShapePreTranspose = boost::assign::list_of(10)(20);
+    std::vector<int> dataShapePreTranspose = {10, 20};
     auto dataWSTranspose = makeHistoWorkspace(
         dataShapePreTranspose, true /*transpose it to make it 20 by 10*/);
 
@@ -302,10 +301,10 @@ public:
 
   void test_performance() {
 
-    std::vector<int> shapeShape = boost::assign::list_of(1000)(1000);
+    std::vector<int> shapeShape = {1000, 1000};
     auto shapeWS = makeHistoWorkspace(shapeShape);
 
-    std::vector<int> dataShape = boost::assign::list_of(1000)(1);
+    std::vector<int> dataShape = {1000, 1};
     auto dataWS = makeHistoWorkspace(dataShape);
 
     ReplicateMD alg;
diff --git a/Framework/MPIAlgorithms/test/CMakeLists.txt b/Framework/MPIAlgorithms/test/CMakeLists.txt
index 2dfe09a9efba6cdbba0995f5d5fd11612d7b5900..fd7cd24ed92a369390246f8f7f111115fc59b761 100644
--- a/Framework/MPIAlgorithms/test/CMakeLists.txt
+++ b/Framework/MPIAlgorithms/test/CMakeLists.txt
@@ -5,6 +5,7 @@ if ( CXXTEST_FOUND )
   set ( TESTHELPER_SRCS
                         ../../TestHelpers/src/TearDownWorld.cpp
                         ../../TestHelpers/src/ComponentCreationHelper.cpp
+                        ../../TestHelpers/src/InstrumentCreationHelper.cpp
                         ../../TestHelpers/src/WorkspaceCreationHelper.cpp
       )
 
diff --git a/Framework/MatlabAPI/src/MatlabInterface.cpp b/Framework/MatlabAPI/src/MatlabInterface.cpp
index 9982d17ae5e251831ca9c1362330dea29a171189..928e9f54b4e9a739ef7c63c081e6d0a2794da971 100644
--- a/Framework/MatlabAPI/src/MatlabInterface.cpp
+++ b/Framework/MatlabAPI/src/MatlabInterface.cpp
@@ -670,11 +670,11 @@ void CreateSimpleAPIHelper(const std::string &algName,
       mfile << "No";
     mfile << ", Direction: "
           << Mantid::Kernel::Direction::asText(prop->direction()); // << ", ";
-    std::set<std::string> allowed = prop->allowedValues();
+    auto allowed = prop->allowedValues();
     if (!allowed.empty()) {
       mfile << ", Allowed values: ";
-      std::set<std::string>::const_iterator sIter = allowed.begin();
-      std::set<std::string>::const_iterator sEnd = allowed.end();
+      auto sIter = allowed.begin();
+      auto sEnd = allowed.end();
       for (; sIter != sEnd;) {
         mfile << (*sIter);
         if (++sIter != sEnd)
@@ -778,13 +778,10 @@ int CreateSimpleAPI(int, mxArray **, int nrhs, const mxArray *prhs[]) {
   * @returns An integer indicating success/failure
   */
 int ListWorkspaces(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
-  std::set<std::string> wkspNames =
-      AnalysisDataService::Instance().getObjectNames();
-  std::set<std::string>::const_iterator sEnd = wkspNames.end();
+  auto wkspNames = AnalysisDataService::Instance().getObjectNames();
   // print the list of names using mexPrintf
-  for (std::set<std::string>::const_iterator sIter = wkspNames.begin();
-       sIter != sEnd; ++sIter) {
-    mexPrintf((*sIter).c_str());
+  for (auto const &wksp_name : wkspNames) {
+    mexPrintf(wksp_name.c_str());
     mexPrintf("\n");
   }
   return 0;
diff --git a/Framework/Nexus/inc/MantidNexus/NexusClasses.h b/Framework/Nexus/inc/MantidNexus/NexusClasses.h
index f37118f95eee5fc5dbaea4c61c2caf0e8a4c7e81..4a898eebb230788ec4ab9fb741c4123dd5ca0aad 100644
--- a/Framework/Nexus/inc/MantidNexus/NexusClasses.h
+++ b/Framework/Nexus/inc/MantidNexus/NexusClasses.h
@@ -674,10 +674,10 @@ private:
     Kernel::DateAndTime start_t = Kernel::DateAndTime(start_time);
     NXInfo vinfo = getDataSetInfo("value");
     if (!vinfo)
-      return NULL;
+      return nullptr;
 
     if (vinfo.dims[0] != times.dim0())
-      return NULL;
+      return nullptr;
 
     if (vinfo.type == NX_CHAR) {
       Kernel::TimeSeriesProperty<std::string> *logv =
@@ -721,7 +721,7 @@ private:
       NXInt value(*this, "value");
       return loadValues<NXInt, TYPE>(logName, value, start_t, times);
     }
-    return NULL;
+    return nullptr;
   }
 
   /// Loads the values in the log into the workspace
diff --git a/Framework/Nexus/src/NexusFileIO.cpp b/Framework/Nexus/src/NexusFileIO.cpp
index 955e7524407fe9722cd3fb3a6cc1191fe04d9aaa..94984b503dfdcefad66994b87fab3b002e663e25 100644
--- a/Framework/Nexus/src/NexusFileIO.cpp
+++ b/Framework/Nexus/src/NexusFileIO.cpp
@@ -235,7 +235,7 @@ bool NexusFileIO::writeNxStringArray(
   for (size_t i = 0; i < values.size(); i++) {
     strncpy(&strs[i * maxlen], values[i].c_str(), maxlen);
   }
-  NXputdata(fileID, (void *)strs);
+  NXputdata(fileID, static_cast<void *>(strs));
   NXclosedata(fileID);
   delete[] strs;
   return (true);
@@ -471,7 +471,7 @@ int NexusFileIO::writeNexusProcessedData2D(
     dims_array[0] = static_cast<int>(axis2.size());
     NXmakedata(fileID, "axis2", NX_FLOAT64, 1, dims_array);
     NXopendata(fileID, "axis2");
-    NXputdata(fileID, (void *)&(axis2[0]));
+    NXputdata(fileID, static_cast<void *>(axis2.data()));
     NXputattr(fileID, "units",
               reinterpret_cast<void *>(const_cast<char *>(sLabel.c_str())),
               static_cast<int>(sLabel.size()), NX_CHAR);
@@ -544,8 +544,8 @@ void NexusFileIO::writeTableColumn(int type, const std::string &interpret_as,
   auto toNexus = new NexusT[nRows];
   for (int ii = 0; ii < nRows; ii++)
     toNexus[ii] = static_cast<NexusT>(col.cell<ColumnT>(ii));
-  NXwritedata(columnName.c_str(), type, 1, dims_array, (void *)(toNexus),
-              false);
+  NXwritedata(columnName.c_str(), type, 1, dims_array,
+              static_cast<void *>(toNexus), false);
   delete[] toNexus;
 
   // attributes
@@ -596,9 +596,7 @@ void NexusFileIO::writeNexusVectorColumn(
   }
 
   // Set-up dimensions
-  int dims[2];
-  dims[0] = static_cast<int>(rowCount);
-  dims[1] = static_cast<int>(maxSize);
+  int dims[2]{static_cast<int>(rowCount), static_cast<int>(maxSize)};
 
   // Create data array
   boost::scoped_array<ElemType> data(new ElemType[rowCount * maxSize]);
@@ -707,7 +705,7 @@ int NexusFileIO::writeNexusTableWorkspace(
           toNexus[ii * maxStr + ic] = ' ';
       }
 
-      NXputdata(fileID, (void *)(toNexus));
+      NXputdata(fileID, static_cast<void *>(toNexus));
       delete[] toNexus;
 
       // attributes
@@ -769,7 +767,7 @@ int NexusFileIO::writeNexusProcessedDataEventCombined(
     else
       NXmakedata(fileID, "indices", NX_INT64, 1, dims_array);
     NXopendata(fileID, "indices");
-    NXputdata(fileID, (void *)(indices.data()));
+    NXputdata(fileID, static_cast<void *>(indices.data()));
     std::string yUnits = ws->YUnit();
     std::string yUnitLabel = ws->YUnitLabel();
     NXputattr(fileID, "units",
@@ -785,16 +783,17 @@ int NexusFileIO::writeNexusProcessedDataEventCombined(
   dims_array[0] = static_cast<int>(
       indices.back()); // TODO big truncation error! This is the # of events
   if (tofs)
-    NXwritedata("tof", NX_FLOAT64, 1, dims_array, (void *)(tofs), compress);
-  if (pulsetimes)
-    NXwritedata("pulsetime", NX_INT64, 1, dims_array, (void *)(pulsetimes),
+    NXwritedata("tof", NX_FLOAT64, 1, dims_array, static_cast<void *>(tofs),
                 compress);
+  if (pulsetimes)
+    NXwritedata("pulsetime", NX_INT64, 1, dims_array,
+                static_cast<void *>(pulsetimes), compress);
   if (weights)
-    NXwritedata("weight", NX_FLOAT32, 1, dims_array, (void *)(weights),
-                compress);
+    NXwritedata("weight", NX_FLOAT32, 1, dims_array,
+                static_cast<void *>(weights), compress);
   if (errorSquareds)
     NXwritedata("error_squared", NX_FLOAT32, 1, dims_array,
-                (void *)(errorSquareds), compress);
+                static_cast<void *>(errorSquareds), compress);
 
   // Close up the overall group
   NXstatus status = NXclosegroup(fileID);
@@ -887,16 +886,17 @@ void NexusFileIO::writeEventListData(std::vector<T> events, bool writeTOF,
   // managed event workspaces.
   bool compress = true; //(num > 100);
   if (writeTOF)
-    NXwritedata("tof", NX_FLOAT64, 1, dims_array, (void *)(tofs), compress);
-  if (writePulsetime)
-    NXwritedata("pulsetime", NX_INT64, 1, dims_array, (void *)(pulsetimes),
+    NXwritedata("tof", NX_FLOAT64, 1, dims_array, static_cast<void *>(tofs),
                 compress);
+  if (writePulsetime)
+    NXwritedata("pulsetime", NX_INT64, 1, dims_array,
+                static_cast<void *>(pulsetimes), compress);
   if (writeWeight)
-    NXwritedata("weight", NX_FLOAT32, 1, dims_array, (void *)(weights),
-                compress);
+    NXwritedata("weight", NX_FLOAT32, 1, dims_array,
+                static_cast<void *>(weights), compress);
   if (writeError)
     NXwritedata("error_squared", NX_FLOAT32, 1, dims_array,
-                (void *)(errorSquareds), compress);
+                static_cast<void *>(errorSquareds), compress);
 
   // Free mem.
   delete[] tofs;
@@ -919,14 +919,14 @@ int NexusFileIO::writeEventList(const DataObjects::EventList &el,
   NXopengroup(fileID, group_name.c_str(), "NXdata");
 
   // Copy the detector IDs to an array.
-  const std::set<detid_t> &dets = el.getDetectorIDs();
+  const auto &dets = el.getDetectorIDs();
 
   // Write out the detector IDs
   if (!dets.empty()) {
     std::vector<detid_t> detectorIDs(dets.begin(), dets.end());
     int dims_array[1];
     NXwritedata("detector_IDs", NX_INT64, 1, dims_array,
-                (void *)(detectorIDs.data()), false);
+                static_cast<void *>(detectorIDs.data()), false);
   }
 
   std::string eventType("UNKNOWN");
@@ -969,7 +969,7 @@ int NexusFileIO::writeEventList(const DataObjects::EventList &el,
             reinterpret_cast<void *>(const_cast<char *>(eventType.c_str())),
             static_cast<int>(eventType.size()), NX_CHAR);
   // Save an attribute with the number of events
-  NXputattr(fileID, "num_events", (void *)(&num), 1, NX_INT64);
+  NXputattr(fileID, "num_events", static_cast<void *>(&num), 1, NX_INT64);
 
   // Close it up!
   status = NXclosegroup(fileID);
@@ -1016,8 +1016,8 @@ int NexusFileIO::getWorkspaceSize(int &numberOfSpectra, int &numberOfChannels,
   type = NX_CHAR;
 
   if (checkAttributeName("units")) {
-    status = NXgetattr(fileID, const_cast<char *>("units"), (void *)sbuf, &len,
-                       &type);
+    status = NXgetattr(fileID, const_cast<char *>("units"),
+                       static_cast<void *>(sbuf), &len, &type);
     if (status != NX_ERROR)
       yUnits = sbuf;
     NXclosedata(fileID);
@@ -1029,7 +1029,8 @@ int NexusFileIO::getWorkspaceSize(int &numberOfSpectra, int &numberOfChannels,
     return (4);
   len = NX_MAXNAMELEN;
   type = NX_CHAR;
-  NXgetattr(fileID, const_cast<char *>("units"), (void *)sbuf, &len, &type);
+  NXgetattr(fileID, const_cast<char *>("units"), static_cast<void *>(sbuf),
+            &len, &type);
   axesUnits = std::string(sbuf, len);
   NXgetinfo(fileID, &rank, dim, &type);
   // non-uniform X has 2D axis1 data
@@ -1044,7 +1045,8 @@ int NexusFileIO::getWorkspaceSize(int &numberOfSpectra, int &numberOfChannels,
   NXopendata(fileID, "axis2");
   len = NX_MAXNAMELEN;
   type = NX_CHAR;
-  NXgetattr(fileID, const_cast<char *>("units"), (void *)sbuf, &len, &type);
+  NXgetattr(fileID, const_cast<char *>("units"), static_cast<void *>(sbuf),
+            &len, &type);
   axesUnits += std::string(":") + std::string(sbuf, len);
   NXclosedata(fileID);
   NXclosegroup(fileID);
@@ -1081,11 +1083,11 @@ int NexusFileIO::getXValues(MantidVec &xValues, const int &spectra) const {
     return (2);
   NXgetinfo(fileID, &rank, dim, &type);
   if (rank == 1) {
-    NXgetdata(fileID, &xValues[0]);
+    NXgetdata(fileID, xValues.data());
   } else {
     int start[2] = {spectra, 0};
     int size[2] = {1, dim[1]};
-    NXgetslab(fileID, &xValues[0], start, size);
+    NXgetslab(fileID, xValues.data(), start, size);
   }
   NXclosedata(fileID);
   NXclosegroup(fileID);
@@ -1118,7 +1120,7 @@ int NexusFileIO::getSpectra(MantidVec &values, MantidVec &errors,
   // get buffer and block size
   int start[2] = {spectra - 1, 0};
   int size[2] = {1, dim[1]};
-  NXgetslab(fileID, &values[0], start, size);
+  NXgetslab(fileID, values.data(), start, size);
   NXclosedata(fileID);
 
   // read errors
@@ -1128,7 +1130,7 @@ int NexusFileIO::getSpectra(MantidVec &values, MantidVec &errors,
   NXgetinfo(fileID, &rank, dim, &type);
   // set block size;
   size[1] = dim[1];
-  NXgetslab(fileID, &errors[0], start, size);
+  NXgetslab(fileID, errors.data(), start, size);
   NXclosedata(fileID);
 
   NXclosegroup(fileID);
@@ -1214,9 +1216,7 @@ bool NexusFileIO::writeNexusBinMasking(
   NXstatus status;
 
   // save spectra offsets as a 2d array of ints
-  int dimensions[2];
-  dimensions[0] = spectra_count;
-  dimensions[1] = 2;
+  int dimensions[2]{spectra_count, 2};
   status = NXmakedata(fileID, "masked_spectra", NX_INT32, 2, dimensions);
   if (status == NX_ERROR)
     return false;
@@ -1226,7 +1226,7 @@ bool NexusFileIO::writeNexusBinMasking(
   NXputattr(fileID, "description",
             reinterpret_cast<void *>(const_cast<char *>(description.c_str())),
             static_cast<int>(description.size() + 1), NX_CHAR);
-  NXputdata(fileID, (void *)&spectra[0]);
+  NXputdata(fileID, static_cast<void *>(spectra.data()));
   NXclosedata(fileID);
 
   // save masked bin indices
@@ -1235,7 +1235,7 @@ bool NexusFileIO::writeNexusBinMasking(
   if (status == NX_ERROR)
     return false;
   NXopendata(fileID, "masked_bins");
-  NXputdata(fileID, (void *)&bins[0]);
+  NXputdata(fileID, static_cast<void *>(bins.data()));
   NXclosedata(fileID);
 
   // save masked bin weights
@@ -1244,7 +1244,7 @@ bool NexusFileIO::writeNexusBinMasking(
   if (status == NX_ERROR)
     return false;
   NXopendata(fileID, "mask_weights");
-  NXputdata(fileID, (void *)&weights[0]);
+  NXputdata(fileID, static_cast<void *>(weights.data()));
   NXclosedata(fileID);
 
   return true;
diff --git a/Framework/PythonInterface/inc/MantidPythonInterface/kernel/DataServiceExporter.h b/Framework/PythonInterface/inc/MantidPythonInterface/kernel/DataServiceExporter.h
index 90679c67007c4a433a9654ac8c4b214633f45354..7c0e12b27d43e7edced73ced754fa6f80705d654 100644
--- a/Framework/PythonInterface/inc/MantidPythonInterface/kernel/DataServiceExporter.h
+++ b/Framework/PythonInterface/inc/MantidPythonInterface/kernel/DataServiceExporter.h
@@ -176,10 +176,8 @@ template <typename SvcType, typename SvcPtrType> struct DataServiceExporter {
    */
   static boost::python::object getObjectNamesAsList(SvcType &self) {
     boost::python::list names;
-    const std::set<std::string> keys = self.getObjectNames();
-    std::set<std::string>::const_iterator iend = keys.end();
-    for (std::set<std::string>::const_iterator itr = keys.begin(); itr != iend;
-         ++itr) {
+    const auto keys = self.getObjectNames();
+    for (auto itr = keys.begin(); itr != keys.end(); ++itr) {
       names.append(*itr);
     }
     assert(names.attr("__len__")() == keys.size());
diff --git a/Framework/PythonInterface/inc/MantidPythonInterface/kernel/Registry/TypedPropertyValueHandler.h b/Framework/PythonInterface/inc/MantidPythonInterface/kernel/Registry/TypedPropertyValueHandler.h
index ed0791ce5751965246467e742f47ede5e7d84c8e..3fb9882e461f9057832523e97b6ce65506c782f4 100644
--- a/Framework/PythonInterface/inc/MantidPythonInterface/kernel/Registry/TypedPropertyValueHandler.h
+++ b/Framework/PythonInterface/inc/MantidPythonInterface/kernel/Registry/TypedPropertyValueHandler.h
@@ -76,7 +76,7 @@ struct DLLExport TypedPropertyValueHandler : public PropertyValueHandler {
                            const unsigned int direction) const override {
     using boost::python::extract;
     const ValueType valueInC = extract<ValueType>(defaultValue)();
-    Kernel::Property *valueProp(NULL);
+    Kernel::Property *valueProp(nullptr);
     if (isNone(validator)) {
       valueProp =
           new Kernel::PropertyWithValue<ValueType>(name, valueInC, direction);
@@ -135,7 +135,7 @@ struct DLLExport TypedPropertyValueHandler<boost::shared_ptr<T>>
     using boost::python::extract;
     const PropertyValueType valueInC =
         extract<PropertyValueType>(defaultValue)();
-    Kernel::Property *valueProp(NULL);
+    Kernel::Property *valueProp(nullptr);
     if (isNone(validator)) {
       valueProp = new Kernel::PropertyWithValue<PropertyValueType>(
           name, valueInC, direction);
diff --git a/Framework/PythonInterface/plugins/algorithms/AlignComponents.py b/Framework/PythonInterface/plugins/algorithms/AlignComponents.py
new file mode 100644
index 0000000000000000000000000000000000000000..a2fa92f3ab2d27d15b14db16d7ff2878ccef7827
--- /dev/null
+++ b/Framework/PythonInterface/plugins/algorithms/AlignComponents.py
@@ -0,0 +1,495 @@
+#pylint: disable=no-init, no-name-in-module
+import math
+import numpy as np
+from scipy.stats import chisquare
+from mantid.api import PythonAlgorithm, AlgorithmFactory, MatrixWorkspaceProperty, PropertyMode, \
+    ITableWorkspaceProperty, FileAction, FileProperty, WorkspaceProperty, InstrumentValidator, Progress
+from mantid.kernel import Direction, FloatBoundedValidator, PropertyCriterion, EnabledWhenProperty, \
+    logger, Quat, V3D, StringArrayProperty, StringListValidator
+import mantid.simpleapi as api
+
+class AlignComponents(PythonAlgorithm):
+    """
+    Class to align components
+    """
+
+    _optionsList = ["Xposition", "Yposition", "Zposition", "AlphaRotation", "BetaRotation", "GammaRotation"]
+    _optionsDict = {}
+    _initialPos = None
+    _move = False
+    _rotate = False
+    _masking = False
+    _eulerConvention = None
+
+    def category(self):
+        """
+        Mantid required
+        """
+        return "PythonAlgorithms;Diffraction"
+
+    def name(self):
+        """
+        Mantid required
+        """
+        return "AlignComponents"
+
+    def summary(self):
+        """
+        Mantid required
+        """
+        return "Align a component by minimising difference to an offset workspace"
+
+    #pylint: disable=too-many-locals
+    def PyInit(self):
+        self.declareProperty(ITableWorkspaceProperty("CalibrationTable", "",
+                                                     optional=PropertyMode.Mandatory,
+                                                     direction=Direction.Input),
+                             doc="Calibration table, currently only uses difc")
+
+        self.declareProperty(MatrixWorkspaceProperty("MaskWorkspace", "",
+                                                     optional=PropertyMode.Optional,
+                                                     direction=Direction.Input),
+                             doc="Mask workspace")
+
+        self.declareProperty(FileProperty(name="InstrumentFilename",
+                                          defaultValue="",
+                                          action=FileAction.OptionalLoad,
+                                          extensions=[".xml"]),
+                             doc="Instrument filename")
+
+        self.declareProperty(WorkspaceProperty("Workspace", "",
+                                               validator=InstrumentValidator(),
+                                               optional=PropertyMode.Optional,
+                                               direction=Direction.Input),
+                             doc="Workspace containing the instrument to be calibrated.")
+
+        # Source
+        self.declareProperty(name="FitSourcePosition", defaultValue=False,
+                             doc="Fit the source position, changes L1 (source to sample) distance."
+                             "Uses entire instrument. Occurs before Components are Aligned.")
+
+        # Sample
+        self.declareProperty(name="FitSamplePosition", defaultValue=False,
+                             doc="Fit the sample position, changes L1 (source to sample) and L2 (sample to detector) distance."
+                             "Uses entire instrument. Occurs before Components are Aligned.")
+
+        # List of components
+        self.declareProperty(StringArrayProperty("ComponentList",
+                                                 direction=Direction.Input),
+                             doc="Comma separated list on instrument components to refine.")
+
+        # X position
+        self.declareProperty(name="Xposition", defaultValue=False,
+                             doc="Refine Xposition")
+        condition = EnabledWhenProperty("Xposition", PropertyCriterion.IsNotDefault)
+        self.declareProperty(name="MinXposition", defaultValue=-0.1,
+                             validator=FloatBoundedValidator(-10.0, 10.0),
+                             doc="Minimum relative X bound (m)")
+        self.setPropertySettings("MinXposition", condition)
+        self.declareProperty(name="MaxXposition", defaultValue=0.1,
+                             validator=FloatBoundedValidator(-10.0, 10.0),
+                             doc="Maximum relative X bound (m)")
+        self.setPropertySettings("MaxXposition", condition)
+
+        # Y position
+        self.declareProperty(name="Yposition", defaultValue=False,
+                             doc="Refine Yposition")
+        condition = EnabledWhenProperty("Yposition", PropertyCriterion.IsNotDefault)
+        self.declareProperty(name="MinYposition", defaultValue=-0.1,
+                             validator=FloatBoundedValidator(-10.0, 10.0),
+                             doc="Minimum relative Y bound (m)")
+        self.setPropertySettings("MinYposition", condition)
+        self.declareProperty(name="MaxYposition", defaultValue=0.1,
+                             validator=FloatBoundedValidator(-10.0, 10.0),
+                             doc="Maximum relative Y bound (m)")
+        self.setPropertySettings("MaxYposition", condition)
+
+        # Z position
+        self.declareProperty(name="Zposition", defaultValue=False,
+                             doc="Refine Zposition")
+        condition = EnabledWhenProperty("Zposition", PropertyCriterion.IsNotDefault)
+        self.declareProperty(name="MinZposition", defaultValue=-0.1,
+                             validator=FloatBoundedValidator(-10.0, 10.0),
+                             doc="Minimum relative Z bound (m)")
+        self.setPropertySettings("MinZposition", condition)
+        self.declareProperty(name="MaxZposition", defaultValue=0.1,
+                             validator=FloatBoundedValidator(-10.0, 10.0),
+                             doc="Maximum relative Z bound (m)")
+        self.setPropertySettings("MaxZposition", condition)
+
+        # euler angles convention
+        eulerConventions = ["ZXZ", "XYX", "YZY", "ZYZ", "XZX", "YXY", "XYZ", "YZX", "ZXY", "XZY", "ZYX", "YXZ"]
+        self.declareProperty(name="EulerConvention", defaultValue="YZX",
+                             validator=StringListValidator(eulerConventions),
+                             doc="Euler angles convention used when calculating and displaying angles,"
+                             "eg XYZ corresponding to alpha beta gamma.")
+
+        # alpha rotation
+        self.declareProperty(name="AlphaRotation", defaultValue=False,
+                             doc="Refine rotation around first axis, alpha")
+        condition = EnabledWhenProperty("AlphaRotation", PropertyCriterion.IsNotDefault)
+        self.declareProperty(name="MinAlphaRotation", defaultValue=-10.0,
+                             validator=FloatBoundedValidator(-90, 90),
+                             doc="Minimum relative alpha rotation (deg)")
+        self.setPropertySettings("MinAlphaRotation", condition)
+        self.declareProperty(name="MaxAlphaRotation", defaultValue=10.0,
+                             validator=FloatBoundedValidator(-90, 90),
+                             doc="Maximum relative alpha rotation (deg)")
+        self.setPropertySettings("MaxAlphaRotation", condition)
+
+        # beta rotation
+        self.declareProperty(name="BetaRotation", defaultValue=False,
+                             doc="Refine rotation around seconds axis, beta")
+        condition = EnabledWhenProperty("BetaRotation", PropertyCriterion.IsNotDefault)
+        self.declareProperty(name="MinBetaRotation", defaultValue=-10.0,
+                             validator=FloatBoundedValidator(-90, 90),
+                             doc="Minimum relative beta rotation (deg)")
+        self.setPropertySettings("MinBetaRotation", condition)
+        self.declareProperty(name="MaxBetaRotation", defaultValue=10.0,
+                             validator=FloatBoundedValidator(-90, 90),
+                             doc="Maximum relative beta rotation (deg)")
+        self.setPropertySettings("MaxBetaRotation", condition)
+
+        # gamma rotation
+        self.declareProperty(name="GammaRotation", defaultValue=False,
+                             doc="Refine rotation around third axis, gamma")
+        condition = EnabledWhenProperty("GammaRotation", PropertyCriterion.IsNotDefault)
+        self.declareProperty(name="MinGammaRotation", defaultValue=-10.0,
+                             validator=FloatBoundedValidator(-90, 90),
+                             doc="Minimum relative gamma rotation (deg)")
+        self.setPropertySettings("MinGammaRotation", condition)
+        self.declareProperty(name="MaxGammaRotation", defaultValue=10.0,
+                             validator=FloatBoundedValidator(-90, 90),
+                             doc="Maximum relative gamma rotation (deg)")
+        self.setPropertySettings("MaxGammaRotation", condition)
+
+        # Translation
+        self.setPropertyGroup("Xposition","Translation")
+        self.setPropertyGroup("MinXposition","Translation")
+        self.setPropertyGroup("MaxXposition","Translation")
+        self.setPropertyGroup("Yposition","Translation")
+        self.setPropertyGroup("MinYposition","Translation")
+        self.setPropertyGroup("MaxYposition","Translation")
+        self.setPropertyGroup("Zposition","Translation")
+        self.setPropertyGroup("MinZposition","Translation")
+        self.setPropertyGroup("MaxZposition","Translation")
+
+        # Rotation
+        self.setPropertyGroup("EulerConvention","Rotation")
+        self.setPropertyGroup("AlphaRotation","Rotation")
+        self.setPropertyGroup("MinAlphaRotation","Rotation")
+        self.setPropertyGroup("MaxAlphaRotation","Rotation")
+        self.setPropertyGroup("BetaRotation","Rotation")
+        self.setPropertyGroup("MinBetaRotation","Rotation")
+        self.setPropertyGroup("MaxBetaRotation","Rotation")
+        self.setPropertyGroup("GammaRotation","Rotation")
+        self.setPropertyGroup("MinGammaRotation","Rotation")
+        self.setPropertyGroup("MaxGammaRotation","Rotation")
+
+    def validateInputs(self):
+        """
+        Does basic validation for inputs
+        """
+        issues = dict()
+
+        calWS = self.getProperty('CalibrationTable').value
+
+        if 'difc' not in calWS.getColumnNames() or 'detid' not in calWS.getColumnNames():
+            issues['CalibrationTable'] = "Calibration table requires detid and difc"
+
+        maskWS = self.getProperty("MaskWorkspace").value
+        if maskWS is not None and maskWS.id() != 'MaskWorkspace':
+            issues['MaskWorkspace'] = "MaskWorkspace must be empty or of type \"MaskWorkspace\""
+
+        # Need to get instrument in order to check components are valid
+        if self.getProperty("Workspace").value is not None:
+            wks_name = self.getProperty("Workspace").value.getName()
+        else:
+            inputFilename = self.getProperty("InstrumentFilename").value
+            if inputFilename == "":
+                issues["Workspace"] = "A Workspace or InstrumentFilename must be defined"
+                return issues
+            else:
+                api.LoadEmptyInstrument(Filename=inputFilename,
+                                        OutputWorkspace="alignedWorkspace")
+                wks_name = "alignedWorkspace"
+
+        # Check if each component listed is defined in the instrument
+        components = self.getProperty("ComponentList").value
+        if len(components) <= 0 and not self.getProperty("FitSourcePosition").value and not self.getProperty("FitSamplePosition").value:
+            issues['ComponentList'] = "Must supply components"
+        else:
+            components = [component for component in components
+                          if api.mtd[wks_name].getInstrument().getComponentByName(component) is None]
+            if len(components) > 0:
+                issues['ComponentList'] = "Instrument has no component \"" \
+                                       + ','.join(components) + "\""
+
+        # This checks that something will actually be refined,
+        if not (self.getProperty("Xposition").value or
+                self.getProperty("Yposition").value or
+                self.getProperty("Zposition").value or
+                self.getProperty("AlphaRotation").value or
+                self.getProperty("BetaRotation").value or
+                self.getProperty("GammaRotation").value or
+                self.getProperty("FitSourcePosition").value or
+                self.getProperty("FitSamplePosition").value):
+            issues["Xposition"] = "You must calibrate at least one parameter."
+
+        return issues
+
+    #pylint: disable=too-many-branches
+    def PyExec(self):
+        self._eulerConvention=self.getProperty('EulerConvention').value
+        calWS = self.getProperty('CalibrationTable').value
+        calWS = api.SortTableWorkspace(calWS, Columns='detid')
+        maskWS = self.getProperty("MaskWorkspace").value
+
+        if maskWS != None:
+            self._masking = True
+            mask = maskWS.extractY().flatten()
+
+        difc = calWS.column('difc')
+        if self._masking:
+            difc = np.ma.masked_array(difc, mask)
+
+        detID = calWS.column('detid')
+
+        if self.getProperty("Workspace").value is not None:
+            wks_name = self.getProperty("Workspace").value.getName()
+        else:
+            wks_name = "alignedWorkspace"
+            api.LoadEmptyInstrument(Filename=self.getProperty("InstrumentFilename").value,
+                                    OutputWorkspace=wks_name)
+
+        # First fit L1 if selected for Source and/or Sample
+        for component in "Source", "Sample":
+            if self.getProperty("Fit"+component+"Position").value:
+                if component == "Sample":
+                    componentName = api.mtd[wks_name].getInstrument().getSample().getFullName()
+                    componentZ = api.mtd[wks_name].getInstrument().getSample().getPos().getZ()
+                else:
+                    componentName = api.mtd[wks_name].getInstrument().getSource().getFullName()
+                    componentZ = api.mtd[wks_name].getInstrument().getSource().getPos().getZ()
+                logger.notice("Working on " + componentName +
+                              " Starting position is " + str(componentZ))
+                firstIndex = 0
+                lastIndex = len(difc)
+                if self._masking:
+                    mask_out = mask[firstIndex:lastIndex + 1]
+                else:
+                    mask_out = None
+                newZ = minimize(self._minimisation_func_L1, x0=componentZ,
+                                args=(wks_name,
+                                      componentName,
+                                      firstIndex,
+                                      lastIndex,
+                                      difc[firstIndex:lastIndex + 1],
+                                      mask_out),
+                                bounds=[(componentZ-1,componentZ+1)])
+                api.MoveInstrumentComponent(wks_name, componentName, Z=newZ.x[0],
+                                            RelativePosition=False)
+                logger.notice("Finished " + componentName +
+                              " Final position is " + str(newZ.x[0]))
+
+        # Now fit all the components if any
+        components = self.getProperty("ComponentList").value
+
+        for opt in self._optionsList:
+            self._optionsDict[opt] = self.getProperty(opt).value
+
+        if self._optionsDict["Xposition"] or self._optionsDict["Yposition"] or self._optionsDict["Zposition"]:
+            self._move = True
+
+        if self._optionsDict["AlphaRotation"] or self._optionsDict["BetaRotation"] or self._optionsDict["GammaRotation"]:
+            self._rotate = True
+
+        prog = Progress(self, start=0, end=1, nreports=len(components))
+        for component in components:
+            comp = api.mtd[wks_name].getInstrument().getComponentByName(component)
+            firstDetID = self._getFirstDetID(comp)
+            firstIndex = detID.index(firstDetID)
+            lastDetID = self._getLastDetID(comp)
+            lastIndex = detID.index(lastDetID)
+            if lastDetID - firstDetID != lastIndex - firstIndex:
+                raise RuntimeError("Calibration detid doesn't match instrument")
+
+            eulerAngles = comp.getRotation().getEulerAngles(self._eulerConvention)
+
+            logger.notice("Working on " + comp.getFullName() +
+                          " Starting position is " + str(comp.getPos()) +
+                          " Starting rotation is " + str(eulerAngles))
+
+            x0List = []
+            self._initialPos = [comp.getPos().getX(), comp.getPos().getY(), comp.getPos().getZ(),
+                                eulerAngles[0], eulerAngles[1], eulerAngles[2]]
+
+            boundsList = []
+
+            if self._masking:
+                mask_out = mask[firstIndex:lastIndex + 1]
+                if mask_out.sum() == mask_out.size:
+                    self.log().warning("All pixels in '%s' are masked. Skipping calibration." % component)
+                    continue
+            else:
+                mask_out = None
+
+            if self._optionsDict["Xposition"]:
+                x0List.append(self._initialPos[0])
+                boundsList.append((self._initialPos[0] + self.getProperty("MinXposition").value,
+                                   self._initialPos[0] + self.getProperty("MaxXposition").value))
+            if self._optionsDict["Yposition"]:
+                x0List.append(self._initialPos[1])
+                boundsList.append((self._initialPos[1] + self.getProperty("MinYposition").value,
+                                   self._initialPos[1] + self.getProperty("MaxYposition").value))
+            if self._optionsDict["Zposition"]:
+                x0List.append(self._initialPos[2])
+                boundsList.append((self._initialPos[2] + self.getProperty("MinZposition").value,
+                                   self._initialPos[2] + self.getProperty("MaxZposition").value))
+            if self._optionsDict["AlphaRotation"]:
+                x0List.append(self._initialPos[3])
+                boundsList.append((self._initialPos[3] + self.getProperty("MinAlphaRotation").value,
+                                   self._initialPos[3] + self.getProperty("MaxAlphaRotation").value))
+            if self._optionsDict["BetaRotation"]:
+                x0List.append(self._initialPos[4])
+                boundsList.append((self._initialPos[4] + self.getProperty("MinBetaRotation").value,
+                                   self._initialPos[4] + self.getProperty("MaxBetaRotation").value))
+            if self._optionsDict["GammaRotation"]:
+                x0List.append(self._initialPos[5])
+                boundsList.append((self._initialPos[5] + self.getProperty("MinGammaRotation").value,
+                                   self._initialPos[5] + self.getProperty("MaxGammaRotation").value))
+
+            results = minimize(self._minimisation_func, x0=x0List,
+                               args=(wks_name,
+                                     component,
+                                     firstIndex,
+                                     lastIndex,
+                                     difc[firstIndex:lastIndex + 1],
+                                     mask_out),
+                               bounds=boundsList)
+
+            # Apply the results to the output workspace
+            xmap = self._mapOptions(results.x)
+
+            if self._move:
+                api.MoveInstrumentComponent(wks_name, component, X=xmap[0], Y=xmap[1], Z=xmap[2],
+                                            RelativePosition=False)
+
+            if self._rotate:
+                (rotw, rotx, roty, rotz) = self._eulerToAngleAxis(xmap[3], xmap[4], xmap[5], self._eulerConvention)
+                api.RotateInstrumentComponent(wks_name, component, X=rotx, Y=roty, Z=rotz, Angle=rotw,
+                                              RelativeRotation=False)
+
+            # Need to grab the component again, as things have changed
+            comp = api.mtd[wks_name].getInstrument().getComponentByName(component)
+            logger.notice("Finshed " + comp.getFullName() +
+                          " Final position is " + str(comp.getPos()) +
+                          " Final rotation is " + str(comp.getRotation().getEulerAngles(self._eulerConvention)))
+
+            prog.report()
+        logger.notice("Results applied to workspace "+wks_name)
+
+    #pylint: disable=too-many-arguments
+    def _minimisation_func(self, x_0, wks_name, component, firstIndex, lastIndex, difc, mask):
+        """
+        Basic minimization function used. Returns the chisquared difference between the expected
+        difc and the new difc after the component has been moved or rotated.
+        """
+        xmap = self._mapOptions(x_0)
+
+        if self._move:
+            api.MoveInstrumentComponent(wks_name, component, X=xmap[0], Y=xmap[1], Z=xmap[2], RelativePosition=False)
+
+        if self._rotate:
+            (rotw, rotx, roty, rotz) = self._eulerToAngleAxis(xmap[3], xmap[4], xmap[5], self._eulerConvention) # YZX
+            api.RotateInstrumentComponent(wks_name, component, X=rotx, Y=roty, Z=rotz, Angle=rotw,
+                                          RelativeRotation=False)
+
+        api.CalculateDIFC(InputWorkspace=wks_name, OutputWorkspace=wks_name)
+
+        difc_new = api.mtd[wks_name].extractY().flatten()[firstIndex:lastIndex + 1]
+
+        if self._masking:
+            difc_new = np.ma.masked_array(difc_new, mask)
+
+        return chisquare(f_obs=difc, f_exp=difc_new)[0]
+
+    def _minimisation_func_L1(self, x_0, wks_name, component, firstIndex, lastIndex, difc, mask):
+        """
+        Minimization function for moving component along Z only.
+        """
+        api.MoveInstrumentComponent(wks_name, component, Z=x_0[0], RelativePosition=False)
+        wks_new = api.CalculateDIFC(InputWorkspace=wks_name, OutputWorkspace=wks_name)
+
+        difc_new = wks_new.extractY().flatten()[firstIndex:lastIndex + 1]
+
+        if self._masking:
+            difc_new = np.ma.masked_array(difc_new, mask)
+
+        return chisquare(f_obs=difc, f_exp=difc_new)[0]
+
+    def _getFirstDetID(self, component):
+        """
+        recursive search to find first detID of a component
+        """
+        if component.type() == 'DetectorComponent' or component.type() == 'RectangularDetectorPixel':
+            return component.getID()
+        else:
+            return self._getFirstDetID(component[0])
+
+    def _getLastDetID(self, component):
+        """
+        recursive search to find last detID of a component
+        """
+        if component.type() == 'DetectorComponent' or component.type() == 'RectangularDetectorPixel':
+            return component.getID()
+        else:
+            return self._getLastDetID(component[component.nelements() - 1])
+
+    def _mapOptions(self, inX):
+        """
+        Creates an array combining the refining and constant variables
+        This is required because scipy.optimise.minimise expect a constant
+        number of variable, so need to be able to maps any number of
+        inputs to six outputs.
+
+        """
+        x0_index = 0
+        out = []
+        for opt in self._optionsList:
+            if self._optionsDict[opt]:
+                out.append(inX[x0_index])
+                x0_index += 1
+            else:
+                out.append(self._initialPos[self._optionsList.index(opt)])
+        return out
+
+    def _eulerToQuat(self, alpha, beta, gamma, convention):
+        """
+        Convert Euler angles to a quaternion
+        """
+        getV3D = {'X': V3D(1, 0, 0), 'Y': V3D(0, 1, 0), 'Z': V3D(0, 0, 1)}
+        return (Quat(alpha, getV3D[convention[0]]) * Quat(beta, getV3D[convention[1]]) *
+                Quat(gamma, getV3D[convention[2]]))
+
+    def _eulerToAngleAxis(self, alpha, beta, gamma, convention):
+        """
+        Convert Euler angles to a angle rotation around an axis
+        """
+        quat = self._eulerToQuat(alpha, beta, gamma, convention)
+        if quat[0] == 1:
+            return 0, 0, 0, 1
+        deg = math.acos(quat[0])
+        scale = math.sin(deg)
+        deg *= 360.0 / math.pi
+        ax0 = quat[1] / scale
+        ax1 = quat[2] / scale
+        ax2 = quat[3] / scale
+        return deg, ax0, ax1, ax2
+
+
+try:
+    from scipy.optimize import minimize
+    AlgorithmFactory.subscribe(AlignComponents)
+except ImportError:
+    logger.debug('Failed to subscribe algorithm AlignComponets; cannot import minimize from scipy.optimize')
diff --git a/Framework/PythonInterface/plugins/algorithms/LRDirectBeamSort.py b/Framework/PythonInterface/plugins/algorithms/LRDirectBeamSort.py
index e7ec26930d58240adc4c267f24f1465182103365..96c9183c2f3c0395d9edc50eeb4c624a9dcbc3c7 100644
--- a/Framework/PythonInterface/plugins/algorithms/LRDirectBeamSort.py
+++ b/Framework/PythonInterface/plugins/algorithms/LRDirectBeamSort.py
@@ -1,16 +1,12 @@
 #pylint: disable=no-init,invalid-name
-import math
-import time
-import numpy as np
 import mantid
 from mantid.api import *
 from mantid.simpleapi import *
 from mantid.kernel import *
-import logging
 
 class CompareTwoNXSDataForSFcalculator(object):
     """
-        will return -1, 0 or 1 according to the position of the nexusToPosition in relation to the 
+        will return -1, 0 or 1 according to the position of the nexusToPosition in relation to the
         nexusToCompareWith based on the following criteria
         #1: number of attenuators (ascending order)
         #2: lambda requested (descending order)
@@ -31,7 +27,7 @@ class CompareTwoNXSDataForSFcalculator(object):
             self.resultComparison = compare1
             return
 
-        compare2 = self.compareParameter('vATT', 'ascending')
+        compare2 = self.compareParameter('vAtt', 'ascending')
         if compare2 != 0:
             self.resultComparison = compare2
             return
@@ -58,9 +54,9 @@ class CompareTwoNXSDataForSFcalculator(object):
             resultLessThan = 1
             resultMoreThan = -1
 
-        if (_paramNexusToPosition < _paramNexusToCompareWith):
+        if _paramNexusToPosition < _paramNexusToCompareWith:
             return resultLessThan
-        elif (_paramNexusToPosition > _paramNexusToCompareWith):
+        elif _paramNexusToPosition > _paramNexusToCompareWith:
             return resultMoreThan
         else:
             return 0
@@ -74,7 +70,7 @@ def sorter_function(r1, r2):
     """
     return CompareTwoNXSDataForSFcalculator(r2, r1).result()
 
-     
+
 class LRDirectBeamSort(PythonAlgorithm):
 
     def category(self):
@@ -140,7 +136,7 @@ class LRDirectBeamSort(PythonAlgorithm):
 
     def _compute_scaling_factors(self, lr_data_sorted):
         """
-            If we need to compute the scaling factors, group the runs by their wavelength request 
+            If we need to compute the scaling factors, group the runs by their wavelength request
             @param lr_data_sorted: ordered list of workspaces
         """
         group_list = []
@@ -155,7 +151,7 @@ class LRDirectBeamSort(PythonAlgorithm):
                 if len(current_group)>0:
                     group_list.append(current_group)
                 current_group = []
-    
+
             current_group.append(r)
 
         # Add in the last group
@@ -169,8 +165,6 @@ class LRDirectBeamSort(PythonAlgorithm):
         for g in group_list:
             if len(g) == 0:
                 continue
-            runs = [r.getRunNumber() for r in g]
-            logger.notice(str(runs))
 
             direct_beam_runs = []
             peak_ranges = []
@@ -203,7 +197,7 @@ class LRDirectBeamSort(PythonAlgorithm):
                 else:
                     low_res = [0, number_of_pixels_x]
 
-                att = run.getRun().getProperty('vATT').value[0]-1
+                att = run.getRun().getProperty('vAtt').value[0]-1
                 direct_beam_runs.append(run.getRunNumber())
                 peak_ranges.append(int(peak[0]))
                 peak_ranges.append(int(peak[1]))
@@ -232,6 +226,7 @@ class LRDirectBeamSort(PythonAlgorithm):
             summary += "TOF: %s\n\n" % tof_range
 
             # Compute the scaling factors
+            logger.notice("Computing scaling factors for %s" % str(direct_beam_runs))
             LRScalingFactors(DirectBeamRuns=direct_beam_runs,
                              TOFRange=tof_range, TOFSteps=tof_steps,
                              SignalPeakPixelRange=peak_ranges,
diff --git a/Framework/PythonInterface/plugins/algorithms/LRScalingFactors.py b/Framework/PythonInterface/plugins/algorithms/LRScalingFactors.py
index 32ecddaa8397218c09b3e68835a7b6d7047f249a..84d80ecf5f95a4789ed21e662be1671936f1ff2b 100644
--- a/Framework/PythonInterface/plugins/algorithms/LRScalingFactors.py
+++ b/Framework/PythonInterface/plugins/algorithms/LRScalingFactors.py
@@ -65,6 +65,7 @@ class LRScalingFactors(PythonAlgorithm):
         self.declareProperty("FrontSlitName", "S1", doc="Name of the front slit")
         self.declareProperty("BackSlitName", "Si", doc="Name of the back slit")
         self.declareProperty("TOFSteps", 500.0, doc="TOF step size")
+        self.declareProperty("SlitTolerance", 0.02, doc="Tolerance for matching slit positions")
         self.declareProperty(FileProperty("ScalingFactorFile","",
                                           action=FileAction.Save,
                                           extensions=['cfg']))
@@ -102,7 +103,7 @@ class LRScalingFactors(PythonAlgorithm):
         self.wavelength_tolerance = 0.2
 
         # Slit settings tolerance
-        self.tolerance = 0.02
+        self.tolerance = self.getProperty("SlitTolerance").value
 
         # Scaling factor output
         self.scaling_factors = []
@@ -236,7 +237,7 @@ class LRScalingFactors(PythonAlgorithm):
         if self.have_attenuator_info:
             return self.attenuators[run_index]
         else:
-            return int(workspace.getRun().getProperty('vATT').value[0]-1)
+            return int(workspace.getRun().getProperty('vAtt').value[0]-1)
 
     def get_valid_pixel_range(self, property_name, number_of_runs):
         """
diff --git a/Framework/PythonInterface/plugins/algorithms/LiquidsReflectometryReduction.py b/Framework/PythonInterface/plugins/algorithms/LiquidsReflectometryReduction.py
index 8fb0f9c894d5c7372255e1ab795bbdef5163c2a8..33fa8365ce019255fac7973b9bfa8a8735ce7c9b 100644
--- a/Framework/PythonInterface/plugins/algorithms/LiquidsReflectometryReduction.py
+++ b/Framework/PythonInterface/plugins/algorithms/LiquidsReflectometryReduction.py
@@ -75,6 +75,7 @@ class LiquidsReflectometryReduction(PythonAlgorithm):
         self.declareProperty("AngleOffsetError", 0.0, doc="Angle offset error (degrees)")
         self.declareProperty(MatrixWorkspaceProperty("OutputWorkspace", "", Direction.Output), "Output workspace")
         self.declareProperty("ScalingFactorFile", "", doc="Scaling factor configuration file")
+        self.declareProperty("SlitTolerance", 0.02, doc="Tolerance for matching slit positions")
         self.declareProperty("SlitsWidthFlag", True,
                              doc="Looking for perfect match of slits width when using Scaling Factor file")
         self.declareProperty("IncidentMediumSelected", "", doc="Incident medium used for those runs")
@@ -92,7 +93,7 @@ class LiquidsReflectometryReduction(PythonAlgorithm):
     def PyExec(self):
         # The old reduction code had a tolerance value for matching the
         # slit parameters to get the scaling factors
-        self.TOLERANCE = 0.020
+        self.TOLERANCE = self.getProperty("SlitTolerance").value
 
         # DATA
         dataRunNumbers = self.getProperty("RunNumbers").value
@@ -334,9 +335,9 @@ class LiquidsReflectometryReduction(PythonAlgorithm):
         tthd_units = run_object.getProperty('tthd').units
 
         # Make sure we have radians
-        if thi_units == 'degree':
+        if thi_units.lower().startswith('deg'):
             thi_value *= math.pi / 180.0
-        if tthd_units == 'degree':
+        if tthd_units.lower().startswith('deg'):
             tthd_value *= math.pi / 180.0
 
         theta = math.fabs(tthd_value - thi_value) / 2.
diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/FuryFitMultiple.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/FuryFitMultiple.py
deleted file mode 100644
index 09bb97a1971877097bce4305804ad9905947bb6c..0000000000000000000000000000000000000000
--- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/FuryFitMultiple.py
+++ /dev/null
@@ -1,55 +0,0 @@
-#pylint: disable=no-init
-from mantid import config, logger, AlgorithmFactory
-from mantid.api import *
-from mantid.kernel import *
-from mantid.simpleapi import *
-import os.path
-
-class FuryFitMultiple(PythonAlgorithm):
-
-    def category(self):
-        return "Workflow\\MIDAS"
-
-    def summary(self):
-        #pylint: disable=anomalous-backslash-in-string
-        return "Fits an \*\_iqt file generated by Fury using one of the specified functions."
-
-    def PyInit(self):
-        self.declareProperty(name="InputType", defaultValue="File",validator=StringListValidator(['File', 'Workspace']),
-                             doc='Origin of data input - File (_red.nxs) or Workspace')
-        self.declareProperty(name="Instrument", defaultValue="iris",validator=StringListValidator(['irs', 'iris', 'osi', 'osiris']),
-                             doc='Instrument')
-        self.declareProperty(name='Analyser', defaultValue='graphite002', validator=StringListValidator(['graphite002', 'graphite004']),
-                             doc='Analyser & reflection')
-        self.declareProperty(name="RunNumber",defaultValue=-1, validator=IntBoundedValidator(lower=0),
-                             doc="Sample run number")
-        self.declareProperty(name="TimeMax", defaultValue=0.2, validator=FloatMandatoryValidator(),
-                             doc="Multiplicative scale factor")
-        self.declareProperty(name='Plot', defaultValue='None', validator=StringListValidator(['None', 'Intensity', 'Tau', 'Beta', 'All']),
-                             doc='Switch Plot Off/On')
-
-    def PyExec(self):
-        from IndirectDataAnalysis import furyfitMult
-
-        workdir = config['defaultsave.directory']
-        inType = self.getProperty('InputType').value
-        prefix = self.getProperty('Instrument').value
-        ana = self.getProperty('Analyser').value
-        RunNumb = self.getProperty('RunNumber').value
-        xMax = self.getProperty('TimeMax').value
-        filename = prefix + str(RunNumb) + '_' + ana
-        plotOp = self.getProperty('Plot').value
-        inWS = filename + '_iqt'
-        if inType == 'File':
-            spath = os.path.join(workdir, inWS + '.nxs')  # path name for sample nxs file
-            logger.notice('Input from File : ' + spath)
-            LoadNexusProcessed(Filename=spath, OutputWorkspace=inWS)
-        else:
-            logger.notice('Input from Workspace : ' + inWS)
-        CropWorkspace(InputWorkspace=inWS, OutputWorkspace=inWS, XMin=0.0, XMax=xMax)
-        function = 'name=LinearBackground,A0=0.02,A1=0,ties=(A1=0);'
-        function +=     'name=UserFunction,Formula=Intensity*exp(-(x/Tau)^Beta),Intensity=0.98,Tau=0.02,Beta=0.8'
-
-        furyfitMult(inWS, function, 'SSSS', 0.0, 0.2, False, plotOp, True)
-
-AlgorithmFactory.subscribe(FuryFitMultiple)
diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IqtFitMultiple.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IqtFitMultiple.py
new file mode 100644
index 0000000000000000000000000000000000000000..55d8c9298158d4b8e5158f4e8bcaf1ab1d64cc2c
--- /dev/null
+++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IqtFitMultiple.py
@@ -0,0 +1,213 @@
+#pylint: disable=no-init, too-many-instance-attributes
+from mantid import logger, AlgorithmFactory
+from mantid.api import *
+from mantid.kernel import *
+from mantid.simpleapi import *
+import os.path
+
+class IqtFitMultiple(PythonAlgorithm):
+
+    _input_ws = None
+    _function = None
+    _fit_type = None
+    _start_x = None
+    _end_x = None
+    _spec_min = None
+    _spec_max = None
+    _intensities_constrained = None
+    _minimizer = None
+    _max_iterations = None
+    _result_name = None
+    _parameter_name = None
+    _fit_group_name = None
+
+
+    def category(self):
+        return "Workflow\\MIDAS"
+
+    def summary(self):
+        #pylint: disable=anomalous-backslash-in-string
+        return "Fits an \*\_iqt file generated by I(Q,t)."
+
+    def PyInit(self):
+        self.declareProperty(MatrixWorkspaceProperty('InputWorkspace', '', direction=Direction.Input),
+                             doc='The _iqt.nxs InputWorkspace used by the algorithm')
+
+        self.declareProperty(name='Function', defaultValue='',
+                             doc='The function to use in fitting')
+
+        self.declareProperty(name='FitType', defaultValue='',
+                             doc='The type of fit being carried out')
+
+        self.declareProperty(name='StartX', defaultValue=0.0,
+                             validator=FloatBoundedValidator(0.0),
+                             doc="The first value for X")
+
+        self.declareProperty(name='EndX', defaultValue=0.2,
+                             validator=FloatBoundedValidator(0.0),
+                             doc="The last value for X")
+
+        self.declareProperty(name='SpecMin', defaultValue=0,
+                             validator=IntBoundedValidator(0),
+                             doc='Minimum spectra in the worksapce to fit')
+
+        self.declareProperty(name='SpecMax', defaultValue=1,
+                             validator=IntBoundedValidator(0),
+                             doc='Maximum spectra in the worksapce to fit')
+
+        self.declareProperty(name='Minimizer', defaultValue='Levenberg-Marquardt',
+                             doc='The minimizer to use in fitting')
+
+        self.declareProperty(name="MaxIterations", defaultValue=500,
+                             validator=IntBoundedValidator(0),
+                             doc="The Maximum number of iterations for the fit")
+
+        self.declareProperty(name='ConstrainIntensities', defaultValue=False,
+                             doc="If the Intensities should be constrained during the fit")
+
+        self.declareProperty(MatrixWorkspaceProperty('OutputResultWorkspace', '', direction=Direction.Output),
+                             doc='The outputworkspace containing the results of the fit data')
+
+        self.declareProperty(ITableWorkspaceProperty('OutputParameterWorkspace', '', direction=Direction.Output),
+                             doc='The outputworkspace containing the parameters for each fit')
+
+        self.declareProperty(WorkspaceGroupProperty('OutputWorkspaceGroup', '', direction=Direction.Output),
+                             doc='The OutputWorkspace group Data, Calc and Diff, values for the fit of each spectra')
+
+
+    def validateInputs(self):
+        self._get_properties()
+        issues = dict()
+
+        maximum_possible_spectra = self._input_ws.getNumberHistograms()
+        maximum_possible_x = self._input_ws.readX(0)[self._input_ws.blocksize() - 1]
+        # Validate SpecMin/Max
+
+        if self._spec_max > maximum_possible_spectra:
+            issues['SpecMax'] = ('SpecMax must be smaller or equal to the '\
+             'number of spectra in the input workspace, %d' % maximum_possible_spectra)
+        if self._spec_min < 0:
+            issues['SpecMin'] = 'SpecMin can not be less than 0'
+        if self._spec_max < self._spec_min:
+            issues['SpecMax'] = 'SpecMax must be more than or equal to SpecMin'
+
+        # Validate Start/EndX
+        if self._end_x > maximum_possible_x:
+            issues['EndX'] = ('EndX must be less than the highest x value in the workspace, %d' % maximum_possible_x)
+        if self._start_x < 0:
+            issues['StartX'] = 'StartX can not be less than 0'
+        if self._start_x > self._end_x:
+            issues['EndX'] = 'EndX must be more than StartX'
+
+        return issues
+
+    def _get_properties(self):
+        self._input_ws = self.getProperty('InputWorkspace').value
+        self._function = self.getProperty('Function').value
+        self._fit_type = self.getProperty('FitType').value
+        self._start_x = self.getProperty('StartX').value
+        self._end_x = self.getProperty('EndX').value
+        self._spec_min = self.getProperty('SpecMin').value
+        self._spec_max = self.getProperty('SpecMax').value
+        self._intensities_constrained = self.getProperty('ConstrainIntensities').value
+        self._minimizer = self.getProperty('Minimizer').value
+        self._max_iterations = self.getProperty('MaxIterations').value
+        self._result_name = self.getPropertyValue('OutputResultWorkspace')
+        self._parameter_name = self.getPropertyValue('OutputParameterWorkspace')
+        self._fit_group_name = self.getPropertyValue('OutputWorkspaceGroup')
+
+    def PyExec(self):
+        from IndirectDataAnalysis import (convertToElasticQ,
+                                          createFuryMultiDomainFunction,
+                                          transposeFitParametersTable)
+
+        setup_prog = Progress(self, start=0.0, end=0.1, nreports=4)
+        setup_prog.report('generating output name')
+        output_workspace = self._fit_group_name
+        # check if the naming convention used is alreay correct
+        chopped_name = self._fit_group_name.split('_')
+        if 'WORKSPACE' in chopped_name[-1].upper():
+            output_workspace = ('_').join(chopped_name[:-1])
+
+        option = self._fit_type[:-2]
+        logger.information('Option: '+ option)
+        logger.information('Function: '+ self._function)
+
+        setup_prog.report('Cropping workspace')
+        #prepare input workspace for fitting
+        tmp_fit_workspace = "__Iqtfit_fit_ws"
+        if self._spec_max is None:
+            CropWorkspace(InputWorkspace=self._input_ws, OutputWorkspace=tmp_fit_workspace,
+                          XMin=self._start_x, XMax=self._end_x,
+                          StartWorkspaceIndex=self._spec_min)
+        else:
+            CropWorkspace(InputWorkspace=self._input_ws, OutputWorkspace=tmp_fit_workspace,
+                          XMin=self._start_x, XMax=self._end_x,
+                          StartWorkspaceIndex=self._spec_min, EndWorkspaceIndex=self._spec_max)
+
+        setup_prog.report('Converting to Histogram')
+        ConvertToHistogram(tmp_fit_workspace, OutputWorkspace=tmp_fit_workspace)
+        setup_prog.report('Convert to Elastic Q')
+        convertToElasticQ(tmp_fit_workspace)
+
+        #fit multi-domian functino to workspace
+        fit_prog = Progress(self, start=0.1, end=0.8, nreports=2)
+        multi_domain_func, kwargs = createFuryMultiDomainFunction(self._function, tmp_fit_workspace)
+        fit_prog.report('Fitting...')
+        Fit(Function=multi_domain_func,
+            InputWorkspace=tmp_fit_workspace,
+            WorkspaceIndex=0,
+            Output=output_workspace,
+            CreateOutput=True,
+            Minimizer=self._minimizer,
+            MaxIterations=self._max_iterations,
+            **kwargs)
+        fit_prog.report('Fitting complete')
+
+        conclusion_prog = Progress(self, start=0.8, end=1.0, nreports=5)
+        conclusion_prog.report('Renaming workspaces')
+        # rename workspaces to match user input
+        if output_workspace + "_Workspaces" != self._fit_group_name:
+            RenameWorkspace(InputWorkspace=output_workspace + "_Workspaces", OutputWorkspace=self._fit_group_name)
+        if output_workspace + "_Parameters" != self._parameter_name:
+            RenameWorkspace(InputWorkspace=output_workspace + "_Parameters", OutputWorkspace=self._parameter_name)
+
+        conclusion_prog.report('Tansposing parameter table')
+        transposeFitParametersTable(self._parameter_name)
+
+        #set first column of parameter table to be axis values
+        x_axis = mtd[tmp_fit_workspace].getAxis(1)
+        axis_values = x_axis.extractValues()
+        for i, value in enumerate(axis_values):
+            mtd[self._parameter_name].setCell('axis-1', i, value)
+
+        #convert parameters to matrix workspace
+        parameter_names = 'A0,Intensity,Tau,Beta'
+        conclusion_prog.report('Processing indirect fit parameters')
+        self._result_name = ProcessIndirectFitParameters(InputWorkspace=self._parameter_name,
+                                                         ColumnX="axis-1", XAxisUnit="MomentumTransfer",
+                                                         ParameterNames=parameter_names)
+
+        # create and add sample logs
+        sample_logs  = {'start_x': self._start_x, 'end_x': self._end_x, 'fit_type': self._fit_type,
+                        'intensities_constrained': self._intensities_constrained, 'beta_constrained': True}
+
+        conclusion_prog.report('Copying sample logs')
+        CopyLogs(InputWorkspace=self._input_ws, OutputWorkspace=self._result_name)
+        CopyLogs(InputWorkspace=self._input_ws, OutputWorkspace=self._fit_group_name)
+
+        log_names = [item[0] for item in sample_logs]
+        log_values = [item[1] for item in sample_logs]
+        conclusion_prog.report('Adding sample logs')
+        AddSampleLogMultiple(Workspace=self._result_name, LogNames=log_names, LogValues=log_values)
+        AddSampleLogMultiple(Workspace=self._fit_group_name, LogNames=log_names, LogValues=log_values)
+
+        DeleteWorkspace(tmp_fit_workspace)
+
+        self.setProperty('OutputResultWorkspace', self._result_name)
+        self.setProperty('OutputParameterWorkspace', self._parameter_name)
+        self.setProperty('OutputWorkspaceGroup', self._fit_group_name)
+        conclusion_prog.report('Algorithm complete')
+
+
+AlgorithmFactory.subscribe(IqtFitMultiple)
diff --git a/Framework/PythonInterface/test/python/plugins/algorithms/AlignComponentsTest.py b/Framework/PythonInterface/test/python/plugins/algorithms/AlignComponentsTest.py
new file mode 100644
index 0000000000000000000000000000000000000000..7fe499636272220c97a9f2c3362631511bdd2b95
--- /dev/null
+++ b/Framework/PythonInterface/test/python/plugins/algorithms/AlignComponentsTest.py
@@ -0,0 +1,115 @@
+import unittest
+from mantid.simpleapi import AlignComponents, CreateSampleWorkspace, MoveInstrumentComponent, CreateEmptyTableWorkspace, mtd, RotateInstrumentComponent
+from mantid.api import AlgorithmFactory
+
+class AlignComponentsTest(unittest.TestCase):
+
+    def testAlignComponentsPositionXY(self):
+        CreateSampleWorkspace(OutputWorkspace='testWS', NumBanks=1,BankPixelWidth=4)
+        component='bank1'
+        MoveInstrumentComponent(Workspace='testWS',ComponentName=component,X=0.06,Y=0.04,Z=4.98,RelativePosition=False)
+
+        ### Detector should move to [0.05,0.03,4.98]
+        ### Calibration table generated with:
+        # CreateSampleWorkspace(OutputWorkspace='sample', NumBanks=1,BankPixelWidth=4)
+        # MoveInstrumentComponent(Workspace='sample',ComponentName='bank1',X=0.05,Y=0.03,Z=4.98,RelativePosition=False)
+        # CalculateDIFC(InputWorkspace='sample', OutputWorkspace='sample')
+        # d=mtd['sample'].extractY()
+        # for i in range(len(d)):
+        #        print "calTable.addRow(["+str(i+16)+", "+str(d[i][0])+"])"
+
+        calTable = CreateEmptyTableWorkspace()
+        calTable.addColumn("int", "detid")
+        calTable.addColumn("double", "difc")
+
+        calTable.addRow([16, 44.3352831346])
+        calTable.addRow([17, 47.7503426493])
+        calTable.addRow([18, 51.6581064544])
+        calTable.addRow([19, 55.9553976608])
+        calTable.addRow([20, 49.6495672525])
+        calTable.addRow([21, 52.7214213944])
+        calTable.addRow([22, 56.285004349])
+        calTable.addRow([23, 60.2530897937])
+        calTable.addRow([24, 55.1227558338])
+        calTable.addRow([25, 57.9048914599])
+        calTable.addRow([26, 61.1671229038])
+        calTable.addRow([27, 64.8369848035])
+        calTable.addRow([28, 60.7118272387])
+        calTable.addRow([29, 63.2484968666])
+        calTable.addRow([30, 66.2480051141])
+        calTable.addRow([31, 69.650545037])
+
+        ws = mtd["testWS"]
+        startPos = ws.getInstrument().getComponentByName(component).getPos()
+        startRot = ws.getInstrument().getComponentByName(component).getRotation().getEulerAngles()
+        AlignComponents(CalibrationTable="calTable",
+                        Workspace="testWS",
+                        ComponentList=component,
+                        Xposition=True,
+                        Yposition=True)
+        ws = mtd["testWS"]
+        endPos = ws.getInstrument().getComponentByName(component).getPos()
+        endRot = ws.getInstrument().getComponentByName(component).getRotation().getEulerAngles()
+        self.assertAlmostEqual(endPos.getX(), 0.05)
+        self.assertAlmostEqual(endPos.getY(), 0.03)
+        self.assertEqual(startPos.getZ(), endPos.getZ())
+        self.assertEqual(startRot[0], endRot[0])
+        self.assertEqual(startRot[1], endRot[1])
+        self.assertEqual(startRot[2], endRot[2])
+
+    def testAlignComponentsRotationY(self):
+        CreateSampleWorkspace(OutputWorkspace='testWS', NumBanks=1,BankPixelWidth=4)
+        component='bank1'
+        MoveInstrumentComponent(Workspace='testWS',ComponentName=component,X=2.00,Y=0,Z=2.00,RelativePosition=False)
+        RotateInstrumentComponent(Workspace='testWS',ComponentName='bank1',X=0,Y=1,Z=0,Angle=50,RelativeRotation=False)
+
+        ### Detector should rotate to +45deg around Y
+        ### Calibration table generated with:
+        # CreateSampleWorkspace(OutputWorkspace='sample2', NumBanks=1,BankPixelWidth=4)
+        # MoveInstrumentComponent(Workspace='sample2',ComponentName='bank1',X=2.0,Y=0.0,Z=2.0,RelativePosition=False)
+        # RotateInstrumentComponent(Workspace='sample2',ComponentName='bank1',X=0,Y=1,Z=0,Angle=45,RelativeRotation=False)
+        # CalculateDIFC(InputWorkspace='sample2', OutputWorkspace='sample2')
+        # d=mtd['sample2'].extractY()
+        # for i in range(len(d)):
+        #        print "calTable.addRow(["+str(i+16)+", "+str(d[i][0])+"])"
+
+        calTable = CreateEmptyTableWorkspace()
+        calTable.addColumn("int", "detid")
+        calTable.addColumn("double", "difc")
+
+        calTable.addRow([16, 2481.89300158])
+        calTable.addRow([17, 2481.90717397])
+        calTable.addRow([18, 2481.94969])
+        calTable.addRow([19, 2482.02054626])
+        calTable.addRow([20, 2490.36640334])
+        calTable.addRow([21, 2490.38050851])
+        calTable.addRow([22, 2490.42282292])
+        calTable.addRow([23, 2490.49334316])
+        calTable.addRow([24, 2498.83911141])
+        calTable.addRow([25, 2498.85314962])
+        calTable.addRow([26, 2498.89526313])
+        calTable.addRow([27, 2498.96544859])
+        calTable.addRow([28, 2507.31101837])
+        calTable.addRow([29, 2507.32498986])
+        calTable.addRow([30, 2507.36690322])
+        calTable.addRow([31, 2507.43675513])
+
+        ws = mtd["testWS"]
+        startPos = ws.getInstrument().getComponentByName(component).getPos()
+        startRot = ws.getInstrument().getComponentByName(component).getRotation().getEulerAngles("YZX") #YZX
+        AlignComponents(CalibrationTable="calTable",
+                        Workspace="testWS",
+                        ComponentList=component,
+                        AlphaRotation=True)
+        ws = mtd["testWS"]
+        endPos = ws.getInstrument().getComponentByName(component).getPos()
+        endRot = ws.getInstrument().getComponentByName(component).getRotation().getEulerAngles("YZX") #YZX
+        self.assertEqual(startPos, endPos)
+        self.assertAlmostEqual(endRot[0],45.0,places=0)
+        self.assertEqual(startRot[1], endRot[1])
+        self.assertEqual(startRot[2], endRot[2])
+
+if __name__ == "__main__":
+    # Only test is Algorithm is loaded
+    if AlgorithmFactory.exists("AlignComponents"):
+        unittest.main()
diff --git a/Framework/PythonInterface/test/python/plugins/algorithms/CMakeLists.txt b/Framework/PythonInterface/test/python/plugins/algorithms/CMakeLists.txt
index 331ccef685d945b4287a1a31c0fc58aab5c6d183..264695c2f065f745fa6a79319d7687115ed57bf1 100644
--- a/Framework/PythonInterface/test/python/plugins/algorithms/CMakeLists.txt
+++ b/Framework/PythonInterface/test/python/plugins/algorithms/CMakeLists.txt
@@ -4,6 +4,7 @@
 
 set ( TEST_PY_FILES
   AddSampleLogMultipleTest.py
+  AlignComponentsTest.py
   ApplyPaalmanPingsCorrectionTest.py
   BayesQuasiTest.py
   CalculateSampleTransmissionTest.py
@@ -41,6 +42,7 @@ set ( TEST_PY_FILES
   IndirectTransmissionTest.py
   IndirectTransmissionMonitorTest.py
   ILLIN16BCalibrationTest.py
+  IqtFitMultipleTest.py
   ISISIndirectDiffractionReductionTest.py
   ISISIndirectEnergyTransferTest.py
   LoadDNSLegacyTest.py
diff --git a/Framework/PythonInterface/test/python/plugins/algorithms/IqtFitMultipleTest.py b/Framework/PythonInterface/test/python/plugins/algorithms/IqtFitMultipleTest.py
new file mode 100644
index 0000000000000000000000000000000000000000..19a1b6c269e6c22e787d8371b71a30a222471328
--- /dev/null
+++ b/Framework/PythonInterface/test/python/plugins/algorithms/IqtFitMultipleTest.py
@@ -0,0 +1,222 @@
+import unittest
+from mantid.simpleapi import *
+from mantid.api import MatrixWorkspace, WorkspaceGroup, ITableWorkspace
+
+
+class IqtFitMultipleTest(unittest.TestCase):
+
+    _iqt_ws = None
+    _function = r'name=LinearBackground,A0=0.027668,A1=0,ties=(A1=0);name=UserFunction,Formula=Intensity*exp(-(x/Tau)^Beta),Intensity=0.972332,Tau=0.0247558,Beta=1;ties=(f1.Intensity=1-f0.A0)'
+
+    def setUp(self):
+        self._iqt_ws = Load(Filename='iris26176_graphite002_iqt.nxs',
+                            OutputWorkspace='iris26176_graphite002_iqt')
+
+#-----------------------------------Validation of result-------------------------------------
+
+    def _validate_output(self, params, result, fit_group):
+        self.assertTrue(isinstance(params, ITableWorkspace))
+        self.assertTrue(isinstance(result, MatrixWorkspace))
+        self.assertTrue(isinstance(fit_group, WorkspaceGroup))
+
+        self._validate_table_shape(params)
+        self._validate_matrix_shape(result)
+        self._validate_group_shape(fit_group)
+
+        self._validate_table_values(params)
+        self._validate_matrix_values(result)
+        self._validate_group_values(fit_group)
+
+
+    def _validate_table_shape(self, tableWS):
+        # Check length of rows and columns
+        rows = tableWS.rowCount()
+        columns = tableWS.columnCount()
+        self.assertEquals(rows, 17)
+        self.assertEquals(columns, 11)
+
+        # Check some column names
+        column_names = tableWS.getColumnNames()
+        self.assertEquals('axis-1', column_names[0])
+        self.assertEquals('f0.A0', column_names[1])
+        self.assertEquals('f0.A0_Err', column_names[2])
+
+    def _validate_matrix_shape(self, matrixWS):
+        # Check no. bins and no. hists
+        nbins = matrixWS.blocksize()
+        nhists = matrixWS.getNumberHistograms()
+        self.assertEquals(nbins, 17)
+        self.assertEquals(nhists, 4)
+
+        # Check histogram names
+        text_axis = matrixWS.getAxis(1)
+        self.assertTrue(text_axis.isText())
+        self.assertEquals('f0.A0',text_axis.label(0))
+        self.assertEquals('f1.Intensity',text_axis.label(1))
+        self.assertEquals('f1.Tau',text_axis.label(2))
+        self.assertEquals('f1.Beta',text_axis.label(3))
+
+        # Check bin units
+        self.assertEquals('MomentumTransfer', matrixWS.getAxis(0).getUnit().unitID())
+
+    def _validate_group_shape(self, groupWS):
+        # Check number of workspaces and size
+        nitems = groupWS.getNumberOfEntries()
+        self.assertEquals(nitems, 17)
+        sub_ws = groupWS.getItem(0)
+        nbins = sub_ws.blocksize()
+        nhists = sub_ws.getNumberHistograms()
+        self.assertEquals(nbins, 49)
+        self.assertEquals(nhists, 3)
+
+        # Check histogram names
+        text_axis = sub_ws.getAxis(1)
+        self.assertTrue(text_axis.isText())
+        self.assertEquals('Data',text_axis.label(0))
+        self.assertEquals('Calc',text_axis.label(1))
+        self.assertEquals('Diff',text_axis.label(2))
+
+        # Check bin units
+        self.assertEquals('ns', str(sub_ws.getAxis(0).getUnit().symbol()))
+
+
+    def _validate_table_values(self, tableWS):
+        # Check column data
+        column = tableWS.column(0)
+        self.assertEquals(round(column[0], 6), 0.483619)
+        self.assertEquals(round(column[1], 6), 0.607871)
+        self.assertEquals(round(column[-1], 5), 1.84519)
+
+        # Check row data
+        row = tableWS.row(0)
+        self.assertEquals(round(row['axis-1'], 6),  0.483619)
+        self.assertEquals(round(row['f1.Intensity'], 6), 0.979517)
+        self.assertEquals(round(row['f1.Tau'], 7), 0.0246719)
+
+    def _validate_matrix_values(self, matrixWS):
+        # Check f0.A0
+        a0 = matrixWS.readY(0)
+        self.assertEquals(round(a0[0], 7), 0.0204827)
+        self.assertEquals(round(a0[-1],7), 0.0229125)
+
+        # Check f1.Intensity
+        intensity = matrixWS.readY(1)
+        self.assertEquals(round(intensity[0], 6), 0.979517)
+        self.assertEquals(round(intensity[-1],6), 0.977088)
+
+        # Check f1.Tau
+        tau = matrixWS.readY(2)
+        self.assertEquals(round(tau[0], 7), 0.0246719)
+        self.assertEquals(round(tau[-1],8), 0.00253487)
+
+        # Check f1.Beta
+        beta = matrixWS.readY(3)
+        self.assertEquals(round(beta[0], 6), 0.781177)
+        self.assertEquals(round(beta[-1],6), 0.781177)
+
+    def _validate_group_values(self, groupWS):
+        sub_ws = groupWS.getItem(0)
+        # Check Data
+        data = sub_ws.readY(0)
+        self.assertEquals(round(data[0], 5), 1)
+        self.assertEquals(round(data[-1],7),0.0450769)
+        # Check Calc
+        calc = sub_ws.readY(1)
+        self.assertEquals(round(calc[0], 5), 1)
+        self.assertEquals(round(calc[-1],7),0.0264651)
+        # Check Diff
+        diff = sub_ws.readY(2)
+        self.assertEquals(round(diff[0], 19), -5.31797e-14)
+        self.assertEquals(round(diff[-1],6), 0.018612)
+
+#---------------------------------------Success cases--------------------------------------
+
+    def test_basic(self):
+        """
+        Tests a basic run of IqtfitMultiple.
+        """
+        result, params, fit_group = IqtFitMultiple(InputWorkspace=self._iqt_ws,
+                                                    Function=self._function,
+                                                    FitType='1S_s',
+                                                    StartX=0,
+                                                    EndX=0.2,
+                                                    SpecMin=0,
+                                                    SpecMax=16,
+                                                    ConstrainIntensities=True)
+        self._validate_output(params, result, fit_group)
+
+#----------------------------------------Failure cases-------------------------------------
+
+    def test_minimum_spectra_number_less_than_0(self):
+        self.assertRaises(ValueError, IqtFitMultiple,
+                          InputWorkspace=self._iqt_ws,
+                          Function=self._function,
+                          FitType='1S_s',
+                          EndX=0.2,
+                          SpecMin=-1,
+                          SpecMax=16,
+                          OutputResultWorkspace='result',
+                          OutputParameterWorkspace='table',
+                          OutputWorkspaceGroup='fit_group')
+
+    def test_maximum_spectra_more_than_workspace_spectra(self):
+        self.assertRaises(RuntimeError, IqtFitMultiple, InputWorkspace=self._iqt_ws,
+                          Function=self._function,
+                          FitType='1S_s',
+                          EndX=0.2,
+                          SpecMin=0,
+                          SpecMax=20,
+                          OutputResultWorkspace='result',
+                          OutputParameterWorkspace='table',
+                          OutputWorkspaceGroup='fit_group')
+
+    def test_minimum_spectra_more_than_maximum_spectra(self):
+        self.assertRaises(RuntimeError, IqtFitMultiple, InputWorkspace=self._iqt_ws,
+                          Function=self._function,
+                          FitType='1S_s',
+                          EndX=0.2,
+                          SpecMin=10,
+                          SpecMax=5,
+                          OutputResultWorkspace='result',
+                          OutputParameterWorkspace='table',
+                          OutputWorkspaceGroup='fit_group')
+
+    def test_minimum_x_less_than_0(self):
+        self.assertRaises(ValueError, IqtFitMultiple, InputWorkspace=self._iqt_ws,
+                          Function=self._function,
+                          FitType='1S_s',
+                          StartX=-0.2,
+                          EndX=0.2,
+                          SpecMin=0,
+                          SpecMax=16,
+                          OutputResultWorkspace='result',
+                          OutputParameterWorkspace='table',
+                          OutputWorkspaceGroup='fit_group')
+
+    def test_maximum_x_more_than_workspace_max_x(self):
+        self.assertRaises(RuntimeError, IqtFitMultiple, InputWorkspace=self._iqt_ws,
+                          Function=self._function,
+                          FitType='1S_s',
+                          StartX=0,
+                          EndX=0.4,
+                          SpecMin=0,
+                          SpecMax=16,
+                          OutputResultWorkspace='result',
+                          OutputParameterWorkspace='table',
+                          OutputWorkspaceGroup='fit_group')
+
+    def test_minimum_spectra_more_than_maximum_spectra(self):
+        self.assertRaises(RuntimeError, IqtFitMultiple, InputWorkspace=self._iqt_ws,
+                          Function=self._function,
+                          FitType='1S_s',
+                          StartX=0.2,
+                          EndX=0.1,
+                          SpecMin=0,
+                          SpecMax=16,
+                          OutputResultWorkspace='result',
+                          OutputParameterWorkspace='table',
+                          OutputWorkspaceGroup='fit_group')
+
+
+if __name__=="__main__":
+    unittest.main()
diff --git a/Framework/PythonInterface/test/testhelpers/CMakeLists.txt b/Framework/PythonInterface/test/testhelpers/CMakeLists.txt
index 1aacbe5d6bb30e1ff414e4a37c45484c75c32581..3e07b7e18d23ccd2c9eab39cf121da6709cda132 100644
--- a/Framework/PythonInterface/test/testhelpers/CMakeLists.txt
+++ b/Framework/PythonInterface/test/testhelpers/CMakeLists.txt
@@ -26,6 +26,7 @@ set ( SRC_FILES
   WorkspaceCreationHelperModule.cpp 
   ${FRAMEWORK_DIR}/TestHelpers/src/ComponentCreationHelper.cpp
   ${FRAMEWORK_DIR}/TestHelpers/src/MDEventsTestHelper.cpp
+  ${FRAMEWORK_DIR}/TestHelpers/src/InstrumentCreationHelper.cpp
   ${FRAMEWORK_DIR}/TestHelpers/src/WorkspaceCreationHelper.cpp
 )
 add_library ( PythonWorkspaceCreationHelper ${SRC_FILES} ${INC_FILES} ${PYTHON_INSTALL_FILES} )
diff --git a/Framework/SINQ/inc/MantidSINQ/LoadFlexiNexus.h b/Framework/SINQ/inc/MantidSINQ/LoadFlexiNexus.h
index 5edfb1350b1d5b65645a66db80189565512bbb8f..6eb73727b2f13a811a226155fa207018f0929b05 100644
--- a/Framework/SINQ/inc/MantidSINQ/LoadFlexiNexus.h
+++ b/Framework/SINQ/inc/MantidSINQ/LoadFlexiNexus.h
@@ -91,7 +91,7 @@ private:
   Mantid::Geometry::MDHistoDimension_sptr makeDimension(NeXus::File *fin,
                                                         int index, int length);
 
-  std::set<std::string> populateSpecialMap();
+  std::unordered_set<std::string> populateSpecialMap();
 
   void addMetaData(NeXus::File *fin, Mantid::API::Workspace_sptr ws,
                    Mantid::API::ExperimentInfo_sptr info);
diff --git a/Framework/SINQ/src/InvertMDDim.cpp b/Framework/SINQ/src/InvertMDDim.cpp
index cfb4e6cd467bd29c22b88bb1bce153f1c62ab5c8..92809998d50c3207aa285ec1c77a2e302c4a5381 100644
--- a/Framework/SINQ/src/InvertMDDim.cpp
+++ b/Framework/SINQ/src/InvertMDDim.cpp
@@ -39,7 +39,7 @@ void InvertMDDim::exec() {
     dimensions.push_back(boost::const_pointer_cast<IMDDimension>(dimi));
   }
 
-  MDHistoWorkspace_sptr outWS(new MDHistoWorkspace(dimensions));
+  auto outWS = boost::make_shared<MDHistoWorkspace>(dimensions);
   outWS->setTo(.0, .0, .0);
 
   int rank = static_cast<int>(inWS->getNumDims());
diff --git a/Framework/SINQ/src/LoadFlexiNexus.cpp b/Framework/SINQ/src/LoadFlexiNexus.cpp
index d4b2070b948373f6f918ecc5ee44bd0169be9a85..e7d8e13e95d0e449b1246d24dcd6332ee5fdaf91 100644
--- a/Framework/SINQ/src/LoadFlexiNexus.cpp
+++ b/Framework/SINQ/src/LoadFlexiNexus.cpp
@@ -207,7 +207,7 @@ void LoadFlexiNexus::loadMD(NeXus::File *fin) {
     dimensions.push_back(makeDimension(fin, k, static_cast<int>(inf.dims[k])));
   }
 
-  MDHistoWorkspace_sptr ws(new MDHistoWorkspace(dimensions));
+  auto ws = boost::make_shared<MDHistoWorkspace>(dimensions);
 
   signal_t *dd = ws->getSignalArray();
   signal_t *ddE = ws->getErrorSquaredArray();
@@ -339,7 +339,7 @@ void LoadFlexiNexus::addMetaData(NeXus::File *fin, Workspace_sptr ws,
   * load all the extras into the Run information
   */
   Run &r = info->mutableRun();
-  std::set<std::string> specialMap = populateSpecialMap();
+  auto specialMap = populateSpecialMap();
   for (it = dictionary.begin(); it != dictionary.end(); ++it) {
     if (specialMap.find(it->first) == specialMap.end()) {
       // not in specials!
@@ -366,8 +366,8 @@ void LoadFlexiNexus::addMetaData(NeXus::File *fin, Workspace_sptr ws,
     }
   }
 }
-std::set<std::string> LoadFlexiNexus::populateSpecialMap() {
-  std::set<std::string> specialMap;
+std::unordered_set<std::string> LoadFlexiNexus::populateSpecialMap() {
+  std::unordered_set<std::string> specialMap;
 
   specialMap.insert("title");
   specialMap.insert("data");
diff --git a/Framework/SINQ/src/PoldiFitPeaks1D.cpp b/Framework/SINQ/src/PoldiFitPeaks1D.cpp
index 4099d7db2620e9cddb2082a122726c754e5ab4e9..0035175c9cd072f8fa456a5e2744095aff3e8edb 100644
--- a/Framework/SINQ/src/PoldiFitPeaks1D.cpp
+++ b/Framework/SINQ/src/PoldiFitPeaks1D.cpp
@@ -84,7 +84,7 @@ void PoldiFitPeaks1D::setPeakFunction(const std::string &peakFunction) {
 
 PoldiPeakCollection_sptr PoldiFitPeaks1D::getInitializedPeakCollection(
     const DataObjects::TableWorkspace_sptr &peakTable) const {
-  PoldiPeakCollection_sptr peakCollection(new PoldiPeakCollection(peakTable));
+  auto peakCollection = boost::make_shared<PoldiPeakCollection>(peakTable);
   peakCollection->setProfileFunctionName(m_profileTemplate);
 
   return peakCollection;
@@ -100,7 +100,7 @@ PoldiFitPeaks1D::getPeakProfile(const PoldiPeak_sptr &poldiPeak) const {
 
   IFunction_sptr clonedBackground = m_backgroundTemplate->clone();
 
-  CompositeFunction_sptr totalProfile(new CompositeFunction);
+  auto totalProfile = boost::make_shared<CompositeFunction>();
   totalProfile->initialize();
   totalProfile->addFunction(clonedProfile);
   totalProfile->addFunction(clonedBackground);
@@ -153,7 +153,7 @@ void PoldiFitPeaks1D::exec() {
 
   Workspace2D_sptr dataWorkspace = getProperty("InputWorkspace");
 
-  WorkspaceGroup_sptr fitPlotGroup(new WorkspaceGroup);
+  auto fitPlotGroup = boost::make_shared<WorkspaceGroup>();
 
   for (size_t i = 0; i < m_peaks->peakCount(); ++i) {
     PoldiPeak_sptr currentPeak = m_peaks->peak(i);
diff --git a/Framework/SINQ/src/PoldiFitPeaks1D2.cpp b/Framework/SINQ/src/PoldiFitPeaks1D2.cpp
index 421338f044b7b79449b08a563e8641e7e6f05e5a..ea733d6e460632837d94e92802248f90bfc3ed8b 100644
--- a/Framework/SINQ/src/PoldiFitPeaks1D2.cpp
+++ b/Framework/SINQ/src/PoldiFitPeaks1D2.cpp
@@ -182,7 +182,7 @@ void PoldiFitPeaks1D2::setPeakFunction(const std::string &peakFunction) {
 
 PoldiPeakCollection_sptr PoldiFitPeaks1D2::getInitializedPeakCollection(
     const DataObjects::TableWorkspace_sptr &peakTable) const {
-  PoldiPeakCollection_sptr peakCollection(new PoldiPeakCollection(peakTable));
+  auto peakCollection = boost::make_shared<PoldiPeakCollection>(peakTable);
   peakCollection->setProfileFunctionName(m_profileTemplate);
 
   return peakCollection;
@@ -227,7 +227,7 @@ std::vector<RefinedRange_sptr> PoldiFitPeaks1D2::getReducedRanges(
 
 API::IFunction_sptr
 PoldiFitPeaks1D2::getRangeProfile(const RefinedRange_sptr &range, int n) const {
-  CompositeFunction_sptr totalProfile(new CompositeFunction);
+  auto totalProfile = boost::make_shared<CompositeFunction>();
   totalProfile->initialize();
 
   std::vector<PoldiPeak_sptr> peaks = range->getPeaks();
diff --git a/Framework/SINQ/src/PoldiFitPeaks2D.cpp b/Framework/SINQ/src/PoldiFitPeaks2D.cpp
index 3e3e77a1c7b98b3dae325012c87ba255b36e35ae..b663b4ab1cbc228d3cd307abf5ce90587e190e05 100644
--- a/Framework/SINQ/src/PoldiFitPeaks2D.cpp
+++ b/Framework/SINQ/src/PoldiFitPeaks2D.cpp
@@ -469,7 +469,7 @@ Poldi2DFunction_sptr PoldiFitPeaks2D::getFunctionFromPeakCollection(
 Poldi2DFunction_sptr PoldiFitPeaks2D::getFunctionIndividualPeaks(
     std::string profileFunctionName,
     const PoldiPeakCollection_sptr &peakCollection) const {
-  Poldi2DFunction_sptr mdFunction(new Poldi2DFunction);
+  auto mdFunction = boost::make_shared<Poldi2DFunction>();
 
   for (size_t i = 0; i < peakCollection->peakCount(); ++i) {
     PoldiPeak_sptr peak = peakCollection->peak(i);
@@ -522,7 +522,7 @@ Poldi2DFunction_sptr PoldiFitPeaks2D::getFunctionIndividualPeaks(
 Poldi2DFunction_sptr PoldiFitPeaks2D::getFunctionPawley(
     std::string profileFunctionName,
     const PoldiPeakCollection_sptr &peakCollection) {
-  Poldi2DFunction_sptr mdFunction(new Poldi2DFunction);
+  auto mdFunction = boost::make_shared<Poldi2DFunction>();
 
   boost::shared_ptr<PoldiSpectrumPawleyFunction> poldiPawleyFunction =
       boost::dynamic_pointer_cast<PoldiSpectrumPawleyFunction>(
@@ -979,7 +979,7 @@ IAlgorithm_sptr PoldiFitPeaks2D::calculateSpectrum(
       getNormalizedPeakCollections(peakCollections);
 
   // Create a Poldi2DFunction that collects all sub-functions
-  Poldi2DFunction_sptr mdFunction(new Poldi2DFunction);
+  auto mdFunction = boost::make_shared<Poldi2DFunction>();
 
   // Add one Poldi2DFunction for each peak collection
   for (auto &normalizedPeakCollection : normalizedPeakCollections) {
diff --git a/Framework/SINQ/src/PoldiUtilities/PoldiInstrumentAdapter.cpp b/Framework/SINQ/src/PoldiUtilities/PoldiInstrumentAdapter.cpp
index c297a7b41f4b3d328b8fe1a5154e36f7cd817ad0..f0100ce43be111e2ae37d8cde5ec8ca4015ad6c4 100644
--- a/Framework/SINQ/src/PoldiUtilities/PoldiInstrumentAdapter.cpp
+++ b/Framework/SINQ/src/PoldiUtilities/PoldiInstrumentAdapter.cpp
@@ -5,7 +5,6 @@
 #include "MantidSINQ/PoldiUtilities/PoldiChopperFactory.h"
 #include "MantidSINQ/PoldiUtilities/PoldiSourceSpectrum.h"
 
-#include "boost/assign.hpp"
 #include "boost/make_shared.hpp"
 
 namespace Mantid {
@@ -20,13 +19,13 @@ const std::string PoldiInstrumentAdapter::m_chopperSpeedTargetPropertyName =
     "ChopperSpeedTarget";
 
 std::map<std::string, AbstractDoubleValueExtractor_sptr>
-    PoldiInstrumentAdapter::m_extractors = boost::assign::map_list_of(
-        "dbl list", boost::static_pointer_cast<AbstractDoubleValueExtractor>(
-                        boost::make_shared<VectorDoubleValueExtractor>()))(
-        "int list", boost::static_pointer_cast<AbstractDoubleValueExtractor>(
-                        boost::make_shared<VectorIntValueExtractor>()))(
-        "number", boost::static_pointer_cast<AbstractDoubleValueExtractor>(
-                      boost::make_shared<NumberDoubleValueExtractor>()));
+    PoldiInstrumentAdapter::m_extractors = {
+        {"dbl list", boost::static_pointer_cast<AbstractDoubleValueExtractor>(
+                         boost::make_shared<VectorDoubleValueExtractor>())},
+        {"int list", boost::static_pointer_cast<AbstractDoubleValueExtractor>(
+                         boost::make_shared<VectorIntValueExtractor>())},
+        {"number", boost::static_pointer_cast<AbstractDoubleValueExtractor>(
+                       boost::make_shared<NumberDoubleValueExtractor>())}};
 
 /** Constructor with workspace argument
   *
diff --git a/Framework/SINQ/src/ProjectMD.cpp b/Framework/SINQ/src/ProjectMD.cpp
index a79c1cf0514c5123ca53be85c2833b6cc38e3491..f537b965e69973aab6a70cb4b4263c997f4d9a9b 100644
--- a/Framework/SINQ/src/ProjectMD.cpp
+++ b/Framework/SINQ/src/ProjectMD.cpp
@@ -70,7 +70,7 @@ void ProjectMD::exec() {
     }
   }
 
-  MDHistoWorkspace_sptr outWS(new MDHistoWorkspace(dimensions));
+  auto outWS = boost::make_shared<MDHistoWorkspace>(dimensions);
   outWS->setTo(.0, .0, .0);
 
   memset(targetDim, 0, MAXDIM * sizeof(int));
diff --git a/Framework/SINQ/src/SINQHMListener.cpp b/Framework/SINQ/src/SINQHMListener.cpp
index 9235c1354d06da72f54bab0d1ec05c7e84908f26..69c2fe886fbd100bccde2b0f213c6a380d9f4801 100644
--- a/Framework/SINQ/src/SINQHMListener.cpp
+++ b/Framework/SINQ/src/SINQHMListener.cpp
@@ -106,7 +106,7 @@ boost::shared_ptr<Workspace> SINQHMListener::extractData() {
     dimensions.push_back(MDHistoDimension_sptr(new MDHistoDimension(
         dimNames[i], dimNames[i], frame, .0, coord_t(dim[i]), dim[i])));
   }
-  MDHistoWorkspace_sptr ws(new MDHistoWorkspace(dimensions));
+  auto ws = boost::make_shared<MDHistoWorkspace>(dimensions);
   ws->setTo(.0, .0, .0);
 
   readHMData(ws);
diff --git a/Framework/SINQ/src/SINQTranspose3D.cpp b/Framework/SINQ/src/SINQTranspose3D.cpp
index dff9c09e1123e43fd519a34b4d6207ba1f726761..e48ec358a27981b3f69ee036d51a790517f12327 100644
--- a/Framework/SINQ/src/SINQTranspose3D.cpp
+++ b/Framework/SINQ/src/SINQTranspose3D.cpp
@@ -65,7 +65,7 @@ void SINQTranspose3D::doYXZ(IMDHistoWorkspace_sptr inWS) {
   dimensions.push_back(boost::const_pointer_cast<IMDDimension>(x));
   dimensions.push_back(boost::const_pointer_cast<IMDDimension>(z));
 
-  MDHistoWorkspace_sptr outWS(new MDHistoWorkspace(dimensions));
+  auto outWS = boost::make_shared<MDHistoWorkspace>(dimensions);
 
   inVal = inWS->getSignalArray();
   inErr = inWS->getErrorSquaredArray();
@@ -102,7 +102,7 @@ void SINQTranspose3D::doXZY(IMDHistoWorkspace_sptr inWS) {
   dimensions.push_back(boost::const_pointer_cast<IMDDimension>(z));
   dimensions.push_back(boost::const_pointer_cast<IMDDimension>(y));
 
-  MDHistoWorkspace_sptr outWS(new MDHistoWorkspace(dimensions));
+  auto outWS = boost::make_shared<MDHistoWorkspace>(dimensions);
 
   inVal = inWS->getSignalArray();
   inErr = inWS->getErrorSquaredArray();
@@ -141,7 +141,7 @@ void SINQTranspose3D::doTRICS(IMDHistoWorkspace_sptr inWS) {
   dimensions.push_back(boost::const_pointer_cast<IMDDimension>(z));
   dimensions.push_back(boost::const_pointer_cast<IMDDimension>(y));
 
-  MDHistoWorkspace_sptr outWS(new MDHistoWorkspace(dimensions));
+  auto outWS = boost::make_shared<MDHistoWorkspace>(dimensions);
   outWS->setTo(.0, .0, .0);
 
   inVal = inWS->getSignalArray();
@@ -180,7 +180,7 @@ void SINQTranspose3D::doAMOR(IMDHistoWorkspace_sptr inWS) {
   dimensions.push_back(boost::const_pointer_cast<IMDDimension>(x));
   dimensions.push_back(boost::const_pointer_cast<IMDDimension>(z));
 
-  MDHistoWorkspace_sptr outWS(new MDHistoWorkspace(dimensions));
+  auto outWS = boost::make_shared<MDHistoWorkspace>(dimensions);
   outWS->setTo(.0, .0, .0);
 
   xdim = static_cast<unsigned int>(x->getNBins());
diff --git a/Framework/SINQ/src/SliceMDHisto.cpp b/Framework/SINQ/src/SliceMDHisto.cpp
index 67b7387525683765895a7899f0584b5d93b20cc0..61413131791fab58564e93146ec2fd5f5ede591e 100644
--- a/Framework/SINQ/src/SliceMDHisto.cpp
+++ b/Framework/SINQ/src/SliceMDHisto.cpp
@@ -78,7 +78,7 @@ void SliceMDHisto::exec() {
         arDim->getName(), arDim->getName(), arDim->getMDFrame(),
         arDim->getX(start[k]), arDim->getX(end[k]), end[k] - start[k])));
   }
-  MDHistoWorkspace_sptr outWS(new MDHistoWorkspace(dimensions));
+  auto outWS = boost::make_shared<MDHistoWorkspace>(dimensions);
 
   coord_t *sourceDim =
       reinterpret_cast<coord_t *>(malloc(m_rank * sizeof(coord_t)));
diff --git a/Framework/SINQ/test/CMakeLists.txt b/Framework/SINQ/test/CMakeLists.txt
index 5a868a37ee7ef635562650960ad61b32cd5224f5..93f379e2edde652c1be1290b486be727546c0b06 100644
--- a/Framework/SINQ/test/CMakeLists.txt
+++ b/Framework/SINQ/test/CMakeLists.txt
@@ -5,6 +5,7 @@ if ( CXXTEST_FOUND )
   
   set ( TESTHELPER_SRCS ../../TestHelpers/src/TearDownWorld.cpp 
                         ../../TestHelpers/src/ComponentCreationHelper.cpp
+                        ../../TestHelpers/src/InstrumentCreationHelper.cpp
                         ../../TestHelpers/src/WorkspaceCreationHelper.cpp )
 
   cxxtest_add_test ( PSISINQTest ${TEST_FILES} ${GMOCK_TEST_FILES})
diff --git a/Framework/SINQ/test/PoldiAutoCorrelationCoreTest.h b/Framework/SINQ/test/PoldiAutoCorrelationCoreTest.h
index 06dffe2b98f6b96b26561af4d8839b4f4fadced1..032b397b089c9a02a40df2e444f02e4406fa3844 100644
--- a/Framework/SINQ/test/PoldiAutoCorrelationCoreTest.h
+++ b/Framework/SINQ/test/PoldiAutoCorrelationCoreTest.h
@@ -4,7 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include <gmock/gmock.h>
 #include <gtest/gtest.h>
-#include <boost/assign.hpp>
 
 #include "MantidSINQ/PoldiUtilities/PoldiAutoCorrelationCore.h"
 
@@ -316,10 +315,8 @@ public:
   void testFinalizeCalculation() {
     TestablePoldiAutoCorrelationCore core(m_log);
 
-    MantidVec dValues = boost::assign::list_of(0.5)(0.6)(0.7)(0.8)
-                            .convert_to_container<MantidVec>();
-    MantidVec intensities = boost::assign::list_of(1.0)(2.0)(3.0)(4.0)
-                                .convert_to_container<MantidVec>();
+    MantidVec dValues = {0.5, 0.6, 0.7, 0.8};
+    MantidVec intensities = {1.0, 2.0, 3.0, 4.0};
 
     DataObjects::Workspace2D_sptr output =
         core.finalizeCalculation(intensities, dValues);
diff --git a/Framework/SINQ/test/PoldiFitPeaks1D2Test.h b/Framework/SINQ/test/PoldiFitPeaks1D2Test.h
index 35fbec1cc249f38f5f47758afc1a36845b5b3002..6d57b9ca2099e0d544105d58430377909bc4f2f2 100644
--- a/Framework/SINQ/test/PoldiFitPeaks1D2Test.h
+++ b/Framework/SINQ/test/PoldiFitPeaks1D2Test.h
@@ -98,7 +98,7 @@ public:
     TS_ASSERT_EQUALS(fitPeaks1D.propertyCount(), 8);
 
     std::vector<Property *> properties = fitPeaks1D.getProperties();
-    std::set<std::string> names;
+    std::unordered_set<std::string> names;
 
     for (size_t i = 0; i < properties.size(); ++i) {
       names.insert(properties[i]->name());
diff --git a/Framework/SINQ/test/PoldiFitPeaks1DTest.h b/Framework/SINQ/test/PoldiFitPeaks1DTest.h
index 452d6472c3987e074ea2ba878042f6b2cca616c4..5fef57ec078c66f53a436b0b1deb7d2812a552b7 100644
--- a/Framework/SINQ/test/PoldiFitPeaks1DTest.h
+++ b/Framework/SINQ/test/PoldiFitPeaks1DTest.h
@@ -100,7 +100,7 @@ public:
     TS_ASSERT_EQUALS(fitPeaks1D.propertyCount(), 6);
 
     std::vector<Property *> properties = fitPeaks1D.getProperties();
-    std::set<std::string> names;
+    std::unordered_set<std::string> names;
 
     for (size_t i = 0; i < properties.size(); ++i) {
       names.insert(properties[i]->name());
diff --git a/Framework/SINQ/test/PoldiPeakCollectionTest.h b/Framework/SINQ/test/PoldiPeakCollectionTest.h
index 7c218c80e0b647965c94357c3977a91760dfddfe..1e9d6b5cc94aef06cc63ecefadb71c5dd8e15420 100644
--- a/Framework/SINQ/test/PoldiPeakCollectionTest.h
+++ b/Framework/SINQ/test/PoldiPeakCollectionTest.h
@@ -287,7 +287,7 @@ public:
   void testColumnCheckConsistency() {
     TestablePoldiPeakCollection peaks;
 
-    TableWorkspace_sptr newTable(new TableWorkspace());
+    auto newTable = boost::make_shared<TableWorkspace>();
     peaks.prepareTable(newTable);
 
     TS_ASSERT(peaks.checkColumns(newTable));
diff --git a/Framework/SINQ/test/PoldiResidualCorrelationCoreTest.h b/Framework/SINQ/test/PoldiResidualCorrelationCoreTest.h
index f155d3e61cc3be86de52ccb0add0cd3b9b4fb7b2..8f12f7167c296db98122eebaaed60d959b48277c 100644
--- a/Framework/SINQ/test/PoldiResidualCorrelationCoreTest.h
+++ b/Framework/SINQ/test/PoldiResidualCorrelationCoreTest.h
@@ -2,7 +2,6 @@
 #define MANTID_SINQ_POLDIRESIDUALCORRELATIONCORETEST_H_
 
 #include <cxxtest/TestSuite.h>
-#include <boost/assign.hpp>
 
 #include "MantidSINQ/PoldiUtilities/PoldiResidualCorrelationCore.h"
 
@@ -102,10 +101,8 @@ public:
         WorkspaceCreationHelper::Create2DWorkspaceWhereYIsWorkspaceIndex(2, 2);
     core.setCountData(testWorkspace);
     core.m_timeBinCount = 2;
-    core.m_detectorElements =
-        boost::assign::list_of(0)(1).convert_to_container<std::vector<int>>();
-    core.m_indices =
-        boost::assign::list_of(0)(1).convert_to_container<std::vector<int>>();
+    core.m_detectorElements = {0, 1};
+    core.m_indices = {0, 1};
 
     // sum of counts = 2, number of cells = 4, that means ratio = 0.5, which is
     // subtracted from all counts.
@@ -120,9 +117,7 @@ public:
   void testCalculateAverage() {
     TestablePoldiResidualCorrelationCore core(m_log);
 
-    std::vector<double> numbers =
-        boost::assign::list_of(1.0)(2.0)(3.0)(4.0)(5.0)(6.0)
-            .convert_to_container<std::vector<double>>();
+    std::vector<double> numbers = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0};
     TS_ASSERT_EQUALS(core.calculateAverage(numbers), 3.5);
 
     std::vector<double> empty;
@@ -132,9 +127,7 @@ public:
   void testCalculateAverageDeviationFromValue() {
     TestablePoldiResidualCorrelationCore core(m_log);
 
-    std::vector<double> numbers =
-        boost::assign::list_of(1.0)(2.0)(3.0)(4.0)(5.0)(6.0)
-            .convert_to_container<std::vector<double>>();
+    std::vector<double> numbers = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0};
     TS_ASSERT_EQUALS(core.calculateAverageDeviationFromValue(numbers, 3.5),
                      1.5);
 
diff --git a/Framework/ScriptRepository/src/ScriptRepositoryImpl.cpp b/Framework/ScriptRepository/src/ScriptRepositoryImpl.cpp
index feefdddd7f417fb7830600255113275fa85b27bd..5997a26ab258b7a8f9c831439f7db38471cdc23d 100644
--- a/Framework/ScriptRepository/src/ScriptRepositoryImpl.cpp
+++ b/Framework/ScriptRepository/src/ScriptRepositoryImpl.cpp
@@ -8,6 +8,8 @@
 #include "MantidKernel/NetworkProxy.h"
 #include "MantidKernel/ProxyInfo.h"
 #include <utility>
+#include <unordered_set>
+
 using Mantid::Kernel::DateAndTime;
 using Mantid::Kernel::Logger;
 using Mantid::Kernel::ConfigService;
@@ -1482,7 +1484,7 @@ void ScriptRepositoryImpl::parseDownloadedEntries(Repository &repo) {
   std::string filename = std::string(local_repository).append(".local.json");
   std::vector<std::string> entries_to_delete;
   Repository::iterator entry_it;
-  std::set<std::string> folders_of_deleted;
+  std::unordered_set<std::string> folders_of_deleted;
 
   try {
     Json::Value pt = readJsonFile(filename, "Error reading .local.json file");
@@ -1530,7 +1532,7 @@ void ScriptRepositoryImpl::parseDownloadedEntries(Repository &repo) {
     if (entries_to_delete.size() > 0) {
 
       // clear the auto_update flag from the folders if the user deleted files
-      BOOST_FOREACH (const std::string &folder, folders_of_deleted) {
+      for (const auto &folder : folders_of_deleted) {
         if (!pt.isMember(folder))
           continue;
 
diff --git a/Framework/TestHelpers/inc/MantidTestHelpers/BoxControllerDummyIO.h b/Framework/TestHelpers/inc/MantidTestHelpers/BoxControllerDummyIO.h
index 34f9d277550fa8c73e828fa232d6045480311968..fcee7f89bd5be08b35bc08ba8b3298e511a837c7 100644
--- a/Framework/TestHelpers/inc/MantidTestHelpers/BoxControllerDummyIO.h
+++ b/Framework/TestHelpers/inc/MantidTestHelpers/BoxControllerDummyIO.h
@@ -55,7 +55,7 @@ public:
   /// get the full file name of the file used for IO operations
   const std::string &getFileName() const override { return m_fileName; }
   /**Return the size of the NeXus data block used in NeXus data array*/
-  size_t getDataChunk() const { return 1; }
+  size_t getDataChunk() const override { return 1; }
 
   bool openFile(const std::string &fileName, const std::string &mode) override;
   void saveBlock(const std::vector<float> & /* DataBlock */,
diff --git a/Framework/TestHelpers/inc/MantidTestHelpers/InstrumentCreationHelper.h b/Framework/TestHelpers/inc/MantidTestHelpers/InstrumentCreationHelper.h
new file mode 100644
index 0000000000000000000000000000000000000000..3ef6ca88f0d21a5cf9862a6d520dc08055a197f5
--- /dev/null
+++ b/Framework/TestHelpers/inc/MantidTestHelpers/InstrumentCreationHelper.h
@@ -0,0 +1,19 @@
+#ifndef INSTRUMENTCREATIONHELPER_H_
+#define INSTRUMENTCREATIONHELPER_H_
+
+#include "MantidTestHelpers/ComponentCreationHelper.h"
+
+namespace Mantid {
+namespace API {
+class MatrixWorkspace;
+}
+}
+
+namespace InstrumentCreationHelper {
+
+void addFullInstrumentToWorkspace(Mantid::API::MatrixWorkspace &workspace,
+                                  bool includeMonitors, bool startYNegative,
+                                  const std::string &instrumentName);
+}
+
+#endif /* INSTRUMENTCREATIONHELPER_H_ */
diff --git a/Framework/TestHelpers/inc/MantidTestHelpers/MDEventsTestHelper.h b/Framework/TestHelpers/inc/MantidTestHelpers/MDEventsTestHelper.h
index d4c1a04d915d3a769a77635c1243564c95bcbdc4..393e24270ab794dcd6ef3de7bbc0ffb162d72eaf 100644
--- a/Framework/TestHelpers/inc/MantidTestHelpers/MDEventsTestHelper.h
+++ b/Framework/TestHelpers/inc/MantidTestHelpers/MDEventsTestHelper.h
@@ -344,7 +344,7 @@ makeMDEWFull(size_t splitInto, coord_t min, coord_t max,
 
 /** Generate an empty MDBox */
 MDBox<MDLeanEvent<1>, 1> *makeMDBox1(size_t splitInto = 10,
-                                     API::BoxController *splitter = NULL);
+                                     API::BoxController *splitter = nullptr);
 
 /** Generate an empty MDBox with 3 dimensions, split 10x5x2 */
 MDBox<MDLeanEvent<3>, 3> *makeMDBox3();
diff --git a/Framework/TestHelpers/src/InstrumentCreationHelper.cpp b/Framework/TestHelpers/src/InstrumentCreationHelper.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..93f5abac5396c191e68f773bab37a11758c6ebdd
--- /dev/null
+++ b/Framework/TestHelpers/src/InstrumentCreationHelper.cpp
@@ -0,0 +1,91 @@
+#include "MantidTestHelpers/InstrumentCreationHelper.h"
+
+#include "MantidGeometry/Instrument.h"
+#include "MantidGeometry/Instrument/Detector.h"
+#include "MantidGeometry/Instrument/ReferenceFrame.h"
+#include "MantidAPI/MatrixWorkspace.h"
+#include "MantidAPI/Axis.h"
+
+using namespace Mantid;
+using namespace Mantid::Kernel;
+using namespace Mantid::Geometry;
+using namespace Mantid::API;
+namespace InstrumentCreationHelper {
+
+void addFullInstrumentToWorkspace(MatrixWorkspace &workspace,
+                                  bool includeMonitors, bool startYNegative,
+                                  const std::string &instrumentName) {
+  auto instrument = boost::make_shared<Instrument>(instrumentName);
+  instrument->setReferenceFrame(
+      boost::make_shared<ReferenceFrame>(Y, Z, Left, ""));
+  workspace.setInstrument(instrument);
+
+  const double pixelRadius(0.05);
+  Object_sptr pixelShape = ComponentCreationHelper::createCappedCylinder(
+      pixelRadius, 0.02, V3D(0.0, 0.0, 0.0), V3D(0., 1.0, 0.), "tube");
+
+  const double detXPos(5.0);
+  // Careful! Do not use size_t or auto, the unisgned will break the -=2 below.
+  int ndets = static_cast<int>(workspace.getNumberHistograms());
+  if (includeMonitors)
+    ndets -= 2;
+  for (int i = 0; i < ndets; ++i) {
+    std::ostringstream lexer;
+    lexer << "pixel-" << i << ")";
+    Detector *physicalPixel =
+        new Detector(lexer.str(), workspace.getAxis(1)->spectraNo(i),
+                     pixelShape, instrument.get());
+    int ycount(i);
+    if (startYNegative)
+      ycount -= 1;
+    const double ypos = ycount * 2.0 * pixelRadius;
+    physicalPixel->setPos(detXPos, ypos, 0.0);
+    instrument->add(physicalPixel);
+    instrument->markAsDetector(physicalPixel);
+    workspace.getSpectrum(i)->setDetectorID(physicalPixel->getID());
+  }
+
+  // Monitors last
+  if (includeMonitors) // These occupy the last 2 spectra
+  {
+    Detector *monitor1 =
+        new Detector("mon1", workspace.getAxis(1)->spectraNo(ndets),
+                     Object_sptr(), instrument.get());
+    monitor1->setPos(-9.0, 0.0, 0.0);
+    instrument->add(monitor1);
+    instrument->markAsMonitor(monitor1);
+    workspace.getSpectrum(ndets)->setDetectorID(ndets + 1);
+
+    Detector *monitor2 =
+        new Detector("mon2", workspace.getAxis(1)->spectraNo(ndets) + 1,
+                     Object_sptr(), instrument.get());
+    monitor2->setPos(-2.0, 0.0, 0.0);
+    instrument->add(monitor2);
+    instrument->markAsMonitor(monitor2);
+    workspace.getSpectrum(ndets + 1)->setDetectorID(ndets + 2);
+  }
+
+  // Define a source and sample position
+  // Define a source component
+  ObjComponent *source = new ObjComponent(
+      "moderator",
+      ComponentCreationHelper::createSphere(0.1, V3D(0, 0, 0), "1"),
+      instrument.get());
+  source->setPos(V3D(-20, 0.0, 0.0));
+  instrument->add(source);
+  instrument->markAsSource(source);
+
+  // Define a sample as a simple sphere
+  ObjComponent *sample = new ObjComponent(
+      "samplePos",
+      ComponentCreationHelper::createSphere(0.1, V3D(0, 0, 0), "1"),
+      instrument.get());
+  instrument->setPos(0.0, 0.0, 0.0);
+  instrument->add(sample);
+  instrument->markAsSamplePos(sample);
+  // chopper position
+  Component *chop_pos = new Component("chopper-position",
+                                      Kernel::V3D(-10, 0, 0), instrument.get());
+  instrument->add(chop_pos);
+}
+}
diff --git a/Framework/TestHelpers/src/MDEventsTestHelper.cpp b/Framework/TestHelpers/src/MDEventsTestHelper.cpp
index f1797c3a5224c8953d001908b27d6195903404e8..bf524406a8e8c76fe35093e265da4072264fc711 100644
--- a/Framework/TestHelpers/src/MDEventsTestHelper.cpp
+++ b/Framework/TestHelpers/src/MDEventsTestHelper.cpp
@@ -65,7 +65,7 @@ EventWorkspace_sptr
 createDiffractionEventWorkspace(int numEvents, int numPixels, int numBins) {
   double binDelta = 10.0;
 
-  EventWorkspace_sptr retVal(new EventWorkspace);
+  auto retVal = boost::make_shared<EventWorkspace>();
   retVal->initialize(numPixels, 1, 1);
 
   // --------- Load the instrument -----------
@@ -349,7 +349,7 @@ Mantid::DataObjects::MDHistoWorkspace_sptr makeFakeMDHistoWorkspaceWithMDFrame(
         " invalid or unsupported number of dimensions given");
 
   ws_sptr->setTo(signal, errorSquared, numEvents);
-  ws_sptr->addExperimentInfo(ExperimentInfo_sptr(new ExperimentInfo()));
+  ws_sptr->addExperimentInfo(boost::make_shared<ExperimentInfo>());
   if (!name.empty())
     AnalysisDataService::Instance().addOrReplace(name, ws_sptr);
   return ws_sptr;
diff --git a/Framework/TestHelpers/src/WorkspaceCreationHelper.cpp b/Framework/TestHelpers/src/WorkspaceCreationHelper.cpp
index 1419325d126e8e822d628eee14cadcdf93dbdb9b..b87243ed01c61a37f7fd6e1a8afba8c9a8b0ec26 100644
--- a/Framework/TestHelpers/src/WorkspaceCreationHelper.cpp
+++ b/Framework/TestHelpers/src/WorkspaceCreationHelper.cpp
@@ -13,6 +13,7 @@
 //------------------------------------------------------------------------------
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
 #include "MantidTestHelpers/ComponentCreationHelper.h"
+#include "MantidTestHelpers/InstrumentCreationHelper.h"
 
 #include "MantidAPI/Run.h"
 #include "MantidAPI/IAlgorithm.h"
@@ -76,7 +77,7 @@ Workspace2D_sptr Create1DWorkspaceRand(int size) {
   std::generate(y1.access().begin(), y1.access().end(), randFunc);
   e1.access().resize(size);
   std::generate(e1.access().begin(), e1.access().end(), randFunc);
-  Workspace2D_sptr retVal(new Workspace2D);
+  auto retVal = boost::make_shared<Workspace2D>();
   retVal->initialize(1, size, size);
   retVal->setX(0, x1);
   retVal->setData(0, y1, e1);
@@ -89,7 +90,7 @@ Workspace2D_sptr Create1DWorkspaceConstant(int size, double value,
   x1.access().resize(size, 1);
   y1.access().resize(size, value);
   e1.access().resize(size, error);
-  Workspace2D_sptr retVal(new Workspace2D);
+  auto retVal = boost::make_shared<Workspace2D>();
   retVal->initialize(1, size, size);
   retVal->setX(0, x1);
   retVal->setData(0, y1, e1);
@@ -112,7 +113,7 @@ Workspace2D_sptr Create1DWorkspaceFib(int size) {
   y1.access().resize(size);
   std::generate(y1.access().begin(), y1.access().end(), FibSeries<double>());
   e1.access().resize(size);
-  Workspace2D_sptr retVal(new Workspace2D);
+  auto retVal = boost::make_shared<Workspace2D>();
   retVal->initialize(1, size, size);
   retVal->setX(0, x1);
   retVal->setData(0, y1, e1);
@@ -159,7 +160,7 @@ Create2DWorkspaceWithValues(int64_t nHist, int64_t nBins, bool isHist,
   x1.access().resize(isHist ? nBins + 1 : nBins, xVal);
   y1.access().resize(nBins, yVal);
   e1.access().resize(nBins, eVal);
-  Workspace2D_sptr retVal(new Workspace2D);
+  auto retVal = boost::make_shared<Workspace2D>();
   retVal->initialize(nHist, isHist ? nBins + 1 : nBins, nBins);
   for (int i = 0; i < nHist; i++) {
     retVal->setX(i, x1);
@@ -239,7 +240,7 @@ Workspace2D_sptr maskSpectra(Workspace2D_sptr workspace,
  */
 WorkspaceGroup_sptr CreateWorkspaceGroup(int nEntries, int nHist, int nBins,
                                          const std::string &stem) {
-  WorkspaceGroup_sptr group(new WorkspaceGroup);
+  auto group = boost::make_shared<WorkspaceGroup>();
   AnalysisDataService::Instance().add(stem, group);
   for (int i = 0; i < nEntries; ++i) {
     Workspace2D_sptr ws = Create2DWorkspace(nHist, nBins);
@@ -263,7 +264,7 @@ Workspace2D_sptr Create2DWorkspaceBinned(int nhist, int nbins, double x0,
   for (int i = 0; i < nbins + 1; ++i) {
     x.access()[i] = x0 + i * deltax;
   }
-  Workspace2D_sptr retVal(new Workspace2D);
+  auto retVal = boost::make_shared<Workspace2D>();
   retVal->initialize(nhist, nbins + 1, nbins);
   for (int i = 0; i < nhist; i++) {
     retVal->setX(i, x);
@@ -286,7 +287,7 @@ Workspace2D_sptr Create2DWorkspaceBinned(int nhist, const int numBoundaries,
   for (int i = 0; i < numBoundaries; ++i) {
     x.access()[i] = xBoundaries[i];
   }
-  Workspace2D_sptr retVal(new Workspace2D);
+  auto retVal = boost::make_shared<Workspace2D>();
   retVal->initialize(nhist, numBins + 1, numBins);
   for (int i = 0; i < nhist; i++) {
     retVal->setX(i, x);
@@ -344,75 +345,8 @@ create2DWorkspaceWithFullInstrument(int nhist, int nbins, bool includeMonitors,
   space->getAxis(0)->setUnit("TOF");
   space->setYUnit("Counts");
 
-  auto testInst = boost::make_shared<Instrument>(instrumentName);
-  testInst->setReferenceFrame(
-      boost::make_shared<ReferenceFrame>(Y, Z, Left, ""));
-  space->setInstrument(testInst);
-
-  const double pixelRadius(0.05);
-  Object_sptr pixelShape = ComponentCreationHelper::createCappedCylinder(
-      pixelRadius, 0.02, V3D(0.0, 0.0, 0.0), V3D(0., 1.0, 0.), "tube");
-
-  const double detXPos(5.0);
-  int ndets = nhist;
-  if (includeMonitors)
-    ndets -= 2;
-  for (int i = 0; i < ndets; ++i) {
-    std::ostringstream lexer;
-    lexer << "pixel-" << i << ")";
-    Detector *physicalPixel =
-        new Detector(lexer.str(), space->getAxis(1)->spectraNo(i), pixelShape,
-                     testInst.get());
-    int ycount(i);
-    if (startYNegative)
-      ycount -= 1;
-    const double ypos = ycount * 2.0 * pixelRadius;
-    physicalPixel->setPos(detXPos, ypos, 0.0);
-    testInst->add(physicalPixel);
-    testInst->markAsDetector(physicalPixel);
-    space->getSpectrum(i)->addDetectorID(physicalPixel->getID());
-  }
-
-  // Monitors last
-  if (includeMonitors) // These occupy the last 2 spectra
-  {
-    Detector *monitor1 =
-        new Detector("mon1", space->getAxis(1)->spectraNo(ndets), Object_sptr(),
-                     testInst.get());
-    monitor1->setPos(-9.0, 0.0, 0.0);
-    testInst->add(monitor1);
-    testInst->markAsMonitor(monitor1);
-
-    Detector *monitor2 =
-        new Detector("mon2", space->getAxis(1)->spectraNo(ndets) + 1,
-                     Object_sptr(), testInst.get());
-    monitor2->setPos(-2.0, 0.0, 0.0);
-    testInst->add(monitor2);
-    testInst->markAsMonitor(monitor2);
-  }
-
-  // Define a source and sample position
-  // Define a source component
-  ObjComponent *source = new ObjComponent(
-      "moderator",
-      ComponentCreationHelper::createSphere(0.1, V3D(0, 0, 0), "1"),
-      testInst.get());
-  source->setPos(V3D(-20, 0.0, 0.0));
-  testInst->add(source);
-  testInst->markAsSource(source);
-
-  // Define a sample as a simple sphere
-  ObjComponent *sample = new ObjComponent(
-      "samplePos",
-      ComponentCreationHelper::createSphere(0.1, V3D(0, 0, 0), "1"),
-      testInst.get());
-  testInst->setPos(0.0, 0.0, 0.0);
-  testInst->add(sample);
-  testInst->markAsSamplePos(sample);
-  // chopper position
-  Component *chop_pos =
-      new Component("chopper-position", Kernel::V3D(-10, 0, 0), testInst.get());
-  testInst->add(chop_pos);
+  InstrumentCreationHelper::addFullInstrumentToWorkspace(
+      *space, includeMonitors, startYNegative, instrumentName);
 
   return space;
 }
@@ -600,15 +534,12 @@ void createInstrumentForWorkspaceWithDistances(
 
 //================================================================================================================
 WorkspaceSingleValue_sptr CreateWorkspaceSingleValue(double value) {
-  WorkspaceSingleValue_sptr retVal(
-      new WorkspaceSingleValue(value, sqrt(value)));
-  return retVal;
+  return boost::make_shared<WorkspaceSingleValue>(value, sqrt(value));
 }
 
 WorkspaceSingleValue_sptr CreateWorkspaceSingleValueWithError(double value,
                                                               double error) {
-  WorkspaceSingleValue_sptr retVal(new WorkspaceSingleValue(value, error));
-  return retVal;
+  return boost::make_shared<WorkspaceSingleValue>(value, error);
 }
 
 /** Perform some finalization on event workspace stuff */
@@ -657,7 +588,7 @@ CreateEventWorkspaceWithStartTime(int numPixels, int numBins, int numEvents,
   // add one to the number of bins as this is histogram
   numBins++;
 
-  EventWorkspace_sptr retVal(new EventWorkspace);
+  auto retVal = boost::make_shared<EventWorkspace>();
   retVal->initialize(numPixels, 1, 1);
 
   // Make fake events
@@ -712,7 +643,7 @@ EventWorkspace_sptr
 CreateGroupedEventWorkspace(std::vector<std::vector<int>> groups, int numBins,
                             double binDelta) {
 
-  EventWorkspace_sptr retVal(new EventWorkspace);
+  auto retVal = boost::make_shared<EventWorkspace>();
   retVal->initialize(1, 2, 1);
 
   for (size_t g = 0; g < groups.size(); g++) {
@@ -749,7 +680,7 @@ CreateGroupedEventWorkspace(std::vector<std::vector<int>> groups, int numBins,
  */
 EventWorkspace_sptr CreateRandomEventWorkspace(size_t numbins, size_t numpixels,
                                                double bin_delta) {
-  EventWorkspace_sptr retVal(new EventWorkspace);
+  auto retVal = boost::make_shared<EventWorkspace>();
   retVal->initialize(numpixels, numbins, numbins - 1);
 
   // and X-axis for references:
@@ -1235,7 +1166,7 @@ RebinnedOutput_sptr CreateRebinnedOutputWorkspace() {
 
 Mantid::DataObjects::PeaksWorkspace_sptr
 createPeaksWorkspace(const int numPeaks, const bool createOrientedLattice) {
-  PeaksWorkspace_sptr peaksWS(new PeaksWorkspace());
+  auto peaksWS = boost::make_shared<PeaksWorkspace>();
   Instrument_sptr inst =
       ComponentCreationHelper::createTestInstrumentRectangular2(1, 10);
   peaksWS->setInstrument(inst);
diff --git a/Framework/UserAlgorithms/CMakeLists.txt b/Framework/UserAlgorithms/CMakeLists.txt
deleted file mode 100644
index b9fd1beb1b27725d0b2ba92809328dfcd8aeac7e..0000000000000000000000000000000000000000
--- a/Framework/UserAlgorithms/CMakeLists.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-set ( SRC_FILES HelloWorldAlgorithm.cpp
-                LorentzianTest.cpp
-		Muon_ExpDecayOscTest.cpp
-                ModifyData.cpp
-                PropertyAlgorithm.cpp
-                WorkspaceAlgorithm.cpp
-)
-
-set ( SRC_UNITY_IGNORE_FILES )
-
-set ( INC_FILES HelloWorldAlgorithm.h
-                LorentzianTest.h
-		Muon_ExpDecayOscTest.h
-                ModifyData.h
-                PropertyAlgorithm.h
-                WorkspaceAlgorithm.h
-)
-
-if (COVERALLS)
-    foreach( loop_var ${SRC_FILES} ${INC_FILES})
-      set_property(GLOBAL APPEND PROPERTY COVERAGE_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/${loop_var}")
-    endforeach(loop_var)
-endif()
-
-if(UNITY_BUILD)
-  include(UnityBuild)
-  enable_unity_build(UserAlgorithms SRC_FILES SRC_UNITY_IGNORE_FILES 10)
-endif(UNITY_BUILD)
-
-# Add the target for this directory
-add_library ( UserAlgorithms EXCLUDE_FROM_ALL ${SRC_FILES} ${INC_FILES})
-
-# Add to the 'Framework' group in VS
-set_property ( TARGET UserAlgorithms PROPERTY FOLDER "MantidFramework" )
-
-target_link_libraries ( UserAlgorithms LINK_PRIVATE ${TCMALLOC_LIBRARIES_LINKTIME} ${MANTIDLIBS} )
diff --git a/Framework/UserAlgorithms/SConstruct b/Framework/UserAlgorithms/SConstruct
deleted file mode 100644
index f8338933ecad03ef230e795d470c17c22581e08e..0000000000000000000000000000000000000000
--- a/Framework/UserAlgorithms/SConstruct
+++ /dev/null
@@ -1,59 +0,0 @@
-""" Builds a set of user-defined algorithms.
-
-    The name of the library will be the same as the directory that the
-    build is executed from, i.e. the stem returned from the current
-    working directory
-"""
-import os
-import platform
-
-# Must be the same version that Mantid uses
-MSVC_VERSION=14.0
-
-include_dir = '../include'
-install_dir = '../plugins'
-link_flags = ['/OPT:REF','/OPT:ICF','/ltcg']
-target_arch=None
-if platform.architecture()[0] == '64bit':
-    target_arch="x86_64"
-    link_flags.append('/MACHINE:X64')
-else:
-    target_arch="x86"
-
-env = Environment(ENV=os.environ,
-                  MSVC_VERSION=str(MSVC_VERSION),
-                  TARGET_ARCH=target_arch,
-                  CPPPATH = include_dir, 
-                  PATH = '.', 
-                  LIBS = [
-                           'MantidKernel',
-                           'MantidAPI',
-                           'MantidGeometry',
-                           'MantidDataObjects',
-                           'MantidCurveFitting',
-                           'boost_date_time-mt'
-                         ], 
-                  LINKFLAGS = link_flags,
-                  CCFLAGS = ['/nologo','/Ox', '/Ot','/GL', '/W3','/EHsc', '/MD', '/TP','/wd4251', '/wd4275', '/wd4996'],
-                  CPPDEFINES = ['NDEBUG', '_SCL_SECURE_NO_WARNINGS', '_CRT_SECURE_NO_WARNINGS', '_CRT_SECURE_NO_DEPRECATE',\
-                                '_CRT_NONSTDC_NO_DEPRECATE', '_SCL_SECURE_NO_DEPRECATE', ('MS_VISUAL_STUDIO','1'),\
-                                ('WINVER','0x0500'), 'BOOST_ALL_DYN_LINK', 'BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG',\
-                                'BOOST_ALL_NO_LIB','NOMINMAX','_USE_MATH_DEFINES', 'WNT','WIN32','_WINDOWS', 'POCO_DLL',\
-                                'GSL_DLL']
-                  )
-# Check whether we should include the OpenMP flag
-conf = Configure(env)
-if conf.CheckLib('vcomp'):
-    env.Append(CCFLAGS=['/openmp'])
-
-# The output library name will be the same as the directory that the build is run from
-cwd = os.getcwd()
-lib_name = os.path.basename(os.getcwd()) 
-
-# Compile all .cpp files on the current path
-sources = Glob('*.cpp')
-shared = env.SharedLibrary(lib_name, sources)
-
-# Install to the destination directory
-env.Install(install_dir,shared)
-env.Alias('install',install_dir)
diff --git a/Framework/UserAlgorithms/build.bat b/Framework/UserAlgorithms/build.bat
deleted file mode 100644
index 88026260cb874f88115136ae8311055fdc9c79b3..0000000000000000000000000000000000000000
--- a/Framework/UserAlgorithms/build.bat
+++ /dev/null
@@ -1,37 +0,0 @@
-@echo off
-setlocal
-
-REM %1 can be an optional --quiet argument that means the script does not 
-REM pause at the end. This ensures that if the argument is not --quiet
-REM it is passed on to scons
-if "%1" == "--quiet" (
-  set ONE=""
-) else (
-  set ONE=%1
-)
-
-REM Save where we started
-set OLDPWD=%CD%
-REM Go to directory of this script
-cd %~dp0
-
-REM Build the code
-python ../scons-local/scons.py %ONE% %2 %3 %4 %5 %6 %7 %8 %9
-if errorlevel 1 goto end
-
-REM Install libraries
-python ../scons-local/scons.py install %ONE% %2 %3 %4 %5 %6 %7 %8 %9
-
-
-:end
-REM Save error level from being overwritten
-set ERR=%errorlevel%
-REM Make sure we are back where we started
-cd %OLDPWD%
-REM quiet allows scripts to avoid the asking for input to close the window
-if "%1" == "--quiet" (
-  exit /b %ERR%
-) else (
-  pause
-)
-
diff --git a/Framework/UserAlgorithms/build.sh b/Framework/UserAlgorithms/build.sh
deleted file mode 100755
index 37fad9e94b2dd450affcd0c0962fb0668797c849..0000000000000000000000000000000000000000
--- a/Framework/UserAlgorithms/build.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-# 
-# Builds the example algorithms shared library for those not using scons
-#
-g++ -fPIC -c -I ../API/inc -I ../Kernel/inc -I ../Geometry/inc -I ../DataObjects/inc -I ../../Third_Party/include *.cpp
-g++ -shared -o libUsersAlgorithms.so *.o
-mv libUsersAlgorithms.so ../Bin/Plugins/
-rm -f *.o
diff --git a/Framework/UserAlgorithms/createAlg.py b/Framework/UserAlgorithms/createAlg.py
deleted file mode 100644
index 3a5b550daa0df0af2091949f6692193d59162dcd..0000000000000000000000000000000000000000
--- a/Framework/UserAlgorithms/createAlg.py
+++ /dev/null
@@ -1,80 +0,0 @@
-#####################################################################################
-#                                                                                   #
-# This is a simple script to create header (.h) and source (.cpp) stubs for a new   #
-# algorithm for use in Mantid.                                                      #
-#                                                                                   #
-# Usage: python createAlg.py [AlgorithmName] [Category (optional)]                  #
-#                                                                                   #
-# Author: Russell Taylor, Tessella Support Services plc, 12/09/2008                 #
-#####################################################################################
-
-import sys
-import string
-
-args = len(sys.argv)
-if args == 1:
-    print "\nMissing arguments"
-    sys.exit("Usage: python createAlg.py [AlgorithmName] [Category (optional)]\n")
-
-name = sys.argv[1]
-if args > 2:
-  cat = sys.argv[2]
-else:
-  cat = "UserAlgorithms"
-
-hfilename = name + ".h"
-cppfilename = name + ".cpp"
-
-h = open(hfilename, "w")
-h.write("#ifndef " + string.upper(name) + "_H_\n"
-        "#define " + string.upper(name) + "_H_\n\n"
-        "#include \"MantidAPI/Algorithm.h\"\n\n"
-        "class " + name + " : public Mantid::API::Algorithm\n"
-        "{\n"
-        "public:\n"
-        "  /// (Empty) Constructor\n"
-        "  " + name + "() : Mantid::API::Algorithm() {}\n"
-        "  /// Virtual destructor\n"
-        "  virtual ~" + name +"() {}\n"
-        "  /// Algorithm's name\n"
-        "  virtual const std::string name() const { return \"" + name + "\"; }\n"
-        "  /// Algorithm's version\n"
-        "  virtual int version() const { return (1); }\n"
-        "  /// Algorithm's category for identification\n"
-        "  virtual const std::string category() const { return \"" + cat + "\"; }\n\n"
-        "private:\n"
-        "  /// Initialisation code\n"
-        "  void init();\n"
-        "  ///Execution code\n"
-        "  void exec();\n\n"
-        "};\n\n"
-        "#endif /*" + string.upper(name) + "_H_*/\n"
-        )
-h.close()
-
-c = open(cppfilename, "w")
-c.write("#include \"" + hfilename + "\"\n\n"
-        "// Register the algorithm into the AlgorithmFactory\n"
-        "DECLARE_ALGORITHM(" + name + ")\n\n"
-        "using namespace Mantid::Kernel;\n"
-        "using namespace Mantid::API;\n"
-        "using namespace Mantid::Geometry;\n\n"
-        "// A reference to the logger is provided by the base class, it is called g_log.\n"
-        "// It is used to print out information, warning and error messages\n\n"
-        "void " + name + "::init()\n{\n"
-        "  // Put your initialisation code (e.g. declaring properties) here...\n\n"
-        "  // Virtually all algorithms will want an input and an output workspace as properties.\n"
-        "  // Here are the lines for this, so just uncomment them:\n"
-        "  //   declareProperty(new WorkspaceProperty<>(\"InputWorkspace\",\"\",Direction::Input));\n"
-        "  //   declareProperty(new WorkspaceProperty<>(\"OutputWorkspace\",\"\",Direction::Output));\n\n"
-        "}\n\n"
-        "void " + name + "::exec()\n{\n"
-        "  // Put the algorithm execution code here... \n\n"
-        "  // The first thing to do will almost certainly be to retrieve the input workspace.\n"
-        "  // Here's the line for that - just uncomment it:\n"
-        "  //   MatrixWorkspace_sptr inputWorkspace = getProperty(\"InputWorkspace\");\n\n"
-        "}\n\n"
-        )
-c.close()
-
-print "\nSuccessfully created " + hfilename + " & " + cppfilename + " files.\n"
diff --git a/Framework/WorkflowAlgorithms/src/AlignAndFocusPowder.cpp b/Framework/WorkflowAlgorithms/src/AlignAndFocusPowder.cpp
index aecaeee4aa4d25535c199874c2a60a13aaa6932f..86d6523947eda1f56554428400893f656251ed5c 100644
--- a/Framework/WorkflowAlgorithms/src/AlignAndFocusPowder.cpp
+++ b/Framework/WorkflowAlgorithms/src/AlignAndFocusPowder.cpp
@@ -170,32 +170,35 @@ void AlignAndFocusPowder::init() {
   declareProperty("ReductionProperties", "__powdereduction", Direction::Input);
 }
 
+template <typename NumT> struct RegLowVectorPair {
+  std::vector<NumT> reg;
+  std::vector<NumT> low;
+};
+
 template <typename NumT>
-void splitVectors(const std::vector<NumT> &orig, const size_t numVal,
-                  const std::string &label, std::vector<NumT> &left,
-                  std::vector<NumT> &right) {
-  // clear the outputs
-  left.clear();
-  right.clear();
+RegLowVectorPair<NumT> splitVectors(const std::vector<NumT> &orig,
+                                    const size_t numVal,
+                                    const std::string &label) {
+  RegLowVectorPair<NumT> out;
 
   // check that there is work to do
-  if (orig.empty())
-    return;
-
-  // do the spliting
-  if (orig.size() == numVal) {
-    left.assign(orig.begin(), orig.end());
-    right.assign(orig.begin(), orig.end());
-  } else if (orig.size() == 2 * numVal) {
-    left.assign(orig.begin(), orig.begin() + numVal);
-    right.assign(orig.begin() + numVal, orig.begin());
-  } else {
-    std::stringstream msg;
-    msg << "Input number of " << label << " ids is not equal to "
-        << "the number of histograms or empty (" << orig.size() << " != 0 or "
-        << numVal << " or " << (2 * numVal) << ")";
-    throw std::runtime_error(msg.str());
+  if (!orig.empty()) {
+    // do the spliting
+    if (orig.size() == numVal) {
+      out.reg.assign(orig.begin(), orig.end());
+      out.low.assign(orig.begin(), orig.end());
+    } else if (orig.size() == 2 * numVal) {
+      out.reg.assign(orig.begin(), orig.begin() + numVal);
+      out.low.assign(orig.begin() + numVal, orig.begin());
+    } else {
+      std::stringstream msg;
+      msg << "Input number of " << label << " ids is not equal to "
+          << "the number of histograms or empty (" << orig.size() << " != 0 or "
+          << numVal << " or " << (2 * numVal) << ")";
+      throw std::runtime_error(msg.str());
+    }
   }
+  return out;
 }
 
 //----------------------------------------------------------------------------------------------
@@ -317,29 +320,14 @@ void AlignAndFocusPowder::exec() {
 
   // Now setup the output workspace
   m_outputW = getProperty("OutputWorkspace");
-  if (m_outputW == m_inputW) {
-    if (m_inputEW) {
-      m_outputEW = boost::dynamic_pointer_cast<EventWorkspace>(m_outputW);
+  if (m_inputEW) {
+    if (m_outputW != m_inputW) {
+      m_outputEW = EventWorkspace_sptr(m_inputEW->clone().release());
     }
+    m_outputEW = boost::dynamic_pointer_cast<EventWorkspace>(m_outputW);
   } else {
-    if (m_inputEW) {
-      // Make a brand new EventWorkspace
-      m_outputEW = boost::dynamic_pointer_cast<EventWorkspace>(
-          WorkspaceFactory::Instance().create(
-              "EventWorkspace", m_inputEW->getNumberHistograms(), 2, 1));
-      // Copy geometry over.
-      WorkspaceFactory::Instance().initializeFromParent(m_inputEW, m_outputEW,
-                                                        false);
-      // You need to copy over the data as well.
-      m_outputEW->copyDataFrom((*m_inputEW));
-
-      // Cast to the matrixOutputWS and save it
-      m_outputW = boost::dynamic_pointer_cast<MatrixWorkspace>(m_outputEW);
-      // m_outputW->setName(getProperty("OutputWorkspace"));
-    } else {
-      // Not-an-event workspace
+    if (m_outputW != m_inputW) {
       m_outputW = WorkspaceFactory::Instance().create(m_inputW);
-      // m_outputW->setName(getProperty("OutputWorkspace"));
     }
   }
 
@@ -604,25 +592,18 @@ void AlignAndFocusPowder::exec() {
     size_t numreg = m_outputW->getNumberHistograms();
 
     // set up the vectors for doing everything
-    std::vector<int32_t> specidsReg;
-    std::vector<int32_t> specidsLow;
-    splitVectors(specids, numreg, "specids", specidsReg, specidsLow);
-    std::vector<double> tthsReg;
-    std::vector<double> tthsLow;
-    splitVectors(tths, numreg, "two-theta", tthsReg, tthsLow);
-    std::vector<double> l2sReg;
-    std::vector<double> l2sLow;
-    splitVectors(l2s, numreg, "L2", l2sReg, l2sLow);
-    std::vector<double> phisReg;
-    std::vector<double> phisLow;
-    splitVectors(phis, numreg, "phi", phisReg, phisLow);
+    auto specidsSplit = splitVectors(specids, numreg, "specids");
+    auto tthsSplit = splitVectors(tths, numreg, "two-theta");
+    auto l2sSplit = splitVectors(l2s, numreg, "L2");
+    auto phisSplit = splitVectors(phis, numreg, "phi");
 
     // Edit instrument
-    m_outputW = editInstrument(m_outputW, tthsReg, specidsReg, l2sReg, phisReg);
+    m_outputW = editInstrument(m_outputW, tthsSplit.reg, specidsSplit.reg,
+                               l2sSplit.reg, phisSplit.reg);
 
     if (m_processLowResTOF) {
-      m_lowResW =
-          editInstrument(m_lowResW, tthsLow, specidsLow, l2sLow, phisLow);
+      m_lowResW = editInstrument(m_lowResW, tthsSplit.low, specidsSplit.low,
+                                 l2sSplit.low, phisSplit.low);
     }
   }
   m_progress->report();
diff --git a/Framework/WorkflowAlgorithms/src/ConvolutionFitSequential.cpp b/Framework/WorkflowAlgorithms/src/ConvolutionFitSequential.cpp
index 8fb084defc31411ee134d42ec6366a48d0a00363..46cf58941a03fdd449eeab81f8f491b294c7d55a 100644
--- a/Framework/WorkflowAlgorithms/src/ConvolutionFitSequential.cpp
+++ b/Framework/WorkflowAlgorithms/src/ConvolutionFitSequential.cpp
@@ -553,7 +553,8 @@ void ConvolutionFitSequential::calculateEISF(
     // sqrtESqOverYSq = squareRoot( heightESqOverYSq )
     auto sqrtESqOverYSq = cloneVector(heightESqOverYSq);
     std::transform(sqrtESqOverYSq.begin(), sqrtESqOverYSq.end(),
-                   sqrtESqOverYSq.begin(), (double (*)(double))sqrt);
+                   sqrtESqOverYSq.begin(),
+                   static_cast<double (*)(double)>(sqrt));
     // eisfYSumRoot = eisfY * sqrtESqOverYSq
     auto eisfYSumRoot = cloneVector(eisfY);
     std::transform(eisfYSumRoot.begin(), eisfYSumRoot.end(),
diff --git a/Framework/WorkflowAlgorithms/src/EQSANSLoad.cpp b/Framework/WorkflowAlgorithms/src/EQSANSLoad.cpp
index b7d139961e745c452b7e7514fc74a2885badffa6..100ce179e0a0af2540a9385019a9c081072a56c3 100644
--- a/Framework/WorkflowAlgorithms/src/EQSANSLoad.cpp
+++ b/Framework/WorkflowAlgorithms/src/EQSANSLoad.cpp
@@ -335,10 +335,8 @@ void EQSANSLoad::moveToBeamCenter() {
   // default beam center
   if (isEmpty(m_center_x) || isEmpty(m_center_y)) {
     EQSANSInstrument::getDefaultBeamCenter(dataWS, m_center_x, m_center_y);
-    g_log.information() << "Setting beam center to ["
-                        << Poco::NumberFormatter::format(m_center_x, 1) << ", "
-                        << Poco::NumberFormatter::format(m_center_y, 1) << "]"
-                        << std::endl;
+    g_log.information() << "Setting beam center to [" << m_center_x << ", "
+                        << m_center_y << "]" << std::endl;
     return;
   }
 
@@ -380,8 +378,8 @@ void EQSANSLoad::moveToBeamCenter() {
   dataWS->mutableRun().addProperty("beam_center_x", m_center_x, "pixel", true);
   dataWS->mutableRun().addProperty("beam_center_y", m_center_y, "pixel", true);
   m_output_message += "   Beam center: " +
-                      Poco::NumberFormatter::format(m_center_x, 1) + ", " +
-                      Poco::NumberFormatter::format(m_center_y, 1) + "\n";
+                      Poco::NumberFormatter::format(m_center_x) + ", " +
+                      Poco::NumberFormatter::format(m_center_y) + "\n";
 }
 
 /// Read a config file
@@ -430,8 +428,8 @@ void EQSANSLoad::readConfigFile(const std::string &filePath) {
   dataWS->mutableRun().addProperty("high_tof_cut", m_high_TOF_cut,
                                    "microsecond", true);
   m_output_message +=
-      "   Discarding lower " + Poco::NumberFormatter::format(m_low_TOF_cut, 1) +
-      " and upper " + Poco::NumberFormatter::format(m_high_TOF_cut, 1) +
+      "   Discarding lower " + Poco::NumberFormatter::format(m_low_TOF_cut) +
+      " and upper " + Poco::NumberFormatter::format(m_high_TOF_cut) +
       " microsec\n";
 
   if (m_moderator_position != 0) {
@@ -638,7 +636,7 @@ void EQSANSLoad::exec() {
     g_log.information() << "Moving moderator to " << m_moderator_position
                         << std::endl;
     m_output_message += "   Moderator position: " +
-                        Poco::NumberFormatter::format(m_moderator_position, 3) +
+                        Poco::NumberFormatter::format(m_moderator_position) +
                         " m\n";
     mvAlg = createChildAlgorithm("MoveInstrumentComponent", 0.4, 0.45);
     mvAlg->setProperty<MatrixWorkspace_sptr>("Workspace", dataWS);
@@ -721,8 +719,8 @@ void EQSANSLoad::exec() {
                                      true);
     wl_combined_max = wl_max;
     m_output_message += "   Wavelength range: " +
-                        Poco::NumberFormatter::format(wl_min, 1) + " - " +
-                        Poco::NumberFormatter::format(wl_max, 1);
+                        Poco::NumberFormatter::format(wl_min) + " - " +
+                        Poco::NumberFormatter::format(wl_max);
     if (frame_skipping) {
       const double wl_min2 = tofAlg->getProperty("WavelengthMinFrame2");
       const double wl_max2 = tofAlg->getProperty("WavelengthMaxFrame2");
@@ -731,8 +729,8 @@ void EQSANSLoad::exec() {
                                        "Angstrom", true);
       dataWS->mutableRun().addProperty("wavelength_max_frame2", wl_max2,
                                        "Angstrom", true);
-      m_output_message += " and " + Poco::NumberFormatter::format(wl_min2, 1) +
-                          " - " + Poco::NumberFormatter::format(wl_max2, 1) +
+      m_output_message += " and " + Poco::NumberFormatter::format(wl_min2) +
+                          " - " + Poco::NumberFormatter::format(wl_max2) +
                           " Angstrom\n";
     } else
       m_output_message += " Angstrom\n";
@@ -771,9 +769,13 @@ void EQSANSLoad::exec() {
   // Rebin so all the wavelength bins are aligned
   const bool preserveEvents = getProperty("PreserveEvents");
   const double wl_step = getProperty("WavelengthStep");
-  std::string params = Poco::NumberFormatter::format(wl_min, 2) + "," +
-                       Poco::NumberFormatter::format(wl_step, 2) + "," +
-                       Poco::NumberFormatter::format(wl_combined_max, 2);
+
+  const double wl_min_rounded = round(wl_min * 100.0) / 100.0;
+  const double wl_max_rounded = round(wl_combined_max * 100.0) / 100.0;
+  std::string params = Poco::NumberFormatter::format(wl_min_rounded, 2) + "," +
+                       Poco::NumberFormatter::format(wl_step) + "," +
+                       Poco::NumberFormatter::format(wl_max_rounded, 2);
+  g_log.information() << "Rebin parameters: " << params << std::endl;
   IAlgorithm_sptr rebinAlg = createChildAlgorithm("Rebin", 0.71, 0.72);
   rebinAlg->setProperty<MatrixWorkspace_sptr>("InputWorkspace", dataWS);
   if (preserveEvents)
diff --git a/Framework/WorkflowAlgorithms/src/HFIRInstrument.cpp b/Framework/WorkflowAlgorithms/src/HFIRInstrument.cpp
index 74261359d3d011e7f3a4ea36842c3800fcfed4b2..ceb5c81114ac707157ba12462117c28b73f749e7 100644
--- a/Framework/WorkflowAlgorithms/src/HFIRInstrument.cpp
+++ b/Framework/WorkflowAlgorithms/src/HFIRInstrument.cpp
@@ -6,8 +6,8 @@
 #include "MantidKernel/Property.h"
 #include "MantidKernel/PropertyWithValue.h"
 #include "MantidDataObjects/Workspace2D.h"
+#include "MantidKernel/StringTokenizer.h"
 #include "MantidGeometry/Instrument.h"
-#include "Poco/StringTokenizer.h"
 #include "Poco/NumberParser.h"
 
 namespace Mantid {
@@ -98,8 +98,8 @@ double getSourceToSampleDistance(API::MatrixWorkspace_sptr dataWS) {
         "Unable to find [aperture-distances] instrument parameter");
 
   double SSD = 0;
-  Poco::StringTokenizer tok(pars[0], ",",
-                            Poco::StringTokenizer::TOK_IGNORE_EMPTY);
+  Mantid::Kernel::StringTokenizer tok(
+      pars[0], ",", Mantid::Kernel::StringTokenizer::TOK_IGNORE_EMPTY);
   if (tok.count() > 0 && tok.count() < 10 && nguides >= 0 && nguides < 9) {
     const std::string distance_as_string = tok[8 - nguides];
     if (!Poco::NumberParser::tryParseFloat(distance_as_string, SSD))
diff --git a/Framework/WorkflowAlgorithms/src/SANSSolidAngleCorrection.cpp b/Framework/WorkflowAlgorithms/src/SANSSolidAngleCorrection.cpp
index 7af248ef255b0758eb3bd185935fdf961de9fea2..7fb9cee5d5e04c9ee33e75f1678b973ca40486cf 100644
--- a/Framework/WorkflowAlgorithms/src/SANSSolidAngleCorrection.cpp
+++ b/Framework/WorkflowAlgorithms/src/SANSSolidAngleCorrection.cpp
@@ -171,42 +171,26 @@ void SANSSolidAngleCorrection::exec() {
 
 void SANSSolidAngleCorrection::execEvent() {
   MatrixWorkspace_sptr inputWS = getProperty("InputWorkspace");
-  EventWorkspace_sptr inputEventWS =
-      boost::dynamic_pointer_cast<EventWorkspace>(inputWS);
-
-  const int numberOfSpectra =
-      static_cast<int>(inputEventWS->getNumberHistograms());
-  Progress progress(this, 0.0, 1.0, inputEventWS->getNumberHistograms());
 
   // generate the output workspace pointer
-  MatrixWorkspace_sptr outputWS = this->getProperty("OutputWorkspace");
-  EventWorkspace_sptr outputEventWS;
-  if (outputWS == inputWS)
-    outputEventWS = boost::dynamic_pointer_cast<EventWorkspace>(outputWS);
-  else {
-    // Make a brand new EventWorkspace
-    outputEventWS = boost::dynamic_pointer_cast<EventWorkspace>(
-        WorkspaceFactory::Instance().create(
-            "EventWorkspace", inputEventWS->getNumberHistograms(), 2, 1));
-    // Copy geometry over.
-    WorkspaceFactory::Instance().initializeFromParent(inputEventWS,
-                                                      outputEventWS, false);
-    // You need to copy over the data as well.
-    outputEventWS->copyDataFrom((*inputEventWS));
-
-    // Cast to the matrixOutputWS and save it
-    outputWS = boost::dynamic_pointer_cast<MatrixWorkspace>(outputEventWS);
-    this->setProperty("OutputWorkspace", outputWS);
+  MatrixWorkspace_sptr outputWS = getProperty("OutputWorkspace");
+  if (outputWS != inputWS) {
+    outputWS = MatrixWorkspace_sptr(inputWS->clone().release());
+    setProperty("OutputWorkspace", outputWS);
   }
+  auto outputEventWS = boost::dynamic_pointer_cast<EventWorkspace>(outputWS);
 
+  const int numberOfSpectra =
+      static_cast<int>(outputEventWS->getNumberHistograms());
+  Progress progress(this, 0.0, 1.0, numberOfSpectra);
   progress.report("Solid Angle Correction");
 
-  PARALLEL_FOR2(inputEventWS, outputEventWS)
+  PARALLEL_FOR1(outputEventWS)
   for (int i = 0; i < numberOfSpectra; i++) {
     PARALLEL_START_INTERUPT_REGION
     IDetector_const_sptr det;
     try {
-      det = inputEventWS->getDetector(i);
+      det = outputEventWS->getDetector(i);
     } catch (Exception::NotFoundError &) {
       g_log.warning() << "Spectrum index " << i
                       << " has no detector assigned to it - discarding"
@@ -226,7 +210,7 @@ void SANSSolidAngleCorrection::execEvent() {
 
     // Compute solid angle correction factor
     const bool is_tube = getProperty("DetectorTubes");
-    const double tanTheta = tan(inputEventWS->detectorTwoTheta(det));
+    const double tanTheta = tan(outputEventWS->detectorTwoTheta(det));
     const double theta_term = sqrt(tanTheta * tanTheta + 1.0);
     double corr;
     if (is_tube) {
diff --git a/Framework/WorkflowAlgorithms/test/CMakeLists.txt b/Framework/WorkflowAlgorithms/test/CMakeLists.txt
index 4992d610d377a9d5274cdd14c53c1b9e787ddadc..3e9182162b1f414d60394674e474095d57224a29 100644
--- a/Framework/WorkflowAlgorithms/test/CMakeLists.txt
+++ b/Framework/WorkflowAlgorithms/test/CMakeLists.txt
@@ -7,6 +7,7 @@ if ( CXXTEST_FOUND )
   # It will go out of scope at the end of this file so doesn't need un-setting
   set ( TESTHELPER_SRCS ../../TestHelpers/src/TearDownWorld.cpp
                         ../../TestHelpers/src/ComponentCreationHelper.cpp
+                        ../../TestHelpers/src/InstrumentCreationHelper.cpp
                         ../../TestHelpers/src/WorkspaceCreationHelper.cpp )
   cxxtest_add_test ( WorkflowAlgorithmsTest ${TEST_FILES} )
   target_link_libraries ( WorkflowAlgorithmsTest LINK_PRIVATE ${TCMALLOC_LIBRARIES_LINKTIME} 
diff --git a/MantidPlot/CMakeLists.txt b/MantidPlot/CMakeLists.txt
index 964780b99c0558fc80b571f0b805e5f411b45084..c1ec766c646df90825aab89694be9a26d470477f 100644
--- a/MantidPlot/CMakeLists.txt
+++ b/MantidPlot/CMakeLists.txt
@@ -655,6 +655,7 @@ include_directories ( ${CMAKE_CURRENT_BINARY_DIR} )
 ###########################################################################
 
 qt4_add_resources ( RES_FILES ${PROJECT_SOURCE_DIR}/images/images.qrc )
+qt4_add_resources ( RES_FILES ${PROJECT_SOURCE_DIR}/images/MantidWidgets.qrc )
 qt4_add_resources ( RES_FILES ${PROJECT_SOURCE_DIR}/images//fonts/fonts.qrc )
 qt4_add_resources ( RES_FILES ${CMAKE_CURRENT_SOURCE_DIR}/icons/icons.qrc )
 qt4_add_resources ( RES_FILES ${PROJECT_SOURCE_DIR}/MantidQt/SliceViewer/icons/SliceViewerIcons.qrc )
diff --git a/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindow.cpp b/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindow.cpp
index 18c1a65a7445f0e678281cea1141365e186faedb..ad77b07274e49c3f0a076ee686934ed1559fe42b 100644
--- a/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindow.cpp
+++ b/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindow.cpp
@@ -19,6 +19,11 @@ InstrumentWindow::InstrumentWindow(const QString &wsName, const QString &label,
   this->setWidget(m_instrumentWidget);
   confirmClose(parent->confirmCloseInstrWindow);
   resize(m_instrumentWidget->size());
+
+  connect(m_instrumentWidget, SIGNAL(preDeletingHandle()), this,
+          SLOT(closeSafely()));
+  connect(m_instrumentWidget, SIGNAL(clearingHandle()), this,
+          SLOT(closeSafely()));
 }
 
 InstrumentWindow::~InstrumentWindow() {}
@@ -50,46 +55,6 @@ void InstrumentWindow::selectTab(int tab) {
   return m_instrumentWidget->selectTab(tab);
 }
 
-/**
-* Closes the window if the associated workspace is deleted.
-* @param ws_name :: Name of the deleted workspace.
-* @param workspace_ptr :: Pointer to the workspace to be deleted
-*/
-void InstrumentWindow::preDeleteHandle(
-    const std::string &ws_name,
-    const boost::shared_ptr<Workspace> workspace_ptr) {
-  if (m_instrumentWidget->hasWorkspace(ws_name)) {
-    confirmClose(false);
-    close();
-    return;
-  }
-  Mantid::API::IPeaksWorkspace_sptr pws =
-      boost::dynamic_pointer_cast<Mantid::API::IPeaksWorkspace>(workspace_ptr);
-  if (pws) {
-    m_instrumentWidget->deletePeaksWorkspace(pws);
-    return;
-  }
-}
-
-void InstrumentWindow::afterReplaceHandle(
-    const std::string &wsName, const boost::shared_ptr<Workspace> workspace) {
-  m_instrumentWidget->handleWorkspaceReplacement(wsName, workspace);
-}
-
-void InstrumentWindow::renameHandle(const std::string &oldName,
-                                    const std::string &newName) {
-  if (m_instrumentWidget->hasWorkspace(oldName)) {
-    m_instrumentWidget->renameWorkspace(newName);
-    setWindowTitle(QString("Instrument - ") +
-                   m_instrumentWidget->getWorkspaceName());
-  }
-}
-
-void InstrumentWindow::clearADSHandle() {
-  confirmClose(false);
-  close();
-}
-
 InstrumentWidgetTab *InstrumentWindow::getTab(const QString &title) const {
   return m_instrumentWidget->getTab(title);
 }
@@ -137,3 +102,8 @@ void InstrumentWindow::setScaleType(GraphOptions::ScaleType type) {
 void InstrumentWindow::setViewType(const QString &type) {
   return m_instrumentWidget->setViewType(type);
 }
+
+void InstrumentWindow::closeSafely() {
+	confirmClose(false);
+	close();
+}
diff --git a/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindow.h b/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindow.h
index 85ab64f257a2301dba38844f8510bb1d4da6f88a..9869af2a6b1ce29eaa05ee99bea50353cf25503f 100644
--- a/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindow.h
+++ b/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindow.h
@@ -47,17 +47,8 @@ public:
   void setScaleType(GraphOptions::ScaleType);
   void setViewType(const QString &);
 
-private:
-  /// ADS notification handlers
-  virtual void preDeleteHandle(
-      const std::string &ws_name,
-      const boost::shared_ptr<Mantid::API::Workspace> workspace_ptr);
-  virtual void afterReplaceHandle(
-      const std::string &wsName,
-      const boost::shared_ptr<Mantid::API::Workspace> workspace_ptr);
-  virtual void renameHandle(const std::string &oldName,
-                            const std::string &newName);
-  virtual void clearADSHandle();
+public slots:
+  void closeSafely();
 
 private:
 	MantidQt::MantidWidgets::InstrumentWidget *m_instrumentWidget;
diff --git a/MantidPlot/src/Mantid/MantidDock.cpp b/MantidPlot/src/Mantid/MantidDock.cpp
index 24235edcd92fc6c07b399214cc7d7438dc058b0b..6562fdf15e08fc5f999feeb9c273f9291594e07c 100644
--- a/MantidPlot/src/Mantid/MantidDock.cpp
+++ b/MantidPlot/src/Mantid/MantidDock.cpp
@@ -24,8 +24,6 @@
 #include <MantidQtAPI/InterfaceManager.h>
 #include <MantidQtAPI/Message.h>
 
-#include <boost/assign/list_of.hpp>
-
 #include <Poco/Path.h>
 
 #include <algorithm>
@@ -35,40 +33,40 @@ using namespace Mantid::API;
 using namespace Mantid::Kernel;
 using namespace Mantid::Geometry;
 
-namespace
-{
-  /// static logger for dock widget
-  Mantid::Kernel::Logger docklog("MantidDockWidget");
-  Mantid::Kernel::Logger treelog("MantidTreeWidget");
+namespace {
+/// static logger for dock widget
+Mantid::Kernel::Logger docklog("MantidDockWidget");
+Mantid::Kernel::Logger treelog("MantidTreeWidget");
 
-  WorkspaceIcons WORKSPACE_ICONS = WorkspaceIcons();
+WorkspaceIcons WORKSPACE_ICONS = WorkspaceIcons();
 }
 
-MantidDockWidget::MantidDockWidget(MantidUI *mui, ApplicationWindow *parent) :
-  QDockWidget(tr("Workspaces"),parent), m_mantidUI(mui), m_updateCount( 0 ),
-  m_treeUpdating(false), m_ads(Mantid::API::AnalysisDataService::Instance())
-{
-  setObjectName("exploreMantid"); // this is needed for QMainWindow::restoreState()
+MantidDockWidget::MantidDockWidget(MantidUI *mui, ApplicationWindow *parent)
+    : QDockWidget(tr("Workspaces"), parent), m_mantidUI(mui), m_updateCount(0),
+      m_treeUpdating(false),
+      m_ads(Mantid::API::AnalysisDataService::Instance()) {
+  setObjectName(
+      "exploreMantid"); // this is needed for QMainWindow::restoreState()
   setMinimumHeight(150);
   setMinimumWidth(200);
-  parent->addDockWidget( Qt::RightDockWidgetArea, this );
+  parent->addDockWidget(Qt::RightDockWidgetArea, this);
 
   m_appParent = parent;
 
   QFrame *f = new QFrame(this);
   setWidget(f);
 
-  m_tree = new MantidTreeWidget(this,m_mantidUI);
+  m_tree = new MantidTreeWidget(this, m_mantidUI);
   m_tree->setHeaderLabel("Workspaces");
 
-  FlowLayout * buttonLayout = new FlowLayout();
+  FlowLayout *buttonLayout = new FlowLayout();
   m_loadButton = new QPushButton("Load");
   m_saveButton = new QPushButton("Save");
   m_deleteButton = new QPushButton("Delete");
-  m_groupButton= new QPushButton("Group");
-  m_sortButton= new QPushButton("Sort");
+  m_groupButton = new QPushButton("Group");
+  m_sortButton = new QPushButton("Sort");
 
-  if(m_groupButton)
+  if (m_groupButton)
     m_groupButton->setEnabled(false);
   m_deleteButton->setEnabled(false);
   m_saveButton->setEnabled(false);
@@ -80,13 +78,14 @@ MantidDockWidget::MantidDockWidget(MantidUI *mui, ApplicationWindow *parent) :
   buttonLayout->addWidget(m_saveButton);
 
   m_workspaceFilter = new MantidQt::MantidWidgets::LineEditWithClear();
-  m_workspaceFilter->setPlaceholderText("Filter Workspaces");  
-  m_workspaceFilter->setToolTip("Type here to filter the workspaces");  
+  m_workspaceFilter->setPlaceholderText("Filter Workspaces");
+  m_workspaceFilter->setToolTip("Type here to filter the workspaces");
 
-  connect(m_workspaceFilter, SIGNAL(textChanged(const QString&)), this, SLOT(filterWorkspaceTree(const QString&)));
+  connect(m_workspaceFilter, SIGNAL(textChanged(const QString &)), this,
+          SLOT(filterWorkspaceTree(const QString &)));
 
-  QVBoxLayout * layout = new QVBoxLayout();
-  f->setLayout(layout); 
+  QVBoxLayout *layout = new QVBoxLayout();
+  f->setLayout(layout);
   layout->setSpacing(0);
   layout->setMargin(0);
   layout->addLayout(buttonLayout);
@@ -96,14 +95,15 @@ MantidDockWidget::MantidDockWidget(MantidUI *mui, ApplicationWindow *parent) :
   m_loadMenu = new QMenu(this);
   m_saveMenu = new QMenu(this);
 
-  QAction *loadFileAction = new QAction("File",this);
-  QAction *liveDataAction = new QAction("Live Data",this);
+  QAction *loadFileAction = new QAction("File", this);
+  QAction *liveDataAction = new QAction("Live Data", this);
   m_loadMapper = new QSignalMapper(this);
-  m_loadMapper->setMapping(liveDataAction,"StartLiveData");
-  m_loadMapper->setMapping(loadFileAction,"Load");
-  connect(liveDataAction,SIGNAL(activated()), m_loadMapper, SLOT(map()));
-  connect(loadFileAction,SIGNAL(activated()),m_loadMapper,SLOT(map()));
-  connect(m_loadMapper, SIGNAL(mapped(const QString &)), m_mantidUI, SLOT(showAlgorithmDialog(const QString&)));
+  m_loadMapper->setMapping(liveDataAction, "StartLiveData");
+  m_loadMapper->setMapping(loadFileAction, "Load");
+  connect(liveDataAction, SIGNAL(activated()), m_loadMapper, SLOT(map()));
+  connect(loadFileAction, SIGNAL(activated()), m_loadMapper, SLOT(map()));
+  connect(m_loadMapper, SIGNAL(mapped(const QString &)), m_mantidUI,
+          SLOT(showAlgorithmDialog(const QString &)));
   m_loadMenu->addAction(loadFileAction);
   m_loadMenu->addAction(liveDataAction);
   m_loadButton->setMenu(m_loadMenu);
@@ -117,56 +117,62 @@ MantidDockWidget::MantidDockWidget(MantidUI *mui, ApplicationWindow *parent) :
   createSortMenuActions();
   createWorkspaceMenuActions();
 
-  connect(m_deleteButton,SIGNAL(clicked()),this,SLOT(deleteWorkspaces()));
-  connect(m_tree,SIGNAL(itemClicked(QTreeWidgetItem*, int)),this,SLOT(clickedWorkspace(QTreeWidgetItem*, int)));
-  connect(m_tree,SIGNAL(itemSelectionChanged()),this,SLOT(workspaceSelected()));
-  connect(m_groupButton,SIGNAL(clicked()),this,SLOT(groupingButtonClick()));
+  connect(m_deleteButton, SIGNAL(clicked()), this, SLOT(deleteWorkspaces()));
+  connect(m_tree, SIGNAL(itemClicked(QTreeWidgetItem *, int)), this,
+          SLOT(clickedWorkspace(QTreeWidgetItem *, int)));
+  connect(m_tree, SIGNAL(itemSelectionChanged()), this,
+          SLOT(workspaceSelected()));
+  connect(m_groupButton, SIGNAL(clicked()), this, SLOT(groupingButtonClick()));
 
   m_tree->setContextMenuPolicy(Qt::CustomContextMenu);
-  connect(m_tree, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(popupMenu(const QPoint &)));
-
-  // call this slot directly after the signal is received. just increment the update counter
-  connect(m_mantidUI, SIGNAL(workspace_renamed(QString,QString)), this, SLOT(recordWorkspaceRename(QString,QString)),Qt::DirectConnection);
-  // call this slot directly after the signal is received. just increment the update counter
-  connect(m_mantidUI, SIGNAL(ADS_updated()), this, SLOT(incrementUpdateCount()), Qt::DirectConnection);
-  // this slot is called when the GUI thread is free. decrement the counter. do nothing until the counter == 0
-  connect(m_mantidUI, SIGNAL(ADS_updated()), this, SLOT(updateTree()), Qt::QueuedConnection);
-
-  connect(m_mantidUI, SIGNAL(workspaces_cleared()), m_tree, SLOT(clear()),Qt::QueuedConnection);
-  connect(m_tree,SIGNAL(itemSelectionChanged()),this,SLOT(treeSelectionChanged()));
-  connect(m_tree, SIGNAL(itemExpanded(QTreeWidgetItem*)), this, SLOT(populateChildData(QTreeWidgetItem*)));
+  connect(m_tree, SIGNAL(customContextMenuRequested(const QPoint &)), this,
+          SLOT(popupMenu(const QPoint &)));
+
+  // call this slot directly after the signal is received. just increment the
+  // update counter
+  connect(m_mantidUI, SIGNAL(workspace_renamed(QString, QString)), this,
+          SLOT(recordWorkspaceRename(QString, QString)), Qt::DirectConnection);
+  // call this slot directly after the signal is received. just increment the
+  // update counter
+  connect(m_mantidUI, SIGNAL(ADS_updated()), this, SLOT(incrementUpdateCount()),
+          Qt::DirectConnection);
+  // this slot is called when the GUI thread is free. decrement the counter. do
+  // nothing until the counter == 0
+  connect(m_mantidUI, SIGNAL(ADS_updated()), this, SLOT(updateTree()),
+          Qt::QueuedConnection);
+
+  connect(m_mantidUI, SIGNAL(workspaces_cleared()), m_tree, SLOT(clear()),
+          Qt::QueuedConnection);
+  connect(m_tree, SIGNAL(itemSelectionChanged()), this,
+          SLOT(treeSelectionChanged()));
+  connect(m_tree, SIGNAL(itemExpanded(QTreeWidgetItem *)), this,
+          SLOT(populateChildData(QTreeWidgetItem *)));
   m_tree->setDragEnabled(true);
 }
 
-MantidDockWidget::~MantidDockWidget()
-{
-}
+MantidDockWidget::~MantidDockWidget() {}
 
 /** Returns the name of the selected workspace
 *  (the first one if more than one is selected)
 */
-QString MantidDockWidget::getSelectedWorkspaceName() const
-{
-  QList<QTreeWidgetItem*> items = m_tree->selectedItems();
+QString MantidDockWidget::getSelectedWorkspaceName() const {
+  QList<QTreeWidgetItem *> items = m_tree->selectedItems();
   QString str("");
-  if( !items.empty() )
-  {
+  if (!items.empty()) {
     QTreeWidgetItem *item = items[0];
-    if (item) str = item->text(0);
+    if (item)
+      str = item->text(0);
   }
   return str;
 }
 
-/// Returns a pointer to the selected workspace (the first if multiple workspaces selected)
-Mantid::API::Workspace_sptr MantidDockWidget::getSelectedWorkspace() const
-{
+/// Returns a pointer to the selected workspace (the first if multiple
+/// workspaces selected)
+Mantid::API::Workspace_sptr MantidDockWidget::getSelectedWorkspace() const {
   QString workspaceName = getSelectedWorkspaceName();
-  if (m_ads.doesExist(workspaceName.toStdString()))
-  {
+  if (m_ads.doesExist(workspaceName.toStdString())) {
     return m_ads.retrieve(workspaceName.toStdString());
-  }
-  else
-  {
+  } else {
     return Mantid::API::Workspace_sptr();
   }
 }
@@ -174,76 +180,102 @@ Mantid::API::Workspace_sptr MantidDockWidget::getSelectedWorkspace() const
 /**
 * Create the action items associated with the dock
 */
-void MantidDockWidget::createWorkspaceMenuActions()
-{
-  m_showData = new QAction(tr("Show Data"),this);
-  connect(m_showData,SIGNAL(triggered()),m_mantidUI,SLOT(importWorkspace()));
+void MantidDockWidget::createWorkspaceMenuActions() {
+  m_showData = new QAction(tr("Show Data"), this);
+  connect(m_showData, SIGNAL(triggered()), m_mantidUI, SLOT(importWorkspace()));
 
-  m_showInst = new QAction(tr("Show Instrument"),this);
-  connect(m_showInst,SIGNAL(triggered()),m_mantidUI,SLOT(showMantidInstrumentSelected()));
+  m_showInst = new QAction(tr("Show Instrument"), this);
+  connect(m_showInst, SIGNAL(triggered()), m_mantidUI,
+          SLOT(showMantidInstrumentSelected()));
 
-  m_plotSpec = new QAction(tr("Plot Spectrum..."),this);
-  connect(m_plotSpec,SIGNAL(triggered()),this,SLOT(plotSpectra()));
+  m_plotSpec = new QAction(tr("Plot Spectrum..."), this);
+  connect(m_plotSpec, SIGNAL(triggered()), this, SLOT(plotSpectra()));
 
-  m_plotSpecErr = new QAction(tr("Plot Spectrum with Errors..."),this);
-  connect(m_plotSpecErr,SIGNAL(triggered()),this,SLOT(plotSpectraErr()));
+  m_plotSpecErr = new QAction(tr("Plot Spectrum with Errors..."), this);
+  connect(m_plotSpecErr, SIGNAL(triggered()), this, SLOT(plotSpectraErr()));
 
   m_colorFill = new QAction(tr("Color Fill Plot"), this);
   connect(m_colorFill, SIGNAL(triggered()), this, SLOT(drawColorFillPlot()));
 
-  m_showDetectors = new QAction(tr("Show Detectors"),this);
-  connect(m_showDetectors,SIGNAL(activated()),this,SLOT(showDetectorTable()));
+  m_showDetectors = new QAction(tr("Show Detectors"), this);
+  connect(m_showDetectors, SIGNAL(activated()), this,
+          SLOT(showDetectorTable()));
 
-  m_showBoxData = new QAction(tr("Show Box Data Table"),this);
-  connect(m_showBoxData,SIGNAL(activated()),m_mantidUI,SLOT(importBoxDataTable()));
+  m_showBoxData = new QAction(tr("Show Box Data Table"), this);
+  connect(m_showBoxData, SIGNAL(activated()), m_mantidUI,
+          SLOT(importBoxDataTable()));
 
   m_showVatesGui = new QAction(tr("Show Vates Simple Interface"), this);
-  { QIcon icon; icon.addFile(QString::fromUtf8(":/VatesSimpleGuiViewWidgets/icons/pvIcon.png"), QSize(), QIcon::Normal, QIcon::Off);
-  m_showVatesGui->setIcon(icon); }
-  connect(m_showVatesGui, SIGNAL(activated()), m_mantidUI, SLOT(showVatesSimpleInterface()));
+  {
+    QIcon icon;
+    icon.addFile(
+        QString::fromUtf8(":/VatesSimpleGuiViewWidgets/icons/pvIcon.png"),
+        QSize(), QIcon::Normal, QIcon::Off);
+    m_showVatesGui->setIcon(icon);
+  }
+  connect(m_showVatesGui, SIGNAL(activated()), m_mantidUI,
+          SLOT(showVatesSimpleInterface()));
 
   m_showMDPlot = new QAction(tr("Plot MD"), this);
   connect(m_showMDPlot, SIGNAL(activated()), m_mantidUI, SLOT(showMDPlot()));
 
   m_showListData = new QAction(tr("List Data"), this);
-  connect(m_showListData, SIGNAL(activated()), m_mantidUI, SLOT(showListData())); 
+  connect(m_showListData, SIGNAL(activated()), m_mantidUI,
+          SLOT(showListData()));
 
   m_showSpectrumViewer = new QAction(tr("Show Spectrum Viewer"), this);
-  connect(m_showSpectrumViewer, SIGNAL(activated()), m_mantidUI, SLOT(showSpectrumViewer()));
+  connect(m_showSpectrumViewer, SIGNAL(activated()), m_mantidUI,
+          SLOT(showSpectrumViewer()));
 
   m_showSliceViewer = new QAction(tr("Show Slice Viewer"), this);
-  { QIcon icon; icon.addFile(QString::fromUtf8(":/SliceViewer/icons/SliceViewerWindow_icon.png"), QSize(), QIcon::Normal, QIcon::Off);
-  m_showSliceViewer->setIcon(icon); }
-  connect(m_showSliceViewer, SIGNAL(activated()), m_mantidUI, SLOT(showSliceViewer()));
+  {
+    QIcon icon;
+    icon.addFile(
+        QString::fromUtf8(":/SliceViewer/icons/SliceViewerWindow_icon.png"),
+        QSize(), QIcon::Normal, QIcon::Off);
+    m_showSliceViewer->setIcon(icon);
+  }
+  connect(m_showSliceViewer, SIGNAL(activated()), m_mantidUI,
+          SLOT(showSliceViewer()));
 
   m_showLogs = new QAction(tr("Sample Logs..."), this);
-  connect(m_showLogs,SIGNAL(triggered()),m_mantidUI,SLOT(showLogFileWindow()));
+  connect(m_showLogs, SIGNAL(triggered()), m_mantidUI,
+          SLOT(showLogFileWindow()));
 
   m_showSampleMaterial = new QAction(tr("Sample Material..."), this);
-  connect(m_showSampleMaterial,SIGNAL(triggered()),m_mantidUI,SLOT(showSampleMaterialWindow()));
+  connect(m_showSampleMaterial, SIGNAL(triggered()), m_mantidUI,
+          SLOT(showSampleMaterialWindow()));
 
   m_showHist = new QAction(tr("Show History"), this);
-  connect(m_showHist,SIGNAL(triggered()),m_mantidUI,SLOT(showAlgorithmHistory()));
+  connect(m_showHist, SIGNAL(triggered()), m_mantidUI,
+          SLOT(showAlgorithmHistory()));
 
-  m_saveNexus = new QAction(tr("Save Nexus"),this);
-  connect(m_saveNexus,SIGNAL(activated()),m_mantidUI,SLOT(saveNexusWorkspace()));
+  m_saveNexus = new QAction(tr("Save Nexus"), this);
+  connect(m_saveNexus, SIGNAL(activated()), m_mantidUI,
+          SLOT(saveNexusWorkspace()));
 
-  m_rename = new QAction(tr("Rename"),this);
-  connect(m_rename,SIGNAL(activated()),this,SLOT(renameWorkspace()));
+  m_rename = new QAction(tr("Rename"), this);
+  connect(m_rename, SIGNAL(activated()), this, SLOT(renameWorkspace()));
 
-  m_delete = new QAction(tr("Delete"),this);
-  connect(m_delete,SIGNAL(triggered()),this,SLOT(deleteWorkspaces()));
+  m_delete = new QAction(tr("Delete"), this);
+  connect(m_delete, SIGNAL(triggered()), this, SLOT(deleteWorkspaces()));
 
-  m_showTransposed = new QAction(tr("Show Transposed"),this);
-  connect(m_showTransposed,SIGNAL(triggered()),m_mantidUI,SLOT(importTransposed()));
+  m_showTransposed = new QAction(tr("Show Transposed"), this);
+  connect(m_showTransposed, SIGNAL(triggered()), m_mantidUI,
+          SLOT(importTransposed()));
 
-  m_convertToMatrixWorkspace = new QAction(tr("Convert to MatrixWorkspace"),this);
+  m_convertToMatrixWorkspace =
+      new QAction(tr("Convert to MatrixWorkspace"), this);
   m_convertToMatrixWorkspace->setIcon(QIcon(getQPixmap("mantid_matrix_xpm")));
-  connect(m_convertToMatrixWorkspace,SIGNAL(triggered()),this,SLOT(convertToMatrixWorkspace()));
+  connect(m_convertToMatrixWorkspace, SIGNAL(triggered()), this,
+          SLOT(convertToMatrixWorkspace()));
 
-  m_convertMDHistoToMatrixWorkspace = new QAction(tr("Convert to MatrixWorkspace"),this);
-  m_convertMDHistoToMatrixWorkspace->setIcon(QIcon(getQPixmap("mantid_matrix_xpm")));
-  connect(m_convertMDHistoToMatrixWorkspace,SIGNAL(triggered()),this,SLOT(convertMDHistoToMatrixWorkspace()));
+  m_convertMDHistoToMatrixWorkspace =
+      new QAction(tr("Convert to MatrixWorkspace"), this);
+  m_convertMDHistoToMatrixWorkspace->setIcon(
+      QIcon(getQPixmap("mantid_matrix_xpm")));
+  connect(m_convertMDHistoToMatrixWorkspace, SIGNAL(triggered()), this,
+          SLOT(convertMDHistoToMatrixWorkspace()));
 
   m_clearUB = new QAction(tr("Clear UB Matrix"), this);
   connect(m_clearUB, SIGNAL(activated()), this, SLOT(clearUB()));
@@ -258,15 +290,14 @@ void MantidDockWidget::createWorkspaceMenuActions()
 /**
 * Create actions for sorting.
 */
-void MantidDockWidget::createSortMenuActions()
-{
+void MantidDockWidget::createSortMenuActions() {
   chooseByName();
   m_sortMenu = new QMenu(this);
 
-  QAction* m_ascendingSortAction = new QAction("Ascending", this);
-  QAction* m_descendingSortAction = new QAction("Descending", this);
-  QAction* m_byNameChoice = new QAction("Name", this);
-  QAction* m_byLastModifiedChoice = new QAction("Last Modified", this);
+  QAction *m_ascendingSortAction = new QAction("Ascending", this);
+  QAction *m_descendingSortAction = new QAction("Descending", this);
+  QAction *m_byNameChoice = new QAction("Name", this);
+  QAction *m_byLastModifiedChoice = new QAction("Last Modified", this);
 
   m_ascendingSortAction->setCheckable(true);
   m_ascendingSortAction->setEnabled(true);
@@ -296,10 +327,13 @@ void MantidDockWidget::createSortMenuActions()
   m_sortChoiceGroup->setExclusive(true);
   m_byNameChoice->setChecked(true);
 
-  connect(m_ascendingSortAction, SIGNAL(activated()), this, SLOT(sortAscending()));
-  connect(m_descendingSortAction, SIGNAL(activated()), this, SLOT(sortDescending()));
+  connect(m_ascendingSortAction, SIGNAL(activated()), this,
+          SLOT(sortAscending()));
+  connect(m_descendingSortAction, SIGNAL(activated()), this,
+          SLOT(sortDescending()));
   connect(m_byNameChoice, SIGNAL(activated()), this, SLOT(chooseByName()));
-  connect(m_byLastModifiedChoice, SIGNAL(activated()), this, SLOT(chooseByLastModified()));
+  connect(m_byLastModifiedChoice, SIGNAL(activated()), this,
+          SLOT(chooseByLastModified()));
 
   m_sortMenu->addActions(sortDirectionGroup->actions());
   m_sortMenu->addSeparator();
@@ -311,49 +345,44 @@ void MantidDockWidget::createSortMenuActions()
 * When an item is expanded, populate the child data for this item
 * @param item :: The item being expanded
 */
-void MantidDockWidget::populateChildData(QTreeWidgetItem* item)
-{
+void MantidDockWidget::populateChildData(QTreeWidgetItem *item) {
   QVariant userData = item->data(0, Qt::UserRole);
-  if ( userData.isNull() ) return;
+  if (userData.isNull())
+    return;
 
   // Clear it first
-  while( item->childCount() > 0 )
-  {
-    auto * widgetItem = item->takeChild(0);
+  while (item->childCount() > 0) {
+    auto *widgetItem = item->takeChild(0);
     delete widgetItem;
   }
 
   Workspace_sptr workspace = userData.value<Workspace_sptr>();
 
-  if(auto group = boost::dynamic_pointer_cast<WorkspaceGroup>(workspace))
-  {
+  if (auto group = boost::dynamic_pointer_cast<WorkspaceGroup>(workspace)) {
     const size_t nmembers = group->getNumberOfEntries();
-    for(size_t i = 0; i < nmembers; ++i)
-    {
+    for (size_t i = 0; i < nmembers; ++i) {
       auto ws = group->getItem(i);
-      auto * node = addTreeEntry(std::make_pair(ws->name(), ws), item);
+      auto *node = addTreeEntry(std::make_pair(ws->name(), ws), item);
       excludeItemFromSort(node);
-      if (shouldBeSelected(node->text(0))) node->setSelected(true);
+      if (shouldBeSelected(node->text(0)))
+        node->setSelected(true);
     }
-  }
-  else
-  {
+  } else {
     QString details;
-    try
-    {
+    try {
       details = workspace->toString().c_str();
-    }
-    catch(std::runtime_error& e)
-    {
+    } catch (std::runtime_error &e) {
       details = QString("Error: %1").arg(e.what());
     }
-    QStringList rows = details.split(QLatin1Char('\n'), QString::SkipEmptyParts);
-    rows.append(QString("Memory used: ") + workspace->getMemorySizeAsStr().c_str());
+    QStringList rows =
+        details.split(QLatin1Char('\n'), QString::SkipEmptyParts);
+    rows.append(QString("Memory used: ") +
+                workspace->getMemorySizeAsStr().c_str());
 
     auto iend = rows.constEnd();
-    for(auto itr = rows.constBegin(); itr != iend; ++itr)
-    {
-      MantidTreeWidgetItem *data = new MantidTreeWidgetItem(QStringList(*itr), m_tree);
+    for (auto itr = rows.constBegin(); itr != iend; ++itr) {
+      MantidTreeWidgetItem *data =
+          new MantidTreeWidgetItem(QStringList(*itr), m_tree);
       data->setFlags(Qt::NoItemFlags);
       excludeItemFromSort(data);
       item->addChild(data);
@@ -366,14 +395,11 @@ void MantidDockWidget::populateChildData(QTreeWidgetItem* item)
 * @param item :: A workspace tree item.
 * @param wsID :: An icon type code.
 */
-void MantidDockWidget::setItemIcon(QTreeWidgetItem *item, const std::string & wsID)
-{
-  try
-  {
+void MantidDockWidget::setItemIcon(QTreeWidgetItem *item,
+                                   const std::string &wsID) {
+  try {
     item->setIcon(0, QIcon(WORKSPACE_ICONS.getIcon(wsID)));
-  }
-  catch(std::runtime_error&)
-  {
+  } catch (std::runtime_error &) {
     docklog.warning() << "Cannot find icon for workspace ID '" << wsID << "'\n";
   }
 }
@@ -382,19 +408,17 @@ void MantidDockWidget::setItemIcon(QTreeWidgetItem *item, const std::string & ws
 * Update the workspace tree to match the current state of the ADS.
 * It is important that the workspace tree is modified only by this method.
 */
-void MantidDockWidget::updateTree()
-{
+void MantidDockWidget::updateTree() {
   // do not update until the counter is zero
-  if ( m_updateCount.deref() ) return;
+  if (m_updateCount.deref())
+    return;
 
   // find all expanded top-level entries
   QStringList expanded;
   int n = m_tree->topLevelItemCount();
-  for(int i = 0; i < n; ++i)
-  {
+  for (int i = 0; i < n; ++i) {
     auto item = m_tree->topLevelItem(i);
-    if ( item->isExpanded() )
-    {
+    if (item->isExpanded()) {
       expanded << item->text(0);
     }
   }
@@ -409,45 +433,38 @@ void MantidDockWidget::updateTree()
 }
 
 /**
-* Slot to be connected directly to ADS_updated signal. Increase m_updateCount and return.
+* Slot to be connected directly to ADS_updated signal. Increase m_updateCount
+* and return.
 */
-void MantidDockWidget::incrementUpdateCount()
-{
-  m_updateCount.ref();
-}
+void MantidDockWidget::incrementUpdateCount() { m_updateCount.ref(); }
 
 /**
-* Save the old and the new name in m_renameMap. This is needed to restore selection
+* Save the old and the new name in m_renameMap. This is needed to restore
+* selection
 *   of the renamed workspace (if it was selected before renaming).
 * @param old_name :: Old name of a renamed workspace.
 * @param new_name :: New name of a renamed workspace.
 */
-void MantidDockWidget::recordWorkspaceRename(QString old_name, QString new_name)
-{
+void MantidDockWidget::recordWorkspaceRename(QString old_name,
+                                             QString new_name) {
   // check if old_name has been recently a new name
   QList<QString> oldNames = m_renameMap.keys(old_name);
   // non-empty list of oldNames become new_name
-  if ( !oldNames.isEmpty() )
-  {
-    foreach(QString name, oldNames)
-    {
-      m_renameMap[name] = new_name;
-    }
-  }
-  else
-  {
+  if (!oldNames.isEmpty()) {
+    foreach (QString name, oldNames) { m_renameMap[name] = new_name; }
+  } else {
     // record a new rename pair
     m_renameMap[old_name] = new_name;
   }
 }
 
 /**
-* Flips the flag indicating whether a tree update is in progress. Actions such as sorting
+* Flips the flag indicating whether a tree update is in progress. Actions such
+* as sorting
 * are disabled while an update is in progress.
 * @param state The required state for the flag
 */
-void MantidDockWidget::setTreeUpdating(const bool state)
-{
+void MantidDockWidget::setTreeUpdating(const bool state) {
   m_treeUpdating = state;
 }
 
@@ -456,59 +473,61 @@ void MantidDockWidget::setTreeUpdating(const bool state)
 * @param topLevelItems The map of names to workspaces
 * @param expanded Names of items who should expanded after being populated
 */
-void MantidDockWidget::populateTopLevel(const std::map<std::string,Mantid::API::Workspace_sptr> & topLevelItems,
-                                        const QStringList & expanded)
-{
+void MantidDockWidget::populateTopLevel(
+    const std::map<std::string, Mantid::API::Workspace_sptr> &topLevelItems,
+    const QStringList &expanded) {
   // collect names of selected workspaces
   QList<QTreeWidgetItem *> selected = m_tree->selectedItems();
   m_selectedNames.clear(); // just in case
-  foreach( QTreeWidgetItem *item, selected)
-  {
+  foreach (QTreeWidgetItem *item, selected) {
     m_selectedNames << item->text(0);
   }
 
   // populate the tree from scratch
   m_tree->clear();
   auto iend = topLevelItems.end();
-  for(auto it = topLevelItems.begin(); it != iend; ++it)
-  {
+  for (auto it = topLevelItems.begin(); it != iend; ++it) {
     auto *node = addTreeEntry(*it);
     QString name = node->text(0);
-    if(expanded.contains(name)) node->setExpanded(true);
+    if (expanded.contains(name))
+      node->setExpanded(true);
     // see if item must be selected
-    if ( shouldBeSelected(name) ) node->setSelected(true);
+    if (shouldBeSelected(name))
+      node->setSelected(true);
   }
   m_selectedNames.clear();
   m_renameMap.clear();
 
-  //apply any filtering
+  // apply any filtering
   filterWorkspaceTree(m_workspaceFilter->text());
 }
 
 /**
-* Adds a node for the given named item, including a single child ID item to make each node have a expandable button
+* Adds a node for the given named item, including a single child ID item to make
+* each node have a expandable button
 * and allowing plotting to work from non-expanded items
 * @param item A name/workspace pair to add.
 * @param parent If not null then add the new items as a child of the given item
 */
-MantidTreeWidgetItem * MantidDockWidget::addTreeEntry(const std::pair<std::string,Mantid::API::Workspace_sptr> & item, QTreeWidgetItem* parent)
-{
-  MantidTreeWidgetItem *node = new MantidTreeWidgetItem(QStringList(item.first.c_str()), m_tree);
-  node->setData(0,Qt::UserRole, QVariant::fromValue(item.second));
-
-  // A a child ID item so that it becomes expandable. Using the correct ID is needed when plotting from non-expanded groups.
+MantidTreeWidgetItem *MantidDockWidget::addTreeEntry(
+    const std::pair<std::string, Mantid::API::Workspace_sptr> &item,
+    QTreeWidgetItem *parent) {
+  MantidTreeWidgetItem *node =
+      new MantidTreeWidgetItem(QStringList(item.first.c_str()), m_tree);
+  node->setData(0, Qt::UserRole, QVariant::fromValue(item.second));
+
+  // A a child ID item so that it becomes expandable. Using the correct ID is
+  // needed when plotting from non-expanded groups.
   const std::string wsID = item.second->id();
-  MantidTreeWidgetItem *idNode = new MantidTreeWidgetItem(QStringList(wsID.c_str()), m_tree);
+  MantidTreeWidgetItem *idNode =
+      new MantidTreeWidgetItem(QStringList(wsID.c_str()), m_tree);
   idNode->setFlags(Qt::NoItemFlags);
   node->addChild(idNode);
-  setItemIcon(node,wsID);
+  setItemIcon(node, wsID);
 
-  if(parent)
-  {
+  if (parent) {
     parent->addChild(node);
-  }
-  else
-  {
+  } else {
     m_tree->addTopLevelItem(node);
   }
   return node;
@@ -518,21 +537,15 @@ MantidTreeWidgetItem * MantidDockWidget::addTreeEntry(const std::pair<std::strin
 * Check if a workspace should be selected after dock update.
 * @param name :: Name of a workspace to check.
 */
-bool MantidDockWidget::shouldBeSelected(QString name) const
-{
+bool MantidDockWidget::shouldBeSelected(QString name) const {
   QStringList renamed = m_renameMap.keys(name);
-  if ( !renamed.isEmpty() )
-  {
-    foreach(QString oldName,renamed)
-    {
-      if ( m_selectedNames.contains(oldName) )
-      {
+  if (!renamed.isEmpty()) {
+    foreach (QString oldName, renamed) {
+      if (m_selectedNames.contains(oldName)) {
         return true;
       }
     }
-  }
-  else if(m_selectedNames.contains(name))
-  {
+  } else if (m_selectedNames.contains(name)) {
     return true;
   }
   return false;
@@ -543,26 +556,30 @@ bool MantidDockWidget::shouldBeSelected(QString name) const
 * @param menu :: The menu to store the items
 * @param matrixWS :: The workspace related to the menu
 */
-void MantidDockWidget::addMatrixWorkspaceMenuItems(QMenu *menu, const Mantid::API::MatrixWorkspace_const_sptr & matrixWS) const
-{
+void MantidDockWidget::addMatrixWorkspaceMenuItems(
+    QMenu *menu,
+    const Mantid::API::MatrixWorkspace_const_sptr &matrixWS) const {
   // Add all options except plot of we only have 1 value
   menu->addAction(m_showData);
   menu->addAction(m_showInst);
-  // Disable the 'show instrument' option if a workspace doesn't have an instrument attached
-  m_showInst->setEnabled( matrixWS->getInstrument() && !matrixWS->getInstrument()->getName().empty() );
+  // Disable the 'show instrument' option if a workspace doesn't have an
+  // instrument attached
+  m_showInst->setEnabled(matrixWS->getInstrument() &&
+                         !matrixWS->getInstrument()->getName().empty());
   menu->addSeparator();
   menu->addAction(m_plotSpec);
   menu->addAction(m_plotSpecErr);
 
   // Don't plot a spectrum if only one X value
-  m_plotSpec->setEnabled ( matrixWS->blocksize() > 1 );
-  m_plotSpecErr->setEnabled ( matrixWS->blocksize() > 1 );
+  m_plotSpec->setEnabled(matrixWS->blocksize() > 1);
+  m_plotSpecErr->setEnabled(matrixWS->blocksize() > 1);
 
   menu->addAction(m_showSpectrumViewer); // The 2D spectrum viewer
 
   menu->addAction(m_colorFill);
   // Show the color fill plot if you have more than one histogram
-  m_colorFill->setEnabled( ( matrixWS->axes() > 1 && matrixWS->getNumberHistograms() > 1) );
+  m_colorFill->setEnabled(
+      (matrixWS->axes() > 1 && matrixWS->getNumberHistograms() > 1));
   menu->addAction(m_showSliceViewer); // The 2D slice viewer
   menu->addSeparator();
   menu->addAction(m_showDetectors);
@@ -577,60 +594,52 @@ void MantidDockWidget::addMatrixWorkspaceMenuItems(QMenu *menu, const Mantid::AP
 * @param menu :: The menu to store the items
 * @param WS :: The workspace related to the menu
 */
-void MantidDockWidget::addMDEventWorkspaceMenuItems(QMenu *menu, const Mantid::API::IMDEventWorkspace_const_sptr & WS) const
-{
+void MantidDockWidget::addMDEventWorkspaceMenuItems(
+    QMenu *menu, const Mantid::API::IMDEventWorkspace_const_sptr &WS) const {
   Q_UNUSED(WS);
 
-  //menu->addAction(m_showBoxData); // Show MD Box data (for debugging only)
+  // menu->addAction(m_showBoxData); // Show MD Box data (for debugging only)
   menu->addAction(m_showVatesGui); // Show the Vates simple interface
-  if (!MantidQt::API::InterfaceManager::hasVatesLibraries())
-  {
+  if (!MantidQt::API::InterfaceManager::hasVatesLibraries()) {
     m_showVatesGui->setEnabled(false);
-  }
-  else
-  {
+  } else {
     std::size_t nDim = WS->getNonIntegratedDimensions().size();
     m_showVatesGui->setEnabled(nDim >= 3 && nDim < 5);
   }
   menu->addAction(m_showSliceViewer); // The 2D slice viewer
-  menu->addAction(m_showHist);  // Algorithm history
-  menu->addAction(m_showListData); // Show data in table
+  menu->addAction(m_showHist);        // Algorithm history
+  menu->addAction(m_showListData);    // Show data in table
   menu->addAction(m_showLogs);
 }
 
-void MantidDockWidget::addMDHistoWorkspaceMenuItems(QMenu *menu, const Mantid::API::IMDWorkspace_const_sptr &WS) const
-{
+void MantidDockWidget::addMDHistoWorkspaceMenuItems(
+    QMenu *menu, const Mantid::API::IMDWorkspace_const_sptr &WS) const {
   Q_UNUSED(WS);
-  menu->addAction(m_showHist); // Algorithm history
+  menu->addAction(m_showHist);     // Algorithm history
   menu->addAction(m_showVatesGui); // Show the Vates simple interface
-  if (!MantidQt::API::InterfaceManager::hasVatesLibraries())
-  {
+  if (!MantidQt::API::InterfaceManager::hasVatesLibraries()) {
     m_showVatesGui->setEnabled(false);
-  }
-  else
-  {
+  } else {
     std::size_t nDim = WS->getNonIntegratedDimensions().size();
     m_showVatesGui->setEnabled(nDim >= 3 && nDim < 5);
   }
   menu->addAction(m_showSliceViewer); // The 2D slice viewer
-  menu->addAction(m_showMDPlot); // A plot of intensity vs bins
-  menu->addAction(m_showListData); // Show data in table
+  menu->addAction(m_showMDPlot);      // A plot of intensity vs bins
+  menu->addAction(m_showListData);    // Show data in table
   menu->addAction(m_convertMDHistoToMatrixWorkspace);
   menu->addAction(m_showLogs);
 }
 
-
 /** Add the actions that are appropriate for a PeaksWorkspace
 * @param menu :: The menu to store the items
 * @param WS :: The workspace related to the menu
 */
-void MantidDockWidget::addPeaksWorkspaceMenuItems(QMenu *menu, const Mantid::API::IPeaksWorkspace_const_sptr &WS) const
-{
+void MantidDockWidget::addPeaksWorkspaceMenuItems(
+    QMenu *menu, const Mantid::API::IPeaksWorkspace_const_sptr &WS) const {
   Q_UNUSED(WS);
   menu->addAction(m_showData);
   menu->addAction(m_showVatesGui); // Show the Vates simple interface
-  if (!MantidQt::API::InterfaceManager::hasVatesLibraries())
-  {
+  if (!MantidQt::API::InterfaceManager::hasVatesLibraries()) {
     m_showVatesGui->setEnabled(false);
   }
   menu->addSeparator();
@@ -676,8 +685,7 @@ void MantidDockWidget::addWorkspaceGroupMenuItems(
 * Add the actions that are appropriate for a MatrixWorkspace
 * @param menu :: The menu to store the items
 */
-void MantidDockWidget::addTableWorkspaceMenuItems(QMenu * menu) const
-{
+void MantidDockWidget::addTableWorkspaceMenuItems(QMenu *menu) const {
   menu->addAction(m_showData);
   menu->addAction(m_showTransposed);
   menu->addAction(m_showHist);
@@ -690,11 +698,10 @@ void MantidDockWidget::addTableWorkspaceMenuItems(QMenu * menu) const
 * @param menu : Parent menu.
 * @param wsName : Name of the selected workspace.
 */
-void MantidDockWidget::addClearMenuItems(QMenu* menu, const QString& wsName)
-{
-  QMenu* clearMenu = new QMenu(tr("Clear Options"), this);
+void MantidDockWidget::addClearMenuItems(QMenu *menu, const QString &wsName) {
+  QMenu *clearMenu = new QMenu(tr("Clear Options"), this);
 
-  m_clearUB->setEnabled( m_mantidUI->hasUB(wsName) );
+  m_clearUB->setEnabled(m_mantidUI->hasUB(wsName));
 
   clearMenu->addAction(m_clearUB);
   menu->addMenu(clearMenu);
@@ -704,92 +711,73 @@ void MantidDockWidget::addClearMenuItems(QMenu* menu, const QString& wsName)
 * Filter workspaces based on the string provided
 * @param text : the string to filter on.
 */
-void MantidDockWidget::filterWorkspaceTree(const QString &text)
-{
+void MantidDockWidget::filterWorkspaceTree(const QString &text) {
   const QString filterText = text.stripWhiteSpace();
-  QRegExp filterRegEx (filterText,false);
+  QRegExp filterRegEx(filterText, false);
 
-
-
-  //show all items
+  // show all items
   QTreeWidgetItemIterator it(m_tree);
-  while (*it) 
-  {
+  while (*it) {
     (*it)->setHidden(false);
     ++it;
   }
 
   int hiddenCount = 0;
-  QList<QTreeWidgetItem*> visibleGroups;
-  if (!filterText.isEmpty())
-  {
-
+  QList<QTreeWidgetItem *> visibleGroups;
+  if (!filterText.isEmpty()) {
 
-    //Loop over everything (currently loaded) and top level
-    //find out what is already expanded
+    // Loop over everything (currently loaded) and top level
+    // find out what is already expanded
     QStringList expanded;
     int n = m_tree->topLevelItemCount();
-    for(int i = 0; i < n; ++i)
-    {
+    for (int i = 0; i < n; ++i) {
       auto item = m_tree->topLevelItem(i);
-      if ( item->isExpanded() )
-      {
+      if (item->isExpanded()) {
         expanded << item->text(0);
-      }
-      else  
-      {
-        //expand everything that is at the top level (as we lazy load this is required)
+      } else {
+        // expand everything that is at the top level (as we lazy load this is
+        // required)
         item->setExpanded(true);
       }
     }
 
-    //filter based on the string
-    QTreeWidgetItemIterator it(m_tree,QTreeWidgetItemIterator::All);
-    while (*it) 
-    {
+    // filter based on the string
+    QTreeWidgetItemIterator it(m_tree, QTreeWidgetItemIterator::All);
+    while (*it) {
       QTreeWidgetItem *item = (*it);
       QVariant userData = item->data(0, Qt::UserRole);
 
-      if (!userData.isNull() ) 
-      {
+      if (!userData.isNull()) {
         Workspace_sptr workspace = userData.value<Workspace_sptr>();
-        if (workspace)
-        {
-          //I am a workspace
-          if (item->text(0).contains(filterRegEx))
-          {
-            //my name does match the filter
-            if(auto group = boost::dynamic_pointer_cast<WorkspaceGroup>(workspace))
-            {
-              //I am a group, I will want my children to be visible
-              //but I cannot do that until this iterator has finished
-              //store this pointer in a list for processing later
+        if (workspace) {
+          // I am a workspace
+          if (item->text(0).contains(filterRegEx)) {
+            // my name does match the filter
+            if (auto group =
+                    boost::dynamic_pointer_cast<WorkspaceGroup>(workspace)) {
+              // I am a group, I will want my children to be visible
+              // but I cannot do that until this iterator has finished
+              // store this pointer in a list for processing later
               visibleGroups.append(item);
               item->setHidden(false);
             }
 
-            if (item->parent() == NULL)
-            {
+            if (item->parent() == NULL) {
               // No parent, I am a top level workspace - show me
               item->setHidden(false);
-            }
-            else
-            {
+            } else {
               // I am a child workspace of a group
               // I match, so I want my parent to remain visible as well.
               item->setHidden(false);
-              if (item->parent()->isHidden())
-              {
-                //I was previously hidden, show me and set to be expanded
+              if (item->parent()->isHidden()) {
+                // I was previously hidden, show me and set to be expanded
                 --hiddenCount;
                 item->parent()->setHidden(false);
                 expanded << item->parent()->text(0);
               }
             }
-          }
-          else
-          {
-            //my name does not match the filter - hide me
+          } else {
+            // my name does not match the filter - hide me
             item->setHidden(true);
             ++hiddenCount;
           }
@@ -798,66 +786,56 @@ void MantidDockWidget::filterWorkspaceTree(const QString &text)
       ++it;
     }
 
-    //make children of visible groups visible
-    for (auto itGroup = visibleGroups.begin(); itGroup != visibleGroups.end(); ++itGroup)
-    {
-      QTreeWidgetItem *group = (*itGroup);  
-      for (int i = 0; i < group->childCount(); i++)
-      {
-        QTreeWidgetItem *child = group->child(i); 
-        if (child->isHidden())
-        {
-          //I was previously hidden, show me
+    // make children of visible groups visible
+    for (auto itGroup = visibleGroups.begin(); itGroup != visibleGroups.end();
+         ++itGroup) {
+      QTreeWidgetItem *group = (*itGroup);
+      for (int i = 0; i < group->childCount(); i++) {
+        QTreeWidgetItem *child = group->child(i);
+        if (child->isHidden()) {
+          // I was previously hidden, show me
           --hiddenCount;
           child->setHidden(false);
         }
       }
     }
 
-    //set the expanded state
-    for(int i = 0; i < n; ++i)
-    {
+    // set the expanded state
+    for (int i = 0; i < n; ++i) {
       auto item = m_tree->topLevelItem(i);
       item->setExpanded(expanded.contains(item->text(0)));
     }
-
   }
 
-  //display a message if items are hidden
-  if (hiddenCount > 0)
-  {
-    QString headerString = QString("Workspaces (%1 filtered)").arg(QString::number(hiddenCount));
-    m_tree->headerItem()->setText(0,headerString);
-  }
-  else
-  {
-    m_tree->headerItem()->setText(0,"Workspaces");
+  // display a message if items are hidden
+  if (hiddenCount > 0) {
+    QString headerString =
+        QString("Workspaces (%1 filtered)").arg(QString::number(hiddenCount));
+    m_tree->headerItem()->setText(0, headerString);
+  } else {
+    m_tree->headerItem()->setText(0, "Workspaces");
   }
 }
 
-
-void MantidDockWidget::clickedWorkspace(QTreeWidgetItem* item, int)
-{
+void MantidDockWidget::clickedWorkspace(QTreeWidgetItem *item, int) {
   Q_UNUSED(item);
 }
 
-void MantidDockWidget::workspaceSelected()
-{ 
-  QList<QTreeWidgetItem*> selectedItems=m_tree->selectedItems();
-  if(selectedItems.isEmpty()) return;
+void MantidDockWidget::workspaceSelected() {
+  QList<QTreeWidgetItem *> selectedItems = m_tree->selectedItems();
+  if (selectedItems.isEmpty())
+    return;
 
   // If there are multiple workspaces selected group and save as Nexus
-  if(selectedItems.length() > 1)
-  {
+  if (selectedItems.length() > 1) {
     connect(m_saveButton, SIGNAL(clicked()), this, SLOT(saveWorkspaceGroup()));
 
     // Don't display as a group
     m_saveButton->setMenu(NULL);
-  }
-  else
-  {
+  } else {
     // Don't run the save group function when clicked
-    disconnect(m_saveButton, SIGNAL(clicked()), this, SLOT(saveWorkspaceGroup()));
+    disconnect(m_saveButton, SIGNAL(clicked()), this,
+               SLOT(saveWorkspaceGroup()));
 
     // Remove all existing save algorithms from list
     m_saveMenu->clear();
@@ -871,9 +849,8 @@ void MantidDockWidget::workspaceSelected()
     m_saveButton->setMenu(m_saveMenu);
   }
 
-  QString wsName=selectedItems[0]->text(0);
-  if(m_ads.doesExist(wsName.toStdString()))
-  {
+  QString wsName = selectedItems[0]->text(0);
+  if (m_ads.doesExist(wsName.toStdString())) {
     m_mantidUI->enableSaveNexus(wsName);
   }
 }
@@ -881,13 +858,14 @@ void MantidDockWidget::workspaceSelected()
 /**
  * Adds an algorithm to the save menu.
  *
- * @param algorithmString Algorithm string in format ALGO_NAME.VERSION or ALGO_NAME
+ * @param algorithmString Algorithm string in format ALGO_NAME.VERSION or
+ * ALGO_NAME
  * @param menuEntryName Text to be shown in menu
  */
-void MantidDockWidget::addSaveMenuOption(QString algorithmString, QString menuEntryName)
-{
+void MantidDockWidget::addSaveMenuOption(QString algorithmString,
+                                         QString menuEntryName) {
   // Default to algo string if no entry name given
-  if(menuEntryName.isEmpty())
+  if (menuEntryName.isEmpty())
     menuEntryName = algorithmString;
 
   // Create the action and add data
@@ -895,7 +873,8 @@ void MantidDockWidget::addSaveMenuOption(QString algorithmString, QString menuEn
   saveAction->setData(QVariant(algorithmString));
 
   // Connect the tigger slot to show algorithm dialog
-  connect(saveAction, SIGNAL(triggered()), this, SLOT(handleShowSaveAlgorithm()));
+  connect(saveAction, SIGNAL(triggered()), this,
+          SLOT(handleShowSaveAlgorithm()));
 
   // Add it to the menu
   m_saveMenu->addAction(saveAction);
@@ -904,10 +883,9 @@ void MantidDockWidget::addSaveMenuOption(QString algorithmString, QString menuEn
 /**
  * Save all selected workspaces
  */
-void MantidDockWidget::saveWorkspaceGroup()
-{
-  QList<QTreeWidgetItem*> items = m_tree->selectedItems();
-  if(items.size() < 2)
+void MantidDockWidget::saveWorkspaceGroup() {
+  QList<QTreeWidgetItem *> items = m_tree->selectedItems();
+  if (items.size() < 2)
     return;
 
   m_saveFolderDialog->setWindowTitle("Select save folder");
@@ -916,33 +894,30 @@ void MantidDockWidget::saveWorkspaceGroup()
 }
 
 /**
- * Handler for the directory browser being closed when selecting save on multiple workspaces
+ * Handler for the directory browser being closed when selecting save on
+ * multiple workspaces
  *
  * @param folder Path to folder to save workspaces in
  */
-void MantidDockWidget::saveWorkspacesToFolder(const QString &folder)
-{
-  QList<QTreeWidgetItem*> items = m_tree->selectedItems();
+void MantidDockWidget::saveWorkspacesToFolder(const QString &folder) {
+  QList<QTreeWidgetItem *> items = m_tree->selectedItems();
 
   // Loop through multiple items selected from the mantid tree
-  QList<QTreeWidgetItem*>::iterator itr=items.begin();
-  for (itr = items.begin(); itr != items.end(); ++itr)
-  {
+  QList<QTreeWidgetItem *>::iterator itr = items.begin();
+  for (itr = items.begin(); itr != items.end(); ++itr) {
     QString workspaceName = (*itr)->text(0);
     QString filename = folder + "/" + workspaceName + ".nxs";
 
     IAlgorithm_sptr saveAlg = AlgorithmManager::Instance().create("SaveNexus");
     saveAlg->initialize();
-    try
-    {
+    try {
       saveAlg->setProperty("InputWorkspace", workspaceName.toStdString());
       saveAlg->setProperty("Filename", filename.toStdString());
       saveAlg->execute();
-    }
-    catch(std::runtime_error &rte)
-    {
-      docklog.error() << "Error saving workspace " << workspaceName.toStdString()
-        << ": " << rte.what() << std::endl;
+    } catch (std::runtime_error &rte) {
+      docklog.error() << "Error saving workspace "
+                      << workspaceName.toStdString() << ": " << rte.what()
+                      << std::endl;
     }
   }
 }
@@ -954,35 +929,31 @@ void MantidDockWidget::saveWorkspacesToFolder(const QString &folder)
  * in the form ALGORITHM_NAME.VERSION or just ALGORITHM_NAME to use the
  * most recent version.
  */
-void MantidDockWidget::handleShowSaveAlgorithm()
-{
+void MantidDockWidget::handleShowSaveAlgorithm() {
   QAction *sendingAction = dynamic_cast<QAction *>(sender());
 
-  if(sendingAction)
-  {
+  if (sendingAction) {
     QString wsName = getSelectedWorkspaceName();
     QVariant data = sendingAction->data();
 
-    if(data.canConvert<QString>())
-    {
+    if (data.canConvert<QString>()) {
       QString algorithmName;
       int version = -1;
 
       QStringList splitData = data.toString().split(".");
-      switch(splitData.length())
-      {
-        case 2:
-          version = splitData[1].toInt();
-        case 1:
-          algorithmName = splitData[0];
-          break;
-        default:
-          m_mantidUI->saveNexusWorkspace();
-          return;
+      switch (splitData.length()) {
+      case 2:
+        version = splitData[1].toInt();
+      case 1:
+        algorithmName = splitData[0];
+        break;
+      default:
+        m_mantidUI->saveNexusWorkspace();
+        return;
       }
 
-      QHash<QString,QString> presets;
-      if(!wsName.isEmpty())
+      QHash<QString, QString> presets;
+      if (!wsName.isEmpty())
         presets["InputWorkspace"] = wsName;
 
       m_mantidUI->showAlgorithmDialog(algorithmName, presets, NULL, version);
@@ -990,98 +961,92 @@ void MantidDockWidget::handleShowSaveAlgorithm()
     }
   }
 
-  // If we can't get the type of algorithm this should be we can always fall back on Nexus
+  // If we can't get the type of algorithm this should be we can always fall
+  // back on Nexus
   m_mantidUI->saveNexusWorkspace();
 }
 
 /**
 deleteWorkspaces
 */
-void MantidDockWidget::deleteWorkspaces()
-{
-  QList<QTreeWidgetItem*> items = m_tree->selectedItems();
-  MantidMatrix* m = dynamic_cast<MantidMatrix*>(m_mantidUI->appWindow()->activeWindow());
-   
+void MantidDockWidget::deleteWorkspaces() {
+  QList<QTreeWidgetItem *> items = m_tree->selectedItems();
+  MantidMatrix *m =
+      dynamic_cast<MantidMatrix *>(m_mantidUI->appWindow()->activeWindow());
+
   bool deleteExplorer = false;
   bool deleteActive = false;
 
-  if((m_deleteButton->hasFocus() || m_tree->hasFocus()) && !items.empty())
-  {
+  if ((m_deleteButton->hasFocus() || m_tree->hasFocus()) && !items.empty()) {
     deleteExplorer = true;
   }
-  if((m && m->isA("MantidMatrix")) && (!m->workspaceName().isEmpty() && m_ads.doesExist(m->workspaceName().toStdString())))
-  {
+  if ((m && m->isA("MantidMatrix")) &&
+      (!m->workspaceName().isEmpty() &&
+       m_ads.doesExist(m->workspaceName().toStdString()))) {
     deleteActive = true;
   }
 
-  if(deleteActive || deleteExplorer)
-  {    
+  if (deleteActive || deleteExplorer) {
     QMessageBox::StandardButton reply;
-    
-    if(m_appParent->isDeleteWorkspacePromptEnabled())
-    {
-      reply = QMessageBox::question(this, "Delete Workspaces", "Are you sure you want to delete the selected Workspaces?\n\nThis prompt can be disabled from:\nPreferences->General->Confirmations",
-                                    QMessageBox::Yes|QMessageBox::No);
-    }
-    else
-    {
+
+    if (m_appParent->isDeleteWorkspacePromptEnabled()) {
+      reply = QMessageBox::question(
+          this, "Delete Workspaces",
+          "Are you sure you want to delete the selected Workspaces?\n\nThis "
+          "prompt can be disabled from:\nPreferences->General->Confirmations",
+          QMessageBox::Yes | QMessageBox::No);
+    } else {
       reply = QMessageBox::Yes;
     }
 
-    if (reply == QMessageBox::Yes)
-    {
-      if(deleteExplorer)
-      { 
-        //loop through multiple items selected from the mantid tree
-        QList<QTreeWidgetItem*>::iterator itr=items.begin();
-        for (itr = items.begin(); itr != items.end(); ++itr)
-        {
-          //Sometimes we try to delete a workspace that's already been deleted.
-          if(m_ads.doesExist((*itr)->text(0).toStdString()))
+    if (reply == QMessageBox::Yes) {
+      if (deleteExplorer) {
+        // loop through multiple items selected from the mantid tree
+        QList<QTreeWidgetItem *>::iterator itr = items.begin();
+        for (itr = items.begin(); itr != items.end(); ++itr) {
+          // Sometimes we try to delete a workspace that's already been deleted.
+          if (m_ads.doesExist((*itr)->text(0).toStdString()))
             m_mantidUI->deleteWorkspace((*itr)->text(0));
-        }//end of for loop for selected items
-      }
-      else if(deleteActive)
-      {
+        } // end of for loop for selected items
+      } else if (deleteActive) {
         m_mantidUI->deleteWorkspace(m->workspaceName());
       }
     }
   }
 }
 
-void MantidDockWidget::sortAscending()
-{
-  if(isTreeUpdating()) return;
+void MantidDockWidget::sortAscending() {
+  if (isTreeUpdating())
+    return;
   m_tree->setSortOrder(Qt::Ascending);
   m_tree->sort();
 }
 
-void MantidDockWidget::sortDescending()
-{
-  if(isTreeUpdating()) return;
+void MantidDockWidget::sortDescending() {
+  if (isTreeUpdating())
+    return;
   m_tree->setSortOrder(Qt::Descending);
   m_tree->sort();
 }
 
-void MantidDockWidget::chooseByName()
-{
-  if(isTreeUpdating()) return;
+void MantidDockWidget::chooseByName() {
+  if (isTreeUpdating())
+    return;
   m_tree->setSortScheme(ByName);
   m_tree->sort();
 }
 
-void MantidDockWidget::chooseByLastModified()
-{
-  if(isTreeUpdating()) return;
+void MantidDockWidget::chooseByLastModified() {
+  if (isTreeUpdating())
+    return;
   m_tree->setSortScheme(ByLastModified);
   m_tree->sort();
 }
 
-void MantidDockWidget::excludeItemFromSort(MantidTreeWidgetItem *item)
-{
+void MantidDockWidget::excludeItemFromSort(MantidTreeWidgetItem *item) {
   static int counter = 1;
 
-  item->setSortPos( counter );
+  item->setSortPos(counter);
 
   counter++;
 }
@@ -1091,200 +1056,202 @@ void MantidDockWidget::excludeItemFromSort(MantidTreeWidgetItem *item)
 * @param name :: A string containing the name of the program
 */
 
-void MantidDockWidget::saveToProgram(const QString & name)
-{
-  //Create a map for the keys and details to go into
-  std::map<std::string,std::string> programKeysAndDetails;
+void MantidDockWidget::saveToProgram(const QString &name) {
+  // Create a map for the keys and details to go into
+  std::map<std::string, std::string> programKeysAndDetails;
   programKeysAndDetails["name"] = name.toStdString();
 
-  //Get a list of the program detail keys (mandatory - target, saveusing) (optional - arguments, save parameters, workspace type)
-  std::vector<std::string> programKeys = (Mantid::Kernel::ConfigService::Instance().getKeys(("workspace.sendto." + programKeysAndDetails.find("name")->second)));
+  // Get a list of the program detail keys (mandatory - target, saveusing)
+  // (optional - arguments, save parameters, workspace type)
+  std::vector<std::string> programKeys =
+      (Mantid::Kernel::ConfigService::Instance().getKeys(
+          ("workspace.sendto." + programKeysAndDetails.find("name")->second)));
 
-  for (size_t i=0; i<programKeys.size(); i++)
-  {
-    //Assign a key to its value using the map
-    programKeysAndDetails[programKeys[i]] = (Mantid::Kernel::ConfigService::Instance().getString(("workspace.sendto." + programKeysAndDetails.find("name")->second + "." + programKeys[i])));
+  for (size_t i = 0; i < programKeys.size(); i++) {
+    // Assign a key to its value using the map
+    programKeysAndDetails[programKeys[i]] =
+        (Mantid::Kernel::ConfigService::Instance().getString(
+            ("workspace.sendto." + programKeysAndDetails.find("name")->second +
+             "." + programKeys[i])));
   }
 
-  //Check to see if mandatory information is included
-  if ((programKeysAndDetails.count("name") != 0) && (programKeysAndDetails.count("target") != 0) && (programKeysAndDetails.count("saveusing") != 0))    
-  {
-    std::string expTarget = Poco::Path::expand(programKeysAndDetails.find("target")->second);
+  // Check to see if mandatory information is included
+  if ((programKeysAndDetails.count("name") != 0) &&
+      (programKeysAndDetails.count("target") != 0) &&
+      (programKeysAndDetails.count("saveusing") != 0)) {
+    std::string expTarget =
+        Poco::Path::expand(programKeysAndDetails.find("target")->second);
 
     QFileInfo target = QString::fromStdString(expTarget);
-    if(target.exists())
-    {
-      try
-      {
-        //Setup a shared pointer for the algorithm using the appropriate save type
+    if (target.exists()) {
+      try {
+        // Setup a shared pointer for the algorithm using the appropriate save
+        // type
         Mantid::API::IAlgorithm_sptr alg;
 
-        //Convert to QString and create Algorithm
-        QString saveUsing = QString::fromStdString(programKeysAndDetails.find("saveusing")->second);
+        // Convert to QString and create Algorithm
+        QString saveUsing = QString::fromStdString(
+            programKeysAndDetails.find("saveusing")->second);
 
-        //Create a new save based on what files the new program can open
+        // Create a new save based on what files the new program can open
         alg = m_mantidUI->createAlgorithm(saveUsing);
 
-        //Get the file extention based on the workspace
-        Property* prop = alg->getProperty("Filename");
-        FileProperty *fileProp = dynamic_cast<FileProperty*>(prop);
+        // Get the file extention based on the workspace
+        Property *prop = alg->getProperty("Filename");
+        FileProperty *fileProp = dynamic_cast<FileProperty *>(prop);
         std::string ext;
-        if(fileProp)
-        {
+        if (fileProp) {
           ext = fileProp->getDefaultExt();
         }
 
-        //Save as.. default save + the file type i.e .nxs
-        alg->setPropertyValue("fileName", "auto_save_" + selectedWsName.toStdString() + ext);
+        // Save as.. default save + the file type i.e .nxs
+        alg->setPropertyValue(
+            "fileName", "auto_save_" + selectedWsName.toStdString() + ext);
 
-        //Save the workspace
+        // Save the workspace
         alg->setPropertyValue("InputWorkspace", selectedWsName.toStdString());
 
-        //If there are any save parameters
-        if (programKeysAndDetails.count("saveparameters") != 0)
-        {
-          QString saveParametersGrouped = QString::fromStdString(programKeysAndDetails.find("saveparameters")->second);
+        // If there are any save parameters
+        if (programKeysAndDetails.count("saveparameters") != 0) {
+          QString saveParametersGrouped = QString::fromStdString(
+              programKeysAndDetails.find("saveparameters")->second);
           QStringList saveParameters = saveParametersGrouped.split(',');
 
-          //For each one found split it up and assign the parameter
-          for (int i = 0; i<saveParameters.size(); i++)
-          {
+          // For each one found split it up and assign the parameter
+          for (int i = 0; i < saveParameters.size(); i++) {
             QStringList sPNameAndDetail = saveParameters[i].split('=');
-            std::string saveParameterName = sPNameAndDetail[0].trimmed().toStdString();
-            std::string saveParameterDetail = sPNameAndDetail[1].trimmed().toStdString();
-            if(saveParameterDetail == "True")
+            std::string saveParameterName =
+                sPNameAndDetail[0].trimmed().toStdString();
+            std::string saveParameterDetail =
+                sPNameAndDetail[1].trimmed().toStdString();
+            if (saveParameterDetail == "True")
               alg->setProperty(saveParameterName, true);
-            else if(saveParameterDetail == "False")
+            else if (saveParameterDetail == "False")
               alg->setProperty(saveParameterName, false);
-            else  //if not true or false then must be a value
+            else // if not true or false then must be a value
             {
               alg->setPropertyValue(saveParameterName, saveParameterDetail);
             }
           }
         }
 
-        //Execute the save
+        // Execute the save
         m_mantidUI->executeAlgorithmAsync(alg, true);
-        //alg->execute();
+        // alg->execute();
 
-        //Get the save location of the file (should be default Mantid folder)
-        //std::string savedFile = alg->getProperty("Filename");
-        QString savedFile = QString::fromStdString(alg->getProperty("Filename"));
+        // Get the save location of the file (should be default Mantid folder)
+        // std::string savedFile = alg->getProperty("Filename");
+        QString savedFile =
+            QString::fromStdString(alg->getProperty("Filename"));
         QStringList arguments;
 
-        //Arguments for the program to take. Default will be the file anyway.
-        if (programKeysAndDetails.count("arguments") != 0)
-        {
-          QString temp = QString::fromStdString(programKeysAndDetails.find("arguments")->second);
+        // Arguments for the program to take. Default will be the file anyway.
+        if (programKeysAndDetails.count("arguments") != 0) {
+          QString temp = QString::fromStdString(
+              programKeysAndDetails.find("arguments")->second);
           temp.replace(QString("[file]"), savedFile);
-          //temp.replace(QString("[user]"), user;
+          // temp.replace(QString("[user]"), user;
           arguments = temp.split(",");
-        }
-        else
+        } else
           arguments.insert(0, savedFile);
 
-        //convert the list into a standard vector for compatibility with Poco
+        // convert the list into a standard vector for compatibility with Poco
         std::vector<std::string> argumentsV;
 
-        for (int i = 0; i<arguments.size(); i++)
-        {
+        for (int i = 0; i < arguments.size(); i++) {
           argumentsV.assign(1, (arguments[i].toStdString()));
         }
 
-        //Execute the program
-        try
-        {
-          Mantid::Kernel::ConfigService::Instance().launchProcess(expTarget, argumentsV);
-        }
-        catch(std::runtime_error&)
-        {
-          QMessageBox::information(this, "Error", "User tried to open program from: " + QString::fromStdString(expTarget) + " There was an error opening the program. Please check the target and arguments list to ensure that these are correct");
+        // Execute the program
+        try {
+          Mantid::Kernel::ConfigService::Instance().launchProcess(expTarget,
+                                                                  argumentsV);
+        } catch (std::runtime_error &) {
+          QMessageBox::information(
+              this, "Error", "User tried to open program from: " +
+                                 QString::fromStdString(expTarget) +
+                                 " There was an error opening the program. "
+                                 "Please check the target and arguments list "
+                                 "to ensure that these are correct");
         }
+      } catch (std::exception &) {
+        QMessageBox::information(
+            this, "Mantid - Send to Program",
+            "A file property wasn't found. Please check that the correct" +
+                QString("save algorithm was used.\n(View -> Preferences -> "
+                        "Mantid -> SendTo -> Edit -> SaveUsing)"));
       }
-      catch(std::exception&)
-      {
-        QMessageBox::information(this, "Mantid - Send to Program", "A file property wasn't found. Please check that the correct"
-          + QString("save algorithm was used.\n(View -> Preferences -> Mantid -> SendTo -> Edit -> SaveUsing)") );
-      }
-    }
-    else
-      QMessageBox::information(this, "Target Path Error", "User tried to open program from: " + QString::fromStdString(expTarget) + " The target file path for the program can't be found. Please check that the full path is correct");
+    } else
+      QMessageBox::information(this, "Target Path Error",
+                               "User tried to open program from: " +
+                                   QString::fromStdString(expTarget) +
+                                   " The target file path for the program "
+                                   "can't be found. Please check that the full "
+                                   "path is correct");
   }
 }
 
-
-void MantidDockWidget::renameWorkspace()
-{
-  //get selected workspace
-  QList<QTreeWidgetItem*>selectedItems=m_tree->selectedItems();
+void MantidDockWidget::renameWorkspace() {
+  // get selected workspace
+  QList<QTreeWidgetItem *> selectedItems = m_tree->selectedItems();
   QStringList selectedwsNames;
-  if(!selectedItems.empty())
-  {
-    for(int i=0; i < selectedItems.size(); ++i)
-    {
+  if (!selectedItems.empty()) {
+    for (int i = 0; i < selectedItems.size(); ++i) {
       selectedwsNames.append(selectedItems[i]->text(0));
     }
   }
   m_mantidUI->renameWorkspace(selectedwsNames);
 }
 
-void MantidDockWidget::showDetectorTable()
-{
-  //get selected workspace
-  QList<QTreeWidgetItem*>selectedItems=m_tree->selectedItems();
+void MantidDockWidget::showDetectorTable() {
+  // get selected workspace
+  QList<QTreeWidgetItem *> selectedItems = m_tree->selectedItems();
   QString selctedwsName;
-  if(!selectedItems.empty())
-  {
-    selctedwsName=selectedItems[0]->text(0);
+  if (!selectedItems.empty()) {
+    selctedwsName = selectedItems[0]->text(0);
   }
-  m_mantidUI->createDetectorTable(selctedwsName,std::vector<int>());
+  m_mantidUI->createDetectorTable(selctedwsName, std::vector<int>());
 }
 
-void MantidDockWidget::popupMenu(const QPoint & pos)
-{
-  QTreeWidgetItem* treeItem = m_tree->itemAt(pos);
+void MantidDockWidget::popupMenu(const QPoint &pos) {
+  QTreeWidgetItem *treeItem = m_tree->itemAt(pos);
   selectedWsName = "";
-  if( treeItem ) selectedWsName = treeItem->text(0);
-  else m_tree->selectionModel()->clear();
+  if (treeItem)
+    selectedWsName = treeItem->text(0);
+  else
+    m_tree->selectionModel()->clear();
   QMenu *menu(NULL);
 
-  //If no workspace is here then have load raw and dae
-  if( selectedWsName.isEmpty() )
-  {
+  // If no workspace is here then have load raw and dae
+  if (selectedWsName.isEmpty()) {
     menu = m_loadMenu;
   }
-  //else show instrument, sample logs and delete
-  else
-  {
+  // else show instrument, sample logs and delete
+  else {
     // Fresh menu
     menu = new QMenu(this);
     menu->setObjectName("WorkspaceContextMenu");
     Mantid::API::Workspace_const_sptr ws;
-    try
-    {
+    try {
       ws = m_ads.retrieve(selectedWsName.toStdString());
-    }
-    catch(Mantid::Kernel::Exception::NotFoundError &)
-    {
+    } catch (Mantid::Kernel::Exception::NotFoundError &) {
       // Nothing to do
       return;
     }
 
     // Add the items that are appropriate for the type
-    if( MatrixWorkspace_const_sptr matrixWS = boost::dynamic_pointer_cast<const Mantid::API::MatrixWorkspace>(ws) ) 
-    {
+    if (MatrixWorkspace_const_sptr matrixWS =
+            boost::dynamic_pointer_cast<const Mantid::API::MatrixWorkspace>(
+                ws)) {
       addMatrixWorkspaceMenuItems(menu, matrixWS);
-    }
-    else if( IMDEventWorkspace_const_sptr mdeventWS = boost::dynamic_pointer_cast<const IMDEventWorkspace>(ws) )
-    {
+    } else if (IMDEventWorkspace_const_sptr mdeventWS =
+                   boost::dynamic_pointer_cast<const IMDEventWorkspace>(ws)) {
       addMDEventWorkspaceMenuItems(menu, mdeventWS);
-    }
-    else if( IMDWorkspace_const_sptr mdWS = boost::dynamic_pointer_cast<const IMDWorkspace>(ws) )
-    {
+    } else if (IMDWorkspace_const_sptr mdWS =
+                   boost::dynamic_pointer_cast<const IMDWorkspace>(ws)) {
       addMDHistoWorkspaceMenuItems(menu, mdWS);
-    }
-    else if( IPeaksWorkspace_const_sptr peaksWS = boost::dynamic_pointer_cast<const IPeaksWorkspace>(ws) )
-    {
+    } else if (IPeaksWorkspace_const_sptr peaksWS =
+                   boost::dynamic_pointer_cast<const IPeaksWorkspace>(ws)) {
       addPeaksWorkspaceMenuItems(menu, peaksWS);
     } else if (WorkspaceGroup_const_sptr groupWS =
                    boost::dynamic_pointer_cast<const WorkspaceGroup>(ws)) {
@@ -1295,193 +1262,184 @@ void MantidDockWidget::popupMenu(const QPoint & pos)
     }
     addClearMenuItems(menu, selectedWsName);
 
-    //Get the names of the programs for the send to option
-    std::vector<std::string> programNames = (Mantid::Kernel::ConfigService::Instance().getKeys("workspace.sendto.name"));
+    // Get the names of the programs for the send to option
+    std::vector<std::string> programNames =
+        (Mantid::Kernel::ConfigService::Instance().getKeys(
+            "workspace.sendto.name"));
     bool firstPass(true);
-    //Check to see if any options aren't visible
-    for (size_t i = 0; i<programNames.size(); i++)
-    {
-      std::string visible = Mantid::Kernel::ConfigService::Instance().getString("workspace.sendto." + programNames[i] + ".visible");
-      std::string target = Mantid::Kernel::ConfigService::Instance().getString("workspace.sendto." + programNames[i] + ".target");
-      if (Mantid::Kernel::ConfigService::Instance().isExecutable(target) && visible == "Yes")
-      {
+    // Check to see if any options aren't visible
+    for (size_t i = 0; i < programNames.size(); i++) {
+      std::string visible = Mantid::Kernel::ConfigService::Instance().getString(
+          "workspace.sendto." + programNames[i] + ".visible");
+      std::string target = Mantid::Kernel::ConfigService::Instance().getString(
+          "workspace.sendto." + programNames[i] + ".target");
+      if (Mantid::Kernel::ConfigService::Instance().isExecutable(target) &&
+          visible == "Yes") {
         bool compatible(true);
-        std::string saveUsing(Mantid::Kernel::ConfigService::Instance().getString("workspace.sendto." + programNames[i] + ".saveusing") );
-        try
-        {
-          Mantid::API::IAlgorithm_sptr alg = Mantid::API::AlgorithmManager::Instance().create(saveUsing);
-          alg->setPropertyValue("InputWorkspace", selectedWsName.toStdString() );
-        }
-        catch(std::exception&)
-        {
+        std::string saveUsing(
+            Mantid::Kernel::ConfigService::Instance().getString(
+                "workspace.sendto." + programNames[i] + ".saveusing"));
+        try {
+          Mantid::API::IAlgorithm_sptr alg =
+              Mantid::API::AlgorithmManager::Instance().create(saveUsing);
+          alg->setPropertyValue("InputWorkspace", selectedWsName.toStdString());
+        } catch (std::exception &) {
           compatible = false;
         }
-        if (compatible != false)
-        {
-          if (firstPass == true)
-          {
-            m_saveToProgram = new QMenu(tr("Send to"),this);
+        if (compatible != false) {
+          if (firstPass == true) {
+            m_saveToProgram = new QMenu(tr("Send to"), this);
             menu->addMenu(m_saveToProgram);
 
-            //Sub-menu for program list
+            // Sub-menu for program list
             m_programMapper = new QSignalMapper(this);
           }
           QString name = QString::fromStdString(programNames[i]);
-          //Setup new menu option for the program
-          m_program = new QAction(tr(name),this);
-          connect(m_program,SIGNAL(activated()),m_programMapper,SLOT(map()));
-          //Send name of program when clicked
+          // Setup new menu option for the program
+          m_program = new QAction(tr(name), this);
+          connect(m_program, SIGNAL(activated()), m_programMapper, SLOT(map()));
+          // Send name of program when clicked
           m_programMapper->setMapping(m_program, name);
-          m_saveToProgram->addAction(m_program);		
+          m_saveToProgram->addAction(m_program);
 
-          // Set first pass to false so that it doesn't set up another menu entry for all programs.
+          // Set first pass to false so that it doesn't set up another menu
+          // entry for all programs.
           firstPass = false;
         }
-      } 
+      }
     }
 
-    //Tell the button what to listen for and what to do once clicked (if there is anything to connect it will be set to false)
-    if (firstPass == false)    
-      connect(m_programMapper, SIGNAL(mapped(const QString &)), this, SLOT(saveToProgram(const QString &)));
+    // Tell the button what to listen for and what to do once clicked (if there
+    // is anything to connect it will be set to false)
+    if (firstPass == false)
+      connect(m_programMapper, SIGNAL(mapped(const QString &)), this,
+              SLOT(saveToProgram(const QString &)));
 
-    //Rename is valid for all workspace types
+    // Rename is valid for all workspace types
     menu->addAction(m_rename);
-    //separate delete
+    // separate delete
     menu->addSeparator();
     menu->addAction(m_delete);
   }
 
-  //Show the menu at the cursor's current position
+  // Show the menu at the cursor's current position
   menu->popup(QCursor::pos());
 }
 
-void MantidDockWidget::groupingButtonClick()
-{
-  if(m_groupButton)
-  {
-    QString qButtonName=m_groupButton->text();
-    if(qButtonName == "Group")
-    {
+void MantidDockWidget::groupingButtonClick() {
+  if (m_groupButton) {
+    QString qButtonName = m_groupButton->text();
+    if (qButtonName == "Group") {
       m_mantidUI->groupWorkspaces();
-    }
-    else if(qButtonName == "Ungroup")
-    {
+    } else if (qButtonName == "Ungroup") {
       m_mantidUI->ungroupWorkspaces();
     }
   }
 }
 
 /// Plots a single spectrum from each selected workspace
-void MantidDockWidget::plotSpectra()
-{
+void MantidDockWidget::plotSpectra() {
   const auto userInput = m_tree->chooseSpectrumFromSelected();
-  // An empty map will be returned if the user clicks cancel in the spectrum selection
-  if (userInput.plots.empty()) return;
+  // An empty map will be returned if the user clicks cancel in the spectrum
+  // selection
+  if (userInput.plots.empty())
+    return;
 
   bool spectrumPlot(true), errs(false), clearWindow(false);
   MultiLayer *window(NULL);
-  m_mantidUI->plot1D(userInput.plots, spectrumPlot, MantidQt::DistributionDefault, errs,
-                     window, clearWindow, userInput.waterfall);
+  m_mantidUI->plot1D(userInput.plots, spectrumPlot,
+                     MantidQt::DistributionDefault, errs, window, clearWindow,
+                     userInput.waterfall);
 }
 
 /// Plots a single spectrum from each selected workspace with errors
-void MantidDockWidget::plotSpectraErr()
-{
+void MantidDockWidget::plotSpectraErr() {
   const auto userInput = m_tree->chooseSpectrumFromSelected();
-  // An empty map will be returned if the user clicks cancel in the spectrum selection
-  if (userInput.plots.empty()) return;
+  // An empty map will be returned if the user clicks cancel in the spectrum
+  // selection
+  if (userInput.plots.empty())
+    return;
 
   bool spectrumPlot(true), errs(true), clearWindow(false);
   MultiLayer *window(NULL);
-  m_mantidUI->plot1D(userInput.plots, spectrumPlot, MantidQt::DistributionDefault, errs,
-                     window, clearWindow, userInput.waterfall);
+  m_mantidUI->plot1D(userInput.plots, spectrumPlot,
+                     MantidQt::DistributionDefault, errs, window, clearWindow,
+                     userInput.waterfall);
 }
 
 /**
 * Draw a color fill plot of the workspaces that are currently selected.
-* NOTE: The drawing of 2D plots is currently intimately linked with MantidMatrix meaning
+* NOTE: The drawing of 2D plots is currently intimately linked with MantidMatrix
+* meaning
 * that one of these must be generated first!
 */
-void MantidDockWidget::drawColorFillPlot()
-{
+void MantidDockWidget::drawColorFillPlot() {
   // Get the selected workspaces
   const QStringList wsNames = m_tree->getSelectedWorkspaceNames();
-  if( wsNames.empty() ) return;
+  if (wsNames.empty())
+    return;
 
   // Extract child workspace names from any WorkspaceGroups selected.
   // Use a list to preserve workspace order.
   QStringList allWsNames;
-  foreach( const QString wsName, wsNames )
-  {
-    const auto wsGroup = boost::dynamic_pointer_cast<const WorkspaceGroup>(m_ads.retrieve(wsName.toStdString()));
-    if( wsGroup )
-    {
+  foreach (const QString wsName, wsNames) {
+    const auto wsGroup = boost::dynamic_pointer_cast<const WorkspaceGroup>(
+        m_ads.retrieve(wsName.toStdString()));
+    if (wsGroup) {
       const auto children = wsGroup->getNames();
-      for( auto childWsName = children.begin(); childWsName != children.end(); ++childWsName )
-      {
+      for (auto childWsName = children.begin(); childWsName != children.end();
+           ++childWsName) {
         auto name = QString::fromStdString(*childWsName);
-        if (allWsNames.contains(name)) continue;
+        if (allWsNames.contains(name))
+          continue;
         allWsNames.append(name);
       }
-    }
-    else
+    } else
       allWsNames.append(wsName);
   }
 
   m_mantidUI->drawColorFillPlots(allWsNames);
 }
 
-void MantidDockWidget::treeSelectionChanged()
-{
-  //get selected workspaces
-  QList<QTreeWidgetItem*>Items = m_tree->selectedItems();
-
-  if(m_groupButton)
-  {
-    if(Items.size()==1)
-    {
-      //check it's group
-      QList<QTreeWidgetItem*>::const_iterator itr=Items.begin();
-      std::string selectedWSName=(*itr)->text(0).toStdString();
-      if(m_ads.doesExist(selectedWSName))
-      {
-        Workspace_sptr wsSptr=m_ads.retrieve(selectedWSName);
-        WorkspaceGroup_sptr grpSptr=boost::dynamic_pointer_cast<WorkspaceGroup>(wsSptr);
-        if(grpSptr)
-        {
+void MantidDockWidget::treeSelectionChanged() {
+  // get selected workspaces
+  QList<QTreeWidgetItem *> Items = m_tree->selectedItems();
+
+  if (m_groupButton) {
+    if (Items.size() == 1) {
+      // check it's group
+      QList<QTreeWidgetItem *>::const_iterator itr = Items.begin();
+      std::string selectedWSName = (*itr)->text(0).toStdString();
+      if (m_ads.doesExist(selectedWSName)) {
+        Workspace_sptr wsSptr = m_ads.retrieve(selectedWSName);
+        WorkspaceGroup_sptr grpSptr =
+            boost::dynamic_pointer_cast<WorkspaceGroup>(wsSptr);
+        if (grpSptr) {
           m_groupButton->setText("Ungroup");
           m_groupButton->setEnabled(true);
-        }
-        else
+        } else
           m_groupButton->setEnabled(false);
       }
 
-    }
-    else if(Items.size()>=2)
-    {
+    } else if (Items.size() >= 2) {
       m_groupButton->setText("Group");
       m_groupButton->setEnabled(true);
-    }
-    else if(Items.size()==0)
-    {
+    } else if (Items.size() == 0) {
       m_groupButton->setText("Group");
       m_groupButton->setEnabled(false);
     }
   }
 
-  if(m_deleteButton)
+  if (m_deleteButton)
     m_deleteButton->setEnabled(Items.size() > 0);
 
-  if(m_saveButton)
+  if (m_saveButton)
     m_saveButton->setEnabled(Items.size() > 0);
 
-  if (Items.size() > 0)
-  {
+  if (Items.size() > 0) {
     auto item = *(Items.begin());
     m_mantidUI->enableSaveNexus(item->text(0));
-  }
-  else
-  {
+  } else {
     m_mantidUI->disableSaveNexus();
   }
 }
@@ -1489,30 +1447,26 @@ void MantidDockWidget::treeSelectionChanged()
 /**
 * Convert selected TableWorkspace to a MatrixWorkspace.
 */
-void MantidDockWidget::convertToMatrixWorkspace()
-{
-  m_mantidUI->showAlgorithmDialog(QString("ConvertTableToMatrixWorkspace"),-1);
+void MantidDockWidget::convertToMatrixWorkspace() {
+  m_mantidUI->showAlgorithmDialog(QString("ConvertTableToMatrixWorkspace"), -1);
 }
 
 /**
 * Convert selected MDHistoWorkspace to a MatrixWorkspace.
 */
-void MantidDockWidget::convertMDHistoToMatrixWorkspace()
-{
-  m_mantidUI->showAlgorithmDialog(QString("ConvertMDHistoToMatrixWorkspace"),-1);
+void MantidDockWidget::convertMDHistoToMatrixWorkspace() {
+  m_mantidUI->showAlgorithmDialog(QString("ConvertMDHistoToMatrixWorkspace"),
+                                  -1);
 }
 
 /**
 * Handler for the clear the UB matrix event.
 */
-void MantidDockWidget::clearUB()
-{
-  QList<QTreeWidgetItem*> selectedItems = m_tree->selectedItems();
+void MantidDockWidget::clearUB() {
+  QList<QTreeWidgetItem *> selectedItems = m_tree->selectedItems();
   QStringList selctedWSNames;
-  if (!selectedItems.empty())
-  {
-    for (int i = 0; i < selectedItems.size(); ++i)
-    {
+  if (!selectedItems.empty()) {
+    for (int i = 0; i < selectedItems.size(); ++i) {
       selctedWSNames.append(selectedItems[i]->text(0));
     }
   }
@@ -1523,10 +1477,7 @@ void MantidDockWidget::clearUB()
 * Accept a drag drop event and process the data appropriately
 * @param de :: The drag drop event
 */
-void MantidDockWidget::dropEvent(QDropEvent *de)
-{
-  m_tree->dropEvent(de);
-}
+void MantidDockWidget::dropEvent(QDropEvent *de) { m_tree->dropEvent(de); }
 
 /**
  * Create a 3D surface plot from the selected workspace group
@@ -1572,8 +1523,8 @@ void MantidDockWidget::plotContour() {
 //------------ MantidTreeWidget -----------------------//
 
 MantidTreeWidget::MantidTreeWidget(MantidDockWidget *w, MantidUI *mui)
-  : QTreeWidget(w),m_dockWidget(w),m_mantidUI(mui),m_ads(Mantid::API::AnalysisDataService::Instance()),m_sortScheme()
-{
+    : QTreeWidget(w), m_dockWidget(w), m_mantidUI(mui),
+      m_ads(Mantid::API::AnalysisDataService::Instance()), m_sortScheme() {
   setObjectName("WorkspaceTree");
   setSelectionMode(QAbstractItemView::ExtendedSelection);
   setSortOrder(Qt::AscendingOrder);
@@ -1584,8 +1535,7 @@ MantidTreeWidget::MantidTreeWidget(MantidDockWidget *w, MantidUI *mui)
 * Accept a drag move event and selects whether to accept the action
 * @param de :: The drag move event
 */
-void MantidTreeWidget::dragMoveEvent(QDragMoveEvent *de)
-{
+void MantidTreeWidget::dragMoveEvent(QDragMoveEvent *de) {
   // The event needs to be accepted here
   if (de->mimeData()->hasUrls())
     de->accept();
@@ -1595,80 +1545,73 @@ void MantidTreeWidget::dragMoveEvent(QDragMoveEvent *de)
 * Accept a drag enter event and selects whether to accept the action
 * @param de :: The drag enter event
 */
-void MantidTreeWidget::dragEnterEvent(QDragEnterEvent *de)
-{
+void MantidTreeWidget::dragEnterEvent(QDragEnterEvent *de) {
   // Set the drop action to be the proposed action.
   if (de->mimeData()->hasUrls())
     de->acceptProposedAction();
 }
 
-
-
 /**
 * Accept a drag drop event and process the data appropriately
 * @param de :: The drag drop event
 */
-void MantidTreeWidget::dropEvent(QDropEvent *de)
-{
+void MantidTreeWidget::dropEvent(QDropEvent *de) {
   QStringList filenames;
-  const QMimeData *mimeData = de->mimeData();  
-  if (mimeData->hasUrls()) 
-  {
+  const QMimeData *mimeData = de->mimeData();
+  if (mimeData->hasUrls()) {
     QList<QUrl> urlList = mimeData->urls();
-    for (int i = 0; i < urlList.size(); ++i) 
-    {
+    for (int i = 0; i < urlList.size(); ++i) {
       QString fName = urlList[i].toLocalFile();
-      if (fName.size()>0)
-      {
+      if (fName.size() > 0) {
         filenames.append(fName);
       }
     }
   }
   de->acceptProposedAction();
 
-  for (int i = 0; i < filenames.size(); ++i) 
-  {
-    try
-    {
+  for (int i = 0; i < filenames.size(); ++i) {
+    try {
       QFileInfo fi(filenames[i]);
       QString basename = fi.baseName();
       IAlgorithm_sptr alg = m_mantidUI->createAlgorithm("Load");
       alg->initialize();
-      alg->setProperty("Filename",filenames[i].toStdString());
-      alg->setProperty("OutputWorkspace",basename.toStdString());
-      m_mantidUI->executeAlgorithmAsync(alg,true);
-    }
-    catch (std::runtime_error& error)
-    {
-      treelog.error()<<"Failed to Load the file "<<filenames[i].toStdString()<<" . The reason for failure is: "<< error.what()<<std::endl;
-    }      
-    catch (std::logic_error& error)
-    {
-      treelog.error()<<"Failed to Load the file "<<filenames[i].toStdString()<<" . The reason for failure is: "<< error.what()<<std::endl;
-    }
-    catch (std::exception& error)
-    {
-      treelog.error()<<"Failed to Load the file "<<filenames[i].toStdString()<<" . The reason for failure is: "<< error.what()<<std::endl;
+      alg->setProperty("Filename", filenames[i].toStdString());
+      alg->setProperty("OutputWorkspace", basename.toStdString());
+      m_mantidUI->executeAlgorithmAsync(alg, true);
+    } catch (std::runtime_error &error) {
+      treelog.error() << "Failed to Load the file "
+                      << filenames[i].toStdString()
+                      << " . The reason for failure is: " << error.what()
+                      << std::endl;
+    } catch (std::logic_error &error) {
+      treelog.error() << "Failed to Load the file "
+                      << filenames[i].toStdString()
+                      << " . The reason for failure is: " << error.what()
+                      << std::endl;
+    } catch (std::exception &error) {
+      treelog.error() << "Failed to Load the file "
+                      << filenames[i].toStdString()
+                      << " . The reason for failure is: " << error.what()
+                      << std::endl;
     }
   }
 }
 
-void MantidTreeWidget::mousePressEvent (QMouseEvent *e)
-{
-  if (e->button() == Qt::LeftButton)
-  {
-    if( !itemAt(e->pos()) ) selectionModel()->clear();
+void MantidTreeWidget::mousePressEvent(QMouseEvent *e) {
+  if (e->button() == Qt::LeftButton) {
+    if (!itemAt(e->pos()))
+      selectionModel()->clear();
     m_dragStartPosition = e->pos();
   }
 
   QTreeWidget::mousePressEvent(e);
 }
 
-void MantidTreeWidget::mouseMoveEvent(QMouseEvent *e)
-{
+void MantidTreeWidget::mouseMoveEvent(QMouseEvent *e) {
   if (!(e->buttons() & Qt::LeftButton))
     return;
-  if ((e->pos() - m_dragStartPosition).manhattanLength() < QApplication::startDragDistance())
+  if ((e->pos() - m_dragStartPosition).manhattanLength() <
+      QApplication::startDragDistance())
     return;
 
   // Start dragging
@@ -1676,13 +1619,15 @@ void MantidTreeWidget::mouseMoveEvent(QMouseEvent *e)
   QMimeData *mimeData = new QMimeData;
 
   QStringList wsnames = getSelectedWorkspaceNames();
-  if (wsnames.size() == 0) return;
+  if (wsnames.size() == 0)
+    return;
   QString importStatement = "";
-  foreach( const QString wsname, wsnames )
-  {
+  foreach (const QString wsname, wsnames) {
     QString prefix = "";
-    if (wsname[0].isDigit()) prefix = "ws";
-    if (importStatement.size() > 0) importStatement += "\n";
+    if (wsname[0].isDigit())
+      prefix = "ws";
+    if (importStatement.size() > 0)
+      importStatement += "\n";
     importStatement += prefix + wsname + " = mtd[\"" + wsname + "\"]";
   }
 
@@ -1692,28 +1637,22 @@ void MantidTreeWidget::mouseMoveEvent(QMouseEvent *e)
   drag->setMimeData(mimeData);
 
   Qt::DropAction dropAction = drag->exec(Qt::CopyAction | Qt::MoveAction);
-  (void) dropAction;
+  (void)dropAction;
 }
 
-void MantidTreeWidget::mouseDoubleClickEvent(QMouseEvent *e)
-{
-  try
-  {
+void MantidTreeWidget::mouseDoubleClickEvent(QMouseEvent *e) {
+  try {
     QString wsName = m_mantidUI->getSelectedWorkspaceName();
     Mantid::API::WorkspaceGroup_sptr grpWSPstr;
-    grpWSPstr=boost::dynamic_pointer_cast< WorkspaceGroup>
-      (m_ads.retrieve(wsName.toStdString()));
-    if(!grpWSPstr)
-    {
-      if ( ! wsName.isEmpty() )
-      {
-        m_mantidUI->importWorkspace(wsName,false);
+    grpWSPstr = boost::dynamic_pointer_cast<WorkspaceGroup>(
+        m_ads.retrieve(wsName.toStdString()));
+    if (!grpWSPstr) {
+      if (!wsName.isEmpty()) {
+        m_mantidUI->importWorkspace(wsName, false);
         return;
       }
     }
-  }
-  catch(Mantid::Kernel::Exception::NotFoundError &)
-  {
+  } catch (Mantid::Kernel::Exception::NotFoundError &) {
     return;
   }
   QTreeWidget::mouseDoubleClickEvent(e);
@@ -1724,13 +1663,11 @@ void MantidTreeWidget::mouseDoubleClickEvent(QMouseEvent *e)
 * extract child workspaces from groups - it only returns
 * exactly what has been selected.
 */
-QStringList MantidTreeWidget::getSelectedWorkspaceNames() const
-{
+QStringList MantidTreeWidget::getSelectedWorkspaceNames() const {
   QStringList names;
 
-  foreach( const auto selectedItem, this->selectedItems() )
-  {
-    if( selectedItem )
+  foreach (const auto selectedItem, this->selectedItems()) {
+    if (selectedItem)
       names.append(selectedItem->text(0));
   }
 
@@ -1798,26 +1735,20 @@ MantidTreeWidget::chooseSpectrumFromSelected(bool showWaterfallOpt,
 
   // Check to see if all workspaces have only a single spectrum ...
   bool allSingleWorkspaces = true;
-  foreach( const auto selectedMatrixWs, selectedMatrixWsList )
-  {
-    if( selectedMatrixWs->getNumberHistograms() != 1 )
-    {
+  foreach (const auto selectedMatrixWs, selectedMatrixWsList) {
+    if (selectedMatrixWs->getNumberHistograms() != 1) {
       allSingleWorkspaces = false;
       break;
     }
   }
 
   // ... and if so, just return all workspace names mapped to workspace index 0;
-  if( allSingleWorkspaces )
-  {
-    const std::set<int> SINGLE_SPECTRUM = boost::assign::list_of<int>(0);
-    QMultiMap<QString,std::set<int>> spectrumToPlot;
-    foreach( const auto selectedMatrixWs, selectedMatrixWsList )
-    {
-      spectrumToPlot.insert(
-        QString::fromStdString(selectedMatrixWs->name()),
-        SINGLE_SPECTRUM
-        );
+  if (allSingleWorkspaces) {
+    const std::set<int> SINGLE_SPECTRUM = {0};
+    QMultiMap<QString, std::set<int>> spectrumToPlot;
+    foreach (const auto selectedMatrixWs, selectedMatrixWsList) {
+      spectrumToPlot.insert(QString::fromStdString(selectedMatrixWs->name()),
+                            SINGLE_SPECTRUM);
     }
     MantidWSIndexWidget::UserInput selections;
     selections.plots = spectrumToPlot;
@@ -1884,145 +1815,122 @@ MantidTreeWidget::chooseContourPlotOptions(int nWorkspaces) const {
   return choosePlotOptions("Contour", nWorkspaces);
 }
 
-void MantidTreeWidget::setSortScheme(MantidItemSortScheme sortScheme)
-{
+void MantidTreeWidget::setSortScheme(MantidItemSortScheme sortScheme) {
   m_sortScheme = sortScheme;
 }
 
-void MantidTreeWidget::setSortOrder(Qt::SortOrder sortOrder)
-{
+void MantidTreeWidget::setSortOrder(Qt::SortOrder sortOrder) {
   m_sortOrder = sortOrder;
 }
 
-Qt::SortOrder MantidTreeWidget::getSortOrder() const
-{
-  return m_sortOrder;
-}
+Qt::SortOrder MantidTreeWidget::getSortOrder() const { return m_sortOrder; }
 
-MantidItemSortScheme MantidTreeWidget::getSortScheme() const
-{
+MantidItemSortScheme MantidTreeWidget::getSortScheme() const {
   return m_sortScheme;
 }
 
 /**
 * Sort the items according to the current sort scheme and order.
 */
-void MantidTreeWidget::sort()
-{
-  sortItems(sortColumn(), m_sortOrder);
-}
+void MantidTreeWidget::sort() { sortItems(sortColumn(), m_sortOrder); }
 
 /**
 * Log a warning message.
 * @param msg :: A message to log.
 */
-void MantidTreeWidget::logWarningMessage(const std::string& msg)
-{
-  treelog.warning( msg );
+void MantidTreeWidget::logWarningMessage(const std::string &msg) {
+  treelog.warning(msg);
 }
 
 //-------------------- MantidTreeWidgetItem ----------------------//
 /**Constructor.
 * Must be passed its parent MantidTreeWidget, to facilitate correct sorting.
 */
-MantidTreeWidgetItem::MantidTreeWidgetItem(MantidTreeWidget* parent)
-  :QTreeWidgetItem(parent),m_parent(parent),m_sortPos(0)
-{
-}
+MantidTreeWidgetItem::MantidTreeWidgetItem(MantidTreeWidget *parent)
+    : QTreeWidgetItem(parent), m_parent(parent), m_sortPos(0) {}
 
 /**Constructor.
 * Must be passed its parent MantidTreeWidget, to facilitate correct sorting.
 */
-MantidTreeWidgetItem::MantidTreeWidgetItem(QStringList list, MantidTreeWidget* parent):
-  QTreeWidgetItem(list),m_parent(parent),m_sortPos(0)
-{
-}
+MantidTreeWidgetItem::MantidTreeWidgetItem(QStringList list,
+                                           MantidTreeWidget *parent)
+    : QTreeWidgetItem(list), m_parent(parent), m_sortPos(0) {}
 
 /**Overidden operator.
 * Must be passed its parent MantidTreeWidget, to facilitate correct sorting.
 */
-bool MantidTreeWidgetItem::operator<(const QTreeWidgetItem &other)const
-{
+bool MantidTreeWidgetItem::operator<(const QTreeWidgetItem &other) const {
   // If this and/or other has been set to have a Qt::UserRole, then
   // it has an accompanying sort order that we must maintain, no matter
   // what the user has seletected in terms of order or scheme.
 
   bool thisShouldBeSorted = m_sortPos == 0;
-  const MantidTreeWidgetItem *mantidOther = dynamic_cast<const MantidTreeWidgetItem*>(&other);
+  const MantidTreeWidgetItem *mantidOther =
+      dynamic_cast<const MantidTreeWidgetItem *>(&other);
   int otherSortPos = mantidOther ? mantidOther->getSortPos() : 0;
   bool otherShouldBeSorted = otherSortPos == 0;
 
-  // just in case m_parent is NULL. I think I saw this once but cannot reproduce.
-  if ( !m_parent ) return false;
+  // just in case m_parent is NULL. I think I saw this once but cannot
+  // reproduce.
+  if (!m_parent)
+    return false;
 
-  if(!thisShouldBeSorted && !otherShouldBeSorted)
-  {
-    if(m_parent->getSortOrder() == Qt::Ascending)
+  if (!thisShouldBeSorted && !otherShouldBeSorted) {
+    if (m_parent->getSortOrder() == Qt::Ascending)
       return m_sortPos < otherSortPos;
     else
       return m_sortPos >= otherSortPos;
-  }
-  else if(thisShouldBeSorted && !otherShouldBeSorted)
-  {
-    if(m_parent->getSortOrder() == Qt::Ascending)
+  } else if (thisShouldBeSorted && !otherShouldBeSorted) {
+    if (m_parent->getSortOrder() == Qt::Ascending)
       return false;
     else
       return true;
-  }
-  else if(!thisShouldBeSorted && otherShouldBeSorted)
-  {
-    if(m_parent->getSortOrder() == Qt::Ascending)
+  } else if (!thisShouldBeSorted && otherShouldBeSorted) {
+    if (m_parent->getSortOrder() == Qt::Ascending)
       return true;
     else
       return false;
   }
 
   // If both should be sorted, and the scheme is set to ByName ...
-  if(m_parent->getSortScheme() == ByName)
-  {
-    if(QString::compare(text(0), other.text(0), Qt::CaseInsensitive) < 0)
+  if (m_parent->getSortScheme() == ByName) {
+    if (QString::compare(text(0), other.text(0), Qt::CaseInsensitive) < 0)
       return true;
     return false;
   }
   // ... else both should be sorted and the scheme is set to ByLastModified.
-  else
-  {
-    try
-    {
-      if(childCount() > 0 && other.childCount() > 0)
-      {
-        const QTreeWidgetItem * other_ptr = &other;
-
-        try
-        {
+  else {
+    try {
+      if (childCount() > 0 && other.childCount() > 0) {
+        const QTreeWidgetItem *other_ptr = &other;
+
+        try {
           return getLastModified(this) < getLastModified(other_ptr);
-        }
-        catch(std::out_of_range &e)
-        {
-          m_parent->logWarningMessage( e.what() );
+        } catch (std::out_of_range &e) {
+          m_parent->logWarningMessage(e.what());
           return false;
         }
       }
-    }
-    catch (Mantid::Kernel::Exception::NotFoundError&)
-    {
+    } catch (Mantid::Kernel::Exception::NotFoundError &) {
       ;
     }
     return false;
   }
 }
 
-/**Finds the date and time of the last modification made to the workspace who's details
+/**Finds the date and time of the last modification made to the workspace who's
+* details
 * are found in the given QTreeWidgetItem.
 */
-DateAndTime MantidTreeWidgetItem::getLastModified(const QTreeWidgetItem* item)
-{
+DateAndTime MantidTreeWidgetItem::getLastModified(const QTreeWidgetItem *item) {
   QVariant userData = item->data(0, Qt::UserRole);
-  if ( userData.isNull() ) return DateAndTime(); //now
+  if (userData.isNull())
+    return DateAndTime(); // now
 
   Workspace_sptr workspace = userData.value<Workspace_sptr>();
-  const Mantid::API::WorkspaceHistory & wsHist = workspace->getHistory();
-  if(wsHist.empty()) return DateAndTime(); // now
+  const Mantid::API::WorkspaceHistory &wsHist = workspace->getHistory();
+  if (wsHist.empty())
+    return DateAndTime(); // now
 
   const size_t indexOfLast = wsHist.size() - 1;
   const auto lastAlgHist = wsHist.getAlgorithmHistory(indexOfLast);
@@ -2034,19 +1942,19 @@ DateAndTime MantidTreeWidgetItem::getLastModified(const QTreeWidgetItem* item)
 * The AlgorithmSelectorWidget
 * The progress bar and Details button
 */
-AlgorithmDockWidget::AlgorithmDockWidget(MantidUI *mui, ApplicationWindow *w):
-  QDockWidget(w),m_progressBar(NULL),m_algID(),m_mantidUI(mui)
-{
+AlgorithmDockWidget::AlgorithmDockWidget(MantidUI *mui, ApplicationWindow *w)
+    : QDockWidget(w), m_progressBar(NULL), m_algID(), m_mantidUI(mui) {
   setWindowTitle(tr("Algorithms"));
-  setObjectName("exploreAlgorithms"); // this is needed for QMainWindow::restoreState()
+  setObjectName(
+      "exploreAlgorithms"); // this is needed for QMainWindow::restoreState()
   setMinimumHeight(150);
   setMinimumWidth(200);
-  w->addDockWidget( Qt::RightDockWidgetArea, this );//*/
+  w->addDockWidget(Qt::RightDockWidgetArea, this); //*/
 
-  //Add the AlgorithmSelectorWidget
+  // Add the AlgorithmSelectorWidget
   m_selector = new MantidQt::MantidWidgets::AlgorithmSelectorWidget(this);
-  connect(m_selector,SIGNAL(executeAlgorithm(const QString &, const int)),
-    m_mantidUI,SLOT(showAlgorithmDialog(const QString &, const int)));
+  connect(m_selector, SIGNAL(executeAlgorithm(const QString &, const int)),
+          m_mantidUI, SLOT(showAlgorithmDialog(const QString &, const int)));
 
   m_runningLayout = new QHBoxLayout();
   m_runningLayout->setName("testA");
@@ -2054,57 +1962,48 @@ AlgorithmDockWidget::AlgorithmDockWidget(MantidUI *mui, ApplicationWindow *w):
   m_runningButton = new QPushButton("Details");
   m_runningLayout->addStretch();
   m_runningLayout->addWidget(m_runningButton);
-  connect(m_runningButton,SIGNAL(clicked()),m_mantidUI,SLOT(showAlgMonitor()));
-
+  connect(m_runningButton, SIGNAL(clicked()), m_mantidUI,
+          SLOT(showAlgMonitor()));
 
   QFrame *f = new QFrame(this);
-  QVBoxLayout * layout = new QVBoxLayout(f, 4 /*border*/, 4 /*spacing*/);
+  QVBoxLayout *layout = new QVBoxLayout(f, 4 /*border*/, 4 /*spacing*/);
   f->setLayout(layout);
   layout->setMargin(0);
   layout->addWidget(m_selector);
   layout->addLayout(m_runningLayout);
 
   setWidget(f);
-
 }
 
 /** Update the list of algorithms in the dock */
-void AlgorithmDockWidget::update()
-{
-  m_selector->update();
-}
-
+void AlgorithmDockWidget::update() { m_selector->update(); }
 
-void AlgorithmDockWidget::updateProgress(void* alg, const double p, const QString& msg, double estimatedTime, int progressPrecision)
-{
-  if (m_algID.empty()) return;
-  if (alg == m_algID.first() && p >= 0 && p <= 100 && m_progressBar)
-  {
-    m_progressBar->setValue( static_cast<int>(p) );
+void AlgorithmDockWidget::updateProgress(void *alg, const double p,
+                                         const QString &msg,
+                                         double estimatedTime,
+                                         int progressPrecision) {
+  if (m_algID.empty())
+    return;
+  if (alg == m_algID.first() && p >= 0 && p <= 100 && m_progressBar) {
+    m_progressBar->setValue(static_cast<int>(p));
     // Make the progress string
     std::ostringstream mess;
     mess << msg.toStdString();
     mess.precision(progressPrecision);
     mess << " " << std::fixed << p << "%";
-    if (estimatedTime > 0.5)
-    {
+    if (estimatedTime > 0.5) {
       mess.precision(0);
       mess << " (~";
       if (estimatedTime < 60)
         mess << static_cast<int>(estimatedTime) << "s";
-      else if (estimatedTime < 60*60)
-      {
-        int min = static_cast<int>(estimatedTime/60);
-        int sec = static_cast<int>(estimatedTime - min*60);
-        mess << min << "m"
-          << std::setfill('0') << std::setw(2) << sec << "s";
-      }
-      else
-      {
-        int hours = static_cast<int>(estimatedTime/3600);
-        int min = static_cast<int>( (estimatedTime-hours*3600)/60);
-        mess << hours << "h"
-          << std::setfill('0') << std::setw(2) << min << "h";
+      else if (estimatedTime < 60 * 60) {
+        int min = static_cast<int>(estimatedTime / 60);
+        int sec = static_cast<int>(estimatedTime - min * 60);
+        mess << min << "m" << std::setfill('0') << std::setw(2) << sec << "s";
+      } else {
+        int hours = static_cast<int>(estimatedTime / 3600);
+        int min = static_cast<int>((estimatedTime - hours * 3600) / 60);
+        mess << hours << "h" << std::setfill('0') << std::setw(2) << min << "h";
       }
       mess << ")";
     }
@@ -2113,37 +2012,32 @@ void AlgorithmDockWidget::updateProgress(void* alg, const double p, const QStrin
   }
 }
 
-void AlgorithmDockWidget::algorithmStarted(void* alg)
-{
+void AlgorithmDockWidget::algorithmStarted(void *alg) {
   m_algID.push_front(alg);
   hideProgressBar();
   showProgressBar();
 }
 
-void AlgorithmDockWidget::algorithmFinished(void* alg)
-{
-  if (m_algID.empty()) return;
+void AlgorithmDockWidget::algorithmFinished(void *alg) {
+  if (m_algID.empty())
+    return;
   m_algID.removeAll(alg);
   hideProgressBar();
 }
 
-void AlgorithmDockWidget::showProgressBar()
-{
-  if (m_progressBar == NULL)
-  {
+void AlgorithmDockWidget::showProgressBar() {
+  if (m_progressBar == NULL) {
     // insert progress bar
     m_progressBar = new QProgressBar();
     m_progressBar->setAlignment(Qt::AlignHCenter);
-    m_runningLayout->insertWidget(1,m_progressBar);
+    m_runningLayout->insertWidget(1, m_progressBar);
     // remove the stretch item
     m_runningLayout->removeItem(m_runningLayout->takeAt(0));
   }
 }
 
-void AlgorithmDockWidget::hideProgressBar()
-{
-  if (m_progressBar && m_algID.empty())
-  {
+void AlgorithmDockWidget::hideProgressBar() {
+  if (m_progressBar && m_algID.empty()) {
     m_runningLayout->insertStretch(0);
     m_runningLayout->removeWidget(m_progressBar);
     m_progressBar->close();
@@ -2152,6 +2046,4 @@ void AlgorithmDockWidget::hideProgressBar()
   }
 }
 
-
 //--------------------  ----------------------//
-
diff --git a/MantidPlot/src/Mantid/MantidMatrix.cpp b/MantidPlot/src/Mantid/MantidMatrix.cpp
index 94312853bbd87272253dba457c1fdf9cd332abdd..96447d82263a08af1e632907995f44c7447fbbd7 100644
--- a/MantidPlot/src/Mantid/MantidMatrix.cpp
+++ b/MantidPlot/src/Mantid/MantidMatrix.cpp
@@ -54,7 +54,6 @@
 #include <limits>
 
 #include <boost/math/special_functions/fpclassify.hpp>
-//using namespace Mantid;
 using namespace Mantid::API;
 using namespace Mantid::Kernel;
 using namespace MantidQt::API;
diff --git a/MantidPlot/src/Mantid/MantidMatrixExtensionRequest.cpp b/MantidPlot/src/Mantid/MantidMatrixExtensionRequest.cpp
index 2bac618e9821d5cff06cf2e18f7a76dd7fe0c007..e014f93f8780425e3b9ea5893b5802aa344569be 100644
--- a/MantidPlot/src/Mantid/MantidMatrixExtensionRequest.cpp
+++ b/MantidPlot/src/Mantid/MantidMatrixExtensionRequest.cpp
@@ -4,6 +4,7 @@
 #include "MantidMatrixNullExtensionHandler.h"
 #include "MantidMatrixDxExtensionHandler.h"
 #include "MantidKernel/Logger.h"
+#include "MantidKernel/make_unique.h"
 
 
 MantidMatrixExtensionRequest::MantidMatrixExtensionRequest()
@@ -26,7 +27,8 @@ MantidMatrixExtensionRequest::createMantidMatrixTabExtension(
       extension.label = "X Errors";
       extension.type = type;
       // Extend the chain of responsibility
-      std::unique_ptr<MantidMatrixDxExtensionHandler> dxHandler(new MantidMatrixDxExtensionHandler());
+      auto dxHandler =
+          Mantid::Kernel::make_unique<MantidMatrixDxExtensionHandler>();
       dxHandler->setSuccessor(m_extensionHandler);
       m_extensionHandler = std::move(dxHandler);
       return extension;
diff --git a/MantidPlot/src/Mantid/MantidUI.cpp b/MantidPlot/src/Mantid/MantidUI.cpp
index 2c910595fb1b0c7fddcc374124efabb0498b688d..ad0c59bf71bfa095769a03083652e6171ef0e2c5 100644
--- a/MantidPlot/src/Mantid/MantidUI.cpp
+++ b/MantidPlot/src/Mantid/MantidUI.cpp
@@ -342,9 +342,9 @@ void MantidUI::saveSettings() const
 QStringList MantidUI::getWorkspaceNames()
 {
   QStringList sl;
-  std::set<std::string> sv = Mantid::API::AnalysisDataService::Instance().getObjectNames();
-  for (std::set<std::string>::const_iterator it = sv.begin(); it != sv.end(); ++it)
-    sl<<QString::fromStdString(*it);
+  auto sv = Mantid::API::AnalysisDataService::Instance().getObjectNames();
+  for (const auto &name : sv)
+    sl<<QString::fromStdString(name);
   return sl;
 }
 
diff --git a/MantidPlot/src/Mantid/MantidUI.h b/MantidPlot/src/Mantid/MantidUI.h
index c8196359a276b20ebd794decec208adbe02f61d9..5f07217253b52070460107bcaa1f8709ea5f0886 100644
--- a/MantidPlot/src/Mantid/MantidUI.h
+++ b/MantidPlot/src/Mantid/MantidUI.h
@@ -28,6 +28,7 @@
 #include <QProgressDialog>
 #include <QMap>
 #include <QMutex>
+#include <unordered_map>
 
 //----------------------------------
 // Forward declarations
@@ -101,10 +102,8 @@ Code Documentation is available at: <http://doxygen.mantidproject.org>
 */
 
 /// Required by Qt to use Mantid::API::Workspace_sptr as a parameter type in signals
-Q_DECLARE_METATYPE(Mantid::API::Workspace_sptr)
-  Q_DECLARE_METATYPE(Mantid::API::MatrixWorkspace_sptr)
-  Q_DECLARE_METATYPE(Mantid::API::MatrixWorkspace_const_sptr)
-  Q_DECLARE_METATYPE(std::string)
+Q_DECLARE_METATYPE(Mantid::API::MatrixWorkspace_sptr)
+Q_DECLARE_METATYPE(Mantid::API::MatrixWorkspace_const_sptr)
 
 class MantidUI:public QObject
 {
@@ -572,7 +571,7 @@ private:
   QMap<std::string,int> m_DAE_map;
 
   // Stores dependent mdi windows. If the 'key' window closes, all 'value' ones must be closed as well.
-  std::multimap<MdiSubWindow*,MdiSubWindow*> m_mdiDependency;
+  std::unordered_multimap<MdiSubWindow*,MdiSubWindow*> m_mdiDependency;
   QMdiSubWindow *m_vatesSubWindow; ///< Holder for the Vates interface sub-window
 
   //prevents some repeated code realtating to log names
diff --git a/MantidPlot/src/PythonScript.cpp b/MantidPlot/src/PythonScript.cpp
index 7453f5b3397cbc91256c9edd09e512ee7f3783af..ef4158b60c25c2bc902aeb91320e254549c6e4c5 100644
--- a/MantidPlot/src/PythonScript.cpp
+++ b/MantidPlot/src/PythonScript.cpp
@@ -698,7 +698,7 @@ bool PythonScript::executeString()
   if(!result)
   {
     emit_error();
-    // If a script was aborted we both raise a KeyboardInterrupt and 
+    // If a script was aborted we both raise a KeyboardInterrupt and
     // call Algorithm::cancel to make sure we capture it. The doubling
     // can leave an interrupt in the pipeline so we clear it was we've
     // got the error info out
@@ -926,8 +926,7 @@ void PythonScript::postDeleteHandle(const std::string& wsName)
  */
 void PythonScript::clearADSHandle()
 {
-  std::set<std::string>::const_iterator iend = m_workspaceHandles.end();
-  for( std::set<std::string>::const_iterator itr = m_workspaceHandles.begin(); itr != iend; )
+  for( auto itr = m_workspaceHandles.cbegin(); itr != m_workspaceHandles.cend(); )
   {
     // This also erases the element from current set. The standard says that erase only invalidates
     // iterators of erased elements so we need to increment the iterator and get back the previous value
diff --git a/MantidQt/API/inc/MantidQtAPI/InterfaceFactory.h b/MantidQt/API/inc/MantidQtAPI/InterfaceFactory.h
index 96265d85f96a8383c9e79665d92c42f08202d48a..dae2a6d3b5cf65e65b439c8ee35440641a437de6 100644
--- a/MantidQt/API/inc/MantidQtAPI/InterfaceFactory.h
+++ b/MantidQt/API/inc/MantidQtAPI/InterfaceFactory.h
@@ -172,11 +172,9 @@ template<typename TYPE>
 void UserSubWindowFactoryImpl::saveAliasNames(const std::string & realName)
 {
   std::set<std::string> aliases = TYPE::aliases();
-  std::set<std::string>::const_iterator iend = aliases.end();
-  for( std::set<std::string>::const_iterator itr = aliases.begin(); itr != iend;
-       ++itr )
+  for(const auto &alias_std_str : aliases)
   {
-    QString alias = QString::fromStdString(*itr);
+    QString alias = QString::fromStdString(alias_std_str);
     if( m_aliasLookup.contains(alias) )
     {
       if( m_badAliases.contains(alias) )
diff --git a/MantidQt/API/inc/MantidQtAPI/WorkspaceObserver.h b/MantidQt/API/inc/MantidQtAPI/WorkspaceObserver.h
index 87651e7a9684a8e88d64fa316285fad6132546c1..1143f74d3ff028d6a7501342890f22bc51857e8a 100644
--- a/MantidQt/API/inc/MantidQtAPI/WorkspaceObserver.h
+++ b/MantidQt/API/inc/MantidQtAPI/WorkspaceObserver.h
@@ -2,9 +2,15 @@
 #define WORKSPACE_OBSERVER_H
 
 #include "MantidAPI/AnalysisDataService.h"
+#include "MantidAPI/Workspace_fwd.h"
 #include <Poco/NObserver.h>
 #include <QObject>
 #include "DllOption.h"
+#include <QMetaType>
+
+
+Q_DECLARE_METATYPE(std::string)
+Q_DECLARE_METATYPE(Mantid::API::Workspace_sptr)
 
 //------------------------------------------------
 // Mantid Forward declaration
diff --git a/MantidQt/API/src/FilePropertyWidget.cpp b/MantidQt/API/src/FilePropertyWidget.cpp
index d13f3c2c4604cee5715b1024c81a272923acf5f0..b38ae2c7516207fec156a5852af6f6bdb3ef94fe 100644
--- a/MantidQt/API/src/FilePropertyWidget.cpp
+++ b/MantidQt/API/src/FilePropertyWidget.cpp
@@ -5,7 +5,6 @@
 #include "MantidQtAPI/FileDialogHandler.h"
 
 using namespace Mantid::Kernel;
-//using namespace Mantid::API;
 
 namespace MantidQt
 {
diff --git a/MantidQt/API/src/MantidQwtIMDWorkspaceData.cpp b/MantidQt/API/src/MantidQwtIMDWorkspaceData.cpp
index 51788597ae0b6ff59c7873638a857dc15025db1d..049c90671a2a14902b2e89f9e9a4361e0c6eb84a 100644
--- a/MantidQt/API/src/MantidQwtIMDWorkspaceData.cpp
+++ b/MantidQt/API/src/MantidQwtIMDWorkspaceData.cpp
@@ -168,9 +168,10 @@ MantidQwtIMDWorkspaceData* MantidQwtIMDWorkspaceData::copy(Mantid::API::IMDWorks
 /** Cache the X/Y line plot data from this workspace and start/end points */
 void MantidQwtIMDWorkspaceData::cacheLinePlot()
 {
-  m_workspace->getLinePlot(m_start, m_end, m_normalization, m_lineX, m_Y, m_E);
-//  std::cout << "MantidQwtIMDWorkspaceData found " << m_Y.size() << " points\n";
-//  std::cout << "Plotting from " << m_start << " to " << m_end << std::endl;
+  auto line = m_workspace->getLinePlot(m_start, m_end, m_normalization);
+  m_lineX = line.x;
+  m_Y = line.y;
+  m_E = line.e;
 }
 
 //-----------------------------------------------------------------------------
diff --git a/MantidQt/API/src/PropertyWidget.cpp b/MantidQt/API/src/PropertyWidget.cpp
index 2af591dd93965559c09b3a47daef8e4975725b75..5db46504d06c2aec54024ec31810682d96e95fbf 100644
--- a/MantidQt/API/src/PropertyWidget.cpp
+++ b/MantidQt/API/src/PropertyWidget.cpp
@@ -4,7 +4,6 @@
 #include "MantidAPI/IWorkspaceProperty.h"
 #include "MantidAPI/AnalysisDataService.h"
 
-#include <boost/assign.hpp>
 #include <boost/foreach.hpp>
 
 #include <cmath>
@@ -20,457 +19,451 @@ using namespace Mantid::API;
 using Mantid::API::IWorkspaceProperty;
 
 namespace // anonymous
-{
-  /**
-   * Attempts to convert the given string into a double representation of a number.
-   * Rounding will occur so that "0.0200000000001" will be output as 0.02, for example.
-   *
-   * @param s :: the string to convert.
-   * @returns :: the converted number
-   *
-   * @throws std::runtime_error :: if conversion was unsuccesful.
-   */
-  double stringToRoundedNumber(const std::string & s)
-  {
-    // Using std::istringstream is a nice way to do string-to-double conversion
-    // in this situation as it rounds numbers for us at the same time.  Unfortunately,
-    // commas seem to confuse it ("0,0,0" is converted to "0" without any warning).
-    const bool containsComma = s.find(",") != std::string::npos;
-    if( containsComma )
-      throw std::runtime_error("");
-    
-    std::istringstream i(s);
-    double roundedNumber;
-    
-    if (!(i >> roundedNumber))
-      throw std::runtime_error("");
-    
-    return roundedNumber;
-  } 
-
-  /**
-   * Tests whether or not the given string value is "valid" for the given property.
-   *
-   * @param prop  :: the property to test against
-   * @param value :: the string to test with
-   * @returns     :: true if the value is valid, else false.
-   */
-  bool isValidPropertyValue(Mantid::Kernel::Property * prop, const std::string & value)
-  {
-    const auto guineaPig = boost::shared_ptr<Property>(prop->clone());
-    return guineaPig->setValue(value).empty();
-  }
-
-  /**
-   * Checks whether or not the given string value is one of our known "EMPTY_*" macros,
-   * which are used by some algorithms to denote an empty default number value.  We
-   * class the other *_MAX macros as "empty" macros, too.
-   *
-   * @param value :: the string value to check
-   * @returns     :: true if the value is one of the macros, else false
-   */
-  bool isEmptyNumMacro(const std::string & value)
-  {
-    using namespace Mantid;
-
-    // Catch instances of Python's "sys.maxint" which otherwise seem to fall through our net.
-    if( value == "2.14748e+09" )
-      return true;
-
-    double roundedNumber;
-    try
-    {
-      roundedNumber = stringToRoundedNumber(value);
-    }
-    catch( std::runtime_error & )
     {
-      return false;
-    }
-    
-    static const std::vector<double> EMPTY_NUM_MACROS = boost::assign::list_of
-      (EMPTY_DBL()) (-DBL_MAX) (DBL_MAX)
-      (static_cast<double>(EMPTY_INT()))
-      (static_cast<double>(EMPTY_LONG()))
-      (static_cast<double>(-INT_MAX))
-      (static_cast<double>(-LONG_MAX));
-
-    return std::find(EMPTY_NUM_MACROS.begin(), EMPTY_NUM_MACROS.end(), roundedNumber) != EMPTY_NUM_MACROS.end();
-  }
-
-  /**
-   * Checks whether or not the given property can optionally be left blank by
-   * an algorithm user.
-   *
-   * @param prop :: the property to check
-   * @returns    :: true if can be left blank, else false
-   */
-  bool isOptionalProperty(Mantid::Kernel::Property * prop)
-  {
-    return isValidPropertyValue(prop, "") ||
-           isValidPropertyValue(prop, prop->getDefault());
+/**
+ * Attempts to convert the given string into a double representation of a
+ * number.
+ * Rounding will occur so that "0.0200000000001" will be output as 0.02, for
+ * example.
+ *
+ * @param s :: the string to convert.
+ * @returns :: the converted number
+ *
+ * @throws std::runtime_error :: if conversion was unsuccesful.
+ */
+double stringToRoundedNumber(const std::string &s) {
+  // Using std::istringstream is a nice way to do string-to-double conversion
+  // in this situation as it rounds numbers for us at the same time.
+  // Unfortunately,
+  // commas seem to confuse it ("0,0,0" is converted to "0" without any
+  // warning).
+  const bool containsComma = s.find(",") != std::string::npos;
+  if (containsComma)
+    throw std::runtime_error("");
+
+  std::istringstream i(s);
+  double roundedNumber;
+
+  if (!(i >> roundedNumber))
+    throw std::runtime_error("");
+
+  return roundedNumber;
+}
+
+/**
+ * Tests whether or not the given string value is "valid" for the given
+ * property.
+ *
+ * @param prop  :: the property to test against
+ * @param value :: the string to test with
+ * @returns     :: true if the value is valid, else false.
+ */
+bool isValidPropertyValue(Mantid::Kernel::Property *prop,
+                          const std::string &value) {
+  const auto guineaPig = boost::shared_ptr<Property>(prop->clone());
+  return guineaPig->setValue(value).empty();
+}
+
+/**
+ * Checks whether or not the given string value is one of our known "EMPTY_*"
+ * macros,
+ * which are used by some algorithms to denote an empty default number value. We
+ * class the other *_MAX macros as "empty" macros, too.
+ *
+ * @param value :: the string value to check
+ * @returns     :: true if the value is one of the macros, else false
+ */
+bool isEmptyNumMacro(const std::string &value) {
+  using namespace Mantid;
+
+  // Catch instances of Python's "sys.maxint" which otherwise seem to fall
+  // through our net.
+  if (value == "2.14748e+09")
+    return true;
+
+  double roundedNumber;
+  try {
+    roundedNumber = stringToRoundedNumber(value);
+  } catch (std::runtime_error &) {
+    return false;
   }
 
-  /**
-   * For a given property, will create a placeholder text string.
-   *
-   * This will act in a similar way to the function used for the same purpose in the
-   * WikiMaker script, except that we won't ever display "optional".
-   *
-   * @param prop :: the property for which to create placeholder text
-   * @returns    :: the placeholder text
-   */
-  std::string createFieldPlaceholderText(Mantid::Kernel::Property * prop)
-  {
-    const std::string defaultValue = prop->getDefault();
-    if( defaultValue.empty() )
-      return "";
-
-    if( !isValidPropertyValue(prop, defaultValue) || isEmptyNumMacro(prop->getDefault()))
-      return "";
-
-    // It seems likely that any instance of "-0" or "-0.0" should be replaced with an appropriate
-    // EMPTY_* macro, but for now just display them as they appear in the Wiki.
-    if( defaultValue == "-0" || defaultValue == "-0.0" )
-      return "0";
-
-    double roundedNumber;
-    try
-    {
-      roundedNumber = stringToRoundedNumber(defaultValue);
-    }
-    catch( std::runtime_error & )
-    {
-      return defaultValue;
-    }
-
-    // We'd like to round off any instances of "2.7999999999999998", "0.050000000000000003",
-    // or similar, but we want to keep the decimal point in values like "0.0" or "1.0" since
-    // they can be a visual clue that a double is expected.
-    static const std::size_t STRING_ROUNDING_LENGTH = 15;
-    if( defaultValue.length() >= STRING_ROUNDING_LENGTH )
-    {
-      std::stringstream roundedValue;
-      roundedValue << roundedNumber;
-      return roundedValue.str();
-    }
-
+  static const std::vector<double> EMPTY_NUM_MACROS = {
+      EMPTY_DBL(),
+      -DBL_MAX,
+      DBL_MAX,
+      static_cast<double>(EMPTY_INT()),
+      static_cast<double>(EMPTY_LONG()),
+      static_cast<double>(-INT_MAX),
+      static_cast<double>(-LONG_MAX)};
+
+  return std::find(EMPTY_NUM_MACROS.begin(), EMPTY_NUM_MACROS.end(),
+                   roundedNumber) != EMPTY_NUM_MACROS.end();
+}
+
+/**
+ * Checks whether or not the given property can optionally be left blank by
+ * an algorithm user.
+ *
+ * @param prop :: the property to check
+ * @returns    :: true if can be left blank, else false
+ */
+bool isOptionalProperty(Mantid::Kernel::Property *prop) {
+  return isValidPropertyValue(prop, "") ||
+         isValidPropertyValue(prop, prop->getDefault());
+}
+
+/**
+ * For a given property, will create a placeholder text string.
+ *
+ * This will act in a similar way to the function used for the same purpose in
+ * the
+ * WikiMaker script, except that we won't ever display "optional".
+ *
+ * @param prop :: the property for which to create placeholder text
+ * @returns    :: the placeholder text
+ */
+std::string createFieldPlaceholderText(Mantid::Kernel::Property *prop) {
+  const std::string defaultValue = prop->getDefault();
+  if (defaultValue.empty())
+    return "";
+
+  if (!isValidPropertyValue(prop, defaultValue) ||
+      isEmptyNumMacro(prop->getDefault()))
+    return "";
+
+  // It seems likely that any instance of "-0" or "-0.0" should be replaced with
+  // an appropriate
+  // EMPTY_* macro, but for now just display them as they appear in the Wiki.
+  if (defaultValue == "-0" || defaultValue == "-0.0")
+    return "0";
+
+  double roundedNumber;
+  try {
+    roundedNumber = stringToRoundedNumber(defaultValue);
+  } catch (std::runtime_error &) {
     return defaultValue;
   }
-} // anonymous namespace
-
-namespace MantidQt
-{
-namespace API
-{
-  /**
-   * Constructor.
-   *
-   * @param parent :: the parent of this label.
-   */
-  ClickableLabel::ClickableLabel(QWidget * parent) : QLabel(parent) {}
-  /**
-   * Destructor.
-   */
-  ClickableLabel::~ClickableLabel() {}
-
-  /**
-   * Catches the mouse press event and emits the signal.
-   *
-   * @param event :: the QMouseEvent generated by a user clicking the label.
-   */
-  void ClickableLabel::mousePressEvent(QMouseEvent * event)
-  {
-    UNUSED_ARG(event);
-    emit clicked();
-  }
-
-  /** Constructor
-   */
-  PropertyWidget::PropertyWidget(Mantid::Kernel::Property * prop, QWidget * parent, QGridLayout * layout, int row)
-  : QWidget(parent),
-    m_prop(prop), m_gridLayout(layout), m_parent(NULL), m_row(row),// m_info(NULL),
-    m_doc(), m_replaceWSButton(NULL), m_widgets(), m_error(), m_isOutputWsProp(false),
-    m_previousValue(), m_enteredValue(), m_icons(), m_useHistory(true)
-  {
-    if (!prop)
-      throw std::runtime_error("NULL Property passed to the PropertyWidget constructor.");
-
-    if (!m_gridLayout)
-    {
-      // Create a LOCAL grid layout
-      m_gridLayout = new QGridLayout(this, 1, 5);
-      m_gridLayout->setSpacing(5);
-      this->setLayout(m_gridLayout);
-      m_row = 0;
-      m_parent = this;
-    }
-    else
-    {
-      // Use the parent of the provided QGridLayout when adding widgets
-      m_parent = parent;
-    }
-
-    QWidget * infoWidget = new QWidget();
-    infoWidget->setLayout(new QHBoxLayout(this));
-    infoWidget->layout()->setSpacing(1);
-    infoWidget->layout()->setContentsMargins(0, 0, 0, 0);
-    m_gridLayout->addWidget(infoWidget, m_row, 4);
-    
-    QMap<Info, QPair<QString, QString>> pathsAndToolTips;
-    pathsAndToolTips[RESTORE] = QPair<QString, QString>(":/history.png", "This property had a previously-entered value.  Click to toggle it off and on.");
-    pathsAndToolTips[REPLACE] = QPair<QString, QString>(":/replace.png", "A workspace with this name already exists and so will be overwritten.");
-    pathsAndToolTips[INVALID] = QPair<QString, QString>(":/invalid.png", "");
-
-    std::vector<Info> labelOrder = boost::assign::list_of(RESTORE)(REPLACE)(INVALID);
-
-    BOOST_FOREACH( const Info info, labelOrder )
-    {
-      const QString iconPath = pathsAndToolTips[info].first;
-      const QString toolTip  = pathsAndToolTips[info].second;
-
-      auto icon = new ClickableLabel(this);
-      icon->setPixmap(QPixmap(iconPath).scaledToHeight(15));
-      icon->setVisible(false);
-      icon->setToolTip(toolTip);
-
-      infoWidget->layout()->addWidget(icon);
-      m_icons[info] = icon;
-    }
-
-    connect(m_icons[RESTORE], SIGNAL(clicked()), this, SLOT(toggleUseHistory()));
 
-    /// Save the documentation tooltip
-    m_doc = QString::fromStdString(prop->briefDocumentation());
-
-    if( !isOptionalProperty(prop) )
-    {
-      if(!m_doc.isEmpty()) m_doc += ".\n\n";
-      m_doc += "This property is required.";
-    }
-    
-    if( prop->direction() == Direction::Output && dynamic_cast<IWorkspaceProperty*>(prop) )
-      m_isOutputWsProp = true;
+  // We'd like to round off any instances of "2.7999999999999998",
+  // "0.050000000000000003",
+  // or similar, but we want to keep the decimal point in values like "0.0" or
+  // "1.0" since
+  // they can be a visual clue that a double is expected.
+  static const std::size_t STRING_ROUNDING_LENGTH = 15;
+  if (defaultValue.length() >= STRING_ROUNDING_LENGTH) {
+    std::stringstream roundedValue;
+    roundedValue << roundedNumber;
+    return roundedValue.str();
   }
 
-  /** Destructor
-   */
-  PropertyWidget::~PropertyWidget()
-  {
-  }
+  return defaultValue;
+}
+} // anonymous namespace
 
-  /**
-   * Set this widget's value.
-   *
-   * @param value :: the value to set
-   */
-  void PropertyWidget::setValue(const QString & value)
-  {
-    setValueImpl(value);
-    valueChangedSlot();
-    updateIconVisibility();
+namespace MantidQt {
+namespace API {
+/**
+ * Constructor.
+ *
+ * @param parent :: the parent of this label.
+ */
+ClickableLabel::ClickableLabel(QWidget *parent) : QLabel(parent) {}
+/**
+ * Destructor.
+ */
+ClickableLabel::~ClickableLabel() {}
+
+/**
+ * Catches the mouse press event and emits the signal.
+ *
+ * @param event :: the QMouseEvent generated by a user clicking the label.
+ */
+void ClickableLabel::mousePressEvent(QMouseEvent *event) {
+  UNUSED_ARG(event);
+  emit clicked();
+}
+
+/** Constructor
+ */
+PropertyWidget::PropertyWidget(Mantid::Kernel::Property *prop, QWidget *parent,
+                               QGridLayout *layout, int row)
+    : QWidget(parent), m_prop(prop), m_gridLayout(layout), m_parent(NULL),
+      m_row(row), // m_info(NULL),
+      m_doc(), m_replaceWSButton(NULL), m_widgets(), m_error(),
+      m_isOutputWsProp(false), m_previousValue(), m_enteredValue(), m_icons(),
+      m_useHistory(true) {
+  if (!prop)
+    throw std::runtime_error(
+        "NULL Property passed to the PropertyWidget constructor.");
+
+  if (!m_gridLayout) {
+    // Create a LOCAL grid layout
+    m_gridLayout = new QGridLayout(this, 1, 5);
+    m_gridLayout->setSpacing(5);
+    this->setLayout(m_gridLayout);
+    m_row = 0;
+    m_parent = this;
+  } else {
+    // Use the parent of the provided QGridLayout when adding widgets
+    m_parent = parent;
   }
 
-  /**
-   * Set this widget's value as a previously-entered value.
-   *
-   * @param previousValue :: the previous value of this widget
-   */
-  void PropertyWidget::setPreviousValue(const QString & previousValue)
-  {
-    m_previousValue = previousValue;
-    setValue(m_previousValue);
-
-    // Handle input workspace options that have been set to a workspace previously,
-    // but where the workspace no longer exists.
-    const auto currentValue = getValue().toStdString();
-    if( getValue() != previousValue )
-    {
-      m_previousValue = "";
-      setValue(m_previousValue);
-    }
-    
-    // Once we've made the history icon visible, it will stay that way for
-    // the lifetime of the property widget.
-    if( m_previousValue.toStdString() != m_prop->getDefault() &&
-        !m_previousValue.isEmpty() )
-      m_icons[RESTORE]->setVisible(true);
+  QWidget *infoWidget = new QWidget();
+  infoWidget->setLayout(new QHBoxLayout(this));
+  infoWidget->layout()->setSpacing(1);
+  infoWidget->layout()->setContentsMargins(0, 0, 0, 0);
+  m_gridLayout->addWidget(infoWidget, m_row, 4);
+
+  QMap<Info, QPair<QString, QString>> pathsAndToolTips;
+  pathsAndToolTips[RESTORE] = QPair<QString, QString>(
+      ":/history.png", "This property had a previously-entered value.  Click "
+                       "to toggle it off and on.");
+  pathsAndToolTips[REPLACE] = QPair<QString, QString>(
+      ":/replace.png",
+      "A workspace with this name already exists and so will be overwritten.");
+  pathsAndToolTips[INVALID] = QPair<QString, QString>(":/invalid.png", "");
+
+  std::vector<Info> labelOrder = {RESTORE, REPLACE, INVALID};
+
+  BOOST_FOREACH (const Info info, labelOrder) {
+    const QString iconPath = pathsAndToolTips[info].first;
+    const QString toolTip = pathsAndToolTips[info].second;
+
+    auto icon = new ClickableLabel(this);
+    icon->setPixmap(QPixmap(iconPath).scaledToHeight(15));
+    icon->setVisible(false);
+    icon->setToolTip(toolTip);
+
+    infoWidget->layout()->addWidget(icon);
+    m_icons[info] = icon;
   }
 
-  /**
-   * Update which icons should be shown.
-   * @param error An optional error string. If empty the property is revalidated by calling prop->setValue and
-   * the error is pulled from here
-   */
-  void PropertyWidget::updateIconVisibility(const QString &error)
-  {
-    QString userError(error);
-    if(userError.isEmpty())
-    {
-      // Show "*" icon if the value is invalid for this property.
-      QString value = this->getValue().trimmed();
-      // Use the default if empty
-      if( value.isEmpty() )
-        value = QString::fromStdString(m_prop->getDefault());
-
-      try
-      {
-        userError = QString::fromStdString(m_prop->setValue(value.toStdString()));
-      }
-      catch(std::exception & err_details)
-      {
-        userError = QString::fromAscii(err_details.what());
-      }
-    }
-    this->setError(userError.trimmed());
-
-    m_icons[INVALID]->setVisible(!m_error.isEmpty());
-    m_icons[INVALID]->setToolTip(m_error);
-    // Show "!" icon if a workspace would be overwritten.
-    if( m_isOutputWsProp )
-    {
-      const bool wsExists = Mantid::API::AnalysisDataService::Instance().doesExist(getValue().toStdString());
-      m_icons[REPLACE]->setVisible(wsExists);
-    }
-  }
+  connect(m_icons[RESTORE], SIGNAL(clicked()), this, SLOT(toggleUseHistory()));
 
-  /** Slot called when someone clicks the "replace ws button" */
-  void PropertyWidget::replaceWSButtonClicked()
-  {
-    emit replaceWorkspaceName(QString::fromStdString(m_prop->name()));
-  }
+  /// Save the documentation tooltip
+  m_doc = QString::fromStdString(prop->briefDocumentation());
 
-  /**
-   * Emits a signal that the value of the property was changed.
-   */
-  void PropertyWidget::valueChangedSlot()
-  {
-    // This will be caught by the GenericDialog.
-    emit valueChanged( QString::fromStdString(m_prop->name()) ) ;
+  if (!isOptionalProperty(prop)) {
+    if (!m_doc.isEmpty())
+      m_doc += ".\n\n";
+    m_doc += "This property is required.";
   }
 
-  /**
-   * To be called when a user edits a property, as opposed to one being set programmatically.
-   */
-  void PropertyWidget::userEditedProperty()
-  {
-    setUseHistoryIcon(getValue() == m_previousValue);
-    if( getValue() != m_previousValue )
-      m_enteredValue = getValue();
-    updateIconVisibility();
-    valueChangedSlot();
-  }
-  
-  /**
-   * Toggle whether or not to use the previously-entered value.
-   */
-  void PropertyWidget::toggleUseHistory()
-  {
-    setUseHistoryIcon(!m_useHistory);
-    if( m_useHistory )
-      setValue(m_previousValue);
-    else
-      setValue(m_enteredValue);
-  }
-  
-  /**
-   * Sets the history on/off icons.
-   *
-   * @param useHistory :: when true, will show the history on image, when false will show the history off image.
-   */
-  void PropertyWidget::setUseHistoryIcon(bool useHistory)
-  {
-    if( m_useHistory != useHistory )
-    {
-      m_useHistory = useHistory;
-      const QString iconPath = useHistory ? ":/history.png" : ":/history_off.png";
-      m_icons[RESTORE]->setPixmap(QPixmap(iconPath).scaledToHeight(15));
-    }
+  if (prop->direction() == Direction::Output &&
+      dynamic_cast<IWorkspaceProperty *>(prop))
+    m_isOutputWsProp = true;
+}
+
+/** Destructor
+ */
+PropertyWidget::~PropertyWidget() {}
+
+/**
+ * Set this widget's value.
+ *
+ * @param value :: the value to set
+ */
+void PropertyWidget::setValue(const QString &value) {
+  setValueImpl(value);
+  valueChangedSlot();
+  updateIconVisibility();
+}
+
+/**
+ * Set this widget's value as a previously-entered value.
+ *
+ * @param previousValue :: the previous value of this widget
+ */
+void PropertyWidget::setPreviousValue(const QString &previousValue) {
+  m_previousValue = previousValue;
+  setValue(m_previousValue);
+
+  // Handle input workspace options that have been set to a workspace
+  // previously,
+  // but where the workspace no longer exists.
+  const auto currentValue = getValue().toStdString();
+  if (getValue() != previousValue) {
+    m_previousValue = "";
+    setValue(m_previousValue);
   }
 
-  /** Create and show the "Replace WS" button.
-   *
-   * This only has an effect for Output WorkspaceProperty's.
-   *
-   */
-  void PropertyWidget::addReplaceWSButton()
-  {
-    // Don't re-create it if it already exists
-    if (m_replaceWSButton)
-      return;
-
-    IWorkspaceProperty * wsProp = dynamic_cast<IWorkspaceProperty*>(m_prop);
-    if (wsProp && (m_prop->direction() == Direction::Output) )
-    {
-      m_replaceWSButton = new QPushButton(QIcon(":/data_replace.png"), "", m_parent);
-      // MG: There is no way with the QIcon class to actually ask what size it is so I had to hard
-      // code this number here to get it to a sensible size
-      m_replaceWSButton->setMaximumWidth(32);
-      //m_wsbtn_tracker[btn ] = 1;
-      m_replaceWSButton->setToolTip("Replace input workspace");
-      connect(m_replaceWSButton, SIGNAL(clicked()), this, SLOT(replaceWSButtonClicked()));
-      connect(m_replaceWSButton, SIGNAL(clicked()), this, SLOT(valueChangedSlot()));
-      m_widgets.push_back(m_replaceWSButton);
-      // Place in the grid on column 2.
-      m_gridLayout->addWidget(m_replaceWSButton, m_row, 2);
-      m_replaceWSButton->setVisible(true);
+  // Once we've made the history icon visible, it will stay that way for
+  // the lifetime of the property widget.
+  if (m_previousValue.toStdString() != m_prop->getDefault() &&
+      !m_previousValue.isEmpty())
+    m_icons[RESTORE]->setVisible(true);
+}
+
+/**
+ * Update which icons should be shown.
+ * @param error An optional error string. If empty the property is revalidated
+ * by calling prop->setValue and
+ * the error is pulled from here
+ */
+void PropertyWidget::updateIconVisibility(const QString &error) {
+  QString userError(error);
+  if (userError.isEmpty()) {
+    // Show "*" icon if the value is invalid for this property.
+    QString value = this->getValue().trimmed();
+    // Use the default if empty
+    if (value.isEmpty())
+      value = QString::fromStdString(m_prop->getDefault());
+
+    try {
+      userError = QString::fromStdString(m_prop->setValue(value.toStdString()));
+    } catch (std::exception &err_details) {
+      userError = QString::fromAscii(err_details.what());
     }
   }
-
-  /** Externally set an error string to display in the validator
-   *
-   * @param error :: string to show in the star, empty means no error
-   */
-  void PropertyWidget::setError(const QString & error)
-  {
-    m_error = error.trimmed();
+  this->setError(userError.trimmed());
+
+  m_icons[INVALID]->setVisible(!m_error.isEmpty());
+  m_icons[INVALID]->setToolTip(m_error);
+  // Show "!" icon if a workspace would be overwritten.
+  if (m_isOutputWsProp) {
+    const bool wsExists =
+        Mantid::API::AnalysisDataService::Instance().doesExist(
+            getValue().toStdString());
+    m_icons[REPLACE]->setVisible(wsExists);
   }
-
-  /** Sets all widgets contained within to Enabled
-   * @param val :: enabled or not   */
-  void PropertyWidget::setEnabled(bool val)
-  {
-    for (int i=0; i < m_widgets.size(); i++)
-      m_widgets[i]->setEnabled(val);
-    QWidget::setEnabled(val);
+}
+
+/** Slot called when someone clicks the "replace ws button" */
+void PropertyWidget::replaceWSButtonClicked() {
+  emit replaceWorkspaceName(QString::fromStdString(m_prop->name()));
+}
+
+/**
+ * Emits a signal that the value of the property was changed.
+ */
+void PropertyWidget::valueChangedSlot() {
+  // This will be caught by the GenericDialog.
+  emit valueChanged(QString::fromStdString(m_prop->name()));
+}
+
+/**
+ * To be called when a user edits a property, as opposed to one being set
+ * programmatically.
+ */
+void PropertyWidget::userEditedProperty() {
+  setUseHistoryIcon(getValue() == m_previousValue);
+  if (getValue() != m_previousValue)
+    m_enteredValue = getValue();
+  updateIconVisibility();
+  valueChangedSlot();
+}
+
+/**
+ * Toggle whether or not to use the previously-entered value.
+ */
+void PropertyWidget::toggleUseHistory() {
+  setUseHistoryIcon(!m_useHistory);
+  if (m_useHistory)
+    setValue(m_previousValue);
+  else
+    setValue(m_enteredValue);
+}
+
+/**
+ * Sets the history on/off icons.
+ *
+ * @param useHistory :: when true, will show the history on image, when false
+ * will show the history off image.
+ */
+void PropertyWidget::setUseHistoryIcon(bool useHistory) {
+  if (m_useHistory != useHistory) {
+    m_useHistory = useHistory;
+    const QString iconPath = useHistory ? ":/history.png" : ":/history_off.png";
+    m_icons[RESTORE]->setPixmap(QPixmap(iconPath).scaledToHeight(15));
   }
-
-  /** Sets all widgets contained within to Visible
-   * @param val :: Visible or not   */
-  void PropertyWidget::setVisible(bool val)
-  {
-    for (int i=0; i < m_widgets.size(); i++)
-      m_widgets[i]->setVisible(val);
-    QWidget::setVisible(val);
+}
+
+/** Create and show the "Replace WS" button.
+ *
+ * This only has an effect for Output WorkspaceProperty's.
+ *
+ */
+void PropertyWidget::addReplaceWSButton() {
+  // Don't re-create it if it already exists
+  if (m_replaceWSButton)
+    return;
+
+  IWorkspaceProperty *wsProp = dynamic_cast<IWorkspaceProperty *>(m_prop);
+  if (wsProp && (m_prop->direction() == Direction::Output)) {
+    m_replaceWSButton =
+        new QPushButton(QIcon(":/data_replace.png"), "", m_parent);
+    // MG: There is no way with the QIcon class to actually ask what size it is
+    // so I had to hard
+    // code this number here to get it to a sensible size
+    m_replaceWSButton->setMaximumWidth(32);
+    // m_wsbtn_tracker[btn ] = 1;
+    m_replaceWSButton->setToolTip("Replace input workspace");
+    connect(m_replaceWSButton, SIGNAL(clicked()), this,
+            SLOT(replaceWSButtonClicked()));
+    connect(m_replaceWSButton, SIGNAL(clicked()), this,
+            SLOT(valueChangedSlot()));
+    m_widgets.push_back(m_replaceWSButton);
+    // Place in the grid on column 2.
+    m_gridLayout->addWidget(m_replaceWSButton, m_row, 2);
+    m_replaceWSButton->setVisible(true);
   }
-
-  /**
-   * Given a property and its associated label, will make font adjustments to the label
-   * based on whether or not the property is mandatory.
-   *
-   * @param prop  :: property to which the label belongs
-   * @param label :: widget containing the label
-   */
-  void PropertyWidget::setLabelFont(Mantid::Kernel::Property * prop, QWidget * label)
-  {
-    if( !isOptionalProperty(prop) )
-    {
-      auto font = label->font();
-      font.setBold(true);
-      label->setFont(font);
-    }
-  }
-
-  /**
-   * Given a property and its associated QLineEdit text field, will set the field's placeholder
-   * text based on the default value of the property.
-   *
-   * @param prop  :: the property who's default value to use
-   * @param field :: the associated text field to set the placeholder text of
-   */
-  void PropertyWidget::setFieldPlaceholderText(Mantid::Kernel::Property * prop, QLineEdit * field)
-  {
-    field->setPlaceholderText(QString::fromStdString(createFieldPlaceholderText(prop)));
+}
+
+/** Externally set an error string to display in the validator
+ *
+ * @param error :: string to show in the star, empty means no error
+ */
+void PropertyWidget::setError(const QString &error) {
+  m_error = error.trimmed();
+}
+
+/** Sets all widgets contained within to Enabled
+ * @param val :: enabled or not   */
+void PropertyWidget::setEnabled(bool val) {
+  for (int i = 0; i < m_widgets.size(); i++)
+    m_widgets[i]->setEnabled(val);
+  QWidget::setEnabled(val);
+}
+
+/** Sets all widgets contained within to Visible
+ * @param val :: Visible or not   */
+void PropertyWidget::setVisible(bool val) {
+  for (int i = 0; i < m_widgets.size(); i++)
+    m_widgets[i]->setVisible(val);
+  QWidget::setVisible(val);
+}
+
+/**
+ * Given a property and its associated label, will make font adjustments to the
+ * label
+ * based on whether or not the property is mandatory.
+ *
+ * @param prop  :: property to which the label belongs
+ * @param label :: widget containing the label
+ */
+void PropertyWidget::setLabelFont(Mantid::Kernel::Property *prop,
+                                  QWidget *label) {
+  if (!isOptionalProperty(prop)) {
+    auto font = label->font();
+    font.setBold(true);
+    label->setFont(font);
   }
+}
+
+/**
+ * Given a property and its associated QLineEdit text field, will set the
+ * field's placeholder
+ * text based on the default value of the property.
+ *
+ * @param prop  :: the property who's default value to use
+ * @param field :: the associated text field to set the placeholder text of
+ */
+void PropertyWidget::setFieldPlaceholderText(Mantid::Kernel::Property *prop,
+                                             QLineEdit *field) {
+  field->setPlaceholderText(
+      QString::fromStdString(createFieldPlaceholderText(prop)));
+}
 
 } // namespace MantidQt
 } // namespace API
diff --git a/MantidQt/API/test/CMakeLists.txt b/MantidQt/API/test/CMakeLists.txt
index e524aaa6ae3d16f9565a9cec900e36cbe18bbc77..7722cd0f6c1f1b7ada0de935113d7640a89f09a7 100644
--- a/MantidQt/API/test/CMakeLists.txt
+++ b/MantidQt/API/test/CMakeLists.txt
@@ -8,6 +8,7 @@ if ( CXXTEST_FOUND )
     # It will go out of scope at the end of this file so doesn't need un-setting
     set ( TESTHELPER_SRCS ../../../Framework/TestHelpers/src/TearDownWorld.cpp
                           ../../../Framework/TestHelpers/src/ComponentCreationHelper.cpp
+                          ../../../Framework/TestHelpers/src/InstrumentCreationHelper.cpp
                           ../../../Framework/TestHelpers/src/WorkspaceCreationHelper.cpp
         )
     
diff --git a/MantidQt/API/test/SignalRangeTest.h b/MantidQt/API/test/SignalRangeTest.h
index 8bb269ed31c1f9e28107b5da0cd731f929477c36..324fc5fb7ae530a8b34f7d011b07c33d96b919be 100644
--- a/MantidQt/API/test/SignalRangeTest.h
+++ b/MantidQt/API/test/SignalRangeTest.h
@@ -27,12 +27,10 @@ private:
     MOCK_CONST_METHOD2(getSignalWithMaskAtCoord,
                        Mantid::signal_t(const Mantid::coord_t *,
                                         const Mantid::API::MDNormalization &));
-    MOCK_CONST_METHOD6(getLinePlot, void(const Mantid::Kernel::VMD &,
-                                         const Mantid::Kernel::VMD &,
-                                         Mantid::API::MDNormalization,
-                                         std::vector<Mantid::coord_t> &,
-                                         std::vector<Mantid::signal_t> &,
-                                         std::vector<Mantid::signal_t> &));
+    MOCK_CONST_METHOD3(getLinePlot, Mantid::API::IMDWorkspace::LinePlot(
+                                        const Mantid::Kernel::VMD &,
+                                        const Mantid::Kernel::VMD &,
+                                        Mantid::API::MDNormalization));
     MOCK_CONST_METHOD1(
         createIterator,
         Mantid::API::IMDIterator *(Mantid::Geometry::MDImplicitFunction *));
diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/EnggDiffractionPresenter.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/EnggDiffractionPresenter.h
index 1b40072252bbe42194314a4c6f82373d7c593c71..1d09b103135e71af4e22b64ea0200ab39c6b0ae5 100644
--- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/EnggDiffractionPresenter.h
+++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/EnggDiffractionPresenter.h
@@ -140,6 +140,7 @@ private:
 
   std::string buildCalibrateSuggestedFilename(const std::string &vanNo,
                                               const std::string &ceriaNo) const;
+
   //@}
 
   /// @name Focusing related private methods
@@ -231,6 +232,9 @@ private:
   // plots workspace according to the user selection
   void plotFocusedWorkspace(std::string outWSName);
 
+  void plotCalibWorkspace(std::vector<double> difc, std::vector<double> tzero,
+                          std::string specNos);
+
   // algorithms to save the generated workspace
   void saveGSS(std::string inputWorkspace, std::string bank, std::string runNo);
   void saveFocusedXYE(std::string inputWorkspace, std::string bank,
@@ -245,6 +249,15 @@ private:
   // generates a directory if not found and handles the path
   Poco::Path outFilesDir(std::string addToDir);
 
+  // generates appropriate names for table workspaces
+  std::string outFitParamsTblNameGenerator(std::string specNos, size_t bank_i);
+
+  std::string DifcZeroWorkspaceFactory(const std::vector<double> &difc,
+                                       const std::vector<double> &tzero,
+                                       const std::string &specNo) const;
+
+  std::string plotDifcZeroWorkspace() const;
+
   /// 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/EnggDiffractionQtTabCalib.ui b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/EnggDiffractionQtTabCalib.ui
index 434fd621d80f98034f54237f688c9cd3a8f58843..1949ee5b3ab6c2326367ad7319ffb7101cf064a7 100644
--- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/EnggDiffractionQtTabCalib.ui
+++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/EnggDiffractionQtTabCalib.ui
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>577</width>
-    <height>628</height>
+    <width>575</width>
+    <height>629</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -212,7 +212,7 @@
       <bool>true</bool>
      </property>
      <property name="title">
-      <string>Cropped Calibration </string>
+      <string>Cropped Calibration:</string>
      </property>
      <property name="checkable">
       <bool>true</bool>
@@ -371,6 +371,60 @@
      </layout>
     </widget>
    </item>
+   <item>
+    <spacer name="horizontalSpacer_21">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>554</width>
+       <height>20</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item>
+    <widget class="QGroupBox" name="groupBox_output_calib">
+     <property name="title">
+      <string>Output:</string>
+     </property>
+     <layout class="QGridLayout" name="gridLayout_3">
+      <item row="0" column="0">
+       <widget class="QCheckBox" name="checkBox_PlotData_Calib">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="minimumSize">
+         <size>
+          <width>0</width>
+          <height>25</height>
+         </size>
+        </property>
+        <property name="text">
+         <string>Plot Calibrated Workspace</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <spacer name="horizontalSpacer_20">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>554</width>
+       <height>20</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
    <item>
     <spacer name="verticalSpacer">
      <property name="orientation">
diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/EnggDiffractionViewQtGUI.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/EnggDiffractionViewQtGUI.h
index d93a98a0a0f99c436e0cafc22c93b52a7a137675..73f8b35607673a24468231626c2efaf9feb9db1b 100644
--- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/EnggDiffractionViewQtGUI.h
+++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/EnggDiffractionViewQtGUI.h
@@ -124,6 +124,8 @@ public:
 
   virtual bool focusedOutWorkspace() const;
 
+  virtual bool plotCalibWorkspace() const;
+
   virtual void resetFocus();
 
   virtual std::vector<std::string> currentPreprocRunNo() const;
@@ -138,9 +140,15 @@ public:
 
   virtual void plotWaterfallSpectrum(const std::string &wsName);
 
-  virtual void plotReplacingWindow(const std::string &wsName);
+  virtual void plotReplacingWindow(const std::string &wsName,
+                                   const std::string &spectrum,
+                                   const std::string &type);
+
+  virtual void plotVanCurvesCalibOutput();
+
+  virtual void plotDifcZeroCalibOutput(const std::string &pyCode);
 
-  virtual bool saveOutputFiles() const;
+  virtual bool saveFocusedOutputFiles() const;
 
   int currentPlotType() const { return m_currentType; }
 
diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/IEnggDiffractionView.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/IEnggDiffractionView.h
index 9f360c6142a3293d54a6e1880a7b0fcc8f92344f..141667540f49eadfa0c08aaab2347e4b78a1714a 100644
--- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/IEnggDiffractionView.h
+++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/IEnggDiffractionView.h
@@ -292,6 +292,14 @@ public:
    */
   virtual bool focusedOutWorkspace() const = 0;
 
+  /**
+  * Check box to consider when calibrating
+  * whether to plot focused workspace
+  *
+  * @return bool
+  */
+  virtual bool plotCalibWorkspace() const = 0;
+
   /**
    * Reset all focus inputs/options
    */
@@ -343,31 +351,47 @@ public:
  *
  * @return bool
  */
-  virtual bool saveOutputFiles() const = 0;
+  virtual bool saveFocusedOutputFiles() const = 0;
+
+  /**
+  * Produces vanadium curves graph with three spectrum for calib
+  * output.
+  *
+  */
+  virtual void plotVanCurvesCalibOutput() = 0;
+
+  /**
+  * Produces ceria peaks graph with two spectrum for calib
+  * output.
+  *
+  * @param pyCode string which is passed to Mantid via pyScript
+  */
+  virtual void plotDifcZeroCalibOutput(const std::string &pyCode) = 0;
 
   /**
-  * Produces a single spectrum graph for focused output. Runs
-  * plotSpectrum function via python.
+  * Produces a single spectrum graph for focused output.
   *
   * @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.
+ * Produces a waterfall spectrum graph for focused output.
  *
  * @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.
+  * Produces a replaceable spectrum graph for focused output.
   *
   * @param wsName name of the workspace to plot (must be in the ADS)
+  * @param spectrum number of the workspace to plot
+  * @param type of the workspace plot
   */
-  virtual void plotReplacingWindow(const std::string &wsName) = 0;
+  virtual void plotReplacingWindow(const std::string &wsName,
+                                   const std::string &spectrum,
+                                   const std::string &type) = 0;
 };
 
 } // namespace CustomInterfaces
diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IqtFit.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IqtFit.h
index b97c218dc8dfa11753229a92201512a0bf445cc8..f786e912acf97f1551495ea97b4e4aec9cefa15a 100644
--- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IqtFit.h
+++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IqtFit.h
@@ -6,75 +6,77 @@
 #include "MantidAPI/CompositeFunction.h"
 #include "MantidAPI/MatrixWorkspace_fwd.h"
 
-namespace Mantid
-{
-  namespace API
-  {
-    class IFunction;
-    class CompositeFunction;
-  }
+namespace Mantid {
+namespace API {
+class IFunction;
+class CompositeFunction;
+}
 }
 
-namespace MantidQt
-{
-namespace CustomInterfaces
-{
-namespace IDA
-{
-  class DLLExport IqtFit : public IndirectDataAnalysisTab
-  {
-    Q_OBJECT
-
-  public:
-    IqtFit(QWidget * parent = 0);
+namespace MantidQt {
+namespace CustomInterfaces {
+namespace IDA {
+class DLLExport IqtFit : public IndirectDataAnalysisTab {
+  Q_OBJECT
 
-  private:
-    virtual void setup();
-    virtual void run();
-    virtual bool validate();
-    virtual void loadSettings(const QSettings & settings);
+public:
+  IqtFit(QWidget *parent = 0);
 
-  private slots:
-    void typeSelection(int index);
-    void newDataLoaded(const QString wsName);
-    void updatePlot();
-    void specMinChanged(int value);
-    void specMaxChanged(int value);
-    void xMinSelected(double val);
-    void xMaxSelected(double val);
-    void backgroundSelected(double val);
-    void propertyChanged(QtProperty *, double);
-    void checkBoxUpdate(QtProperty * prop, bool checked);
-    void singleFit();
-    void plotGuess(QtProperty*);
-    void fitContextMenu(const QPoint &);
-    void fixItem();
-    void unFixItem();
-    void singleFitComplete(bool error);
+private:
+  virtual void setup();
+  virtual void run();
+  virtual bool validate();
+  virtual void loadSettings(const QSettings &settings);
 
-  private:
-    boost::shared_ptr<Mantid::API::CompositeFunction> createFunction(bool tie=false);
-    boost::shared_ptr<Mantid::API::IFunction> createUserFunction(const QString & name, bool tie=false);
-    QtProperty* createExponential(const QString &);
-    QtProperty* createStretchedExp(const QString &);
-    void setDefaultParameters(const QString& name);
-    QString fitTypeString() const;
-    void constrainIntensities(Mantid::API::CompositeFunction_sptr func);
-    QString minimizerString(QString outputName) const;
+private slots:
+  void typeSelection(int index);
+  void newDataLoaded(const QString wsName);
+  void updatePlot();
+  void specMinChanged(int value);
+  void specMaxChanged(int value);
+  void xMinSelected(double val);
+  void xMaxSelected(double val);
+  void backgroundSelected(double val);
+  void propertyChanged(QtProperty *, double);
+  void checkBoxUpdate(QtProperty *prop, bool checked);
+  void singleFit();
+  void plotGuess(QtProperty *);
+  void fitContextMenu(const QPoint &);
+  void fixItem();
+  void unFixItem();
+  void singleFitComplete(bool error);
+  void algorithmComplete(bool error);
 
-    Ui::IqtFit m_uiForm;
-    QtStringPropertyManager* m_stringManager;
-    QtTreePropertyBrowser* m_ffTree; ///< IqtFit Property Browser
-    QtDoublePropertyManager* m_ffRangeManager; ///< StartX and EndX for IqtFit
-    QMap<QtProperty*, QtProperty*> m_fixedProps;
-    Mantid::API::MatrixWorkspace_sptr m_ffInputWS;
-    Mantid::API::MatrixWorkspace_sptr m_ffOutputWS;
-    QString m_ffInputWSName;
-    QString m_ties;
-    Mantid::API::IAlgorithm_sptr m_singleFitAlg;
-    QString m_singleFitOutputName;
+private:
+  boost::shared_ptr<Mantid::API::CompositeFunction>
+  createFunction(bool tie = false);
+  boost::shared_ptr<Mantid::API::IFunction>
+  createUserFunction(const QString &name, bool tie = false);
+  QtProperty *createExponential(const QString &);
+  QtProperty *createStretchedExp(const QString &);
+  void setDefaultParameters(const QString &name);
+  QString fitTypeString() const;
+  void constrainIntensities(Mantid::API::CompositeFunction_sptr func);
+  QString minimizerString(QString outputName) const;
+  std::string constructBaseName(const std::string &inputName,
+                                const long &specMin, const long &specMax);
+  void plotWorkspace();
+  void saveResult();
 
-  };
+  Ui::IqtFit m_uiForm;
+  QtStringPropertyManager *m_stringManager;
+  QtTreePropertyBrowser *m_ffTree;           ///< IqtFit Property Browser
+  QtDoublePropertyManager *m_ffRangeManager; ///< StartX and EndX for IqtFit
+  QMap<QtProperty *, QtProperty *> m_fixedProps;
+  Mantid::API::MatrixWorkspace_sptr m_ffInputWS;
+  Mantid::API::MatrixWorkspace_sptr m_ffOutputWS;
+  QString m_ffInputWSName;
+  QString m_ties;
+  Mantid::API::IAlgorithm_sptr m_singleFitAlg;
+  QString m_singleFitOutputName;
+  std::string m_plotOption;
+  std::string m_baseName;
+};
 } // namespace IDA
 } // namespace CustomInterfaces
 } // namespace MantidQt
diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/IO_MuonGrouping.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/IO_MuonGrouping.h
index 1249bde21142ba1e580e8fd21d322059e52ecbf7..61be6cc772be5a8329a459b9e14e986974429afe 100644
--- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/IO_MuonGrouping.h
+++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/IO_MuonGrouping.h
@@ -62,12 +62,12 @@ MatrixWorkspace_sptr MANTIDQT_CUSTOMINTERFACES_DLL
 groupWorkspace(MatrixWorkspace_const_sptr ws, const Mantid::API::Grouping &g);
 
 /// create 'map' relating group number to row number in group table
-void MANTIDQT_CUSTOMINTERFACES_DLL whichGroupToWhichRow(const Ui::MuonAnalysis& m_uiForm, 
-  std::vector<int>& groupToRow);
+std::vector<int> MANTIDQT_CUSTOMINTERFACES_DLL
+whichGroupToWhichRow(const Ui::MuonAnalysis &m_uiForm);
 
 /// create 'map' relating pair number to row number in pair table
-void MANTIDQT_CUSTOMINTERFACES_DLL whichPairToWhichRow(const Ui::MuonAnalysis& m_uiForm, 
-  std::vector<int>& pairToRow);
+std::vector<int> MANTIDQT_CUSTOMINTERFACES_DLL
+whichPairToWhichRow(const Ui::MuonAnalysis &m_uiForm);
 
 /// Set Group / Group Pair name
 void MANTIDQT_CUSTOMINTERFACES_DLL setGroupGroupPair(Ui::MuonAnalysis& m_uiForm, 
diff --git a/MantidQt/CustomInterfaces/src/EnggDiffraction/EnggDiffractionPresenter.cpp b/MantidQt/CustomInterfaces/src/EnggDiffraction/EnggDiffractionPresenter.cpp
index aefa4de2adbc198c11738f824c8bdbfe5ca6ae9a..34ef070ba26e0713922e8a9de7145f4c0810a45d 100644
--- a/MantidQt/CustomInterfaces/src/EnggDiffraction/EnggDiffractionPresenter.cpp
+++ b/MantidQt/CustomInterfaces/src/EnggDiffraction/EnggDiffractionPresenter.cpp
@@ -68,7 +68,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;
@@ -177,7 +178,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);
 
@@ -210,7 +212,8 @@ void EnggDiffractionPresenter::ProcessCropCalib() {
 
   g_log.notice()
       << "EnggDiffraction GUI: starting cropped calibration. This may "
-         "take a few seconds... " << std::endl;
+         "take a few seconds... "
+      << std::endl;
 
   const std::string outFilename = outputCalibFilename(vanNo, ceriaNo);
 
@@ -406,7 +409,8 @@ void EnggDiffractionPresenter::processRebinTime() {
   g_log.notice() << "EnggDiffraction GUI: starting new pre-processing "
                     "(re-binning) with a TOF bin into workspace '" +
                         outWSName + "'. This "
-                                    "may take some seconds... " << std::endl;
+                                    "may take some seconds... "
+                 << std::endl;
 
   m_view->enableCalibrateAndFocusActions(false);
   // GUI-blocking alternative:
@@ -432,7 +436,8 @@ void EnggDiffractionPresenter::processRebinMultiperiod() {
   g_log.notice() << "EnggDiffraction GUI: starting new pre-processing "
                     "(re-binning) by pulse times into workspace '" +
                         outWSName + "'. This "
-                                    "may take some seconds... " << std::endl;
+                                    "may take some seconds... "
+                 << std::endl;
 
   m_view->enableCalibrateAndFocusActions(false);
   // GUI-blocking alternative:
@@ -468,7 +473,8 @@ void EnggDiffractionPresenter::processStopFocus() {
   if (m_workerThread) {
     if (m_workerThread->isRunning()) {
       g_log.notice() << "A focus process is currently running, shutting "
-                        "it down as soon as possible..." << std::endl;
+                        "it down as soon as possible..."
+                     << std::endl;
 
       g_abortThread = true;
       g_log.warning() << "Focus Stop has been clicked, please wait until "
@@ -806,11 +812,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);
@@ -928,7 +936,8 @@ void EnggDiffractionPresenter::doCalib(const EnggDiffCalibSettings &cs,
   const size_t bankNo2 = 2;
   std::vector<double> difc, tzero;
 
-  if (specNos != "") {
+  bool specNumUsed = specNos != "";
+  if (specNumUsed) {
     difc.resize(bankNo1);
     tzero.resize(bankNo1);
   } else {
@@ -944,21 +953,14 @@ void EnggDiffractionPresenter::doCalib(const EnggDiffCalibSettings &cs,
       alg->setProperty("InputWorkspace", ceriaWS);
       alg->setProperty("VanIntegrationWorkspace", vanIntegWS);
       alg->setProperty("VanCurvesWorkspace", vanCurvesWS);
-      if (specNos != "")
+      if (specNumUsed)
         alg->setPropertyValue(g_calibCropIdentifier,
                               boost::lexical_cast<std::string>(specNos));
       else
         alg->setPropertyValue("Bank", boost::lexical_cast<std::string>(i + 1));
-      // TODO: figure out what should be done about the list of expected peaks
-      // to EnggCalibrate => it should be a default, as in EnggFitPeaks, that
-      // should be fixed in a nother ticket/issue
-      alg->setPropertyValue(
-          "ExpectedPeaks",
-          "3.1243, 2.7057, 1.9132, 1.6316, 1.5621, "
-          "1.3529, 1.2415, 1.2100, 1.1046, 1.0414, 0.9566, 0.9147, 0.9019, "
-          "0.8556, 0.8252, 0.8158, 0.7811");
+
       const std::string outFitParamsTblName =
-          "engggui_calibration_bank_" + boost::lexical_cast<std::string>(i + 1);
+          outFitParamsTblNameGenerator(specNos, i);
       alg->setPropertyValue("FittedPeaks", outFitParamsTblName);
       alg->setPropertyValue("OutputParametersTableName", outFitParamsTblName);
       alg->execute();
@@ -976,7 +978,6 @@ void EnggDiffractionPresenter::doCalib(const EnggDiffCalibSettings &cs,
                    << "difc: " << difc[i] << ", zero: " << tzero[i]
                    << std::endl;
   }
-
   // Creates appropriate directory
   Poco::Path saveDir = outFilesDir("Calibration");
 
@@ -990,6 +991,10 @@ void EnggDiffractionPresenter::doCalib(const EnggDiffCalibSettings &cs,
   m_view->writeOutCalibFile(outFullPath.toString(), difc, tzero);
   g_log.notice() << "Calibration file written as " << outFullPath.toString()
                  << std::endl;
+
+  // plots the calibrated workspaces.
+  g_plottingCounter++;
+  plotCalibWorkspace(difc, tzero, specNos);
 }
 
 /**
@@ -1232,7 +1237,8 @@ void EnggDiffractionPresenter::doFocusRun(const std::string &dir,
     g_lastValidRun = runNo;
 
     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();
@@ -1275,7 +1281,8 @@ void EnggDiffractionPresenter::doFocusRun(const std::string &dir,
           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();
         }
@@ -1291,8 +1298,8 @@ void EnggDiffractionPresenter::doFocusRun(const std::string &dir,
           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 {
         m_focusFinishedOK = false;
         doFocusing(cs, fullFilename, runNo, bankIDs[idx], specs[idx], dgFile);
@@ -1305,8 +1312,8 @@ void EnggDiffractionPresenter::doFocusRun(const std::string &dir,
       } 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;
       }
     }
 
@@ -1402,7 +1409,8 @@ void EnggDiffractionPresenter::focusingFinished() {
     if (lastRun != lastValid) {
       g_log.warning()
           << "Focussing process has been stopped, last successful "
-             "run number: " << g_lastValidRun
+             "run number: "
+          << g_lastValidRun
           << " , total number of focus run that could not be processed: "
           << (lastRun - lastValid) << std::endl;
     }
@@ -1481,7 +1489,8 @@ void EnggDiffractionPresenter::doFocusing(const EnggDiffCalibSettings &cs,
 
     if (multi_RunNo.size() == 1) {
       g_log.notice() << "Only single file has been listed, the Sum Of Files"
-                        "cannot not be processed" << std::endl;
+                        "cannot not be processed"
+                     << std::endl;
     } else {
       g_log.notice()
           << "Load alogirthm has successfully merged the files provided"
@@ -1583,7 +1592,7 @@ void EnggDiffractionPresenter::doFocusing(const EnggDiffCalibSettings &cs,
   g_log.notice() << "Saved focused workspace as file: " << fullFilename
                  << std::endl;
 
-  bool saveOutputFiles = m_view->saveOutputFiles();
+  bool saveOutputFiles = m_view->saveFocusedOutputFiles();
 
   if (saveOutputFiles) {
     try {
@@ -1647,7 +1656,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. "
@@ -1656,14 +1666,15 @@ 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 {
     g_log.notice() << "Found precalculated Vanadium correction features for "
-                      "Vanadium run " << vanNo
-                   << ". Re-using these files: " << preIntegFilename << ", and "
-                   << preCurvesFilename << std::endl;
+                      "Vanadium run "
+                   << vanNo << ". Re-using these files: " << preIntegFilename
+                   << ", and " << preCurvesFilename << std::endl;
     try {
       loadVanadiumPrecalcWorkspaces(preIntegFilename, preCurvesFilename,
                                     vanIntegWS, vanCurvesWS, vanNo);
@@ -1897,14 +1908,15 @@ void EnggDiffractionPresenter::doRebinningTime(const std::string &runNo,
   } catch (std::invalid_argument &ia) {
     g_log.error() << "Error when rebinning with a regular bin width in time. "
                      "There was an error in the inputs to the algorithm " +
-                         rebinName + ". Error description: " + ia.what() +
-                         "." << std::endl;
+                         rebinName + ". Error description: " + ia.what() + "."
+                  << std::endl;
     return;
   } catch (std::runtime_error &re) {
     g_log.error() << "Error when rebinning with a regular bin width in time. "
                      "Coult not run the algorithm " +
                          rebinName + " successfully. Error description: " +
-                         re.what() + "." << std::endl;
+                         re.what() + "."
+                  << std::endl;
     return;
   }
 
@@ -2000,14 +2012,15 @@ void EnggDiffractionPresenter::doRebinningPulses(const std::string &runNo,
   } catch (std::invalid_argument &ia) {
     g_log.error() << "Error when rebinning by pulse times. "
                      "There was an error in the inputs to the algorithm " +
-                         rebinName + ". Error description: " + ia.what() +
-                         "." << std::endl;
+                         rebinName + ". Error description: " + ia.what() + "."
+                  << std::endl;
     return;
   } catch (std::runtime_error &re) {
     g_log.error() << "Error when rebinning by pulse times. "
                      "Coult not run the algorithm " +
                          rebinName + " successfully. Error description: " +
-                         re.what() + "." << std::endl;
+                         re.what() + "."
+                  << std::endl;
     return;
   }
 
@@ -2061,7 +2074,8 @@ void EnggDiffractionPresenter::rebinningFinished() {
         << std::endl;
   } else {
     g_log.notice() << "Pre-processing (re-binning) finished - the output "
-                      "workspace is ready." << std::endl;
+                      "workspace is ready."
+                   << std::endl;
   }
   if (m_workerThread) {
     delete m_workerThread;
@@ -2086,7 +2100,7 @@ void EnggDiffractionPresenter::plotFocusedWorkspace(std::string outWSName) {
       if (g_plottingCounter == 1)
         m_view->plotFocusedSpectrum(outWSName);
       else
-        m_view->plotReplacingWindow(outWSName);
+        m_view->plotReplacingWindow(outWSName, "0", "0");
 
     } else if (plotType == PlotMode::WATERFALL) {
       if (g_plottingCounter == 1)
@@ -2100,6 +2114,33 @@ void EnggDiffractionPresenter::plotFocusedWorkspace(std::string outWSName) {
   }
 }
 
+/**
+* Check if the plot calibration check-box is ticked
+* python script is passed on to mantid python window
+* which plots the workspaces with customisation
+*
+* @param difc vector of double passed on to py script
+* @param tzero vector of double to plot graph
+* @param specNos string carrying cropped calib info
+*/
+void EnggDiffractionPresenter::plotCalibWorkspace(std::vector<double> difc,
+                                                  std::vector<double> tzero,
+                                                  std::string specNos) {
+  const bool plotCalibWS = m_view->plotCalibWorkspace();
+  if (plotCalibWS) {
+    if (g_plottingCounter == 1) {
+      m_view->plotVanCurvesCalibOutput();
+    } else {
+      m_view->plotReplacingWindow("engggui_vanadium_curves_ws", "[0, 1, 2]",
+                                  "2");
+    }
+    const std::string pythonCode =
+        DifcZeroWorkspaceFactory(difc, tzero, specNos) +
+        plotDifcZeroWorkspace();
+    m_view->plotDifcZeroCalibOutput(pythonCode);
+  }
+}
+
 /**
 * Convert the generated output files and saves them in
 * FocusedXYE format
@@ -2275,6 +2316,155 @@ std::string EnggDiffractionPresenter::outFileNameFactory(
   return fullFilename;
 }
 
+/**
+* Generates the workspace with difc/zero according to the selected bank
+*
+* @param difc vector containing constants difc value of each bank
+* @param tzero vector containing constants tzero value of each bank
+* @param specNo used to set range for Calibration Cropped
+*
+* @return string with a python script
+*/
+std::string EnggDiffractionPresenter::DifcZeroWorkspaceFactory(
+    const std::vector<double> &difc, const std::vector<double> &tzero,
+    const std::string &specNo) const {
+
+  size_t bank1 = size_t(0);
+  size_t bank2 = size_t(1);
+  std::string pyRange;
+  std::string plotSpecNum = "False";
+
+  // sets the range to plot appropriate graph for the particular bank
+  if (specNo == "North") {
+    // only enable script to plot bank 1
+    pyRange = "1, 2";
+  } else if (specNo == "South") {
+    // only enables python script to plot bank 2
+    // as bank 2 data will be located in difc[0] & tzero[0] - refactor
+    pyRange = "2, 3";
+    bank2 = size_t(0);
+  } else if (specNo != "") {
+    pyRange = "1, 2";
+    plotSpecNum = "True";
+  } else {
+    // enables python script to plot bank 1 & 2
+    pyRange = "1, 3";
+  }
+
+  std::string pyCode =
+      "plotSpecNum = " + plotSpecNum + "\n"
+                                       "for i in range(" +
+      pyRange +
+      "):\n"
+
+      " if (plotSpecNum == False):\n"
+      "  bank_ws = workspace(\"engggui_calibration_bank_\" + str(i))\n"
+      " else:\n"
+      "  bank_ws = workspace(\"engggui_calibration_bank_cropped\")\n"
+
+      " xVal = []\n"
+      " yVal = []\n"
+      " y2Val = []\n"
+
+      " if (i == 1):\n"
+      "  difc=" +
+      boost::lexical_cast<std::string>(difc[bank1]) + "\n" + "  tzero=" +
+      boost::lexical_cast<std::string>(tzero[bank1]) + "\n" + " else:\n"
+
+                                                              "  difc=" +
+      boost::lexical_cast<std::string>(difc[bank2]) + "\n" + "  tzero=" +
+      boost::lexical_cast<std::string>(tzero[bank2]) + "\n" +
+
+      " for irow in range(0, bank_ws.rowCount()):\n"
+      "  xVal.append(bank_ws.cell(irow, 0))\n"
+      "  yVal.append(bank_ws.cell(irow, 5))\n"
+
+      "  y2Val.append(xVal[irow] * difc + tzero)\n"
+
+      " ws1 = CreateWorkspace(DataX=xVal, DataY=yVal, UnitX=\"Expected "
+      "Peaks "
+      " Centre(dSpacing, A)\", YUnitLabel = \"Fitted Peaks Centre(TOF, "
+      "us)\")\n"
+      " ws2 = CreateWorkspace(DataX=xVal, DataY=y2Val)\n";
+  return pyCode;
+}
+
+/**
+* Plot the workspace with difc/zero acordding to selected bank
+*
+* @return string with a python script which will merge with
+*
+
+*/
+std::string EnggDiffractionPresenter::plotDifcZeroWorkspace() const {
+  std::string pyCode =
+      // plotSpecNum is true when SpectrumIDs being used
+      " if (plotSpecNum == False):\n"
+      "  output_ws = \"engggui_difc_zero_peaks_bank_\" + str(i)\n"
+      " else:\n"
+      "  output_ws = \"engggui_difc_zero_peaks_cropped\"\n"
+
+      // delete workspace if exists within ADS already
+      " if(mtd.doesExist(output_ws)):\n"
+      "  DeleteWorkspace(output_ws)\n"
+
+      // append workspace with peaks data for Peaks Fitted
+      // and Difc/TZero Straight line
+      " AppendSpectra(ws1, ws2, OutputWorkspace=output_ws)\n"
+      " DeleteWorkspace(ws1)\n"
+      " DeleteWorkspace(ws2)\n"
+
+      " if (plotSpecNum == False):\n"
+      "  DifcZero = \"engggui_difc_zero_peaks_bank_\" + str(i)\n"
+      " else:\n"
+      "  DifcZero = \"engggui_difc_zero_peaks_cropped\"\n"
+
+      " DifcZeroWs = workspace(DifcZero)\n"
+      " DifcZeroPlot = plotSpectrum(DifcZeroWs, [0, 1]).activeLayer()\n"
+
+      " if (plotSpecNum == False):\n"
+      "  DifcZeroPlot.setTitle(\"Engg Gui Difc Zero Peaks Bank \" + "
+      "str(i))\n"
+      " else:\n"
+      "  DifcZeroPlot.setTitle(\"Engg Gui Difc Zero Peaks Cropped\")\n"
+
+      // set the legend title
+      " DifcZeroPlot.setCurveTitle(0, \"Peaks Fitted\")\n"
+      " DifcZeroPlot.setCurveTitle(1, \"DifC/TZero Fitted Straight Line\")\n"
+      " DifcZeroPlot.setAxisTitle(Layer.Bottom, \"Expected Peaks "
+      "Centre(dSpacing, "
+      " A)\")\n"
+      " DifcZeroPlot.setCurveLineStyle(0, QtCore.Qt.DotLine)\n";
+
+  return pyCode;
+}
+
+/**
+* Generates appropriate names for table workspaces
+*
+* @param specNos specIDs or bank name to be passed
+* @param bank_i current loop of the bank during calibration
+*/
+std::string
+EnggDiffractionPresenter::outFitParamsTblNameGenerator(std::string specNos,
+                                                       size_t bank_i) {
+  std::string outFitParamsTblName;
+  bool specNumUsed = specNos != "";
+
+  if (specNumUsed) {
+    if (specNos == "North")
+      outFitParamsTblName = "engggui_calibration_bank_1";
+    else if (specNos == "South")
+      outFitParamsTblName = "engggui_calibration_bank_2";
+    else
+      outFitParamsTblName = "engggui_calibration_bank_cropped";
+  } else {
+    outFitParamsTblName = "engggui_calibration_bank_" +
+                          boost::lexical_cast<std::string>(bank_i + 1);
+  }
+  return outFitParamsTblName;
+}
+
 /**
 * Generates a directory if not found and handles the path
 *
diff --git a/MantidQt/CustomInterfaces/src/EnggDiffraction/EnggDiffractionViewQtGUI.cpp b/MantidQt/CustomInterfaces/src/EnggDiffraction/EnggDiffractionViewQtGUI.cpp
index f0bb446e50e44dd82f6d855b4805d7e94d9b36ec..aedaf321141eef3630f9a9a73beb0178914a9670 100644
--- a/MantidQt/CustomInterfaces/src/EnggDiffraction/EnggDiffractionViewQtGUI.cpp
+++ b/MantidQt/CustomInterfaces/src/EnggDiffraction/EnggDiffractionViewQtGUI.cpp
@@ -260,6 +260,9 @@ void EnggDiffractionViewQtGUI::readSettings() {
 
   m_uiTabCalib.comboBox_calib_cropped_bank_name->setCurrentIndex(0);
 
+  m_uiTabCalib.checkBox_PlotData_Calib->setChecked(
+      qs.value("user-param-calib-plot-data", true).toBool());
+
   // user params - focusing
   m_uiTabFocus.lineEdit_run_num->setUserInput(
       qs.value("user-params-focus-runno", "").toString());
@@ -365,6 +368,9 @@ void EnggDiffractionViewQtGUI::saveSettings() const {
   qs.setValue("user-params-calib-cropped-group-checkbox",
               m_uiTabCalib.groupBox_calib_cropped->isChecked());
 
+  qs.setValue("user-param-calib-plot-data",
+              m_uiTabCalib.checkBox_PlotData_Calib->isChecked());
+
   // user params - focusing
   qs.setValue("user-params-focus-runno",
               m_uiTabFocus.lineEdit_run_num->getText());
@@ -531,6 +537,7 @@ void EnggDiffractionViewQtGUI::enableCalibrateAndFocusActions(bool enable) {
   m_uiTabCalib.groupBox_calib_cropped->setEnabled(enable);
   m_uiTabCalib.pushButton_new_cropped_calib->setEnabled(enable);
   m_ui.pushButton_close->setEnabled(enable);
+  m_uiTabCalib.checkBox_PlotData_Calib->setEnabled(enable);
 
   // focus
   m_uiTabFocus.lineEdit_run_num->setEnabled(enable);
@@ -600,10 +607,12 @@ void EnggDiffractionViewQtGUI::plotWaterfallSpectrum(
   m_presenter->notify(IEnggDiffractionPresenter::LogMsg);
 }
 
-void EnggDiffractionViewQtGUI::plotReplacingWindow(const std::string &wsName) {
-  std::string pyCode =
-      "plotSpectrum('" + wsName +
-      "', 0, error_bars=False, type=0, window=win, clearWindow=True)";
+void EnggDiffractionViewQtGUI::plotReplacingWindow(const std::string &wsName,
+                                                   const std::string &spectrum,
+                                                   const std::string &type) {
+  std::string pyCode = "win=plotSpectrum('" + wsName + "', " + spectrum +
+                       ", error_bars=False, type=" + type +
+                       ", window=win, clearWindow=True)";
   std::string status =
       runPythonCode(QString::fromStdString(pyCode), false).toStdString();
 
@@ -612,6 +621,31 @@ void EnggDiffractionViewQtGUI::plotReplacingWindow(const std::string &wsName) {
   m_presenter->notify(IEnggDiffractionPresenter::LogMsg);
 }
 
+void EnggDiffractionViewQtGUI::plotVanCurvesCalibOutput() {
+  std::string pyCode =
+      "van_curves_ws = workspace(\"engggui_vanadium_curves_ws\")\n"
+      "win = plotSpectrum(van_curves_ws, [0, 1, 2])";
+
+  std::string status =
+      runPythonCode(QString::fromStdString(pyCode), false).toStdString();
+
+  m_logMsgs.push_back(
+      "Plotted output calibration vanadium curves, with status string " +
+      status);
+  m_presenter->notify(IEnggDiffractionPresenter::LogMsg);
+}
+
+void EnggDiffractionViewQtGUI::plotDifcZeroCalibOutput(
+    const std::string &pyCode) {
+
+  std::string status =
+      runPythonCode(QString::fromStdString(pyCode), false).toStdString();
+
+  m_logMsgs.push_back(
+      "Plotted output calibration ceria peaks, 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);
@@ -893,7 +927,11 @@ bool EnggDiffractionViewQtGUI::focusedOutWorkspace() const {
   return m_uiTabFocus.checkBox_FocusedWS->checkState();
 }
 
-bool EnggDiffractionViewQtGUI::saveOutputFiles() const {
+bool EnggDiffractionViewQtGUI::plotCalibWorkspace() const {
+  return m_uiTabCalib.checkBox_PlotData_Calib->checkState();
+}
+
+bool EnggDiffractionViewQtGUI::saveFocusedOutputFiles() const {
   return m_uiTabFocus.checkBox_SaveOutputFiles->checkState();
 }
 
diff --git a/MantidQt/CustomInterfaces/src/Indirect/IqtFit.cpp b/MantidQt/CustomInterfaces/src/Indirect/IqtFit.cpp
index 81118fdbcf6d07b7c87170f0234a7f15c8618e34..c27c577d2ece459fa7b369d8083bda44dfc130a4 100644
--- a/MantidQt/CustomInterfaces/src/Indirect/IqtFit.cpp
+++ b/MantidQt/CustomInterfaces/src/Indirect/IqtFit.cpp
@@ -159,13 +159,22 @@ void IqtFit::run() {
 
   func->applyTies();
 
-  std::string function = std::string(func->asString());
-  QString fitType = fitTypeString();
-  QString specMin = m_uiForm.spSpectraMin->text();
-  QString specMax = m_uiForm.spSpectraMax->text();
+  const auto function = std::string(func->asString());
+  const auto fitType = fitTypeString();
+  const long specMin = m_uiForm.spSpectraMin->value();
+  const long specMax = m_uiForm.spSpectraMax->value();
+  const auto minimizer = minimizerString("$outputname_$wsindex");
+  const auto save = m_uiForm.ckSave->isChecked();
+  m_plotOption = m_uiForm.cbPlotType->currentText().toStdString();
+  const auto startX = boost::lexical_cast<double>(
+      m_properties["StartX"]->valueText().toStdString());
+  const auto endX = boost::lexical_cast<double>(
+      m_properties["EndX"]->valueText().toStdString());
+  const auto maxIt = boost::lexical_cast<long>(
+      m_properties["MaxIterations"]->valueText().toStdString());
 
   QString pyInput =
-      "from IndirectDataAnalysis import furyfitSeq, furyfitMult\n"
+      "from IndirectDataAnalysis import furyfitSeq\n"
       "input = '" +
       m_ffInputWSName + "'\n"
                         "func = r'" +
@@ -177,15 +186,15 @@ void IqtFit::run() {
                                             "endx = " +
       m_properties["EndX"]->valueText() + "\n"
                                           "plot = '" +
-      m_uiForm.cbPlotType->currentText() + "'\n"
-                                           "spec_min = " +
-      specMin + "\n"
-                "spec_max = " +
-      specMax + "\n"
-                "spec_max = None\n"
-                "minimizer = '" +
-      minimizerString("$outputname_$wsindex") + "'\n"
-                                                "max_iterations = " +
+      QString::fromStdString(m_plotOption) + "'\n"
+                                             "spec_min = " +
+      QString::number(specMin) + "\n"
+                                 "spec_max = " +
+      QString::number(specMax) + "\n"
+                                 "spec_max = None\n"
+                                 "minimizer = '" +
+      minimizer + "'\n"
+                  "max_iterations = " +
       QString::number(m_dblManager->value(m_properties["MaxIterations"])) +
       "\n";
 
@@ -194,7 +203,7 @@ void IqtFit::run() {
   else
     pyInput += "constrain_intens = False \n";
 
-  if (m_uiForm.ckSave->isChecked())
+  if (save)
     pyInput += "save = True\n";
   else
     pyInput += "save = False\n";
@@ -205,24 +214,115 @@ void IqtFit::run() {
                "intensities_constrained=constrain_intens, Save=save, "
                "Plot=plot, minimizer=minimizer, "
                "max_iterations=max_iterations)\n";
+
+    QString pyOutput = runPythonCode(pyInput);
+
+    // Set the result workspace for Python script export
+    QString inputWsName = QString::fromStdString(m_ffInputWS->getName());
+    QString resultWsName = inputWsName.left(inputWsName.lastIndexOf("_")) +
+                           "_fury_" + fitType + QString::number(specMin) +
+                           "_to_" + QString::number(specMax) + "_Workspaces";
+    m_pythonExportWsName = resultWsName.toStdString();
+    updatePlot();
+
   } else {
-    pyInput += "furyfitMult(input, func, ftype, startx, endx, "
-               "spec_min=spec_min, spec_max=spec_max, "
-               "intensities_constrained=constrain_intens, Save=save, "
-               "Plot=plot, minimizer=minimizer, "
-               "max_iterations=max_iterations)\n";
+    m_baseName =
+        constructBaseName(m_ffInputWSName.toStdString(), specMin, specMax);
+    auto iqtFitMultiple = AlgorithmManager::Instance().create("IqtFitMultiple");
+    iqtFitMultiple->initialize();
+    iqtFitMultiple->setProperty("InputWorkspace",
+                                m_ffInputWSName.toStdString());
+    iqtFitMultiple->setProperty("Function", function);
+    iqtFitMultiple->setProperty("FitType", fitType.toStdString());
+    iqtFitMultiple->setProperty("StartX", startX);
+    iqtFitMultiple->setProperty("EndX", endX);
+    iqtFitMultiple->setProperty("SpecMin", specMin);
+    iqtFitMultiple->setProperty("SpecMax", specMax);
+    iqtFitMultiple->setProperty("Minimizer", minimizer.toStdString());
+    iqtFitMultiple->setProperty("MaxIterations", maxIt);
+    iqtFitMultiple->setProperty("ConstrainIntensities", constrainIntens);
+    iqtFitMultiple->setProperty("OutputResultWorkspace",
+                                m_baseName + "_Result");
+    iqtFitMultiple->setProperty("OutputParameterWorkspace",
+                                m_baseName + "_Parameters");
+    iqtFitMultiple->setProperty("OutputWorkspaceGroup",
+                                m_baseName + "_Workspaces");
+    m_pythonExportWsName = (m_baseName + "_Workspaces");
+    m_batchAlgoRunner->addAlgorithm(iqtFitMultiple);
+    connect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this,
+            SLOT(algorithmComplete(bool)));
+    m_batchAlgoRunner->executeBatchAsync();
   }
+}
 
-  QString pyOutput = runPythonCode(pyInput);
+/**
+ * Plot workspace based on user input
+ */
+void IqtFit::plotWorkspace() {
+  auto resultWs = AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>(
+      m_baseName + "_Result");
+  if (!(m_plotOption.compare("None") == 0)) {
+    if (m_plotOption.compare("All") == 0) {
+      int specEnd = (int)resultWs->getNumberHistograms();
+      for (int i = 0; i < specEnd; i++) {
+        IndirectTab::plotSpectrum(QString::fromStdString(resultWs->getName()),
+                                  i, i);
+      }
+    } else {
+      int specNumber = m_uiForm.cbPlotType->currentIndex();
+      IndirectTab::plotSpectrum(QString::fromStdString(resultWs->getName()),
+                                specNumber, specNumber);
+    }
+  }
+}
 
-  // Set the result workspace for Python script export
-  QString inputWsName = QString::fromStdString(m_ffInputWS->getName());
-  QString resultWsName = inputWsName.left(inputWsName.lastIndexOf("_")) +
-                         "_fury_" + fitType + specMin + "_to_" + specMax +
-                         "_Workspaces";
-  m_pythonExportWsName = resultWsName.toStdString();
+/**
+ * Save the result of the algorithm
+ */
+void IqtFit::saveResult() {
+  if (m_uiForm.ckSave->isChecked()) {
+    const auto workingdirectory =
+        Mantid::Kernel::ConfigService::Instance().getString(
+            "defaultsave.directory");
+    const auto filepath = workingdirectory + m_baseName + "_Result.nxs";
+    addSaveWorkspaceToQueue(QString::fromStdString(m_baseName + "_Result"),
+                            QString::fromStdString(filepath));
+    m_batchAlgoRunner->executeBatchAsync();
+  }
+}
 
+/**
+* Handles completion of the IqtFitMultiple algorithm.
+* @param error True if the algorithm was stopped due to error, false otherwise
+*/
+void IqtFit::algorithmComplete(bool error) {
+  disconnect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this,
+             SLOT(algorithmComplete(bool)));
+  if (error)
+    return;
   updatePlot();
+  plotWorkspace();
+  saveResult();
+}
+
+/**
+ * Constructs the desired output base name for the  IqtFitMultiple
+ * @param inputName		:: Name of the inputworkspace
+ * @param specMin		:: Minimum number of spectra being fitted
+ * @param specMax		:: Maximum number of spectra being fitted
+ * @return the base name
+ */
+std::string IqtFit::constructBaseName(const std::string &inputName,
+                                      const long &specMin,
+                                      const long &specMax) {
+  QString baseName = QString::fromStdString(inputName);
+  baseName = baseName.left(baseName.lastIndexOf("_"));
+  baseName += "_Iqt_1Smult_s";
+  baseName += QString::number(specMin);
+  baseName += "_to_";
+  baseName += QString::number(specMax);
+  const auto baseName_str = baseName.toStdString();
+  return baseName_str;
 }
 
 bool IqtFit::validate() {
@@ -401,28 +501,28 @@ void IqtFit::typeSelection(int index) {
     m_ffTree->addProperty(m_properties["Exponential1"]);
 
     // remove option to plot beta and add all
-	m_uiForm.cbPlotType->removeItem(4);
+    m_uiForm.cbPlotType->removeItem(4);
     m_uiForm.cbPlotType->removeItem(3);
-	m_uiForm.cbPlotType->addItem("All");
+    m_uiForm.cbPlotType->addItem("All");
     break;
   case 1:
     m_ffTree->addProperty(m_properties["Exponential1"]);
     m_ffTree->addProperty(m_properties["Exponential2"]);
 
     // remove option to plot beta and add all
-	m_uiForm.cbPlotType->removeItem(4);
-	m_uiForm.cbPlotType->removeItem(3);
+    m_uiForm.cbPlotType->removeItem(4);
+    m_uiForm.cbPlotType->removeItem(3);
 
-	m_uiForm.cbPlotType->addItem("All");
+    m_uiForm.cbPlotType->addItem("All");
     break;
   case 2:
     m_ffTree->addProperty(m_properties["StretchedExp"]);
 
-	// add option to plot beta and all
-	m_uiForm.cbPlotType->removeItem(4);
-	m_uiForm.cbPlotType->removeItem(3);
-	m_uiForm.cbPlotType->addItem("Beta");
-	m_uiForm.cbPlotType->addItem("All");
+    // add option to plot beta and all
+    m_uiForm.cbPlotType->removeItem(4);
+    m_uiForm.cbPlotType->removeItem(3);
+    m_uiForm.cbPlotType->addItem("Beta");
+    m_uiForm.cbPlotType->addItem("All");
 
     break;
   case 3:
@@ -430,10 +530,10 @@ void IqtFit::typeSelection(int index) {
     m_ffTree->addProperty(m_properties["StretchedExp"]);
 
     // add option to plot beta and all
-	m_uiForm.cbPlotType->removeItem(4);
-	m_uiForm.cbPlotType->removeItem(3);
-	m_uiForm.cbPlotType->addItem("Beta");
-	m_uiForm.cbPlotType->addItem("All");
+    m_uiForm.cbPlotType->removeItem(4);
+    m_uiForm.cbPlotType->removeItem(3);
+    m_uiForm.cbPlotType->addItem("Beta");
+    m_uiForm.cbPlotType->addItem("All");
 
     break;
   }
diff --git a/MantidQt/CustomInterfaces/src/Muon/IO_MuonGrouping.cpp b/MantidQt/CustomInterfaces/src/Muon/IO_MuonGrouping.cpp
index d888b4d5fe2dbba068b10e3b089f84f3effb128c..db209438fcff363d54845016e36190573d278798 100644
--- a/MantidQt/CustomInterfaces/src/Muon/IO_MuonGrouping.cpp
+++ b/MantidQt/CustomInterfaces/src/Muon/IO_MuonGrouping.cpp
@@ -118,8 +118,7 @@ void parseGroupingTable(const Ui::MuonAnalysis &form,
   g.description = form.groupDescription->text().toStdString();
 
   // Parse grouping info
-  std::vector<int> groupToRow;
-  whichGroupToWhichRow(form, groupToRow);
+  std::vector<int> groupToRow = whichGroupToWhichRow(form);
 
   // Resize group arrays
   g.groupNames.resize(groupToRow.size());
@@ -133,8 +132,7 @@ void parseGroupingTable(const Ui::MuonAnalysis &form,
   }
 
   // Parse pair info
-  std::vector<int> pairToRow;
-  whichPairToWhichRow(form, pairToRow);
+  std::vector<int> pairToRow = whichPairToWhichRow(form);
 
   // Resize pair arrays
   g.pairNames.resize(pairToRow.size());
@@ -264,11 +262,10 @@ MatrixWorkspace_sptr groupWorkspace(MatrixWorkspace_const_sptr ws,
  * create 'map' relating group number to row number in group table
  *
  * @param m_uiForm :: The UI form
- * @param groupToRow :: The 'map' returned
+ * @returns :: The 'map' of group number to table row number
  */
-void whichGroupToWhichRow(const Ui::MuonAnalysis& m_uiForm, std::vector<int>& groupToRow)
-{
-  groupToRow.clear();
+std::vector<int> whichGroupToWhichRow(const Ui::MuonAnalysis &m_uiForm) {
+  std::vector<int> groupToRow;
 
   int numRows = m_uiForm.groupTable->rowCount();
   for (int i = 0; i < numRows; i++)
@@ -297,6 +294,7 @@ void whichGroupToWhichRow(const Ui::MuonAnalysis& m_uiForm, std::vector<int>& gr
 
     groupToRow.push_back(i);
   }
+  return groupToRow;
 }
 
 
@@ -304,11 +302,10 @@ void whichGroupToWhichRow(const Ui::MuonAnalysis& m_uiForm, std::vector<int>& gr
  * create 'map' relating pair number to row number in pair table
  *
  * @param m_uiForm :: The UI form
- * @param pairToRow :: The 'map' returned
+ * @returns :: The 'map' of pair number to table row number
  */
-void whichPairToWhichRow(const Ui::MuonAnalysis& m_uiForm, std::vector<int>& pairToRow)
-{
-  pairToRow.clear();
+std::vector<int> whichPairToWhichRow(const Ui::MuonAnalysis &m_uiForm) {
+  std::vector<int> pairToRow;
 
   int numRows = m_uiForm.pairTable->rowCount();
   for (int i = 0; i < numRows; i++)
@@ -337,6 +334,7 @@ void whichPairToWhichRow(const Ui::MuonAnalysis& m_uiForm, std::vector<int>& pai
 
     pairToRow.push_back(i);
   }
+  return pairToRow;
 }
 
 /**
diff --git a/MantidQt/CustomInterfaces/src/Muon/MuonAnalysis.cpp b/MantidQt/CustomInterfaces/src/Muon/MuonAnalysis.cpp
index 476864aac116dfad108ddc6a91d9a5a7e31853c2..581c6032dce800ed8509db3517a31859d2399c13 100644
--- a/MantidQt/CustomInterfaces/src/Muon/MuonAnalysis.cpp
+++ b/MantidQt/CustomInterfaces/src/Muon/MuonAnalysis.cpp
@@ -36,7 +36,6 @@
 #include <Poco/StringTokenizer.h>
 
 #include <boost/lexical_cast.hpp>
-#include <boost/assign.hpp>
 
 #include <algorithm>
 
@@ -59,12 +58,10 @@
 
 #include <fstream>
 
-//Add this class to the list of specialised dialogs in this namespace
-namespace MantidQt
-{
-namespace CustomInterfaces
-{
-  DECLARE_SUBWINDOW(MuonAnalysis)
+// Add this class to the list of specialised dialogs in this namespace
+namespace MantidQt {
+namespace CustomInterfaces {
+DECLARE_SUBWINDOW(MuonAnalysis)
 
 using namespace Mantid::API;
 using namespace Mantid::Kernel;
@@ -75,10 +72,9 @@ using namespace Mantid::Geometry;
 using Mantid::API::Workspace_sptr;
 using Mantid::API::Grouping;
 
-namespace
-{
-  /// static logger
-  Mantid::Kernel::Logger g_log("MuonAnalysis");
+namespace {
+/// static logger
+Mantid::Kernel::Logger g_log("MuonAnalysis");
 }
 
 // Static constants
@@ -103,10 +99,9 @@ MuonAnalysis::MuonAnalysis(QWidget *parent)
       m_currentLabel("NoLabelSet"), m_numPeriods(0) {}
 
 /**
- * Initialize local Python environmnet. 
+ * Initialize local Python environmnet.
  */
-void MuonAnalysis::initLocalPython()
-{
+void MuonAnalysis::initLocalPython() {
   QString code;
 
   code += "from mantid.simpleapi import *\n";
@@ -117,48 +112,52 @@ void MuonAnalysis::initLocalPython()
 
   runPythonCode(code);
 
-  // TODO: Following shouldn't be here. It is now because ApplicationWindow sets up the Python 
+  // TODO: Following shouldn't be here. It is now because ApplicationWindow sets
+  // up the Python
   // environment only after the UserSubWindow is shown.
 
   // Hide the toolbars, if user wants to
-  if(m_uiForm.hideToolbars->isChecked())
+  if (m_uiForm.hideToolbars->isChecked())
     emit setToolbarsHidden(true);
 }
 
 /// Set up the dialog layout
-void MuonAnalysis::initLayout()
-{
+void MuonAnalysis::initLayout() {
   m_uiForm.setupUi(this);
 
   std::set<std::string> supportedFacilities;
   supportedFacilities.insert("ISIS");
   supportedFacilities.insert("SmuS");
 
-  const std::string userFacility = ConfigService::Instance().getFacility().name();
+  const std::string userFacility =
+      ConfigService::Instance().getFacility().name();
 
-  // Allow to load current run for ISIS only 
-  if ( userFacility != "ISIS" )
+  // Allow to load current run for ISIS only
+  if (userFacility != "ISIS")
     m_uiForm.loadCurrent->setDisabled(true);
 
-  // If facility if not supported by the interface - show a warning, but still open it
-  if ( supportedFacilities.find(userFacility) == supportedFacilities.end() )
-  {
-    const std::string supportedFacilitiesStr = Strings::join(supportedFacilities.begin(), 
-      supportedFacilities.end(), ", ");
+  // If facility if not supported by the interface - show a warning, but still
+  // open it
+  if (supportedFacilities.find(userFacility) == supportedFacilities.end()) {
+    const std::string supportedFacilitiesStr = Strings::join(
+        supportedFacilities.begin(), supportedFacilities.end(), ", ");
 
-    const QString errorTemplate = 
-      "Your facility (%1) is not supported by MuonAnalysis, so you will not be able to load any files. \n\n"
-      "Supported facilities are: %2. \n\n" 
-      "Please use Preferences -> Mantid -> Instrument to update your facility information.";
+    const QString errorTemplate =
+        "Your facility (%1) is not supported by MuonAnalysis, so you will not "
+        "be able to load any files. \n\n"
+        "Supported facilities are: %2. \n\n"
+        "Please use Preferences -> Mantid -> Instrument to update your "
+        "facility information.";
 
-    const QString error = errorTemplate.arg( userFacility.c_str(), supportedFacilitiesStr.c_str() );
+    const QString error =
+        errorTemplate.arg(userFacility.c_str(), supportedFacilitiesStr.c_str());
 
     QMessageBox::warning(this, "Unsupported facility", error);
   }
 
   m_uiForm.fitBrowser->init();
-  connect( m_uiForm.fitBrowser, SIGNAL(sequentialFitRequested()), 
-           this, SLOT(openSequentialFitDialog()) );
+  connect(m_uiForm.fitBrowser, SIGNAL(sequentialFitRequested()), this,
+          SLOT(openSequentialFitDialog()));
 
   // alow appending files
   m_uiForm.mwRunFiles->allowMultipleFiles(true);
@@ -167,8 +166,10 @@ void MuonAnalysis::initLayout()
   startUpLook();
   m_uiForm.mwRunFiles->readSettings(m_settingsGroup + "mwRunFilesBrowse");
 
-  connect(m_uiForm.previousRun, SIGNAL(clicked()), this, SLOT(checkAppendingPreviousRun()));
-  connect(m_uiForm.nextRun, SIGNAL(clicked()), this, SLOT(checkAppendingNextRun()));
+  connect(m_uiForm.previousRun, SIGNAL(clicked()), this,
+          SLOT(checkAppendingPreviousRun()));
+  connect(m_uiForm.nextRun, SIGNAL(clicked()), this,
+          SLOT(checkAppendingNextRun()));
 
   m_optionTab = new MuonAnalysisOptionTab(m_uiForm, m_settingsGroup);
   m_optionTab->initLayout();
@@ -177,78 +178,105 @@ void MuonAnalysis::initLayout()
   m_fitDataTab->init();
 
   m_resultTableTab = new MuonAnalysisResultTableTab(m_uiForm);
-  connect(m_resultTableTab, SIGNAL(runPythonCode(const QString&, bool)),
-                      this, SIGNAL(runAsPythonScript(const QString&, bool)));
+  connect(m_resultTableTab, SIGNAL(runPythonCode(const QString &, bool)), this,
+          SIGNAL(runAsPythonScript(const QString &, bool)));
 
   setCurrentDataName(NOT_AVAILABLE);
 
   // connect guess alpha
-  connect(m_uiForm.guessAlphaButton, SIGNAL(clicked()), this, SLOT(guessAlphaClicked()));
+  connect(m_uiForm.guessAlphaButton, SIGNAL(clicked()), this,
+          SLOT(guessAlphaClicked()));
 
-  // signal/slot connections to respond to changes in instrument selection combo boxes
-  connect(m_uiForm.instrSelector, SIGNAL(instrumentSelectionChanged(const QString&)), this, SLOT(userSelectInstrument(const QString&)));
+  // signal/slot connections to respond to changes in instrument selection combo
+  // boxes
+  connect(m_uiForm.instrSelector,
+          SIGNAL(instrumentSelectionChanged(const QString &)), this,
+          SLOT(userSelectInstrument(const QString &)));
 
   // Load current
-  connect(m_uiForm.loadCurrent, SIGNAL(clicked()), this, SLOT(runLoadCurrent()));
+  connect(m_uiForm.loadCurrent, SIGNAL(clicked()), this,
+          SLOT(runLoadCurrent()));
 
   // If group table change
-  // currentCellChanged ( int currentRow, int currentColumn, int previousRow, int previousColumn )
-  connect(m_uiForm.groupTable, SIGNAL(cellChanged(int, int)), this, SLOT(groupTableChanged(int, int)));
-  connect(m_uiForm.groupTable, SIGNAL(cellClicked(int, int)), this, SLOT(groupTableClicked(int, int)));
-  connect(m_uiForm.groupTable->verticalHeader(), SIGNAL(sectionClicked(int)), SLOT(groupTableClicked(int)));
+  // currentCellChanged ( int currentRow, int currentColumn, int previousRow,
+  // int previousColumn )
+  connect(m_uiForm.groupTable, SIGNAL(cellChanged(int, int)), this,
+          SLOT(groupTableChanged(int, int)));
+  connect(m_uiForm.groupTable, SIGNAL(cellClicked(int, int)), this,
+          SLOT(groupTableClicked(int, int)));
+  connect(m_uiForm.groupTable->verticalHeader(), SIGNAL(sectionClicked(int)),
+          SLOT(groupTableClicked(int)));
 
   // group table plot button
-  connect(m_uiForm.groupTablePlotButton, SIGNAL(clicked()), this, SLOT(runGroupTablePlotButton()));
+  connect(m_uiForm.groupTablePlotButton, SIGNAL(clicked()), this,
+          SLOT(runGroupTablePlotButton()));
 
   // If pair table change
-  connect(m_uiForm.pairTable, SIGNAL(cellChanged(int, int)), this, SLOT(pairTableChanged(int, int)));
-  connect(m_uiForm.pairTable, SIGNAL(cellClicked(int, int)), this, SLOT(pairTableClicked(int, int)));
-  connect(m_uiForm.pairTable->verticalHeader(), SIGNAL(sectionClicked(int)), SLOT(pairTableClicked(int)));
+  connect(m_uiForm.pairTable, SIGNAL(cellChanged(int, int)), this,
+          SLOT(pairTableChanged(int, int)));
+  connect(m_uiForm.pairTable, SIGNAL(cellClicked(int, int)), this,
+          SLOT(pairTableClicked(int, int)));
+  connect(m_uiForm.pairTable->verticalHeader(), SIGNAL(sectionClicked(int)),
+          SLOT(pairTableClicked(int)));
   // Pair table plot button
-  connect(m_uiForm.pairTablePlotButton, SIGNAL(clicked()), this, SLOT(runPairTablePlotButton()));
+  connect(m_uiForm.pairTablePlotButton, SIGNAL(clicked()), this,
+          SLOT(runPairTablePlotButton()));
 
   // save grouping
-  connect(m_uiForm.saveGroupButton, SIGNAL(clicked()), this, SLOT(runSaveGroupButton()));
+  connect(m_uiForm.saveGroupButton, SIGNAL(clicked()), this,
+          SLOT(runSaveGroupButton()));
 
   // load grouping
-  connect(m_uiForm.loadGroupButton, SIGNAL(clicked()), this, SLOT(runLoadGroupButton()));
+  connect(m_uiForm.loadGroupButton, SIGNAL(clicked()), this,
+          SLOT(runLoadGroupButton()));
 
   // clear grouping
-  connect(m_uiForm.clearGroupingButton, SIGNAL(clicked()), this, SLOT(runClearGroupingButton()));
+  connect(m_uiForm.clearGroupingButton, SIGNAL(clicked()), this,
+          SLOT(runClearGroupingButton()));
 
   // front plot button
-  connect(m_uiForm.frontPlotButton, SIGNAL(clicked()), this, SLOT(runFrontPlotButton()));
+  connect(m_uiForm.frontPlotButton, SIGNAL(clicked()), this,
+          SLOT(runFrontPlotButton()));
 
   // front group/ group pair combobox
-  connect(m_uiForm.frontGroupGroupPairComboBox, SIGNAL( currentIndexChanged(int) ), this, SLOT( updateFront() ));
+  connect(m_uiForm.frontGroupGroupPairComboBox,
+          SIGNAL(currentIndexChanged(int)), this, SLOT(updateFront()));
 
-  // Synchronize plot function selector on the Home tab with the one under the Group Table
-  connect(m_uiForm.frontPlotFuncs, SIGNAL( activated(int) ),m_uiForm.groupTablePlotChoice, SLOT( setCurrentIndex(int) ) );
-  connect(m_uiForm.groupTablePlotChoice, SIGNAL( activated(int) ), this, SLOT( syncGroupTablePlotTypeWithHome() ) );
+  // Synchronize plot function selector on the Home tab with the one under the
+  // Group Table
+  connect(m_uiForm.frontPlotFuncs, SIGNAL(activated(int)),
+          m_uiForm.groupTablePlotChoice, SLOT(setCurrentIndex(int)));
+  connect(m_uiForm.groupTablePlotChoice, SIGNAL(activated(int)), this,
+          SLOT(syncGroupTablePlotTypeWithHome()));
 
   connect(m_uiForm.homePeriodBox1, SIGNAL(textChanged(const QString &)), this,
           SLOT(checkForEqualPeriods()));
   connect(m_uiForm.homePeriodBox2, SIGNAL(textChanged(const QString &)), this,
           SLOT(checkForEqualPeriods()));
 
-  connect(m_uiForm.hideToolbars, SIGNAL( toggled(bool) ), this, SIGNAL( setToolbarsHidden(bool) ));
+  connect(m_uiForm.hideToolbars, SIGNAL(toggled(bool)), this,
+          SIGNAL(setToolbarsHidden(bool)));
 
   // connect "?" (Help) Button
-  connect(m_uiForm.muonAnalysisHelp, SIGNAL(clicked()), this, SLOT(muonAnalysisHelpClicked()));
-  connect(m_uiForm.muonAnalysisHelpGrouping, SIGNAL(clicked()), this, SLOT(muonAnalysisHelpGroupingClicked()));
+  connect(m_uiForm.muonAnalysisHelp, SIGNAL(clicked()), this,
+          SLOT(muonAnalysisHelpClicked()));
+  connect(m_uiForm.muonAnalysisHelpGrouping, SIGNAL(clicked()), this,
+          SLOT(muonAnalysisHelpGroupingClicked()));
 
   // add combo boxes to pairTable
-  for (int i = 0; i < m_uiForm.pairTable->rowCount(); i++)
-  {
-    m_uiForm.pairTable->setCellWidget(i,1, new QComboBox);
-    m_uiForm.pairTable->setCellWidget(i,2, new QComboBox);
+  for (int i = 0; i < m_uiForm.pairTable->rowCount(); i++) {
+    m_uiForm.pairTable->setCellWidget(i, 1, new QComboBox);
+    m_uiForm.pairTable->setCellWidget(i, 2, new QComboBox);
   }
 
   // file input
-  connect(m_uiForm.mwRunFiles, SIGNAL(fileFindingFinished()), this, SLOT(inputFileChanged_MWRunFiles()));
+  connect(m_uiForm.mwRunFiles, SIGNAL(fileFindingFinished()), this,
+          SLOT(inputFileChanged_MWRunFiles()));
 
-  connect(m_uiForm.timeZeroAuto, SIGNAL(stateChanged(int)), this, SLOT(setTimeZeroState(int)));
-  connect(m_uiForm.firstGoodDataAuto, SIGNAL(stateChanged(int)), this, SLOT(setFirstGoodDataState(int)));
+  connect(m_uiForm.timeZeroAuto, SIGNAL(stateChanged(int)), this,
+          SLOT(setTimeZeroState(int)));
+  connect(m_uiForm.firstGoodDataAuto, SIGNAL(stateChanged(int)), this,
+          SLOT(setFirstGoodDataState(int)));
 
   // load previous saved values
   loadAutoSavedValues(m_settingsGroup);
@@ -257,55 +285,56 @@ void MuonAnalysis::initLayout()
   loadFittings();
 
   // Detect when the tab is changed
-  connect(m_uiForm.tabWidget, SIGNAL(currentChanged(int)), this, SLOT(changeTab(int)));
+  connect(m_uiForm.tabWidget, SIGNAL(currentChanged(int)), this,
+          SLOT(changeTab(int)));
 
   connectAutoUpdate();
 
   connectAutoSave();
 
-  // Muon scientists never fits peaks, hence they want the following parameter, set to a high number
-  ConfigService::Instance().setString("curvefitting.peakRadius","99");
+  // Muon scientists never fits peaks, hence they want the following parameter,
+  // set to a high number
+  ConfigService::Instance().setString("curvefitting.peakRadius", "99");
 
-  connect(m_uiForm.deadTimeType, SIGNAL( currentIndexChanged(int) ),
-          this, SLOT( onDeadTimeTypeChanged(int) ));
+  connect(m_uiForm.deadTimeType, SIGNAL(currentIndexChanged(int)), this,
+          SLOT(onDeadTimeTypeChanged(int)));
 
-  connect(m_uiForm.mwRunDeadTimeFile, SIGNAL( fileFindingFinished() ),
-          this, SLOT( deadTimeFileSelected() ));
+  connect(m_uiForm.mwRunDeadTimeFile, SIGNAL(fileFindingFinished()), this,
+          SLOT(deadTimeFileSelected()));
 
   m_currentTab = m_uiForm.tabWidget->currentWidget();
 
-  connect(this, SIGNAL( setToolbarsHidden(bool) ), this, SLOT( doSetToolbarsHidden(bool) ), 
-    Qt::QueuedConnection ); // We dont' neet this to happen instantly, prefer safer way
+  connect(this, SIGNAL(setToolbarsHidden(bool)), this,
+          SLOT(doSetToolbarsHidden(bool)),
+          Qt::QueuedConnection); // We dont' neet this to happen instantly,
+                                 // prefer safer way
 
   // Manage User Directories
-  connect(m_uiForm.manageDirectoriesBtn, SIGNAL(clicked()), this, SLOT(openDirectoryDialog() ) );
+  connect(m_uiForm.manageDirectoriesBtn, SIGNAL(clicked()), this,
+          SLOT(openDirectoryDialog()));
 }
 
 /**
 * Muon Analysis help (slot)
 */
-void MuonAnalysis::muonAnalysisHelpClicked()
-{
-  QDesktopServices::openUrl(QUrl(QString("http://www.mantidproject.org/") +
-            "MuonAnalysis"));
+void MuonAnalysis::muonAnalysisHelpClicked() {
+  QDesktopServices::openUrl(
+      QUrl(QString("http://www.mantidproject.org/") + "MuonAnalysis"));
 }
 
 /**
 * Muon Analysis Grouping help (slot)
 */
-void MuonAnalysis::muonAnalysisHelpGroupingClicked()
-{
-  QDesktopServices::openUrl(QUrl(QString("http://www.mantidproject.org/") +
-            "MuonAnalysisGrouping"));
+void MuonAnalysis::muonAnalysisHelpGroupingClicked() {
+  QDesktopServices::openUrl(
+      QUrl(QString("http://www.mantidproject.org/") + "MuonAnalysisGrouping"));
 }
 
-
 /**
  * Set the connected workspace name.
  * @param name The new connected ws name
  */
-void MuonAnalysis::setCurrentDataName(const QString& name)
-{
+void MuonAnalysis::setCurrentDataName(const QString &name) {
   m_currentDataName = name;
 
   // Update labels
@@ -317,13 +346,11 @@ void MuonAnalysis::setCurrentDataName(const QString& name)
 /**
 * Front plot button (slot)
 */
-void MuonAnalysis::runFrontPlotButton()
-{
-  if(m_updating)
+void MuonAnalysis::runFrontPlotButton() {
+  if (m_updating)
     return;
 
-  if (m_deadTimesChanged)
-  {
+  if (m_deadTimesChanged) {
     inputFileChanged(m_previousFilenames);
     return;
   }
@@ -334,30 +361,26 @@ void MuonAnalysis::runFrontPlotButton()
 /**
  * Creates a plot of selected group/pair.
  */
-void MuonAnalysis::plotSelectedItem()
-{
+void MuonAnalysis::plotSelectedItem() {
   ItemType itemType;
-  int tableRow; 
+  int tableRow;
 
   int index = m_uiForm.frontGroupGroupPairComboBox->currentIndex();
 
   if (index < 0)
     return; // Nothing to plot
 
-  if (index >= numGroups())
-  {
+  if (index >= numGroups()) {
     itemType = Pair;
-    tableRow = m_pairToRow[index-numGroups()];
-  }
-  else
-  {
+    tableRow = m_pairToRow[index - numGroups()];
+  } else {
     itemType = Group;
     tableRow = m_groupToRow[index];
   }
 
   PlotType plotType = parsePlotType(m_uiForm.frontPlotFuncs);
 
-  plotItem(itemType, tableRow, plotType);  
+  plotItem(itemType, tableRow, plotType);
 }
 
 /**
@@ -365,41 +388,40 @@ void MuonAnalysis::plotSelectedItem()
  * @param itemType :: Whether it's a group or pair
  * @param tableRow :: Row in the group/pair table which contains the item
  * @param plotType :: What kind of plot we want to analyse
- */ 
-void MuonAnalysis::plotItem(ItemType itemType, int tableRow, PlotType plotType)
-{
+ */
+void MuonAnalysis::plotItem(ItemType itemType, int tableRow,
+                            PlotType plotType) {
   m_updating = true;
 
-  AnalysisDataServiceImpl& ads = AnalysisDataService::Instance();
+  AnalysisDataServiceImpl &ads = AnalysisDataService::Instance();
 
-  try 
-  {
+  try {
     // Create workspace and a raw (unbinned) version of it
     auto ws = createAnalysisWorkspace(itemType, tableRow, plotType);
     auto wsRaw = createAnalysisWorkspace(itemType, tableRow, plotType, true);
 
     // Find names for new workspaces
-    const std::string wsName = getNewAnalysisWSName(itemType, tableRow, plotType);
-    const std::string wsRawName = wsName + "_Raw"; 
+    const std::string wsName =
+        getNewAnalysisWSName(itemType, tableRow, plotType);
+    const std::string wsRawName = wsName + "_Raw";
 
     // Make sure they end up in the ADS
     ads.addOrReplace(wsName, ws);
     ads.addOrReplace(wsRawName, wsRaw);
 
     // Make sure they are grouped
-    std::vector<std::string> wsNames = boost::assign::list_of(wsName)(wsRawName);
+    std::vector<std::string> wsNames = {wsName, wsRawName};
     MuonAnalysisHelper::groupWorkspaces(m_currentLabel, wsNames);
 
     QString wsNameQ = QString::fromStdString(wsName);
 
     // Plot the workspace
-    plotSpectrum( wsNameQ, (plotType == Logorithm) );
-    setCurrentDataName( wsNameQ );
-  }
-  catch(std::exception& e)
-  { 
+    plotSpectrum(wsNameQ, (plotType == Logorithm));
+    setCurrentDataName(wsNameQ);
+  } catch (std::exception &e) {
     g_log.error(e.what());
-    QMessageBox::critical( this, "MuonAnalysis - Error", "Unable to plot the item. Check log for details." ); 
+    QMessageBox::critical(this, "MuonAnalysis - Error",
+                          "Unable to plot the item. Check log for details.");
   }
 
   m_updating = false;
@@ -411,54 +433,48 @@ void MuonAnalysis::plotItem(ItemType itemType, int tableRow, PlotType plotType)
  * @param tableRow :: Row in the group/pair table which contains the item
  * @param plotType :: What kind of plot we want to analyse
  * @return New name
- */ 
-std::string MuonAnalysis::getNewAnalysisWSName(ItemType itemType, int tableRow, PlotType plotType)
-{
+ */
+std::string MuonAnalysis::getNewAnalysisWSName(ItemType itemType, int tableRow,
+                                               PlotType plotType) {
   std::string plotTypeName;
 
-  switch(plotType)
-  {
-    case Asymmetry:
-      plotTypeName = "Asym"; break;
-    case Counts:
-      plotTypeName = "Counts"; break;
-    case Logorithm:
-      plotTypeName = "Logs"; break;
+  switch (plotType) {
+  case Asymmetry:
+    plotTypeName = "Asym";
+    break;
+  case Counts:
+    plotTypeName = "Counts";
+    break;
+  case Logorithm:
+    plotTypeName = "Logs";
+    break;
   }
 
   std::string itemTypeName;
   std::string itemName;
 
-  if ( itemType == Pair )
-  {
+  if (itemType == Pair) {
     itemTypeName = "Pair";
-    itemName = m_uiForm.pairTable->item(tableRow,0)->text().toStdString();
-  }
-  else if ( itemType == Group )
-  {
+    itemName = m_uiForm.pairTable->item(tableRow, 0)->text().toStdString();
+  } else if (itemType == Group) {
     itemTypeName = "Group";
-    itemName = m_uiForm.groupTable->item(tableRow,0)->text().toStdString();
+    itemName = m_uiForm.groupTable->item(tableRow, 0)->text().toStdString();
   }
 
-  const std::string firstPart = (m_currentLabel + "; " + itemTypeName + "; " + itemName + "; "
-                                 + plotTypeName + "; #");
+  const std::string firstPart = (m_currentLabel + "; " + itemTypeName + "; " +
+                                 itemName + "; " + plotTypeName + "; #");
 
   std::string newName;
 
-  if ( isOverwriteEnabled() )
-  {
-    // If ovewrite is enabled, can use the same name again and again 
+  if (isOverwriteEnabled()) {
+    // If ovewrite is enabled, can use the same name again and again
     newName = firstPart + "1";
-  }
-  else
-  { 
+  } else {
     // If overwrite is disabled, need to find unique name for the new workspace
     int plotNum(1);
-    do
-    {
+    do {
       newName = firstPart + boost::lexical_cast<std::string>(plotNum++);
-    }
-    while ( AnalysisDataService::Instance().doesExist(newName) );
+    } while (AnalysisDataService::Instance().doesExist(newName));
   }
 
   return newName;
@@ -468,31 +484,23 @@ std::string MuonAnalysis::getNewAnalysisWSName(ItemType itemType, int tableRow,
  * Returns PlotType as chosen using given selector.
  * @param selector :: Widget to use for parsing
  * @return PlotType as selected using the widget
- */ 
-MuonAnalysis::PlotType MuonAnalysis::parsePlotType(QComboBox* selector)
-{
+ */
+MuonAnalysis::PlotType MuonAnalysis::parsePlotType(QComboBox *selector) {
   std::string plotTypeName = selector->currentText().toStdString();
 
-  if ( plotTypeName == "Asymmetry" )
-  {
+  if (plotTypeName == "Asymmetry") {
     return Asymmetry;
-  }
-  else if ( plotTypeName == "Counts" )
-  {
+  } else if (plotTypeName == "Counts") {
     return Counts;
-  }
-  else if ( plotTypeName == "Logorithm" )
-  {
+  } else if (plotTypeName == "Logorithm") {
     return Logorithm;
-  }
-  else
-  {
+  } else {
     throw std::runtime_error("Unknown plot type name: " + plotTypeName);
   }
 }
 
 /**
- * Creates workspace ready for analysis and plotting. 
+ * Creates workspace ready for analysis and plotting.
  * @param itemType :: Whether it's a group or pair
  * @param tableRow :: Row in the group/pair table which contains the item
  * @param plotType :: What kind of plot we want to analyse
@@ -555,45 +563,43 @@ Workspace_sptr MuonAnalysis::createAnalysisWorkspace(ItemType itemType,
   }
 
   // ---- Analysis ----
-  if ( itemType == Group )
-  {
+  if (itemType == Group) {
     std::string outputType;
 
-    switch(plotType)
-    {
-      case Counts:
-      case Logorithm:
-        outputType = "GroupCounts"; break;
-      case Asymmetry:
-        outputType = "GroupAsymmetry"; break;
-      default:
-        throw std::invalid_argument("Unsupported plot type");
+    switch (plotType) {
+    case Counts:
+    case Logorithm:
+      outputType = "GroupCounts";
+      break;
+    case Asymmetry:
+      outputType = "GroupAsymmetry";
+      break;
+    default:
+      throw std::invalid_argument("Unsupported plot type");
     }
 
     alg->setProperty("OutputType", outputType);
 
     int groupNum = getGroupNumberFromRow(tableRow);
     alg->setProperty("GroupIndex", groupNum);
-  }
-  else if ( itemType == Pair )
-  {
-    if ( plotType == Asymmetry )
+  } else if (itemType == Pair) {
+    if (plotType == Asymmetry)
       alg->setProperty("OutputType", "PairAsymmetry");
     else
       throw std::invalid_argument("Pairs support asymmetry plot type only");
 
-    QTableWidget* t = m_uiForm.pairTable;
+    QTableWidget *t = m_uiForm.pairTable;
 
-    double alpha = t->item(tableRow,3)->text().toDouble();
-    int index1 = static_cast<QComboBox*>( t->cellWidget(tableRow,1) )->currentIndex();
-    int index2 = static_cast<QComboBox*>( t->cellWidget(tableRow,2) )->currentIndex();
+    double alpha = t->item(tableRow, 3)->text().toDouble();
+    int index1 =
+        static_cast<QComboBox *>(t->cellWidget(tableRow, 1))->currentIndex();
+    int index2 =
+        static_cast<QComboBox *>(t->cellWidget(tableRow, 2))->currentIndex();
 
     alg->setProperty("PairFirstIndex", index1);
     alg->setProperty("PairSecondIndex", index2);
     alg->setProperty("Alpha", alpha);
-  }
-  else
-  {
+  } else {
     throw std::invalid_argument("Unsupported item type");
   }
 
@@ -613,13 +619,11 @@ Workspace_sptr MuonAnalysis::createAnalysisWorkspace(ItemType itemType,
 *
 * @param prefix :: instrument name from QComboBox object
 */
-void MuonAnalysis::userSelectInstrument(const QString& prefix)
-{
+void MuonAnalysis::userSelectInstrument(const QString &prefix) {
   // Set file browsing to current instrument
   m_uiForm.mwRunFiles->setInstrumentOverride(prefix);
 
-  if ( prefix != m_curInterfaceSetup )
-  {
+  if (prefix != m_curInterfaceSetup) {
     runClearGroupingButton();
     m_curInterfaceSetup = prefix;
     clearLoadedRun();
@@ -631,15 +635,13 @@ void MuonAnalysis::userSelectInstrument(const QString& prefix)
   }
 }
 
-
 /**
  * Save grouping button (slot)
  */
-void MuonAnalysis::runSaveGroupButton()
-{
-  if ( numGroups() <= 0 )
-  {
-    QMessageBox::warning(this, "MantidPlot - MuonAnalysis", "No grouping to save.");
+void MuonAnalysis::runSaveGroupButton() {
+  if (numGroups() <= 0) {
+    QMessageBox::warning(this, "MantidPlot - MuonAnalysis",
+                         "No grouping to save.");
     return;
   }
 
@@ -648,36 +650,37 @@ void MuonAnalysis::runSaveGroupButton()
 
   // Get value for "dir". If the setting doesn't exist then use
   // the the path in "defaultsave.directory"
-  QString prevPath = prevValues.value("dir", QString::fromStdString(
-    ConfigService::Instance().getString("defaultsave.directory"))).toString();
+  QString prevPath =
+      prevValues.value("dir", QString::fromStdString(
+                                  ConfigService::Instance().getString(
+                                      "defaultsave.directory")))
+          .toString();
 
   QString filter;
   filter.append("Files (*.xml *.XML)");
   filter += ";;AllFiles (*.*)";
-  QString groupingFile = MantidQt::API::FileDialogHandler::getSaveFileName(this,
-                                   "Save Grouping file as", prevPath, filter);
+  QString groupingFile = MantidQt::API::FileDialogHandler::getSaveFileName(
+      this, "Save Grouping file as", prevPath, filter);
 
-  // Add extension if the groupingFile specified doesn't have one. (Solving Linux problem).
+  // Add extension if the groupingFile specified doesn't have one. (Solving
+  // Linux problem).
   if (!groupingFile.endsWith(".xml"))
     groupingFile += ".xml";
 
-  if( ! groupingFile.isEmpty() )
-  {
+  if (!groupingFile.isEmpty()) {
     Mantid::API::Grouping groupingToSave;
     parseGroupingTable(m_uiForm, groupingToSave);
     saveGroupingToXML(groupingToSave, groupingFile.toStdString());
-    
+
     QString directory = QFileInfo(groupingFile).path();
     prevValues.setValue("dir", directory);
   }
 }
 
-
 /**
  * Load grouping button (slot)
  */
-void MuonAnalysis::runLoadGroupButton()
-{
+void MuonAnalysis::runLoadGroupButton() {
   m_updating = true;
 
   // Get grouping file
@@ -686,28 +689,29 @@ void MuonAnalysis::runLoadGroupButton()
 
   // Get value for "dir". If the setting doesn't exist then use
   // the the path in "defaultsave.directory"
-  QString prevPath = prevValues.value("dir", QString::fromStdString(
-    ConfigService::Instance().getString("defaultload.directory"))).toString();
+  QString prevPath =
+      prevValues.value("dir", QString::fromStdString(
+                                  ConfigService::Instance().getString(
+                                      "defaultload.directory")))
+          .toString();
 
   QString filter;
   filter.append("Files (*.xml *.XML)");
   filter += ";;AllFiles (*.*)";
-  QString groupingFile = QFileDialog::getOpenFileName(this, "Load Grouping file", prevPath, filter);
-  if( groupingFile.isEmpty() || QFileInfo(groupingFile).isDir() ) 
+  QString groupingFile = QFileDialog::getOpenFileName(
+      this, "Load Grouping file", prevPath, filter);
+  if (groupingFile.isEmpty() || QFileInfo(groupingFile).isDir())
     return;
-    
+
   QString directory = QFileInfo(groupingFile).path();
   prevValues.setValue("dir", directory);
 
   Mantid::API::Grouping loadedGrouping;
 
-  try
-  {
+  try {
     Mantid::API::GroupingLoader::loadGroupingFromXML(groupingFile.toStdString(),
                                                      loadedGrouping);
-  }
-  catch (Exception::FileError& e)
-  {
+  } catch (Exception::FileError &e) {
     g_log.error("Unable to load grouping. Data left unchanged");
     g_log.error(e.what());
     m_updating = false;
@@ -719,16 +723,13 @@ void MuonAnalysis::runLoadGroupButton()
 
   m_updating = false;
 
-  if ( m_loaded )
-  {
-    try
-    {
+  if (m_loaded) {
+    try {
       groupLoadedWorkspace();
-    }
-    catch(std::exception& e)
-    {
-      g_log.error( e.what() );
-      QMessageBox::critical(this, "MantidPlot - MuonAnalysis",
+    } catch (std::exception &e) {
+      g_log.error(e.what());
+      QMessageBox::critical(
+          this, "MantidPlot - MuonAnalysis",
           "Unable to group the workspace. See log for details.");
     }
   }
@@ -737,27 +738,21 @@ void MuonAnalysis::runLoadGroupButton()
 /**
  * Clear grouping button (slot)
  */
-void MuonAnalysis::runClearGroupingButton()
-{
-  clearTablesAndCombo();
-}
+void MuonAnalysis::runClearGroupingButton() { clearTablesAndCombo(); }
 
 /**
  * Group table plot button (slot)
  */
-void MuonAnalysis::runGroupTablePlotButton()
-{
-  if(m_updating)
+void MuonAnalysis::runGroupTablePlotButton() {
+  if (m_updating)
     return;
 
-  if (m_deadTimesChanged)
-  {
+  if (m_deadTimesChanged) {
     inputFileChanged(m_previousFilenames);
     return;
   }
 
-  if ( getGroupNumberFromRow(m_groupTableRowInFocus) != -1 )
-  {
+  if (getGroupNumberFromRow(m_groupTableRowInFocus) != -1) {
     PlotType plotType = parsePlotType(m_uiForm.groupTablePlotChoice);
     plotItem(Group, m_groupTableRowInFocus, plotType);
   }
@@ -766,85 +761,81 @@ void MuonAnalysis::runGroupTablePlotButton()
 /**
  * Load current (slot)
  */
-void MuonAnalysis::runLoadCurrent()
-{
+void MuonAnalysis::runLoadCurrent() {
   QString instname = m_uiForm.instrSelector->currentText().toUpper();
 
   // If Argus data then simple
-  if ( instname == "ARGUS" )
-  {
-    QString argusDAE = "\\\\ndw828\\argusdata\\current cycle\\nexus\\argus0000000.nxs";
-    Poco::File l_path( argusDAE.toStdString() );
-    try
-    {
-      if ( !l_path.exists() )
-      {
-        QMessageBox::warning(this,"Mantid - MuonAnalysis",
-          QString("Can't load ARGUS Current data since\n") +
-          argusDAE + QString("\n") +
-          QString("does not seem to exist"));
+  if (instname == "ARGUS") {
+    QString argusDAE =
+        "\\\\ndw828\\argusdata\\current cycle\\nexus\\argus0000000.nxs";
+    Poco::File l_path(argusDAE.toStdString());
+    try {
+      if (!l_path.exists()) {
+        QMessageBox::warning(this, "Mantid - MuonAnalysis",
+                             QString("Can't load ARGUS Current data since\n") +
+                                 argusDAE + QString("\n") +
+                                 QString("does not seem to exist"));
         return;
       }
-    }
-    catch(Poco::Exception&)
-    {
-       QMessageBox::warning(this, "MantidPlot - MuonAnalysis", "Can't read from the selected directory, either the computer you are trying"
-         "\nto access is down or your computer is not currently connected to the network.");
-       return;
+    } catch (Poco::Exception &) {
+      QMessageBox::warning(this, "MantidPlot - MuonAnalysis",
+                           "Can't read from the selected directory, either the "
+                           "computer you are trying"
+                           "\nto access is down or your computer is not "
+                           "currently connected to the network.");
+      return;
     }
     m_uiForm.mwRunFiles->setUserInput(argusDAE);
     m_uiForm.mwRunFiles->setText("CURRENT RUN");
     return;
   }
 
-  if ( instname == "EMU" || instname == "HIFI" || instname == "MUSR" || instname == "CHRONUS")
-  {
+  if (instname == "EMU" || instname == "HIFI" || instname == "MUSR" ||
+      instname == "CHRONUS") {
     QString instDirectory = instname;
-    if ( instname == "CHRONUS" )
+    if (instname == "CHRONUS")
       instDirectory = "NDW1030";
     std::string autosavePointsTo = "";
-    std::string autosaveFile = "\\\\" + instDirectory.toStdString() + "\\data\\autosave.run";
-    Poco::File pathAutosave( autosaveFile );
-    
+    std::string autosaveFile =
+        "\\\\" + instDirectory.toStdString() + "\\data\\autosave.run";
+    Poco::File pathAutosave(autosaveFile);
+
     try // check if exists
     {
-      if ( pathAutosave.exists() )
-      {
+      if (pathAutosave.exists()) {
         std::ifstream autofileIn(autosaveFile.c_str(), std::ifstream::in);
         autofileIn >> autosavePointsTo;
       }
-    }
-    catch(Poco::Exception&)
-    {
-       QMessageBox::warning(this, "MantidPlot - MuonAnalysis", "Can't read from the selected directory, either the computer you are trying"
-         "\nto access is down or your computer is not currently connected to the network.");
-       return;
+    } catch (Poco::Exception &) {
+      QMessageBox::warning(this, "MantidPlot - MuonAnalysis",
+                           "Can't read from the selected directory, either the "
+                           "computer you are trying"
+                           "\nto access is down or your computer is not "
+                           "currently connected to the network.");
+      return;
     }
 
     QString psudoDAE;
-    if ( autosavePointsTo.empty() )
-      psudoDAE = "\\\\" + instDirectory + "\\data\\" + instDirectory + "auto_A.tmp";
+    if (autosavePointsTo.empty())
+      psudoDAE =
+          "\\\\" + instDirectory + "\\data\\" + instDirectory + "auto_A.tmp";
     else
       psudoDAE = "\\\\" + instDirectory + "\\data\\" + autosavePointsTo.c_str();
 
-    Poco::File l_path( psudoDAE.toStdString() );
-    try
-    {
-      if ( !l_path.exists() )
-      {
-        QMessageBox::warning(this,"Mantid - MuonAnalysis",
-          QString("Can't load ") + "Current data since\n" +
-          psudoDAE + QString("\n") +
-          QString("does not seem to exist"));
+    Poco::File l_path(psudoDAE.toStdString());
+    try {
+      if (!l_path.exists()) {
+        QMessageBox::warning(this, "Mantid - MuonAnalysis",
+                             QString("Can't load ") + "Current data since\n" +
+                                 psudoDAE + QString("\n") +
+                                 QString("does not seem to exist"));
         return;
       }
-    }
-    catch(Poco::Exception&)
-    {
-      QMessageBox::warning(this,"Mantid - MuonAnalysis",
-        QString("Can't load ") + "Current data since\n" +
-        psudoDAE + QString("\n") +
-        QString("does not seem to exist"));
+    } catch (Poco::Exception &) {
+      QMessageBox::warning(this, "Mantid - MuonAnalysis",
+                           QString("Can't load ") + "Current data since\n" +
+                               psudoDAE + QString("\n") +
+                               QString("does not seem to exist"));
       return;
     }
     m_uiForm.mwRunFiles->setUserInput(psudoDAE);
@@ -852,57 +843,53 @@ void MuonAnalysis::runLoadCurrent()
     return;
   }
 
-  QMessageBox::critical(this, "Unsupported instrument",
-                        "Current run loading is not supported for the selected instrument.");
+  QMessageBox::critical(
+      this, "Unsupported instrument",
+      "Current run loading is not supported for the selected instrument.");
 }
 
 /**
  * Pair table plot button (slot)
  */
-void MuonAnalysis::runPairTablePlotButton()
-{
-  if(m_updating)
+void MuonAnalysis::runPairTablePlotButton() {
+  if (m_updating)
     return;
 
-  if (m_deadTimesChanged)
-  {
+  if (m_deadTimesChanged) {
     inputFileChanged(m_previousFilenames);
     return;
   }
 
-  if ( getPairNumberFromRow(m_pairTableRowInFocus) != -1 )
-  {
+  if (getPairNumberFromRow(m_pairTableRowInFocus) != -1) {
     // Sync with selectors on the front
-    m_uiForm.frontGroupGroupPairComboBox->setCurrentIndex(numGroups() + m_pairTableRowInFocus);
-    m_uiForm.frontPlotFuncs->setCurrentIndex(m_uiForm.pairTablePlotChoice->currentIndex());
+    m_uiForm.frontGroupGroupPairComboBox->setCurrentIndex(
+        numGroups() + m_pairTableRowInFocus);
+    m_uiForm.frontPlotFuncs->setCurrentIndex(
+        m_uiForm.pairTablePlotChoice->currentIndex());
 
     PlotType plotType = parsePlotType(m_uiForm.pairTablePlotChoice);
     plotItem(Pair, m_pairTableRowInFocus, plotType);
   }
-
 }
 
 /**
  * Pair table vertical lable clicked (slot)
  */
-void MuonAnalysis::pairTableClicked(int row)
-{
+void MuonAnalysis::pairTableClicked(int row) {
   m_pairTableRowInFocus = row;
 
   // if something sensible in row then update front
   int pNum = getPairNumberFromRow(row);
-  if ( pNum >= 0 )
-  {
-    m_uiForm.frontGroupGroupPairComboBox->setCurrentIndex(pNum+numGroups());
+  if (pNum >= 0) {
+    m_uiForm.frontGroupGroupPairComboBox->setCurrentIndex(pNum + numGroups());
   }
 }
 
 /**
  * Pair table clicked (slot)
  */
-void MuonAnalysis::pairTableClicked(int row, int column)
-{
-  (void) column;
+void MuonAnalysis::pairTableClicked(int row, int column) {
+  (void)column;
 
   pairTableClicked(row);
 }
@@ -910,9 +897,8 @@ void MuonAnalysis::pairTableClicked(int row, int column)
 /**
  * Group table clicked (slot)
  */
-void MuonAnalysis::groupTableClicked(int row, int column)
-{
-  (void) column;
+void MuonAnalysis::groupTableClicked(int row, int column) {
+  (void)column;
 
   groupTableClicked(row);
 }
@@ -920,20 +906,18 @@ void MuonAnalysis::groupTableClicked(int row, int column)
 /**
 * Group table clicked (slot)
 */
-void MuonAnalysis::groupTableClicked(int row)
-{
+void MuonAnalysis::groupTableClicked(int row) {
   m_groupTableRowInFocus = row;
 
   // if something sensible in row then update front
   int gNum = getGroupNumberFromRow(row);
-  if ( gNum >= 0 )
-  {
+  if (gNum >= 0) {
     m_uiForm.frontGroupGroupPairComboBox->setCurrentIndex(gNum);
-    m_uiForm.frontPlotFuncs->setCurrentIndex(m_uiForm.groupTablePlotChoice->currentIndex());
+    m_uiForm.frontPlotFuncs->setCurrentIndex(
+        m_uiForm.groupTablePlotChoice->currentIndex());
   }
 }
 
-
 /**
 * Group table changed, e.g. if:         (slot)
 *
@@ -943,45 +927,37 @@ void MuonAnalysis::groupTableClicked(int row)
 * @param row :: row number
 * @param column :: column number
 */
-void MuonAnalysis::groupTableChanged(int row, int column)
-{
-  if ( column == 2 )
-  {
+void MuonAnalysis::groupTableChanged(int row, int column) {
+  if (column == 2) {
     // Ignore changes to Ndet column, as they will only be made programmatically
     return;
   }
 
   // changes to the IDs
-  if ( column == 1 )
-  {
-    QTableWidgetItem* itemNdet = m_uiForm.groupTable->item(row,2);
-    QTableWidgetItem *item = m_uiForm.groupTable->item(row,1);
+  if (column == 1) {
+    QTableWidgetItem *itemNdet = m_uiForm.groupTable->item(row, 2);
+    QTableWidgetItem *item = m_uiForm.groupTable->item(row, 1);
 
     // if IDs list has been changed to empty string
-    if (item->text() == "")
-    {
+    if (item->text() == "") {
       if (itemNdet)
         itemNdet->setText("");
-    }
-    else
-    {
+    } else {
       int numDet = numOfDetectors(item->text().toStdString());
 
       std::stringstream detNumRead;
-      if (numDet > 0 )
-      {
+      if (numDet > 0) {
         detNumRead << numDet;
         if (itemNdet == NULL)
-          m_uiForm.groupTable->setItem(row,2, new QTableWidgetItem(detNumRead.str().c_str()));
-        else
-        {
+          m_uiForm.groupTable->setItem(
+              row, 2, new QTableWidgetItem(detNumRead.str().c_str()));
+        else {
           itemNdet->setText(detNumRead.str().c_str());
         }
-      }
-      else
-      {
+      } else {
         if (itemNdet == NULL)
-          m_uiForm.groupTable->setItem(row,2, new QTableWidgetItem("Invalid IDs string"));
+          m_uiForm.groupTable->setItem(
+              row, 2, new QTableWidgetItem("Invalid IDs string"));
         else
           m_uiForm.groupTable->item(row, 2)->setText("Invalid IDs string");
       }
@@ -989,30 +965,27 @@ void MuonAnalysis::groupTableChanged(int row, int column)
   }
 
   // Change to group name
-  if ( column == 0 )
-  {
-    QTableWidgetItem *itemName = m_uiForm.groupTable->item(row,0);
+  if (column == 0) {
+    QTableWidgetItem *itemName = m_uiForm.groupTable->item(row, 0);
 
-    if ( itemName == NULL ) // Just in case it wasn't assigned
+    if (itemName == NULL) // Just in case it wasn't assigned
     {
       itemName = new QTableWidgetItem("");
       m_uiForm.groupTable->setItem(row, 0, itemName);
     }
-      
-    if ( itemName->text() != "" )
-    {
+
+    if (itemName->text() != "") {
       // check that the group name entered does not already exist
-      for (int i = 0; i < m_uiForm.groupTable->rowCount(); i++)
-      {
-        if (i==row)
+      for (int i = 0; i < m_uiForm.groupTable->rowCount(); i++) {
+        if (i == row)
           continue;
 
-        QTableWidgetItem *item = m_uiForm.groupTable->item(i,0);
-        if (item)
-        {
-          if ( item->text() == itemName->text() )
-          {
-            QMessageBox::warning(this, "MantidPlot - MuonAnalysis", "Group names must be unique. Please re-enter Group name.");
+        QTableWidgetItem *item = m_uiForm.groupTable->item(i, 0);
+        if (item) {
+          if (item->text() == itemName->text()) {
+            QMessageBox::warning(
+                this, "MantidPlot - MuonAnalysis",
+                "Group names must be unique. Please re-enter Group name.");
             itemName->setText("");
             break;
           }
@@ -1021,27 +994,23 @@ void MuonAnalysis::groupTableChanged(int row, int column)
     }
   }
 
-  whichGroupToWhichRow(m_uiForm, m_groupToRow);
+  m_groupToRow = whichGroupToWhichRow(m_uiForm);
   updatePairTable();
   updateFrontAndCombo();
-  
-  if ( m_loaded && ! m_updating )
-  {
-    try
-    {
+
+  if (m_loaded && !m_updating) {
+    try {
       groupLoadedWorkspace();
-    }
-    catch(std::exception& e)
-    {
-      g_log.error( e.what() );
+    } catch (std::exception &e) {
+      g_log.error(e.what());
 
-      QMessageBox::critical(this, "MantidPlot - MuonAnalysis", 
+      QMessageBox::critical(
+          this, "MantidPlot - MuonAnalysis",
           "Unable to group the workspace. See log for details");
     }
   }
 }
 
-
 /**
 * Pair table changed, e.g. if:         (slot)
 *
@@ -1051,79 +1020,67 @@ void MuonAnalysis::groupTableChanged(int row, int column)
 * @param row :: row number
 * @param column:: column number
 */
-void MuonAnalysis::pairTableChanged(int row, int column)
-{
+void MuonAnalysis::pairTableChanged(int row, int column) {
   // alpha been modified
-  if ( column == 3 )
-  {
-    QTableWidgetItem* itemAlpha = m_uiForm.pairTable->item(row,3);
-
-    if ( !itemAlpha->text().toStdString().empty() )
-    {
-      try
-      {
-         boost::lexical_cast<double>(itemAlpha->text().toStdString().c_str());
-      }  catch (boost::bad_lexical_cast&)
-      {
-        QMessageBox::warning(this, "MantidPlot - MuonAnalysis", "Alpha must be a number.");
+  if (column == 3) {
+    QTableWidgetItem *itemAlpha = m_uiForm.pairTable->item(row, 3);
+
+    if (!itemAlpha->text().toStdString().empty()) {
+      try {
+        boost::lexical_cast<double>(itemAlpha->text().toStdString().c_str());
+      } catch (boost::bad_lexical_cast &) {
+        QMessageBox::warning(this, "MantidPlot - MuonAnalysis",
+                             "Alpha must be a number.");
         itemAlpha->setText("");
         return;
       }
     }
-    whichPairToWhichRow(m_uiForm, m_pairToRow);
+    m_pairToRow = whichPairToWhichRow(m_uiForm);
     updateFrontAndCombo();
   }
 
   // pair name been modified
-  if ( column == 0 )
-  {
-    QTableWidgetItem *itemName = m_uiForm.pairTable->item(row,0);
+  if (column == 0) {
+    QTableWidgetItem *itemName = m_uiForm.pairTable->item(row, 0);
 
-    if ( itemName == NULL ) // Just in case it wasn't assigned
+    if (itemName == NULL) // Just in case it wasn't assigned
     {
       itemName = new QTableWidgetItem("");
       m_uiForm.pairTable->setItem(row, 0, itemName);
     }
-      
-    if ( itemName->text() != "" )
-    {
+
+    if (itemName->text() != "") {
       // check that the group name entered does not already exist
-      for (int i = 0; i < m_uiForm.pairTable->rowCount(); i++)
-      {
-        if (i==row)
+      for (int i = 0; i < m_uiForm.pairTable->rowCount(); i++) {
+        if (i == row)
           continue;
 
-        QTableWidgetItem *item = m_uiForm.pairTable->item(i,0);
-        if (item)
-        {
-          if ( item->text() == itemName->text() )
-          {
-            QMessageBox::warning(this, "MantidPlot - MuonAnalysis", "Pair names must be unique. Please re-enter Pair name.");
+        QTableWidgetItem *item = m_uiForm.pairTable->item(i, 0);
+        if (item) {
+          if (item->text() == itemName->text()) {
+            QMessageBox::warning(
+                this, "MantidPlot - MuonAnalysis",
+                "Pair names must be unique. Please re-enter Pair name.");
             itemName->setText("");
           }
         }
       }
     }
 
-    whichPairToWhichRow(m_uiForm, m_pairToRow);
+    m_pairToRow = whichPairToWhichRow(m_uiForm);
     updateFrontAndCombo();
 
     // check to see if alpha is specified (if name!="") and if not
     // assign a default of 1.0
-    if ( itemName->text() != "" )
-    {
-      QTableWidgetItem* itemAlpha = m_uiForm.pairTable->item(row,3);
+    if (itemName->text() != "") {
+      QTableWidgetItem *itemAlpha = m_uiForm.pairTable->item(row, 3);
 
-      if (itemAlpha)
-      {
-        if ( itemAlpha->text().toStdString().empty() )
-        {
+      if (itemAlpha) {
+        if (itemAlpha->text().toStdString().empty()) {
           itemAlpha->setText("1.0");
         }
-      }
-      else
-      {
-        m_uiForm.pairTable->setItem(row,3, new QTableWidgetItem("1.0"));
+      } else {
+        m_uiForm.pairTable->setItem(row, 3, new QTableWidgetItem("1.0"));
       }
     }
   }
@@ -1132,72 +1089,67 @@ void MuonAnalysis::pairTableChanged(int row, int column)
 /**
  * Update pair table
  */
-void MuonAnalysis::updatePairTable()
-{
+void MuonAnalysis::updatePairTable() {
   // number of groups has dropped below 2 and pair names specified then
   // clear pair table
-  if ( numGroups() < 2 && numPairs() > 0 )
-  {
+  if (numGroups() < 2 && numPairs() > 0) {
     m_uiForm.pairTable->clearContents();
-    for (int i = 0; i < m_uiForm.pairTable->rowCount(); i++)
-    {
-      m_uiForm.pairTable->setCellWidget(i,1, new QComboBox);
-      m_uiForm.pairTable->setCellWidget(i,2, new QComboBox);
+    for (int i = 0; i < m_uiForm.pairTable->rowCount(); i++) {
+      m_uiForm.pairTable->setCellWidget(i, 1, new QComboBox);
+      m_uiForm.pairTable->setCellWidget(i, 2, new QComboBox);
     }
     updateFrontAndCombo();
     return;
-  }
-  else if ( numGroups() < 2 && numPairs() <= 0 )
-  {
+  } else if (numGroups() < 2 && numPairs() <= 0) {
     return;
   }
 
   // get previous number of groups as listed in the pair comboboxes
-  QComboBox* qwF = static_cast<QComboBox*>(m_uiForm.pairTable->cellWidget(0,1));
-  int previousNumGroups = qwF->count(); // how many groups listed in pair combobox
+  QComboBox *qwF =
+      static_cast<QComboBox *>(m_uiForm.pairTable->cellWidget(0, 1));
+  int previousNumGroups =
+      qwF->count(); // how many groups listed in pair combobox
   int newNumGroups = numGroups();
 
   // reset context of combo boxes
-  for (int i = 0; i < m_uiForm.pairTable->rowCount(); i++)
-  {
-    QComboBox* qwF = static_cast<QComboBox*>(m_uiForm.pairTable->cellWidget(i,1));
-    QComboBox* qwB = static_cast<QComboBox*>(m_uiForm.pairTable->cellWidget(i,2));
+  for (int i = 0; i < m_uiForm.pairTable->rowCount(); i++) {
+    QComboBox *qwF =
+        static_cast<QComboBox *>(m_uiForm.pairTable->cellWidget(i, 1));
+    QComboBox *qwB =
+        static_cast<QComboBox *>(m_uiForm.pairTable->cellWidget(i, 2));
 
-    if (previousNumGroups < newNumGroups)
-    {
+    if (previousNumGroups < newNumGroups) {
       // then need to increase the number of entrees in combo box
-      for (int ii = 1; ii <= newNumGroups-previousNumGroups; ii++)
-      {
-        qwF->addItem(""); // effectively here just allocate space for extra items
+      for (int ii = 1; ii <= newNumGroups - previousNumGroups; ii++) {
+        qwF->addItem(
+            ""); // effectively here just allocate space for extra items
         qwB->addItem("");
       }
-    }
-    else if (previousNumGroups > newNumGroups)
-    {
+    } else if (previousNumGroups > newNumGroups) {
       // then need to decrease the number of entrees in combo box
-      for (int ii = 1; ii <= previousNumGroups-newNumGroups; ii++)
-      {
-        qwF->removeItem(qwF->count()-1); // remove top items
-        qwB->removeItem(qwB->count()-1);
+      for (int ii = 1; ii <= previousNumGroups - newNumGroups; ii++) {
+        qwF->removeItem(qwF->count() - 1); // remove top items
+        qwB->removeItem(qwB->count() - 1);
       }
 
       // further for this case check that none of the current combo box
       // indexes are larger than the number of groups
-      if ( qwF->currentIndex()+1 > newNumGroups || qwB->currentIndex()+1 > newNumGroups )
-      {
+      if (qwF->currentIndex() + 1 > newNumGroups ||
+          qwB->currentIndex() + 1 > newNumGroups) {
         qwF->setCurrentIndex(0);
         qwB->setCurrentIndex(1);
       }
     }
 
-    if ( qwF->currentIndex() == 0 && qwB->currentIndex() == 0 )
+    if (qwF->currentIndex() == 0 && qwB->currentIndex() == 0)
       qwB->setCurrentIndex(1);
 
     // re-populate names in combo boxes with group names
-    for (int ii = 0; ii < newNumGroups; ii++)
-    {
-      qwF->setItemText(ii, m_uiForm.groupTable->item(m_groupToRow[ii],0)->text());
-      qwB->setItemText(ii, m_uiForm.groupTable->item(m_groupToRow[ii],0)->text());
+    for (int ii = 0; ii < newNumGroups; ii++) {
+      qwF->setItemText(ii,
+                       m_uiForm.groupTable->item(m_groupToRow[ii], 0)->text());
+      qwB->setItemText(ii,
+                       m_uiForm.groupTable->item(m_groupToRow[ii], 0)->text());
     }
   }
 }
@@ -1205,40 +1157,40 @@ void MuonAnalysis::updatePairTable()
 /**
  * Slot called when the input file is changed.
  */
-void MuonAnalysis::inputFileChanged_MWRunFiles()
-{
+void MuonAnalysis::inputFileChanged_MWRunFiles() {
   // Handle changed input, then turn buttons back on.
   handleInputFileChanges();
   allowLoading(true);
 }
 
 /**
- * Do some check when reading from MWRun, before actually reading new data file, to see if file is valid
+ * Do some check when reading from MWRun, before actually reading new data file,
+ * to see if file is valid
  */
-void MuonAnalysis::handleInputFileChanges()
-{ 
+void MuonAnalysis::handleInputFileChanges() {
 
-  if ( m_uiForm.mwRunFiles->getText().isEmpty() )
+  if (m_uiForm.mwRunFiles->getText().isEmpty())
     return;
 
-  if ( !m_uiForm.mwRunFiles->isValid() )
-  { 
-    QMessageBox::warning(this,"Mantid - MuonAnalysis", m_uiForm.mwRunFiles->getFileProblem() );
+  if (!m_uiForm.mwRunFiles->isValid()) {
+    QMessageBox::warning(this, "Mantid - MuonAnalysis",
+                         m_uiForm.mwRunFiles->getFileProblem());
     if (m_textToDisplay == "")
       m_uiForm.mwRunFiles->setFileProblem("Error. No File specified.");
     else
-      m_uiForm.mwRunFiles->setFileProblem("Error finding file. Reset to last working data.");
+      m_uiForm.mwRunFiles->setFileProblem(
+          "Error finding file. Reset to last working data.");
     m_uiForm.mwRunFiles->setText(m_textToDisplay);
     return;
   }
 
-  if (!m_updating)
-  {
+  if (!m_updating) {
     inputFileChanged(m_uiForm.mwRunFiles->getFilenames());
 
-    m_textToDisplay =  m_uiForm.mwRunFiles->getText();
+    m_textToDisplay = m_uiForm.mwRunFiles->getText();
 
-    // save selected browse file directory to be reused next time interface is started up
+    // save selected browse file directory to be reused next time interface is
+    // started up
     m_uiForm.mwRunFiles->saveSettings(m_settingsGroup + "mwRunFilesBrowse");
   }
 }
@@ -1248,9 +1200,9 @@ void MuonAnalysis::handleInputFileChanges()
  * @param files :: A list of files to load
  * @return Struct with various loaded parameters
  */
-boost::shared_ptr<LoadResult> MuonAnalysis::load(const QStringList& files) const
-{
-  if ( files.empty() )
+boost::shared_ptr<LoadResult>
+MuonAnalysis::load(const QStringList &files) const {
+  if (files.empty())
     throw std::invalid_argument("Supplied list of files is empty");
 
   auto result = boost::make_shared<LoadResult>();
@@ -1260,23 +1212,22 @@ boost::shared_ptr<LoadResult> MuonAnalysis::load(const QStringList& files) const
   std::string instrName; // Instrument name all the run files should belong to
 
   // Go through all the files and try to load them
-  for ( auto f = files.constBegin(); f != files.constEnd(); ++f )
-  {
+  for (auto f = files.constBegin(); f != files.constEnd(); ++f) {
     std::string file = (*f).toStdString();
 
     // Setup Load Nexus Algorithm
-    IAlgorithm_sptr load = AlgorithmManager::Instance().createUnmanaged("LoadMuonNexus");
+    IAlgorithm_sptr load =
+        AlgorithmManager::Instance().createUnmanaged("LoadMuonNexus");
 
     load->initialize();
     load->setChild(true);
     load->setLogging(false); // We'll take care of print messages ourself
-    load->setPropertyValue("Filename", file );
+    load->setPropertyValue("Filename", file);
 
     // Just to pass validation
     load->setPropertyValue("OutputWorkspace", "__NotUsed");
 
-    if ( f == files.constBegin() )
-    {
+    if (f == files.constBegin()) {
       // These are only needed for the first file
       load->setPropertyValue("DeadTimeTable", "__NotUsed");
       load->setPropertyValue("DetectorGroupingTable", "__NotUsed");
@@ -1286,54 +1237,48 @@ boost::shared_ptr<LoadResult> MuonAnalysis::load(const QStringList& files) const
 
     Workspace_sptr loadedWorkspace = load->getProperty("OutputWorkspace");
 
-    if ( f == files.constBegin() )
-    {
+    if (f == files.constBegin()) {
       instrName = firstPeriod(loadedWorkspace)->getInstrument()->getName();
 
       // Check that is a valid Muon instrument
-      if ( m_uiForm.instrSelector->findText( QString::fromStdString(instrName)) == -1 )
+      if (m_uiForm.instrSelector->findText(QString::fromStdString(instrName)) ==
+          -1)
         throw std::runtime_error("Instrument is not recognized: " + instrName);
 
       result->loadedDeadTimes = load->getProperty("DeadTimeTable");
       result->loadedGrouping = load->getProperty("DetectorGroupingTable");
-      result->mainFieldDirection = static_cast<std::string>(load->getProperty("MainFieldDirection"));
+      result->mainFieldDirection =
+          static_cast<std::string>(load->getProperty("MainFieldDirection"));
       result->timeZero = load->getProperty("TimeZero");
       result->firstGoodData = load->getProperty("FirstGoodData");
-    }
-    else
-    {
-      if ( firstPeriod(loadedWorkspace)->getInstrument()->getName() != instrName )
-        throw std::runtime_error("All the files should be produced by the same instrument");
+    } else {
+      if (firstPeriod(loadedWorkspace)->getInstrument()->getName() != instrName)
+        throw std::runtime_error(
+            "All the files should be produced by the same instrument");
     }
 
     loadedWorkspaces.push_back(loadedWorkspace);
   }
 
-  if (instrName == "ARGUS")
-  {
-    // Some of the ARGUS data files contain wrong information about the instrument main field
+  if (instrName == "ARGUS") {
+    // Some of the ARGUS data files contain wrong information about the
+    // instrument main field
     // direction. It is alway longitudinal.
     result->mainFieldDirection = "longitudinal";
   }
 
-  if ( loadedWorkspaces.size() == 1 )
-  {
+  if (loadedWorkspaces.size() == 1) {
 
     // If single workspace loaded - use it
     Workspace_sptr ws = loadedWorkspaces.front();
     result->loadedWorkspace = ws;
 
     result->label = getRunLabel(ws);
-  }
-  else
-  {
+  } else {
     // If multiple workspaces loaded - sum them to get the one to work with
-    try
-    {
+    try {
       result->loadedWorkspace = sumWorkspaces(loadedWorkspaces);
-    }
-    catch(std::exception& e)
-    {
+    } catch (std::exception &e) {
       std::ostringstream error;
       error << "Unable to sum workspaces together: " << e.what() << "\n";
       error << "Make sure they have equal dimensions and number of periods.";
@@ -1357,34 +1302,34 @@ MuonAnalysis::getGrouping(boost::shared_ptr<LoadResult> loadResult) const {
 
   boost::shared_ptr<Mantid::API::Grouping> groupingToUse;
 
-  Instrument_const_sptr instr = firstPeriod(loadResult->loadedWorkspace)->getInstrument();
+  Instrument_const_sptr instr =
+      firstPeriod(loadResult->loadedWorkspace)->getInstrument();
 
   // Check whether the instrument was changed
-  int instrIndex = m_uiForm.instrSelector->findText( QString::fromStdString(instr->getName()) );
+  int instrIndex = m_uiForm.instrSelector->findText(
+      QString::fromStdString(instr->getName()));
   bool instrChanged = m_uiForm.instrSelector->currentIndex() != instrIndex;
 
   // Check whether the number of spectra was changed
   bool noSpectraChanged(true);
 
-  if ( AnalysisDataService::Instance().doesExist(m_workspace_name) )
-  {
-    auto currentWs = AnalysisDataService::Instance().retrieveWS<Workspace>(m_workspace_name);
+  if (AnalysisDataService::Instance().doesExist(m_workspace_name)) {
+    auto currentWs =
+        AnalysisDataService::Instance().retrieveWS<Workspace>(m_workspace_name);
     size_t currentNoSpectra = firstPeriod(currentWs)->getNumberHistograms();
 
-    size_t loadedNoSpectra = firstPeriod(loadResult->loadedWorkspace)->getNumberHistograms();
+    size_t loadedNoSpectra =
+        firstPeriod(loadResult->loadedWorkspace)->getNumberHistograms();
 
     noSpectraChanged = (currentNoSpectra != loadedNoSpectra);
   }
 
-  if ( !noSpectraChanged && !instrChanged && isGroupingSet() )
-  {
+  if (!noSpectraChanged && !instrChanged && isGroupingSet()) {
     // Use grouping currently set
     result->usedExistGrouping = true;
     groupingToUse = boost::make_shared<Mantid::API::Grouping>();
     parseGroupingTable(m_uiForm, *groupingToUse);
-  }
-  else
-  {
+  } else {
     // Need to load a new grouping
     result->usedExistGrouping = false;
 
@@ -1392,27 +1337,26 @@ MuonAnalysis::getGrouping(boost::shared_ptr<LoadResult> loadResult) const {
     {
       Mantid::API::GroupingLoader loader(instr, loadResult->mainFieldDirection);
       groupingToUse = loader.getGroupingFromIDF();
-    }
-    catch(std::runtime_error& e)
-    {
-      g_log.warning() << "Unable to apply grouping from the IDF: " << e.what() << "\n";
+    } catch (std::runtime_error &e) {
+      g_log.warning() << "Unable to apply grouping from the IDF: " << e.what()
+                      << "\n";
 
-      if ( loadResult->loadedGrouping )
-      {
+      if (loadResult->loadedGrouping) {
         ITableWorkspace_sptr groupingTable;
 
-        if ( !( groupingTable = boost::dynamic_pointer_cast<ITableWorkspace>(loadResult->loadedGrouping) ) )
-        {
-          auto group = boost::dynamic_pointer_cast<WorkspaceGroup>(loadResult->loadedGrouping);
-          groupingTable = boost::dynamic_pointer_cast<ITableWorkspace>( group->getItem(0) );
+        if (!(groupingTable = boost::dynamic_pointer_cast<ITableWorkspace>(
+                  loadResult->loadedGrouping))) {
+          auto group = boost::dynamic_pointer_cast<WorkspaceGroup>(
+              loadResult->loadedGrouping);
+          groupingTable =
+              boost::dynamic_pointer_cast<ITableWorkspace>(group->getItem(0));
         }
 
         groupingToUse = tableToGrouping(groupingTable);
         groupingToUse->description = "Grouping from Nexus file";
-      }
-      else
-      {
-        g_log.warning("No grouping set in the Nexus file. Using dummy grouping");
+      } else {
+        g_log.warning(
+            "No grouping set in the Nexus file. Using dummy grouping");
         groupingToUse = getDummyGrouping(instr);
       }
     }
@@ -1424,13 +1368,14 @@ MuonAnalysis::getGrouping(boost::shared_ptr<LoadResult> loadResult) const {
 }
 
 /**
- * Input file changed. Update GUI accordingly. Note this method does no check of input filename assumed
- * done elsewhere depending on e.g. whether filename came from MWRunFiles or 'get current run' button.
+ * Input file changed. Update GUI accordingly. Note this method does no check of
+ * input filename assumed
+ * done elsewhere depending on e.g. whether filename came from MWRunFiles or
+ * 'get current run' button.
  *
  * @param files :: All file names for the files loading.
  */
-void MuonAnalysis::inputFileChanged(const QStringList& files)
-{
+void MuonAnalysis::inputFileChanged(const QStringList &files) {
   if (files.size() <= 0)
     return;
 
@@ -1479,7 +1424,8 @@ void MuonAnalysis::inputFileChanged(const QStringList& files)
     correctedGroupedWS = alg->getProperty("OutputWorkspace");
   } catch (std::exception &e) {
     g_log.error(e.what());
-    QMessageBox::critical(this, "Loading failed", "Unable to load the file[s]. See log for details.");
+    QMessageBox::critical(this, "Loading failed",
+                          "Unable to load the file[s]. See log for details.");
 
     m_updating = false;
     m_uiForm.tabWidget->setTabEnabled(3, true);
@@ -1487,15 +1433,18 @@ void MuonAnalysis::inputFileChanged(const QStringList& files)
     return;
   }
 
-  // At this point we are sure that new data was loaded successfully, so we can safely overwrite
+  // At this point we are sure that new data was loaded successfully, so we can
+  // safely overwrite
   // previous one.
 
-  // This is done explicitly because addOrReplace is not replacing groups properly.
+  // This is done explicitly because addOrReplace is not replacing groups
+  // properly.
   deleteWorkspaceIfExists(m_workspace_name);
   deleteWorkspaceIfExists(m_grouped_name);
 
   // Get hold of a pointer to a matrix workspace
-  MatrixWorkspace_sptr matrix_workspace = firstPeriod(loadResult->loadedWorkspace);
+  MatrixWorkspace_sptr matrix_workspace =
+      firstPeriod(loadResult->loadedWorkspace);
 
   // Set various instance variables
   m_dataTimeZero = loadResult->timeZero;
@@ -1504,9 +1453,10 @@ void MuonAnalysis::inputFileChanged(const QStringList& files)
   m_previousFilenames = files;
 
   int newInstrIndex = m_uiForm.instrSelector->findText(
-        QString::fromStdString( matrix_workspace->getInstrument()->getName() ));
+      QString::fromStdString(matrix_workspace->getInstrument()->getName()));
 
-  bool instrumentChanged = newInstrIndex != m_uiForm.instrSelector->currentIndex();
+  bool instrumentChanged =
+      newInstrIndex != m_uiForm.instrSelector->currentIndex();
 
   m_uiForm.instrSelector->setCurrentIndex(newInstrIndex);
 
@@ -1516,11 +1466,12 @@ void MuonAnalysis::inputFileChanged(const QStringList& files)
                                       loadResult->loadedWorkspace);
   AnalysisDataService::Instance().add(m_grouped_name, correctedGroupedWS);
 
-  // Update the grouping table with the used grouping, if new grouping was loaded
-  // XXX: this should be done after the instrument was changed, because changing the instrument will
+  // Update the grouping table with the used grouping, if new grouping was
+  // loaded
+  // XXX: this should be done after the instrument was changed, because changing
+  // the instrument will
   //      clear the grouping
-  if ( ! groupResult->usedExistGrouping )
-  {
+  if (!groupResult->usedExistGrouping) {
     runClearGroupingButton();
     fillGroupingTable(*(groupResult->groupingUsed), m_uiForm);
   }
@@ -1530,13 +1481,15 @@ void MuonAnalysis::inputFileChanged(const QStringList& files)
   str << "Description: ";
   str << matrix_workspace->getInstrument()->getDetectorIDs().size();
   str << " detector spectrometer, main field ";
-  str << QString(loadResult->mainFieldDirection.c_str()).toLower().toStdString();
+  str << QString(loadResult->mainFieldDirection.c_str())
+             .toLower()
+             .toStdString();
   str << " to muon polarisation";
   m_uiForm.instrumentDescription->setText(str.str().c_str());
 
-  if(instrumentChanged)
-  {
-    // When instrument changes we use information from data no matter what user has chosen before
+  if (instrumentChanged) {
+    // When instrument changes we use information from data no matter what user
+    // has chosen before
     m_uiForm.timeZeroAuto->setCheckState(Qt::Checked);
     m_uiForm.firstGoodDataAuto->setCheckState(Qt::Checked);
   }
@@ -1550,10 +1503,8 @@ void MuonAnalysis::inputFileChanged(const QStringList& files)
   std::string label = loadResult->label;
 
   // Remove instrument and leading zeros
-  for (auto it = label.begin(); it != label.end(); ++it)
-  {
-    if ( !(isalpha(*it) || *it == '0') )
-    {
+  for (auto it = label.begin(); it != label.end(); ++it) {
+    if (!(isalpha(*it) || *it == '0')) {
       // When non-letter and non-zero met - delete everything up to it
       label.erase(label.begin(), it);
       break;
@@ -1570,19 +1521,22 @@ void MuonAnalysis::inputFileChanged(const QStringList& files)
   // Add other information about the run
   printRunInfo(matrix_workspace, infoStr);
 
-  m_uiForm.infoBrowser->setText( QString::fromStdString(infoStr.str()) );
+  m_uiForm.infoBrowser->setText(QString::fromStdString(infoStr.str()));
 
   // If instrument or number of periods has changed -> update period widgets
-  size_t numPeriods = MuonAnalysisHelper::numPeriods(loadResult->loadedWorkspace);
-  if(instrumentChanged || numPeriods != m_numPeriods)
-  {
+  size_t numPeriods =
+      MuonAnalysisHelper::numPeriods(loadResult->loadedWorkspace);
+  if (instrumentChanged || numPeriods != m_numPeriods) {
     updatePeriodWidgets(numPeriods);
   }
 
   // Populate bin width info in Plot options
-  double binWidth = matrix_workspace->dataX(0)[1] - matrix_workspace->dataX(0)[0];
+  double binWidth =
+      matrix_workspace->dataX(0)[1] - matrix_workspace->dataX(0)[0];
   m_uiForm.optionLabelBinWidth->setText(
-        QString("Data collected with histogram bins of %1 %2s").arg(binWidth).arg(QChar(956)));
+      QString("Data collected with histogram bins of %1 %2s")
+          .arg(binWidth)
+          .arg(QChar(956)));
 
   m_deadTimesChanged = false;
 
@@ -1596,7 +1550,7 @@ void MuonAnalysis::inputFileChanged(const QStringList& files)
 
   m_currentLabel = loadResult->label;
 
-  if(m_uiForm.frontPlotButton->isEnabled())
+  if (m_uiForm.frontPlotButton->isEnabled())
     plotSelectedItem();
 }
 
@@ -1604,11 +1558,10 @@ void MuonAnalysis::inputFileChanged(const QStringList& files)
  * Deletes a workspace _or_ a workspace group with the given name, if one exists
  * @param wsName :: Name of the workspace to delete
  */
-void MuonAnalysis::deleteWorkspaceIfExists(const std::string &wsName)
-{
-  if ( AnalysisDataService::Instance().doesExist(wsName) )
-  {
-    IAlgorithm_sptr deleteAlg = AlgorithmManager::Instance().create("DeleteWorkspace");
+void MuonAnalysis::deleteWorkspaceIfExists(const std::string &wsName) {
+  if (AnalysisDataService::Instance().doesExist(wsName)) {
+    IAlgorithm_sptr deleteAlg =
+        AlgorithmManager::Instance().create("DeleteWorkspace");
     deleteAlg->setLogging(false);
     deleteAlg->setPropertyValue("Workspace", wsName);
     deleteAlg->execute();
@@ -1618,21 +1571,23 @@ void MuonAnalysis::deleteWorkspaceIfExists(const std::string &wsName)
 /**
  * Guess Alpha (slot). For now include all data from first good data(bin)
  */
-void MuonAnalysis::guessAlphaClicked()
-{
+void MuonAnalysis::guessAlphaClicked() {
   m_updating = true;
 
-  if ( getPairNumberFromRow(m_pairTableRowInFocus) >= 0 )
-  {
-    QComboBox* qwF = static_cast<QComboBox*>(m_uiForm.pairTable->cellWidget(m_pairTableRowInFocus,1));
-    QComboBox* qwB = static_cast<QComboBox*>(m_uiForm.pairTable->cellWidget(m_pairTableRowInFocus,2));
+  if (getPairNumberFromRow(m_pairTableRowInFocus) >= 0) {
+    QComboBox *qwF = static_cast<QComboBox *>(
+        m_uiForm.pairTable->cellWidget(m_pairTableRowInFocus, 1));
+    QComboBox *qwB = static_cast<QComboBox *>(
+        m_uiForm.pairTable->cellWidget(m_pairTableRowInFocus, 2));
 
     if (!qwF || !qwB)
       return;
 
     // group IDs
-    QTableWidgetItem *idsF = m_uiForm.groupTable->item(m_groupToRow[qwF->currentIndex()],1);
-    QTableWidgetItem *idsB = m_uiForm.groupTable->item(m_groupToRow[qwB->currentIndex()],1);
+    QTableWidgetItem *idsF =
+        m_uiForm.groupTable->item(m_groupToRow[qwF->currentIndex()], 1);
+    QTableWidgetItem *idsB =
+        m_uiForm.groupTable->item(m_groupToRow[qwB->currentIndex()], 1);
 
     if (!idsF || !idsB)
       return;
@@ -1643,9 +1598,9 @@ void MuonAnalysis::guessAlphaClicked()
 
     double alphaValue;
 
-    try
-    {
-      IAlgorithm_sptr alphaAlg = AlgorithmManager::Instance().create("AlphaCalc");
+    try {
+      IAlgorithm_sptr alphaAlg =
+          AlgorithmManager::Instance().create("AlphaCalc");
       alphaAlg->setPropertyValue("InputWorkspace", inputWS.toStdString());
       alphaAlg->setPropertyValue("ForwardSpectra", idsF->text().toStdString());
       alphaAlg->setPropertyValue("BackwardSpectra", idsB->text().toStdString());
@@ -1653,23 +1608,24 @@ void MuonAnalysis::guessAlphaClicked()
       alphaAlg->execute();
 
       alphaValue = alphaAlg->getProperty("Alpha");
-    }
-    catch(std::exception& e)
-    {
+    } catch (std::exception &e) {
       g_log.error() << "Error when running AlphaCalc: " << e.what() << "\n";
       QMessageBox::critical(this, "Guess alpha error",
-                            "Unable to guess alpha value. AlphaCalc failed. See log for details.");
+                            "Unable to guess alpha value. AlphaCalc failed. "
+                            "See log for details.");
       m_updating = false;
       return;
     }
 
     const QString alpha = QString::number(alphaValue);
 
-    QComboBox* qwAlpha = static_cast<QComboBox*>(m_uiForm.pairTable->cellWidget(m_pairTableRowInFocus,3));
+    QComboBox *qwAlpha = static_cast<QComboBox *>(
+        m_uiForm.pairTable->cellWidget(m_pairTableRowInFocus, 3));
     if (qwAlpha)
-      m_uiForm.pairTable->item(m_pairTableRowInFocus,3)->setText(alpha);
+      m_uiForm.pairTable->item(m_pairTableRowInFocus, 3)->setText(alpha);
     else
-      m_uiForm.pairTable->setItem(m_pairTableRowInFocus,3, new QTableWidgetItem(alpha));
+      m_uiForm.pairTable->setItem(m_pairTableRowInFocus, 3,
+                                  new QTableWidgetItem(alpha));
   }
 
   m_updating = false;
@@ -1683,9 +1639,8 @@ void MuonAnalysis::guessAlphaClicked()
  *
  * @return number of groups
  */
-int MuonAnalysis::numGroups()
-{
-  whichGroupToWhichRow(m_uiForm, m_groupToRow);
+int MuonAnalysis::numGroups() {
+  m_groupToRow = whichGroupToWhichRow(m_uiForm);
   return static_cast<int>(m_groupToRow.size());
 }
 
@@ -1694,17 +1649,16 @@ int MuonAnalysis::numGroups()
  *
  * @return number of pairs
  */
-int MuonAnalysis::numPairs()
-{
-  whichPairToWhichRow(m_uiForm, m_pairToRow);
+int MuonAnalysis::numPairs() {
+  m_pairToRow = whichPairToWhichRow(m_uiForm);
   return static_cast<int>(m_pairToRow.size());
 }
 
 /**
- * Update front "group / group-pair" combo-box based on what the currentIndex now is
+ * Update front "group / group-pair" combo-box based on what the currentIndex
+ * now is
  */
-void MuonAnalysis::updateFront()
-{
+void MuonAnalysis::updateFront() {
   // get current index
   int index = m_uiForm.frontGroupGroupPairComboBox->currentIndex();
 
@@ -1712,22 +1666,19 @@ void MuonAnalysis::updateFront()
 
   int numG = numGroups();
 
-  if (index >= 0 && numG)
-  {
-    if (index >= numG && numG >= 2)
-    {
+  if (index >= 0 && numG) {
+    if (index >= numG && numG >= 2) {
       // i.e. index points to a pair
       m_uiForm.frontPlotFuncs->addItems(m_pairPlotFunc);
 
       m_uiForm.frontAlphaLabel->setVisible(true);
       m_uiForm.frontAlphaNumber->setVisible(true);
 
-      m_uiForm.frontAlphaNumber->setText(m_uiForm.pairTable->item(m_pairToRow[index-numG],3)->text());
+      m_uiForm.frontAlphaNumber->setText(
+          m_uiForm.pairTable->item(m_pairToRow[index - numG], 3)->text());
 
       m_uiForm.frontAlphaNumber->setCursorPosition(0);
-    }
-    else
-    {
+    } else {
       // i.e. index points to a group
       m_uiForm.frontPlotFuncs->addItems(m_groupPlotFunc);
 
@@ -1737,17 +1688,15 @@ void MuonAnalysis::updateFront()
   }
 }
 
-
 /**
  * Update front including first re-populate pair list combo box
  */
-void MuonAnalysis::updateFrontAndCombo()
-{
+void MuonAnalysis::updateFrontAndCombo() {
   // for now brute force clearing and adding new context
   // could go for softer approach and check if is necessary
   // to complete reset this combo box
   int currentI = m_uiForm.frontGroupGroupPairComboBox->currentIndex();
-  if (currentI < 0)  // in case this combobox has not been set yet
+  if (currentI < 0) // in case this combobox has not been set yet
     currentI = 0;
   m_uiForm.frontGroupGroupPairComboBox->clear();
 
@@ -1755,12 +1704,12 @@ void MuonAnalysis::updateFrontAndCombo()
   int numP = numPairs();
   for (int i = 0; i < numG; i++)
     m_uiForm.frontGroupGroupPairComboBox->addItem(
-      m_uiForm.groupTable->item(m_groupToRow[i],0)->text());
+        m_uiForm.groupTable->item(m_groupToRow[i], 0)->text());
   for (int i = 0; i < numP; i++)
     m_uiForm.frontGroupGroupPairComboBox->addItem(
-      m_uiForm.pairTable->item(m_pairToRow[i],0)->text());
-  
-  if ( currentI >= m_uiForm.frontGroupGroupPairComboBox->count() )
+        m_uiForm.pairTable->item(m_pairToRow[i], 0)->text());
+
+  if (currentI >= m_uiForm.frontGroupGroupPairComboBox->count())
     m_uiForm.frontGroupGroupPairComboBox->setCurrentIndex(0);
   else
     m_uiForm.frontGroupGroupPairComboBox->setCurrentIndex(currentI);
@@ -1797,12 +1746,10 @@ void MuonAnalysis::updatePeriodWidgets(size_t numPeriods) {
  * @param row :: A row in the group table
  * @return Group number
  */
-int MuonAnalysis::getGroupNumberFromRow(int row)
-{
-  whichGroupToWhichRow(m_uiForm, m_groupToRow);
-  for (unsigned int i = 0; i < m_groupToRow.size(); i++)
-  {
-    if ( m_groupToRow[i] == row )
+int MuonAnalysis::getGroupNumberFromRow(int row) {
+  m_groupToRow = whichGroupToWhichRow(m_uiForm);
+  for (unsigned int i = 0; i < m_groupToRow.size(); i++) {
+    if (m_groupToRow[i] == row)
       return i;
   }
   return -1;
@@ -1815,43 +1762,36 @@ int MuonAnalysis::getGroupNumberFromRow(int row)
  * @param row :: A row in the pair table
  * @return Pair number
  */
-int MuonAnalysis::getPairNumberFromRow(int row)
-{
-  whichPairToWhichRow(m_uiForm, m_pairToRow);
-  for (unsigned int i = 0; i < m_pairToRow.size(); i++)
-  {
-    if ( m_pairToRow[i] == row )
+int MuonAnalysis::getPairNumberFromRow(int row) {
+  m_pairToRow = whichPairToWhichRow(m_uiForm);
+  for (unsigned int i = 0; i < m_pairToRow.size(); i++) {
+    if (m_pairToRow[i] == row)
       return i;
   }
   return -1;
 }
 
-
 /**
  * Return the pair which is in focus and -1 if none
  */
-int MuonAnalysis::pairInFocus()
-{
+int MuonAnalysis::pairInFocus() {
   // plus some code here which double checks that pair
   // table in focus actually sensible
   return m_pairTableRowInFocus;
 }
 
-
 /**
  * Clear tables and front combo box
  */
-void MuonAnalysis::clearTablesAndCombo()
-{
+void MuonAnalysis::clearTablesAndCombo() {
   m_uiForm.groupTable->clearContents();
   m_uiForm.frontGroupGroupPairComboBox->clear();
   m_uiForm.frontPlotFuncs->clear();
 
   m_uiForm.pairTable->clearContents();
-  for (int i = 0; i < m_uiForm.pairTable->rowCount(); i++)
-  {
-    m_uiForm.pairTable->setCellWidget(i,1, new QComboBox);
-    m_uiForm.pairTable->setCellWidget(i,2, new QComboBox);
+  for (int i = 0; i < m_uiForm.pairTable->rowCount(); i++) {
+    m_uiForm.pairTable->setCellWidget(i, 1, new QComboBox);
+    m_uiForm.pairTable->setCellWidget(i, 2, new QComboBox);
   }
 
   m_uiForm.groupDescription->clear();
@@ -1869,7 +1809,7 @@ void MuonAnalysis::clearLoadedRun() {
 
 /**
  * Get period labels for the periods selected in the GUI
- * @return Return empty string if no periods (well just one period). If more 
+ * @return Return empty string if no periods (well just one period). If more
  *         one period then return "_#" string for the periods selected by user
  */
 QStringList MuonAnalysis::getPeriodLabels() const {
@@ -1891,115 +1831,111 @@ QStringList MuonAnalysis::getPeriodLabels() const {
  * @param wsName   :: Workspace name
  * @param logScale :: Whether to plot using logarithmic scale
  */
-void MuonAnalysis::plotSpectrum(const QString& wsName, bool logScale)
-{
-    // List of script lines which acquire a window for plotting. The window is placed to Python
-    // variable named 'w';'
-    QStringList acquireWindowScript;
+void MuonAnalysis::plotSpectrum(const QString &wsName, bool logScale) {
+  // List of script lines which acquire a window for plotting. The window is
+  // placed to Python
+  // variable named 'w';'
+  QStringList acquireWindowScript;
 
-    MuonAnalysisOptionTab::NewPlotPolicy policy = m_optionTab->newPlotPolicy();
+  MuonAnalysisOptionTab::NewPlotPolicy policy = m_optionTab->newPlotPolicy();
 
-    // Hide all the previous plot windows, if creating a new one
-    if ( policy == MuonAnalysisOptionTab::NewWindow && m_uiForm.hideGraphs->isChecked())
-    {
-      hideAllPlotWindows();
-    }
+  // Hide all the previous plot windows, if creating a new one
+  if (policy == MuonAnalysisOptionTab::NewWindow &&
+      m_uiForm.hideGraphs->isChecked()) {
+    hideAllPlotWindows();
+  }
 
-    QStringList& s = acquireWindowScript; // To keep short
-    s << "ws = mtd['%WSNAME%']";
-    s << "altName = ws.name() + '-1'";
+  QStringList &s = acquireWindowScript; // To keep short
+  s << "ws = mtd['%WSNAME%']";
+  s << "altName = ws.name() + '-1'";
 
-    if ( policy == MuonAnalysisOptionTab::PreviousWindow )
-    {
-      s << "ew = graph(altName)";
-      s << "if '%WSNAME%' != '%PREV%' and ew != None:";
-      s << "    ew.close()";
+  if (policy == MuonAnalysisOptionTab::PreviousWindow) {
+    s << "ew = graph(altName)";
+    s << "if '%WSNAME%' != '%PREV%' and ew != None:";
+    s << "    ew.close()";
 
-      s << "pw = graph('%PREV%-1')";
-      s << "if pw == None:";
-      s << "  pw = newGraph(altName, 0)";
-    }
-    else if ( policy == MuonAnalysisOptionTab::NewWindow )
-    {
-      s << "pw = newGraph(altName, 0)";
-    }
+    s << "pw = graph('%PREV%-1')";
+    s << "if pw == None:";
+    s << "  pw = newGraph(altName, 0)";
+  } else if (policy == MuonAnalysisOptionTab::NewWindow) {
+    s << "pw = newGraph(altName, 0)";
+  }
 
-    s << "w = plotSpectrum(ws.name(), 0, error_bars = %ERRORS%, type = "
-         "%CONNECT%, window = pw, "
-         "clearWindow = True)";
-    s << "w.setName(altName)";
-    s << "w.setObjectName(ws.name())";
-    s << "w.show()";
-    s << "w.setFocus()";
-
-    QString pyS;
-
-    // Add line separators
-    pyS += acquireWindowScript.join("\n") + "\n";
-
-    // Get plotting params
-    const QMap<QString, QString>& params = getPlotStyleParams(wsName);
-
-    // Insert real values
-    QString safeWSName(wsName);
-    safeWSName.replace("'", "\'");
-    pyS.replace("%WSNAME%", safeWSName);
-    pyS.replace("%PREV%", m_currentDataName);
-    pyS.replace("%ERRORS%", params["ShowErrors"]);
-    pyS.replace("%CONNECT%", params["ConnectType"]);
-
-    // Update titles
-    pyS += "l = w.activeLayer()\n"
-           "l.setCurveTitle(0, ws.name())\n"
-           "l.setTitle(ws.getTitle())\n";
-
-    // Set logarithmic scale if required
-    if ( logScale )
-      pyS += "l.logYlinX()\n";
-
-    // Set scaling
-    if( params["YAxisAuto"] == "True" )
-    {
-      pyS += "l.setAutoScale()\n";
-    }
-    else
-    {
-      pyS += "l.setAxisScale(Layer.Left, %1, %2)\n";
-      pyS = pyS.arg(params["YAxisMin"]).arg(params["YAxisMax"]);
-    }
-    runPythonCode( pyS );
+  s << "w = plotSpectrum(ws.name(), 0, error_bars = %ERRORS%, type = "
+       "%CONNECT%, window = pw, "
+       "clearWindow = True)";
+  s << "w.setName(altName)";
+  s << "w.setObjectName(ws.name())";
+  s << "w.show()";
+  s << "w.setFocus()";
+
+  QString pyS;
+
+  // Add line separators
+  pyS += acquireWindowScript.join("\n") + "\n";
+
+  // Get plotting params
+  const QMap<QString, QString> &params = getPlotStyleParams(wsName);
+
+  // Insert real values
+  QString safeWSName(wsName);
+  safeWSName.replace("'", "\'");
+  pyS.replace("%WSNAME%", safeWSName);
+  pyS.replace("%PREV%", m_currentDataName);
+  pyS.replace("%ERRORS%", params["ShowErrors"]);
+  pyS.replace("%CONNECT%", params["ConnectType"]);
+
+  // Update titles
+  pyS += "l = w.activeLayer()\n"
+         "l.setCurveTitle(0, ws.name())\n"
+         "l.setTitle(ws.getTitle())\n";
+
+  // Set logarithmic scale if required
+  if (logScale)
+    pyS += "l.logYlinX()\n";
+
+  // Set scaling
+  if (params["YAxisAuto"] == "True") {
+    pyS += "l.setAutoScale()\n";
+  } else {
+    pyS += "l.setAxisScale(Layer.Left, %1, %2)\n";
+    pyS = pyS.arg(params["YAxisMin"]).arg(params["YAxisMax"]);
+  }
+  runPythonCode(pyS);
 }
 
 /**
- * Get current plot style parameters. wsName is used to get default values. 
+ * Get current plot style parameters. wsName is used to get default values.
  * @param wsName Workspace plot of which we want to style
- * @return Maps of the parameters, see MuonAnalysisOptionTab::parsePlotStyleParams for list
+ * @return Maps of the parameters, see
+ MuonAnalysisOptionTab::parsePlotStyleParams for list
            of possible keys
  */
-QMap<QString, QString> MuonAnalysis::getPlotStyleParams(const QString& wsName)
-{
+QMap<QString, QString> MuonAnalysis::getPlotStyleParams(const QString &wsName) {
   // Get parameter values from the options tab
   QMap<QString, QString> params = m_optionTab->parsePlotStyleParams();
 
   // If autoscale disabled
-  if(params["YAxisAuto"] == "False")
-  {
+  if (params["YAxisAuto"] == "False") {
     // Get specified min/max values for Y axis
     QString min = params["YAxisMin"];
     QString max = params["YAxisMax"];
 
     // If any of those is not specified - get min and max by default
-    if(min.isEmpty() || max.isEmpty())
-    {
-      Workspace_sptr ws_ptr = AnalysisDataService::Instance().retrieve(wsName.toStdString());
-      MatrixWorkspace_sptr matrix_workspace = boost::dynamic_pointer_cast<MatrixWorkspace>(ws_ptr);
-      const Mantid::MantidVec& dataY = matrix_workspace->readY(0);
-
-      if(min.isEmpty())
-        params["YAxisMin"] = QString::number(*min_element(dataY.begin(), dataY.end()));
-
-      if(max.isEmpty())
-        params["YAxisMax"] = QString::number(*max_element(dataY.begin(), dataY.end()));
+    if (min.isEmpty() || max.isEmpty()) {
+      Workspace_sptr ws_ptr =
+          AnalysisDataService::Instance().retrieve(wsName.toStdString());
+      MatrixWorkspace_sptr matrix_workspace =
+          boost::dynamic_pointer_cast<MatrixWorkspace>(ws_ptr);
+      const Mantid::MantidVec &dataY = matrix_workspace->readY(0);
+
+      if (min.isEmpty())
+        params["YAxisMin"] =
+            QString::number(*min_element(dataY.begin(), dataY.end()));
+
+      if (max.isEmpty())
+        params["YAxisMax"] =
+            QString::number(*max_element(dataY.begin(), dataY.end()));
     }
   }
 
@@ -2011,8 +1947,7 @@ QMap<QString, QString> MuonAnalysis::getPlotStyleParams(const QString& wsName)
  * @param wsName Name of the workspace
  * @return True if exists, false if not
  */
-bool MuonAnalysis::plotExists(const QString& wsName)
-{
+bool MuonAnalysis::plotExists(const QString &wsName) {
   QString code;
 
   code += "g = graph('%1-1')\n"
@@ -2020,13 +1955,13 @@ bool MuonAnalysis::plotExists(const QString& wsName)
           "  print('1')\n"
           "else:\n"
           "  print('0')\n";
-  
+
   QString output = runPythonCode(code.arg(wsName));
 
   bool ok;
   int outputCode = output.toInt(&ok);
 
-  if(!ok)
+  if (!ok)
     throw std::logic_error("Script should print 0 or 1");
 
   return (outputCode == 1);
@@ -2036,20 +1971,19 @@ bool MuonAnalysis::plotExists(const QString& wsName)
  * Enable PP tool for the plot of the given WS.
  * @param wsName Name of the WS which plot PP tool will be attached to.
  */
-void MuonAnalysis::selectMultiPeak(const QString& wsName)
-{
+void MuonAnalysis::selectMultiPeak(const QString &wsName) {
   disableAllTools();
 
-  if( ! plotExists(wsName) )
+  if (!plotExists(wsName))
     plotSpectrum(wsName);
 
   QString code;
 
   code += "g = graph('" + wsName + "-1')\n"
-          "if g != None:\n"
-          "  g.show()\n"
-          "  g.setFocus()\n"
-          "  selectMultiPeak(g)\n";
+                                   "if g != None:\n"
+                                   "  g.show()\n"
+                                   "  g.setFocus()\n"
+                                   "  selectMultiPeak(g)\n";
 
   runPythonCode(code);
 }
@@ -2057,16 +1991,12 @@ void MuonAnalysis::selectMultiPeak(const QString& wsName)
 /**
  * Disable tools for all the graphs within MantidPlot.
  */
-void MuonAnalysis::disableAllTools()
-{
-  runPythonCode("disableTools()");
-}
+void MuonAnalysis::disableAllTools() { runPythonCode("disableTools()"); }
 
 /**
  * Hides all the plot windows (MultiLayer ones)
  */
-void MuonAnalysis::hideAllPlotWindows()
-{
+void MuonAnalysis::hideAllPlotWindows() {
   QString code;
 
   code += "for w in windows():\n"
@@ -2079,8 +2009,7 @@ void MuonAnalysis::hideAllPlotWindows()
 /**
  * Shows all the plot windows (MultiLayer ones)
  */
-void MuonAnalysis::showAllPlotWindows()
-{
+void MuonAnalysis::showAllPlotWindows() {
   QString code;
 
   code += "for w in windows():\n"
@@ -2095,10 +2024,8 @@ void MuonAnalysis::showAllPlotWindows()
  *
  * @return true if set
  */
-bool MuonAnalysis::isGroupingSet() const
-{
-  std::vector<int> dummy;
-  whichGroupToWhichRow(m_uiForm, dummy);
+bool MuonAnalysis::isGroupingSet() const {
+  auto dummy = whichGroupToWhichRow(m_uiForm);
 
   if (dummy.empty())
     return false;
@@ -2112,16 +2039,12 @@ bool MuonAnalysis::isGroupingSet() const
  * @param str :: String of type "1-3, 5, 10-15"
  * @return Number of detectors. Return 0 if not recognised
  */
-int MuonAnalysis::numOfDetectors(const std::string& str) const
-{
+int MuonAnalysis::numOfDetectors(const std::string &str) const {
   size_t rangeSize;
 
-  try
-  {
+  try {
     rangeSize = Strings::parseRange(str).size();
-  }
-  catch(...)
-  {
+  } catch (...) {
     rangeSize = 0;
   }
 
@@ -2133,19 +2056,15 @@ int MuonAnalysis::numOfDetectors(const std::string& str) const
  *  @param s :: The input string
  *  @return True is input string is a number
  */
-bool MuonAnalysis::isNumber(const std::string& s) const
-{
-  if( s.empty() )
-  {
+bool MuonAnalysis::isNumber(const std::string &s) const {
+  if (s.empty()) {
     return false;
   }
 
   const std::string allowed("0123456789");
 
-  for (unsigned int i = 0; i < s.size(); i++)
-  {
-    if (allowed.find_first_of(s[i]) == std::string::npos)
-    {
+  for (unsigned int i = 0; i < s.size(); i++) {
+    if (allowed.find_first_of(s[i]) == std::string::npos) {
       return false;
     }
   }
@@ -2153,12 +2072,10 @@ bool MuonAnalysis::isNumber(const std::string& s) const
   return true;
 }
 
-
 /**
 * Return true if data are loaded
 */
-bool MuonAnalysis::areDataLoaded()
-{
+bool MuonAnalysis::areDataLoaded() {
   return AnalysisDataService::Instance().doesExist(m_workspace_name);
 }
 
@@ -2166,8 +2083,7 @@ bool MuonAnalysis::areDataLoaded()
 * Set start up interface look and populate local attributes
 * initiated from info set in QT designer
 */
-void MuonAnalysis::startUpLook()
-{
+void MuonAnalysis::startUpLook() {
   // populate group plot functions
   for (int i = 0; i < m_uiForm.groupTablePlotChoice->count(); i++)
     m_groupPlotFunc.append(m_uiForm.groupTablePlotChoice->itemText(i));
@@ -2175,8 +2091,8 @@ void MuonAnalysis::startUpLook()
   // pair plot functions
   for (int i = 0; i < m_uiForm.pairTablePlotChoice->count(); i++)
     m_pairPlotFunc.append(m_uiForm.pairTablePlotChoice->itemText(i));
-  
-  // Set initial front 
+
+  // Set initial front
   m_uiForm.frontAlphaLabel->setVisible(false);
   m_uiForm.frontAlphaNumber->setVisible(false);
   m_uiForm.frontAlphaNumber->setEnabled(false);
@@ -2189,65 +2105,54 @@ void MuonAnalysis::startUpLook()
   // set various properties of the group table
   m_uiForm.groupTable->setColumnWidth(0, 100);
   m_uiForm.groupTable->setColumnWidth(1, 200);
-  for (int i = 0; i < m_uiForm.groupTable->rowCount(); i++)
-  {
-    QTableWidgetItem* item = m_uiForm.groupTable->item(i,2);
-    if (!item)
-    {
-      QTableWidgetItem* it = new QTableWidgetItem("");
+  for (int i = 0; i < m_uiForm.groupTable->rowCount(); i++) {
+    QTableWidgetItem *item = m_uiForm.groupTable->item(i, 2);
+    if (!item) {
+      QTableWidgetItem *it = new QTableWidgetItem("");
       it->setFlags(it->flags() & (~Qt::ItemIsEditable));
-      m_uiForm.groupTable->setItem(i,2, it);
-    }
-    else
-    {
+      m_uiForm.groupTable->setItem(i, 2, it);
+    } else {
       item->setFlags(item->flags() & (~Qt::ItemIsEditable));
     }
-    item = m_uiForm.groupTable->item(i,0);
-    if (!item)
-    {
-      QTableWidgetItem* it = new QTableWidgetItem("");
-      m_uiForm.groupTable->setItem(i,0, it);
+    item = m_uiForm.groupTable->item(i, 0);
+    if (!item) {
+      QTableWidgetItem *it = new QTableWidgetItem("");
+      m_uiForm.groupTable->setItem(i, 0, it);
     }
   }
 }
 
- /**
- * Time zero returend in ms
- */
-double MuonAnalysis::timeZero()
-{
-  return getValidatedDouble(m_uiForm.timeZeroFront, TIME_ZERO_DEFAULT, "time zero", g_log);
+/**
+* Time zero returend in ms
+*/
+double MuonAnalysis::timeZero() {
+  return getValidatedDouble(m_uiForm.timeZeroFront, TIME_ZERO_DEFAULT,
+                            "time zero", g_log);
 }
 
 /**
- * Returns params string which can be passed to Rebin, according to what user specified. If no rebin
+ * Returns params string which can be passed to Rebin, according to what user
+ * specified. If no rebin
  * requested by user, returns an empty string.
- * @param wsForRebin :: Workspace we are going to rebin. Use to determine bin size
+ * @param wsForRebin :: Workspace we are going to rebin. Use to determine bin
+ * size
  * @return Params string to pass to rebin
  */
-std::string MuonAnalysis::rebinParams(Workspace_sptr wsForRebin)
-{
+std::string MuonAnalysis::rebinParams(Workspace_sptr wsForRebin) {
   MuonAnalysisOptionTab::RebinType rebinType = m_optionTab->getRebinType();
 
-  if ( rebinType == MuonAnalysisOptionTab::NoRebin )
-  {
+  if (rebinType == MuonAnalysisOptionTab::NoRebin) {
     return "";
-  }
-  else if ( rebinType == MuonAnalysisOptionTab::FixedRebin )
-  {
+  } else if (rebinType == MuonAnalysisOptionTab::FixedRebin) {
     MatrixWorkspace_sptr ws = firstPeriod(wsForRebin);
     double binSize = ws->dataX(0)[1] - ws->dataX(0)[0];
 
     double stepSize = m_optionTab->getRebinStep();
 
     return boost::lexical_cast<std::string>(binSize * stepSize);
-  }
-  else if ( rebinType == MuonAnalysisOptionTab::VariableRebin )
-  {
+  } else if (rebinType == MuonAnalysisOptionTab::VariableRebin) {
     return m_optionTab->getRebinParams();
-  }
-  else
-  {
+  } else {
     throw std::runtime_error("Unknown rebin type");
   }
 }
@@ -2255,35 +2160,35 @@ std::string MuonAnalysis::rebinParams(Workspace_sptr wsForRebin)
 /**
  * Return first good bin as set on the interface.
  */
-double MuonAnalysis::firstGoodBin() const
-{
-  return getValidatedDouble(m_uiForm.firstGoodBinFront, FIRST_GOOD_BIN_DEFAULT, "first good bin",
-                            g_log);
+double MuonAnalysis::firstGoodBin() const {
+  return getValidatedDouble(m_uiForm.firstGoodBinFront, FIRST_GOOD_BIN_DEFAULT,
+                            "first good bin", g_log);
 }
 
 /**
  * Returns min X value as specified by user.
  * @return Min X value
  */
-double MuonAnalysis::startTime() const
-{
+double MuonAnalysis::startTime() const {
   auto startTimeType = m_optionTab->getStartTimeType();
   double value(0);
 
-  switch(startTimeType)
-  {
-    case MuonAnalysisOptionTab::FirstGoodData:
-      value = firstGoodBin(); break;
+  switch (startTimeType) {
+  case MuonAnalysisOptionTab::FirstGoodData:
+    value = firstGoodBin();
+    break;
 
-    case MuonAnalysisOptionTab::TimeZero:
-      value = 0; break;
+  case MuonAnalysisOptionTab::TimeZero:
+    value = 0;
+    break;
 
-    case MuonAnalysisOptionTab::Custom:
-      value = m_optionTab->getCustomStartTime(); break;
+  case MuonAnalysisOptionTab::Custom:
+    value = m_optionTab->getCustomStartTime();
+    break;
 
-    default:
-      // Just in case added a new one
-      throw std::runtime_error("Unknown start time type");
+  default:
+    // Just in case added a new one
+    throw std::runtime_error("Unknown start time type");
   }
 
   return value;
@@ -2293,21 +2198,20 @@ double MuonAnalysis::startTime() const
  * Returns max X value as specified by user.
  * @return Max X value, or EMPTY_DBL() if not set
  */
-double MuonAnalysis::finishTime() const
-{
+double MuonAnalysis::finishTime() const {
   return m_optionTab->getCustomFinishTime();
 }
 
 /**
  * Load auto saved values
  */
-void MuonAnalysis::loadAutoSavedValues(const QString& group)
-{
+void MuonAnalysis::loadAutoSavedValues(const QString &group) {
   QSettings prevInstrumentValues;
   prevInstrumentValues.beginGroup(group + "instrument");
-  QString instrumentName = prevInstrumentValues.value("name", "MUSR").toString();
-  m_uiForm.instrSelector->setCurrentIndex(m_uiForm.instrSelector->findText(instrumentName));
-
+  QString instrumentName =
+      prevInstrumentValues.value("name", "MUSR").toString();
+  m_uiForm.instrSelector->setCurrentIndex(
+      m_uiForm.instrSelector->findText(instrumentName));
 
   // Load dead time options.
   QSettings deadTimeOptions;
@@ -2328,14 +2232,15 @@ void MuonAnalysis::loadAutoSavedValues(const QString& group)
   loadWidgetValue(m_uiForm.firstGoodDataAuto, Qt::Checked);
 }
 
-
 /**
-*   Loads up the options for the fit browser so that it works in a muon analysis tab
+*   Loads up the options for the fit browser so that it works in a muon analysis
+* tab
 */
-void MuonAnalysis::loadFittings()
-{
-  // Title of the fitting dock widget that now lies within the fittings tab. Should be made
-  // dynamic so that the Chi-sq can be displayed alongside like original fittings widget
+void MuonAnalysis::loadFittings() {
+  // Title of the fitting dock widget that now lies within the fittings tab.
+  // Should be made
+  // dynamic so that the Chi-sq can be displayed alongside like original
+  // fittings widget
   m_uiForm.fitBrowser->setWindowTitle("Fit Function");
   // Make sure that the window can't be moved or closed within the tab.
   m_uiForm.fitBrowser->setFeatures(QDockWidget::NoDockWidgetFeatures);
@@ -2344,8 +2249,7 @@ void MuonAnalysis::loadFittings()
 /**
  * Allow/disallow loading.
  */
-void MuonAnalysis::allowLoading(bool enabled)
-{
+void MuonAnalysis::allowLoading(bool enabled) {
   m_uiForm.nextRun->setEnabled(enabled);
   m_uiForm.previousRun->setEnabled(enabled);
   m_uiForm.loadCurrent->setEnabled(enabled);
@@ -2353,50 +2257,42 @@ void MuonAnalysis::allowLoading(bool enabled)
 }
 
 /**
-*   Check to see if the appending option is true when the previous button has been pressed and acts accordingly
+*   Check to see if the appending option is true when the previous button has
+* been pressed and acts accordingly
 */
-void MuonAnalysis::checkAppendingPreviousRun()
-{
-  if ( m_uiForm.mwRunFiles->getText().isEmpty() )
-  {
+void MuonAnalysis::checkAppendingPreviousRun() {
+  if (m_uiForm.mwRunFiles->getText().isEmpty()) {
     return;
   }
-  
+
   allowLoading(false);
-  
-  if (m_uiForm.mwRunFiles->getText().contains("-"))
-  {
+
+  if (m_uiForm.mwRunFiles->getText().contains("-")) {
     setAppendingRun(-1);
-  }
-  else
-  {
-    //Subtact one from the current run and load
+  } else {
+    // Subtact one from the current run and load
     changeRun(-1);
   }
 }
 
 /**
-*   Check to see if the appending option is true when the next button has been pressed and acts accordingly
+*   Check to see if the appending option is true when the next button has been
+* pressed and acts accordingly
 */
-void MuonAnalysis::checkAppendingNextRun()
-{
-  if (m_uiForm.mwRunFiles->getText().isEmpty() )
+void MuonAnalysis::checkAppendingNextRun() {
+  if (m_uiForm.mwRunFiles->getText().isEmpty())
     return;
 
   allowLoading(false);
 
-  if (m_uiForm.mwRunFiles->getText().contains("-"))
-  {
+  if (m_uiForm.mwRunFiles->getText().contains("-")) {
     setAppendingRun(1);
-  }
-  else
-  {
-    //Add one to current run and laod
+  } else {
+    // Add one to current run and laod
     changeRun(1);
   }
 }
 
-
 /**
 *   This sets up an appending lot of files so that when the user hits enter
 *   all files within the range will open.
@@ -2404,27 +2300,25 @@ void MuonAnalysis::checkAppendingNextRun()
 *   @param inc :: The number to increase the run by, this can be
 *   -1 if previous has been selected.
 */
-void MuonAnalysis::setAppendingRun(int inc)
-{
+void MuonAnalysis::setAppendingRun(int inc) {
   QString filePath("");
 
   // Get hold of the files to increment or decrement the range to.
-  QStringList currentFiles(m_uiForm.mwRunFiles->getFilenames() );
+  QStringList currentFiles(m_uiForm.mwRunFiles->getFilenames());
   if (currentFiles.empty())
     currentFiles = m_previousFilenames;
 
   // Name and size of the run to change.
   QString run("");
   int runSize(-1);
- 
+
   // The file number that needs to be incremented or decremented.
   int fileNumber(-1);
 
   if (inc < 0) // If the files list only includes one file.
   {
     fileNumber = 0; // Pick the first file in the list to decrement.
-  }
-  else // must be next that has been clicked.
+  } else            // must be next that has been clicked.
   {
     fileNumber = currentFiles.size() - 1; // Pick the last file to increment.
   }
@@ -2432,7 +2326,8 @@ void MuonAnalysis::setAppendingRun(int inc)
   // File path should be the same for both.
   separateMuonFile(filePath, currentFiles[fileNumber], run, runSize);
 
-  int fileExtensionSize(currentFiles[fileNumber].size()-currentFiles[fileNumber].indexOf('.') );
+  int fileExtensionSize(currentFiles[fileNumber].size() -
+                        currentFiles[fileNumber].indexOf('.'));
   QString fileExtension = currentFiles[fileNumber].right(fileExtensionSize);
   currentFiles[fileNumber].chop(fileExtensionSize);
 
@@ -2446,15 +2341,13 @@ void MuonAnalysis::setAppendingRun(int inc)
   getFullCode(runSize, newRun);
 
   // Increment is positive (next button)
-  if (inc < 0)
-  {
+  if (inc < 0) {
     // Add the file to the beginning of mwRunFiles text box.
-    QString lastName = m_previousFilenames[m_previousFilenames.size()-1];
+    QString lastName = m_previousFilenames[m_previousFilenames.size() - 1];
     separateMuonFile(filePath, lastName, run, runSize);
     getFullCode(runSize, run);
     m_uiForm.mwRunFiles->setUserInput(newRun + '-' + run);
-  }
-  else // Increment is negative (previous button)
+  } else // Increment is negative (previous button)
   {
     // Add the file onto the end of mwRunFiles text box
     QString firstName = m_previousFilenames[0];
@@ -2470,74 +2363,71 @@ void MuonAnalysis::setAppendingRun(int inc)
 *   @param amountToChange :: if clicked next then you need to open the next
 *   file so 1 is passed, -1 is passed if previous was clicked by the user.
 */
-void MuonAnalysis::changeRun(int amountToChange)
-{
+void MuonAnalysis::changeRun(int amountToChange) {
   QString filePath("");
   QString currentFile = m_uiForm.mwRunFiles->getFirstFilename();
-  if ( (currentFile.isEmpty() ) )
+  if ((currentFile.isEmpty()))
     currentFile = m_previousFilenames[0];
-  
+
   QString run("");
   int runSize(-1);
 
   // If load current run get the correct run number.
-  if (currentFile.contains("auto") || currentFile.contains("argus0000000"))
-  {
+  if (currentFile.contains("auto") || currentFile.contains("argus0000000")) {
     separateMuonFile(filePath, currentFile, run, runSize);
     currentFile = filePath + QString::fromStdString(m_currentLabel) + ".nxs";
   }
-    
+
   separateMuonFile(filePath, currentFile, run, runSize);
 
-  int fileExtensionSize(currentFile.size()-currentFile.indexOf('.') );
-  QString fileExtension(currentFile.right(fileExtensionSize) );
+  int fileExtensionSize(currentFile.size() - currentFile.indexOf('.'));
+  QString fileExtension(currentFile.right(fileExtensionSize));
   currentFile.chop(fileExtensionSize);
 
   int runNumber = currentFile.right(runSize).toInt();
   currentFile.chop(runSize);
-  
+
   runNumber = runNumber + amountToChange;
   QString newRun("");
   newRun.setNum(runNumber);
 
   getFullCode(runSize, newRun);
 
-  if (m_textToDisplay.contains("\\") || m_textToDisplay.contains("/") || m_textToDisplay == "CURRENT RUN")
+  if (m_textToDisplay.contains("\\") || m_textToDisplay.contains("/") ||
+      m_textToDisplay == "CURRENT RUN")
     m_uiForm.mwRunFiles->setUserInput(filePath + currentFile + newRun);
   else
     m_uiForm.mwRunFiles->setUserInput(newRun);
 }
 
-
 /**
 *   Seperates the a given file into instrument, code and size of the code.
 *   i.e c:/data/MUSR0002419.nxs becomes c:/data/, MUSR0002419.nxs, 2419, 7.
 *
 *   @param filePath :: The file path of the data file.
-*   @param currentFile :: This is the file with path. Can be network path. Return as file with extension.
+*   @param currentFile :: This is the file with path. Can be network path.
+* Return as file with extension.
 *   @param run :: The run as a string without 0's at the beginning.
 *   @param runSize :: contains the size of the run number.
 */
-void MuonAnalysis::separateMuonFile(QString &filePath, QString &currentFile, QString &run, int &runSize)
-{
+void MuonAnalysis::separateMuonFile(QString &filePath, QString &currentFile,
+                                    QString &run, int &runSize) {
   int fileStart(-1);
   int firstRunDigit(-1);
 
-  //Find where the file begins
-  for (int i = 0; i<currentFile.size(); i++)
-  {
-    if(currentFile[i] == '/' || currentFile[i] == '\\')  //.isDigit())
+  // Find where the file begins
+  for (int i = 0; i < currentFile.size(); i++) {
+    if (currentFile[i] == '/' || currentFile[i] == '\\') //.isDigit())
     {
-      fileStart = i+1;
+      fileStart = i + 1;
     }
   }
 
   filePath = currentFile.left(fileStart);
   currentFile = currentFile.right(currentFile.size() - fileStart);
 
-  for (int i = 0; i<currentFile.size(); i++)
-  {
-    if(currentFile[i].isDigit())  //.isDigit())
+  for (int i = 0; i < currentFile.size(); i++) {
+    if (currentFile[i].isDigit()) //.isDigit())
     {
       firstRunDigit = i;
       break;
@@ -2545,53 +2435,47 @@ void MuonAnalysis::separateMuonFile(QString &filePath, QString &currentFile, QSt
   }
 
   runSize = 0;
-  if (! (firstRunDigit < 0) )
-  {
-    //Find where the run number ends
-    for (int i = firstRunDigit; i<currentFile.size(); i++)
-    {
-      if(currentFile[i] == '.')
+  if (!(firstRunDigit < 0)) {
+    // Find where the run number ends
+    for (int i = firstRunDigit; i < currentFile.size(); i++) {
+      if (currentFile[i] == '.')
         break;
-      if(currentFile[i].isDigit())
-      {
+      if (currentFile[i].isDigit()) {
         ++runSize;
       }
     }
   }
-  run = currentFile.right(currentFile.size()-firstRunDigit);
+  run = currentFile.right(currentFile.size() - firstRunDigit);
   run = run.left(runSize);
 }
 
-
 /**
-* Adds the 0's back onto the run which were lost when converting it to an integer.
+* Adds the 0's back onto the run which were lost when converting it to an
+* integer.
 *
 * @param originalSize :: The size of the original run before conversion
 * @param run :: This is the run after it was incremented or decremented.
 */
-void MuonAnalysis::getFullCode(int originalSize, QString & run)
-{
-  while (originalSize > run.size())
-  {
+void MuonAnalysis::getFullCode(int originalSize, QString &run) {
+  while (originalSize > run.size()) {
     run = "0" + run;
   }
 }
 
-
 /**
  * Is called every time when tab gets changed
  *
  * @param newTabIndex :: The index of the tab we switch to
  */
-void MuonAnalysis::changeTab(int newTabIndex)
-{
-  QWidget* newTab = m_uiForm.tabWidget->widget(newTabIndex);
+void MuonAnalysis::changeTab(int newTabIndex) {
+  QWidget *newTab = m_uiForm.tabWidget->widget(newTabIndex);
 
-  // Make sure all toolbars are still not visible. May have brought them back to do a plot.
+  // Make sure all toolbars are still not visible. May have brought them back to
+  // do a plot.
   if (m_uiForm.hideToolbars->isChecked())
     emit setToolbarsHidden(true);
 
-  if(m_currentTab == m_uiForm.DataAnalysis) // Leaving DA tab
+  if (m_currentTab == m_uiForm.DataAnalysis) // Leaving DA tab
   {
     // Say MantidPlot to use default fit prop. browser
     emit setFitPropertyBrowser(NULL);
@@ -2599,12 +2483,14 @@ void MuonAnalysis::changeTab(int newTabIndex)
     // Remove PP tool from any plots it was attached to
     disableAllTools();
 
-    // Disconnect to avoid problems when filling list of workspaces in fit prop. browser
-    disconnect(m_uiForm.fitBrowser, SIGNAL(workspaceNameChanged(const QString&)),
-                              this, SLOT(selectMultiPeak(const QString&)));
+    // Disconnect to avoid problems when filling list of workspaces in fit prop.
+    // browser
+    disconnect(m_uiForm.fitBrowser,
+               SIGNAL(workspaceNameChanged(const QString &)), this,
+               SLOT(selectMultiPeak(const QString &)));
   }
 
-  if(newTab == m_uiForm.DataAnalysis) // Entering DA tab
+  if (newTab == m_uiForm.DataAnalysis) // Entering DA tab
   {
     // Save last fitting range
     auto xmin = m_uiForm.fitBrowser->startX();
@@ -2614,31 +2500,32 @@ void MuonAnalysis::changeTab(int newTabIndex)
     emit setFitPropertyBrowser(m_uiForm.fitBrowser);
 
     // Show connected plot and attach PP tool to it (if has been assigned)
-    if(m_currentDataName != NOT_AVAILABLE)
+    if (m_currentDataName != NOT_AVAILABLE)
       selectMultiPeak(m_currentDataName);
-    
-    // In future, when workspace gets changed, show its plot and attach PP tool to it
-    connect(m_uiForm.fitBrowser, SIGNAL(workspaceNameChanged(const QString&)),
-                           this, SLOT(selectMultiPeak(const QString&)), Qt::QueuedConnection);
+
+    // In future, when workspace gets changed, show its plot and attach PP tool
+    // to it
+    connect(m_uiForm.fitBrowser, SIGNAL(workspaceNameChanged(const QString &)),
+            this, SLOT(selectMultiPeak(const QString &)), Qt::QueuedConnection);
 
     // setFitPropertyBrowser() above changes the fitting range, so we have to
     // either initialise it to the correct values:
     if (xmin == 0.0 && xmax == 0.0) {
-      // A previous fitting range of [0,0] means this is the first time the users goes to "Data Analysis" tab
+      // A previous fitting range of [0,0] means this is the first time the
+      // users goes to "Data Analysis" tab
       // We have to initialise the fitting range
-      m_uiForm.fitBrowser->setStartX(m_uiForm.timeAxisStartAtInput->text().toDouble());
-      m_uiForm.fitBrowser->setEndX(m_uiForm.timeAxisFinishAtInput->text().toDouble());
+      m_uiForm.fitBrowser->setStartX(
+          m_uiForm.timeAxisStartAtInput->text().toDouble());
+      m_uiForm.fitBrowser->setEndX(
+          m_uiForm.timeAxisFinishAtInput->text().toDouble());
     }
     // or set it to the previous values provided by the user:
-    else
-    {
+    else {
       // A previous fitting range already exists, so we use it
-      m_uiForm.fitBrowser->setStartX (xmin);
-      m_uiForm.fitBrowser->setEndX (xmax);
+      m_uiForm.fitBrowser->setStartX(xmin);
+      m_uiForm.fitBrowser->setEndX(xmax);
     }
-  }
-  else if(newTab == m_uiForm.ResultsTable)
-  {
+  } else if (newTab == m_uiForm.ResultsTable) {
     m_resultTableTab->refresh();
   }
 
@@ -2648,56 +2535,68 @@ void MuonAnalysis::changeTab(int newTabIndex)
 /**
 * Set up the signals and slots for auto updating the plots
 */
-void MuonAnalysis::connectAutoUpdate()
-{
+void MuonAnalysis::connectAutoUpdate() {
   // Home tab Auto Updates
-  connect(m_uiForm.frontGroupGroupPairComboBox, SIGNAL( activated(int) ), this, SLOT( homeTabUpdatePlot() ));
+  connect(m_uiForm.frontGroupGroupPairComboBox, SIGNAL(activated(int)), this,
+          SLOT(homeTabUpdatePlot()));
 
-  connect(m_uiForm.frontPlotFuncs, SIGNAL( activated(int) ), this, SLOT( homeTabUpdatePlot() ));
-  connect(m_uiForm.frontAlphaNumber, SIGNAL( returnPressed() ), this, SLOT( homeTabUpdatePlot() ));
+  connect(m_uiForm.frontPlotFuncs, SIGNAL(activated(int)), this,
+          SLOT(homeTabUpdatePlot()));
+  connect(m_uiForm.frontAlphaNumber, SIGNAL(returnPressed()), this,
+          SLOT(homeTabUpdatePlot()));
 
-  connect(m_uiForm.timeZeroFront, SIGNAL(returnPressed()), this, SLOT(homeTabUpdatePlot()));
-  connect(m_uiForm.firstGoodBinFront, SIGNAL(returnPressed ()), this, SLOT(homeTabUpdatePlot()));
+  connect(m_uiForm.timeZeroFront, SIGNAL(returnPressed()), this,
+          SLOT(homeTabUpdatePlot()));
+  connect(m_uiForm.firstGoodBinFront, SIGNAL(returnPressed()), this,
+          SLOT(homeTabUpdatePlot()));
 
   connect(m_uiForm.homePeriodBox1, SIGNAL(editingFinished()), this,
           SLOT(homeTabUpdatePlot()));
   connect(m_uiForm.homePeriodBox2, SIGNAL(editingFinished()), this,
           SLOT(homeTabUpdatePlot()));
 
-  connect(m_uiForm.deadTimeType, SIGNAL( activated(int) ), this, SLOT( deadTimeTypeAutoUpdate(int) ));
+  connect(m_uiForm.deadTimeType, SIGNAL(activated(int)), this,
+          SLOT(deadTimeTypeAutoUpdate(int)));
 
   // Grouping tab Auto Updates
-  connect(m_uiForm.groupTablePlotChoice, SIGNAL(activated(int)), this, SLOT(groupTabUpdatePlot()));
-  connect(m_uiForm.pairTablePlotChoice, SIGNAL(activated(int)), this, SLOT(groupTabUpdatePlot()));
+  connect(m_uiForm.groupTablePlotChoice, SIGNAL(activated(int)), this,
+          SLOT(groupTabUpdatePlot()));
+  connect(m_uiForm.pairTablePlotChoice, SIGNAL(activated(int)), this,
+          SLOT(groupTabUpdatePlot()));
 
   // Settings tab Auto Updates
-  connect(m_optionTab, SIGNAL(settingsTabUpdatePlot()), this, SLOT(settingsTabUpdatePlot()));
-  connect(m_optionTab, SIGNAL(plotStyleChanged()), this, SLOT(updateCurrentPlotStyle()));
+  connect(m_optionTab, SIGNAL(settingsTabUpdatePlot()), this,
+          SLOT(settingsTabUpdatePlot()));
+  connect(m_optionTab, SIGNAL(plotStyleChanged()), this,
+          SLOT(updateCurrentPlotStyle()));
 }
 
 /**
- * Connect widgets to saveWidgetValue() slot so their values are automatically saved when they are
+ * Connect widgets to saveWidgetValue() slot so their values are automatically
+ * saved when they are
  * getting changed.
  */
-void MuonAnalysis::connectAutoSave()
-{
-  connect(m_uiForm.timeZeroFront, SIGNAL(textChanged(const QString&)), this, SLOT(saveWidgetValue()));
-  connect(m_uiForm.firstGoodBinFront, SIGNAL(textChanged(const QString&)), this, SLOT(saveWidgetValue()));
+void MuonAnalysis::connectAutoSave() {
+  connect(m_uiForm.timeZeroFront, SIGNAL(textChanged(const QString &)), this,
+          SLOT(saveWidgetValue()));
+  connect(m_uiForm.firstGoodBinFront, SIGNAL(textChanged(const QString &)),
+          this, SLOT(saveWidgetValue()));
 
-  connect(m_uiForm.timeZeroAuto, SIGNAL(stateChanged(int)), this, SLOT(saveWidgetValue()));
-  connect(m_uiForm.firstGoodDataAuto, SIGNAL(stateChanged(int)), this, SLOT(saveWidgetValue()));
+  connect(m_uiForm.timeZeroAuto, SIGNAL(stateChanged(int)), this,
+          SLOT(saveWidgetValue()));
+  connect(m_uiForm.firstGoodDataAuto, SIGNAL(stateChanged(int)), this,
+          SLOT(saveWidgetValue()));
 }
 
 /**
  * Saves the value of the widget which called the slot.
  * TODO: should be done using MuonAnalysisHelper::WidgetAutoSaver
  */
-void MuonAnalysis::saveWidgetValue()
-{
+void MuonAnalysis::saveWidgetValue() {
   // Get the widget which called the slot
-  QWidget* sender = qobject_cast<QWidget*>(QObject::sender());
+  QWidget *sender = qobject_cast<QWidget *>(QObject::sender());
 
-  if(!sender)
+  if (!sender)
     throw std::runtime_error("Unable to save value of non-widget QObject");
 
   QString name = sender->objectName();
@@ -2706,18 +2605,17 @@ void MuonAnalysis::saveWidgetValue()
   settings.beginGroup(m_settingsGroup + "SavedWidgetValues");
 
   // Save value for QLineEdit
-  if(QLineEdit* w = qobject_cast<QLineEdit*>(sender))
-  {
+  if (QLineEdit *w = qobject_cast<QLineEdit *>(sender)) {
     settings.setValue(name, w->text());
   }
   // Save value for QCheckBox
-  else if(QCheckBox* w = qobject_cast<QCheckBox*>(sender))
-  {
+  else if (QCheckBox *w = qobject_cast<QCheckBox *>(sender)) {
     settings.setValue(name, static_cast<int>(w->checkState()));
   }
   // ... add more as neccessary
   else
-    throw std::runtime_error("Value saving for this widget type is not supported");
+    throw std::runtime_error(
+        "Value saving for this widget type is not supported");
 
   settings.endGroup();
 }
@@ -2728,26 +2626,26 @@ void MuonAnalysis::saveWidgetValue()
  * @param       target :: Widget where the value will be loaded to
  * @param defaultValue :: Values which will be set if there is no saved value
  */
-void MuonAnalysis::loadWidgetValue(QWidget* target, const QVariant& defaultValue)
-{
+void MuonAnalysis::loadWidgetValue(QWidget *target,
+                                   const QVariant &defaultValue) {
   QString name = target->objectName();
 
   QSettings settings;
   settings.beginGroup(m_settingsGroup + "SavedWidgetValues");
 
   // Load value for QLineEdit
-  if(QLineEdit* w = qobject_cast<QLineEdit*>(target))
-  {
+  if (QLineEdit *w = qobject_cast<QLineEdit *>(target)) {
     w->setText(settings.value(name, defaultValue).toString());
   }
   // Load value for QCheckBox
-  else if(QCheckBox* w = qobject_cast<QCheckBox*>(target))
-  {
-    w->setCheckState(static_cast<Qt::CheckState>(settings.value(name, defaultValue).toInt()));
+  else if (QCheckBox *w = qobject_cast<QCheckBox *>(target)) {
+    w->setCheckState(static_cast<Qt::CheckState>(
+        settings.value(name, defaultValue).toInt()));
   }
   // ... add more as neccessary
   else
-    throw std::runtime_error("Value loading for this widget type is not supported");
+    throw std::runtime_error(
+        "Value loading for this widget type is not supported");
 
   settings.endGroup();
 }
@@ -2764,34 +2662,33 @@ void MuonAnalysis::checkForEqualPeriods() {
   }
 }
 
-void MuonAnalysis::homeTabUpdatePlot()
-{
+void MuonAnalysis::homeTabUpdatePlot() {
   if (isAutoUpdateEnabled() && m_currentTab == m_uiForm.Home && m_loaded)
-      runFrontPlotButton();
+    runFrontPlotButton();
 }
 
-void MuonAnalysis::groupTabUpdatePlot()
-{
-  if (isAutoUpdateEnabled() && m_currentTab == m_uiForm.GroupingOptions && m_loaded)
-      runFrontPlotButton();
+void MuonAnalysis::groupTabUpdatePlot() {
+  if (isAutoUpdateEnabled() && m_currentTab == m_uiForm.GroupingOptions &&
+      m_loaded)
+    runFrontPlotButton();
 }
 
-void MuonAnalysis::settingsTabUpdatePlot()
-{
-  if (isAutoUpdateEnabled() && m_currentTab == m_uiForm.Settings && m_loaded == true)
+void MuonAnalysis::settingsTabUpdatePlot() {
+  if (isAutoUpdateEnabled() && m_currentTab == m_uiForm.Settings &&
+      m_loaded == true)
     runFrontPlotButton();
 }
 
 /**
- * Sets plot type combo box on the Home tab to the same value as the one under Group Table.
+ * Sets plot type combo box on the Home tab to the same value as the one under
+ * Group Table.
  */
-void MuonAnalysis::syncGroupTablePlotTypeWithHome()
-{
+void MuonAnalysis::syncGroupTablePlotTypeWithHome() {
   int plotTypeIndex = m_uiForm.groupTablePlotChoice->currentIndex();
 
-  if ( m_uiForm.frontPlotFuncs->count() <= plotTypeIndex )
-  {
-    // This is not the best solution, but I don't have anything brighter at the moment and it
+  if (m_uiForm.frontPlotFuncs->count() <= plotTypeIndex) {
+    // This is not the best solution, but I don't have anything brighter at the
+    // moment and it
     // was working like that for some time without anybody complaining.
     m_uiForm.frontGroupGroupPairComboBox->setCurrentIndex(0);
   }
@@ -2800,19 +2697,17 @@ void MuonAnalysis::syncGroupTablePlotTypeWithHome()
 }
 
 /**
- * Updates the style of the current plot according to actual parameters on settings tab.
+ * Updates the style of the current plot according to actual parameters on
+ * settings tab.
  */
-void MuonAnalysis::updateCurrentPlotStyle()
-{
-  if (isAutoUpdateEnabled() && m_currentDataName != NOT_AVAILABLE)
-  {
+void MuonAnalysis::updateCurrentPlotStyle() {
+  if (isAutoUpdateEnabled() && m_currentDataName != NOT_AVAILABLE) {
     // Replot using new style params
     plotSpectrum(m_currentDataName);
   }
 }
 
-bool MuonAnalysis::isAutoUpdateEnabled()
-{
+bool MuonAnalysis::isAutoUpdateEnabled() {
   int choice(m_uiForm.plotCreation->currentIndex());
   return (choice == 0 || choice == 1);
 }
@@ -2821,8 +2716,7 @@ bool MuonAnalysis::isAutoUpdateEnabled()
  * Whether Overwrite option is enabled on the Settings tab.
  * @return True if enabled, false if not
  */
-bool MuonAnalysis::isOverwriteEnabled()
-{
+bool MuonAnalysis::isOverwriteEnabled() {
   int choice(m_uiForm.plotCreation->currentIndex());
   return (choice == 0 || choice == 2);
 }
@@ -2830,25 +2724,22 @@ bool MuonAnalysis::isOverwriteEnabled()
 /**
  * Executed when interface gets hidden or closed
  */
-void MuonAnalysis::hideEvent(QHideEvent *)
-{
+void MuonAnalysis::hideEvent(QHideEvent *) {
   // Show toolbars if were chosen to be hidden by user
   if (m_uiForm.hideToolbars->isChecked())
     emit setToolbarsHidden(false);
-  
+
   // If closed while on DA tab, reassign fit property browser to default one
-  if(m_currentTab == m_uiForm.DataAnalysis)
+  if (m_currentTab == m_uiForm.DataAnalysis)
     emit setFitPropertyBrowser(NULL);
 }
 
-
 /**
  * Executed when interface gets shown
  */
-void MuonAnalysis::showEvent(QShowEvent *)
-{
+void MuonAnalysis::showEvent(QShowEvent *) {
   // Hide toolbars if requested by user
-  if (m_uiForm.hideToolbars->isChecked() )
+  if (m_uiForm.hideToolbars->isChecked())
     emit setToolbarsHidden(true);
 }
 
@@ -2856,28 +2747,24 @@ void MuonAnalysis::showEvent(QShowEvent *)
  * Hide/show MantidPlot toolbars.
  * @param hidden If true, toolbars will be hidden, if false - shown
  */
-void MuonAnalysis::doSetToolbarsHidden(bool hidden)
-{
+void MuonAnalysis::doSetToolbarsHidden(bool hidden) {
   QString isVisibleStr = hidden ? "False" : "True";
 
-  runPythonCode( QString("setToolbarsVisible(%1)").arg(isVisibleStr) );
+  runPythonCode(QString("setToolbarsVisible(%1)").arg(isVisibleStr));
 }
 
-
 /**
  * Called when dead time correction type is changed.
  * @param choice :: New index of dead time correction type combo box
  */
-void MuonAnalysis::onDeadTimeTypeChanged(int choice)
-{
+void MuonAnalysis::onDeadTimeTypeChanged(int choice) {
   m_deadTimesChanged = true;
 
   if (choice == 0 || choice == 1) // if choice == none || choice == from file
   {
     m_uiForm.mwRunDeadTimeFile->setVisible(false);
     m_uiForm.dtcFileLabel->setVisible(false);
-  }
-  else // choice must be from workspace
+  } else // choice must be from workspace
   {
     m_uiForm.mwRunDeadTimeFile->setVisible(true);
     m_uiForm.mwRunDeadTimeFile->setUserInput("");
@@ -2893,24 +2780,22 @@ void MuonAnalysis::onDeadTimeTypeChanged(int choice)
  * Auto-update the plot after user has changed dead time correction type.
  * @param choice :: User selected index of the dead time correction combox box
  */
-void MuonAnalysis::deadTimeTypeAutoUpdate(int choice)
-{
-  // We update the plot only if user switches to "None" or "From Data File" correction type, because
+void MuonAnalysis::deadTimeTypeAutoUpdate(int choice) {
+  // We update the plot only if user switches to "None" or "From Data File"
+  // correction type, because
   // in case of "From Disk" the file should be specified first.
-  if ( choice == 0 || choice == 1 )
-  {
+  if (choice == 0 || choice == 1) {
     homeTabUpdatePlot();
   }
 }
 
 /**
-* If the user selects/changes the file to be used to apply the dead times then 
+* If the user selects/changes the file to be used to apply the dead times then
 * see if the plot needs updating and make sure next time the user plots that the
 * dead times are applied.
 */
-void MuonAnalysis::deadTimeFileSelected()
-{
-  if(!m_uiForm.mwRunDeadTimeFile->isValid())
+void MuonAnalysis::deadTimeFileSelected() {
+  if (!m_uiForm.mwRunDeadTimeFile->isValid())
     return;
 
   // Remember the filename for the next time interface is opened
@@ -2923,42 +2808,43 @@ void MuonAnalysis::deadTimeFileSelected()
 }
 
 /**
- * Updates the enabled-state and value of Time Zero using "auto" check-box state.
- * @param checkBoxState :: State of "auto" check-box. If -1 will retrieve it from the form
+ * Updates the enabled-state and value of Time Zero using "auto" check-box
+ * state.
+ * @param checkBoxState :: State of "auto" check-box. If -1 will retrieve it
+ * from the form
  */
-void MuonAnalysis::setTimeZeroState(int checkBoxState)
-{
-  if(checkBoxState == -1)
+void MuonAnalysis::setTimeZeroState(int checkBoxState) {
+  if (checkBoxState == -1)
     checkBoxState = m_uiForm.timeZeroAuto->checkState();
 
-  if(checkBoxState == Qt::Checked) // From data file
+  if (checkBoxState == Qt::Checked) // From data file
   {
     m_uiForm.timeZeroFront->setEnabled(false);
     m_uiForm.timeZeroFront->setText(QString::number(m_dataTimeZero, 'g', 2));
     homeTabUpdatePlot(); // Auto-update
-  }
-  else // Custom
+  } else                 // Custom
   {
     m_uiForm.timeZeroFront->setEnabled(true);
   }
 }
 
 /**
- * Updates the enabled-state and value of First Good Data using "auto" check-box state.
- * @param checkBoxState :: State of "auto" check-box. If -1 will retrieve it from the form
+ * Updates the enabled-state and value of First Good Data using "auto" check-box
+ * state.
+ * @param checkBoxState :: State of "auto" check-box. If -1 will retrieve it
+ * from the form
  */
-void MuonAnalysis::setFirstGoodDataState(int checkBoxState)
-{
-  if(checkBoxState == -1)
+void MuonAnalysis::setFirstGoodDataState(int checkBoxState) {
+  if (checkBoxState == -1)
     checkBoxState = m_uiForm.firstGoodDataAuto->checkState();
 
-  if(checkBoxState == Qt::Checked) // From data file
+  if (checkBoxState == Qt::Checked) // From data file
   {
     m_uiForm.firstGoodBinFront->setEnabled(false);
-    m_uiForm.firstGoodBinFront->setText(QString::number(m_dataFirstGoodData, 'g', 2));
+    m_uiForm.firstGoodBinFront->setText(
+        QString::number(m_dataFirstGoodData, 'g', 2));
     homeTabUpdatePlot(); // Auto-update
-  }
-  else // Custom
+  } else                 // Custom
   {
     m_uiForm.firstGoodBinFront->setEnabled(true);
   }
@@ -2970,8 +2856,9 @@ void MuonAnalysis::setFirstGoodDataState(int checkBoxState)
  * @param groupingName :: ADS name of the grouping table to use
  * @return Grouped workspace
  */
-Workspace_sptr MuonAnalysis::groupWorkspace(const std::string& wsName, const std::string& groupingName) const
-{
+Workspace_sptr
+MuonAnalysis::groupWorkspace(const std::string &wsName,
+                             const std::string &groupingName) const {
   ScopedWorkspace outputEntry;
 
   // Use MuonProcess in "correct and group" mode.
@@ -2991,7 +2878,8 @@ Workspace_sptr MuonAnalysis::groupWorkspace(const std::string& wsName, const std
     groupAlg->setPropertyValue("OutputWorkspace", outputEntry.name());
     groupAlg->execute();
   } catch (std::exception &e) {
-    throw std::runtime_error( "Unable to group workspace:\n\n" + std::string(e.what()) );
+    throw std::runtime_error("Unable to group workspace:\n\n" +
+                             std::string(e.what()));
   }
 
   return outputEntry.retrieve();
@@ -3001,16 +2889,17 @@ Workspace_sptr MuonAnalysis::groupWorkspace(const std::string& wsName, const std
  * Groups loaded workspace using information from Grouping Options tab.
  * I.e. m_workspace_name is grouped with result placed to m_grouped_name
  */
-void MuonAnalysis::groupLoadedWorkspace()
-{
+void MuonAnalysis::groupLoadedWorkspace() {
   ITableWorkspace_sptr grouping = parseGrouping();
 
-  if ( ! grouping )
-    throw std::invalid_argument("Unable to parse grouping information from the table, or it is empty.");
+  if (!grouping)
+    throw std::invalid_argument(
+        "Unable to parse grouping information from the table, or it is empty.");
 
   ScopedWorkspace groupingEntry(grouping);
 
-  Workspace_sptr groupedWorkspace = groupWorkspace(m_workspace_name, groupingEntry.name());
+  Workspace_sptr groupedWorkspace =
+      groupWorkspace(m_workspace_name, groupingEntry.name());
 
   deleteWorkspaceIfExists(m_grouped_name);
   AnalysisDataService::Instance().add(m_grouped_name, groupedWorkspace);
@@ -3020,8 +2909,7 @@ void MuonAnalysis::groupLoadedWorkspace()
  * Parses grouping information from the UI table.
  * @return ITableWorkspace of the format returned by LoadMuonNexus
  */
-ITableWorkspace_sptr MuonAnalysis::parseGrouping()
-{
+ITableWorkspace_sptr MuonAnalysis::parseGrouping() {
   auto grouping = boost::make_shared<Mantid::API::Grouping>();
   parseGroupingTable(m_uiForm, *grouping);
   return groupingToTable(grouping);
@@ -3030,15 +2918,12 @@ ITableWorkspace_sptr MuonAnalysis::parseGrouping()
 /**
  * Opens a sequential fit dialog.
  */
-void MuonAnalysis::openSequentialFitDialog()
-{
+void MuonAnalysis::openSequentialFitDialog() {
   Algorithm_sptr loadAlg;
 
-  try
-  {
+  try {
     loadAlg = createLoadAlgorithm();
-  }
-  catch (const std::runtime_error &err) {
+  } catch (const std::runtime_error &err) {
     QString message("Error while setting load properties.\n"
                     "If instrument was changed, properties will have been "
                     "cleared and should be reset.\n\n"
@@ -3047,16 +2932,16 @@ void MuonAnalysis::openSequentialFitDialog()
     QMessageBox::critical(this, "Unable to open dialog", message);
     g_log.error(message.ascii());
     return;
-  }
-  catch(...)
-  {
-    QMessageBox::critical(this, "Unable to open dialog", "Error while setting load properties");
+  } catch (...) {
+    QMessageBox::critical(this, "Unable to open dialog",
+                          "Error while setting load properties");
     return;
   }
 
   m_uiForm.fitBrowser->blockSignals(true);
 
-  MuonSequentialFitDialog* dialog = new MuonSequentialFitDialog(m_uiForm.fitBrowser, loadAlg);
+  MuonSequentialFitDialog *dialog =
+      new MuonSequentialFitDialog(m_uiForm.fitBrowser, loadAlg);
   dialog->exec();
 
   m_uiForm.fitBrowser->blockSignals(false);
@@ -3066,9 +2951,8 @@ void MuonAnalysis::openSequentialFitDialog()
  * Returns custom dead time table file name as set on the interface.
  * @return The filename
  */
-std::string MuonAnalysis::deadTimeFilename() const
-{
-  if(!m_uiForm.mwRunDeadTimeFile->isValid())
+std::string MuonAnalysis::deadTimeFilename() const {
+  if (!m_uiForm.mwRunDeadTimeFile->isValid())
     throw std::runtime_error("Specified Dead Time file is not valid.");
 
   return m_uiForm.mwRunDeadTimeFile->getFirstFilename().toStdString();
@@ -3079,11 +2963,10 @@ std::string MuonAnalysis::deadTimeFilename() const
  * @param filename :: File to load dead times from
  * @return Table (group of tables) with dead times
  */
-Workspace_sptr MuonAnalysis::loadDeadTimes(const std::string& filename) const
-{
-  try
-  {
-    IAlgorithm_sptr loadDeadTimes = AlgorithmManager::Instance().create("LoadNexusProcessed");
+Workspace_sptr MuonAnalysis::loadDeadTimes(const std::string &filename) const {
+  try {
+    IAlgorithm_sptr loadDeadTimes =
+        AlgorithmManager::Instance().create("LoadNexusProcessed");
     loadDeadTimes->setChild(true);
     loadDeadTimes->setLogging(false); // We'll take care of logging ourself
     loadDeadTimes->setPropertyValue("Filename", filename);
@@ -3091,11 +2974,10 @@ Workspace_sptr MuonAnalysis::loadDeadTimes(const std::string& filename) const
     loadDeadTimes->execute();
 
     return loadDeadTimes->getProperty("OutputWorkspace");
-  }
-  catch(std::exception& e)
-  {
+  } catch (std::exception &e) {
     std::ostringstream errorMsg;
-    errorMsg << "Unable to load dead times from the specified file: " << e.what();
+    errorMsg << "Unable to load dead times from the specified file: "
+             << e.what();
     throw std::runtime_error(errorMsg.str());
   }
 }
@@ -3146,11 +3028,11 @@ MuonAnalysis::deadTimesToTable(const Workspace_sptr &deadTimes) const {
 }
 
 /**
- * Creates and algorithm with all the properties set according to widget values on the interface.
+ * Creates and algorithm with all the properties set according to widget values
+ * on the interface.
  * @return The algorithm with properties set
  */
-Algorithm_sptr MuonAnalysis::createLoadAlgorithm()
-{
+Algorithm_sptr MuonAnalysis::createLoadAlgorithm() {
   Algorithm_sptr loadAlg =
       AlgorithmManager::Instance().createUnmanaged("MuonProcess");
   loadAlg->initialize();
@@ -3161,14 +3043,13 @@ Algorithm_sptr MuonAnalysis::createLoadAlgorithm()
   // set too. If it can't be set here (from disk file), the sequential fit
   // must load the dead times from each file.
 
-  if (m_uiForm.deadTimeType->currentIndex() != 0)
-  {
+  if (m_uiForm.deadTimeType->currentIndex() != 0) {
     loadAlg->setProperty("ApplyDeadTimeCorrection", true);
 
     if (m_uiForm.deadTimeType->currentIndex() == 2) // From Specified File
     {
 
-      Workspace_sptr deadTimes = loadDeadTimes( deadTimeFilename() );
+      Workspace_sptr deadTimes = loadDeadTimes(deadTimeFilename());
 
       loadAlg->setProperty("DeadTimeTable", deadTimesToTable(deadTimes));
     }
@@ -3176,26 +3057,25 @@ Algorithm_sptr MuonAnalysis::createLoadAlgorithm()
 
   // -- Grouping --------------------------------------------------------------
 
-  ITableWorkspace_sptr grouping = parseGrouping(); 
+  ITableWorkspace_sptr grouping = parseGrouping();
   loadAlg->setProperty("DetectorGroupingTable", grouping);
 
   // -- X axis options --------------------------------------------------------
   loadAlg->setProperty("Xmin", startTime());
 
   double Xmax = finishTime();
-  if (Xmax != EMPTY_DBL())
-  {
+  if (Xmax != EMPTY_DBL()) {
     loadAlg->setProperty("Xmax", Xmax);
   }
 
-  double timeZero = m_uiForm.timeZeroFront->text().toDouble(); 
+  double timeZero = m_uiForm.timeZeroFront->text().toDouble();
   loadAlg->setProperty("TimeZero", timeZero);
 
   // -- Rebin options ---------------------------------------------------------
-  std::string params = rebinParams(AnalysisDataService::Instance().retrieve(m_grouped_name));
+  std::string params =
+      rebinParams(AnalysisDataService::Instance().retrieve(m_grouped_name));
 
-  if (!params.empty())
-  {
+  if (!params.empty()) {
     loadAlg->setPropertyValue("RebinParams", params);
   }
 
@@ -3203,24 +3083,23 @@ Algorithm_sptr MuonAnalysis::createLoadAlgorithm()
 
   int index = m_uiForm.frontGroupGroupPairComboBox->currentIndex();
 
-  if (index >= numGroups())
-  {
+  if (index >= numGroups()) {
     loadAlg->setProperty("OutputType", "PairAsymmetry");
     int tableRow = m_pairToRow[index - numGroups()];
 
-    QTableWidget* t = m_uiForm.pairTable;
+    QTableWidget *t = m_uiForm.pairTable;
 
-    double alpha = t->item(tableRow,3)->text().toDouble();
-    int index1 = static_cast<QComboBox*>( t->cellWidget(tableRow,1) )->currentIndex();
-    int index2 = static_cast<QComboBox*>( t->cellWidget(tableRow,2) )->currentIndex();
+    double alpha = t->item(tableRow, 3)->text().toDouble();
+    int index1 =
+        static_cast<QComboBox *>(t->cellWidget(tableRow, 1))->currentIndex();
+    int index2 =
+        static_cast<QComboBox *>(t->cellWidget(tableRow, 2))->currentIndex();
 
     loadAlg->setProperty("PairFirstIndex", index1);
     loadAlg->setProperty("PairSecondIndex", index2);
     loadAlg->setProperty("Alpha", alpha);
-  }
-  else
-  {
-    if ( parsePlotType(m_uiForm.frontPlotFuncs) == Asymmetry )
+  } else {
+    if (parsePlotType(m_uiForm.frontPlotFuncs) == Asymmetry)
       loadAlg->setProperty("OutputType", "GroupAsymmetry");
     else
       loadAlg->setProperty("OutputType", "GroupCounts");
@@ -3235,8 +3114,7 @@ Algorithm_sptr MuonAnalysis::createLoadAlgorithm()
   loadAlg->setProperty("SummedPeriodSet", periodLabel1.toStdString());
 
   QString periodLabel2 = m_uiForm.homePeriodBox2->text();
-  if ( periodLabel2 != "None" )
-  {
+  if (periodLabel2 != "None") {
     loadAlg->setProperty("SubtractedPeriodSet", periodLabel2.toStdString());
   }
 
@@ -3246,32 +3124,29 @@ Algorithm_sptr MuonAnalysis::createLoadAlgorithm()
 /**
  * When no data loaded set various buttons etc to inactive
  */
-void MuonAnalysis::noDataAvailable()
-{
+void MuonAnalysis::noDataAvailable() {
   m_uiForm.frontPlotButton->setEnabled(false);
   m_uiForm.groupTablePlotButton->setEnabled(false);
   m_uiForm.pairTablePlotButton->setEnabled(false);
   m_uiForm.guessAlphaButton->setEnabled(false);
 }
 
-
 /**
  * When data loaded set various buttons etc to active
  */
-void MuonAnalysis::nowDataAvailable()
-{
+void MuonAnalysis::nowDataAvailable() {
   m_uiForm.frontPlotButton->setEnabled(true);
   m_uiForm.groupTablePlotButton->setEnabled(true);
   m_uiForm.pairTablePlotButton->setEnabled(true);
   m_uiForm.guessAlphaButton->setEnabled(true);
 }
 
-void MuonAnalysis::openDirectoryDialog()
-{
-  MantidQt::API::ManageUserDirectories *ad = new MantidQt::API::ManageUserDirectories(this);
+void MuonAnalysis::openDirectoryDialog() {
+  MantidQt::API::ManageUserDirectories *ad =
+      new MantidQt::API::ManageUserDirectories(this);
   ad->show();
   ad->setFocus();
 }
 
-}//namespace MantidQT
-}//namespace CustomInterfaces
+} // namespace MantidQT
+} // namespace CustomInterfaces
diff --git a/MantidQt/CustomInterfaces/src/Muon/MuonAnalysisResultTableTab.cpp b/MantidQt/CustomInterfaces/src/Muon/MuonAnalysisResultTableTab.cpp
index 07138d8b6585bfbfca189ddeb86a85ddebeda70d..dc5c80466ec404d3c0bff96c0a953f9bfb077c96 100644
--- a/MantidQt/CustomInterfaces/src/Muon/MuonAnalysisResultTableTab.cpp
+++ b/MantidQt/CustomInterfaces/src/Muon/MuonAnalysisResultTableTab.cpp
@@ -307,7 +307,7 @@ QStringList MuonAnalysisResultTableTab::getIndividualFitWorkspaces()
 {
   QStringList workspaces;
 
-  std::set<std::string> allWorkspaces = AnalysisDataService::Instance().getObjectNames();
+  auto allWorkspaces = AnalysisDataService::Instance().getObjectNames();
 
   for(auto it = allWorkspaces.begin(); it != allWorkspaces.end(); it++)
   {
diff --git a/MantidQt/CustomInterfaces/src/Reflectometry/ReflGenerateNotebook.cpp b/MantidQt/CustomInterfaces/src/Reflectometry/ReflGenerateNotebook.cpp
index 8f627bae49c28f0cb264f2883197b0aca5891e7f..05f873b6d610dcb8e9c25a81f70243d03b06444a 100644
--- a/MantidQt/CustomInterfaces/src/Reflectometry/ReflGenerateNotebook.cpp
+++ b/MantidQt/CustomInterfaces/src/Reflectometry/ReflGenerateNotebook.cpp
@@ -2,6 +2,7 @@
 #include "MantidAPI/NotebookWriter.h"
 #include "MantidQtCustomInterfaces/ParseKeyValueString.h"
 #include "MantidQtCustomInterfaces/Reflectometry/ReflVectorString.h"
+#include "MantidKernel/make_unique.h"
 
 #include <sstream>
 #include <fstream>
@@ -49,10 +50,7 @@ std::string
 ReflGenerateNotebook::generateNotebook(std::map<int, std::set<int>> groups,
                                        std::set<int> rows) {
 
-  std::unique_ptr<Mantid::API::NotebookWriter> notebook(
-      new Mantid::API::NotebookWriter());
-
-  notebook->codeCell(plotsFunctionString());
+  auto notebook = Mantid::Kernel::make_unique<Mantid::API::NotebookWriter>();
 
   notebook->markdownCell(titleString(m_wsName));
 
@@ -198,15 +196,6 @@ std::string tableString(QReflTableModel_sptr model, ColNumbers col_nums,
   return table_string.str();
 }
 
-/**
-  Create string of python code for plotting functions
-  @return string containing the python code
-  */
-std::string plotsFunctionString() {
-  return "#Import some useful tools for plotting\n"
-         "from MantidIPython import *";
-}
-
 /**
   Create string of python code to stitch workspaces in the same group
   @param rows : rows in the stitch group
diff --git a/MantidQt/CustomInterfaces/src/Reflectometry/ReflMainViewPresenter.cpp b/MantidQt/CustomInterfaces/src/Reflectometry/ReflMainViewPresenter.cpp
index 92b19e9266d691223586cb5c472dae64a47feaaa..78b14169ffb7593d6acd13fdbcb74180dc99eb13 100644
--- a/MantidQt/CustomInterfaces/src/Reflectometry/ReflMainViewPresenter.cpp
+++ b/MantidQt/CustomInterfaces/src/Reflectometry/ReflMainViewPresenter.cpp
@@ -177,10 +177,8 @@ ReflMainViewPresenter::ReflMainViewPresenter(
   Mantid::API::AnalysisDataServiceImpl &ads =
       Mantid::API::AnalysisDataService::Instance();
 
-  std::set<std::string> items;
-  items = ads.getObjectNames();
-  for (auto it = items.begin(); it != items.end(); ++it) {
-    const std::string name = *it;
+  auto items = ads.getObjectNames();
+  for (auto const &name : items) {
     Workspace_sptr ws = ads.retrieve(name);
 
     if (isValidModel(ws))
@@ -326,13 +324,13 @@ void ReflMainViewPresenter::saveNotebook(std::map<int, std::set<int>> groups,
     return;
   }
 
-  std::unique_ptr<ReflGenerateNotebook> notebook(new ReflGenerateNotebook(
+  auto notebook = Mantid::Kernel::make_unique<ReflGenerateNotebook>(
       m_wsName, m_model, m_view->getProcessInstrument(),
       ReflTableSchema::COL_RUNS, ReflTableSchema::COL_TRANSMISSION,
       ReflTableSchema::COL_OPTIONS, ReflTableSchema::COL_ANGLE,
       ReflTableSchema::COL_QMIN, ReflTableSchema::COL_QMAX,
       ReflTableSchema::COL_DQQ, ReflTableSchema::COL_SCALE,
-      ReflTableSchema::COL_GROUP));
+      ReflTableSchema::COL_GROUP);
   std::string generatedNotebook = notebook->generateNotebook(groups, rows);
 
   std::ofstream file(filename.c_str(), std::ofstream::trunc);
@@ -1452,13 +1450,27 @@ void ReflMainViewPresenter::search() {
   // This is breaking the abstraction provided by IReflSearcher, but provides a
   // nice usability win
   // If we're not logged into a catalog, prompt the user to do so
-  if (CatalogManager::Instance().getActiveSessions().empty())
-    m_view->showAlgorithmDialog("CatalogLogin");
-
-  auto sessionId =
-      CatalogManager::Instance().getActiveSessions().front()->getSessionId();
-
-  // try {
+  if (CatalogManager::Instance().getActiveSessions().empty()) {
+    try {
+      m_view->showAlgorithmDialog("CatalogLogin");
+    } catch (std::runtime_error &e) {
+      m_view->giveUserCritical("Error Logging in:\n" + std::string(e.what()),
+                               "login failed");
+    }
+  }
+  std::string sessionId;
+  // check to see if we have any active sessions for ICAT
+  if (!CatalogManager::Instance().getActiveSessions().empty()) {
+    // we have an active session, so grab the ID
+    sessionId =
+        CatalogManager::Instance().getActiveSessions().front()->getSessionId();
+  } else {
+    // there are no active sessions, we return here to avoid an exception
+    m_view->giveUserInfo(
+        "Error Logging in: Please press 'Search' to try again.",
+        "Login Failed");
+    return;
+  }
   auto algSearch = AlgorithmManager::Instance().create("CatalogGetDataFiles");
   algSearch->initialize();
   algSearch->setChild(true);
@@ -1468,34 +1480,6 @@ void ReflMainViewPresenter::search() {
   algSearch->setProperty("OutputWorkspace", "_ReflSearchResults");
   auto algRunner = m_view->getAlgorithmRunner();
   algRunner->startAlgorithm(algSearch);
-  /*
-  while (!currentAlg->isExecuted())
-  {
-
-  THIS WORKS FUNCTIONALLY BUT YOU NEED TO
-  FIND A BETTER WAY TO SEE IF ALGORITHM
-  HAS BEEN EXECUTED AS THIS STILL INTRODUCES
-  A SERIAL-TYPE LAG
-
-
-
-  }
-  if (currentAlg->isExecuted())
-  {
-  ITableWorkspace_sptr results = currentAlg->getProperty("OutputWorkspace");
-  m_searchModel = ReflSearchModel_sptr(
-  new ReflSearchModel(*getTransferStrategy(), results, searchInstr));
-  m_view->showSearch(m_searchModel);
-  }
-  //ITableWorkspace_sptr results = algSearch->getProperty("OutputWorkspace");
-  //auto results = m_searcher->search(searchString);
-  m_searchModel = ReflSearchModel_sptr(
-  new ReflSearchModel(*getTransferStrategy(), results, searchInstr));
-  m_view->showSearch(m_searchModel);
-  } catch (std::runtime_error &e) {
-  m_view->giveUserCritical("Error running search:\n" + std::string(e.what()),
-  "Search Failed");
-  }*/
 }
 
 void ReflMainViewPresenter::populateSearch(IAlgorithm_sptr searchAlg) {
@@ -1756,6 +1740,7 @@ void ReflMainViewPresenter::initOptions() {
 std::unique_ptr<ReflTransferStrategy>
 ReflMainViewPresenter::getTransferStrategy() {
   const std::string currentMethod = m_view->getTransferMethod();
+  std::unique_ptr<ReflTransferStrategy> rtnStrategy;
   if (currentMethod == MeasureTransferMethod) {
 
     // We need catalog info overrides from the user-based config service
@@ -1763,22 +1748,22 @@ ReflMainViewPresenter::getTransferStrategy() {
         makeCatalogConfigServiceAdapter(ConfigService::Instance()));
 
     // We make a user-based Catalog Info object for the transfer
-    auto catInfo = std::unique_ptr<ICatalogInfo>(new UserCatalogInfo(
+    std::unique_ptr<ICatalogInfo> catInfo = make_unique<UserCatalogInfo>(
         ConfigService::Instance().getFacility().catalogInfo(),
-        *catConfigService));
+        *catConfigService);
 
     // We are going to load from disk to pick up the meta data, so provide the
     // right repository to do this.
-    auto source = std::unique_ptr<ReflMeasurementItemSource>(
-        new ReflNexusMeasurementItemSource);
+    std::unique_ptr<ReflMeasurementItemSource> source =
+        make_unique<ReflNexusMeasurementItemSource>();
 
     // Finally make and return the Measure based transfer strategy.
-    return std::unique_ptr<ReflTransferStrategy>(
-        new ReflMeasureTransferStrategy(std::move(catInfo), std::move(source)));
+    rtnStrategy = Mantid::Kernel::make_unique<ReflMeasureTransferStrategy>(
+        std::move(catInfo), std::move(source));
+    return rtnStrategy;
   } else if (currentMethod == LegacyTransferMethod) {
-    return std::unique_ptr<ReflTransferStrategy>(
-        new ReflLegacyTransferStrategy);
-
+    rtnStrategy = make_unique<ReflLegacyTransferStrategy>();
+    return rtnStrategy;
   } else {
     throw std::runtime_error("Unknown tranfer method selected: " +
                              currentMethod);
diff --git a/MantidQt/CustomInterfaces/src/SANSDiagnostics.cpp b/MantidQt/CustomInterfaces/src/SANSDiagnostics.cpp
index bc6f44799bdcd0bb0e7057b7716eb0bb8b613a6d..a8abf5f7ac065bbd333bd9dbb244c7646c0f98e0 100644
--- a/MantidQt/CustomInterfaces/src/SANSDiagnostics.cpp
+++ b/MantidQt/CustomInterfaces/src/SANSDiagnostics.cpp
@@ -527,8 +527,7 @@ namespace MantidQt
                                               QString& startWSIndex,QString& endWSIndex)
     {      
             
-      std::vector<size_t> wsindexList;
-      mws_sptr->getIndicesFromSpectra(specList,wsindexList);
+      auto wsindexList = mws_sptr->getIndicesFromSpectra(specList);
       std::string wsStart;
       std::string wsEnd;
       try
diff --git a/MantidQt/CustomInterfaces/src/SANSRunWindow.cpp b/MantidQt/CustomInterfaces/src/SANSRunWindow.cpp
index 004700917eb96d514beb9685f25c0e834d2e2774..bc6d68f1ff407bedbbfdd6d935efb42707653c8c 100644
--- a/MantidQt/CustomInterfaces/src/SANSRunWindow.cpp
+++ b/MantidQt/CustomInterfaces/src/SANSRunWindow.cpp
@@ -49,7 +49,6 @@
 
 #include "MantidQtCustomInterfaces/SANSEventSlicing.h"
 
-#include <boost/assign.hpp>
 #include <boost/foreach.hpp>
 #include <boost/function.hpp>
 #include <boost/tuple/tuple.hpp>
@@ -435,8 +434,7 @@ void SANSRunWindow::initLocalPython() {
   // Make sure that user file is valid
   if (!isValidUserFile()) {
     m_cfg_loaded = false;
-  }
-  else {
+  } else {
     loadUserFile();
     handleInstrumentChange();
     m_cfg_loaded = true;
@@ -1465,11 +1463,11 @@ bool SANSRunWindow::workspaceExists(const QString &ws_name) const {
  * @returns A list of the currently available workspaces
  */
 QStringList SANSRunWindow::currentWorkspaceList() const {
-  std::set<std::string> ws_list =
+  auto ws_list =
       AnalysisDataService::Instance().getObjectNames();
-  std::set<std::string>::const_iterator iend = ws_list.end();
+  auto iend = ws_list.end();
   QStringList current_list;
-  for (std::set<std::string>::const_iterator itr = ws_list.begin(); itr != iend;
+  for (auto itr = ws_list.begin(); itr != iend;
        ++itr) {
     current_list.append(QString::fromStdString(*itr));
   }
@@ -3666,9 +3664,9 @@ void SANSRunWindow::resetGeometryDetailsBox() {
 void SANSRunWindow::cleanup() {
   Mantid::API::AnalysisDataServiceImpl &ads =
       Mantid::API::AnalysisDataService::Instance();
-  std::set<std::string> workspaces = ads.getObjectNames();
-  std::set<std::string>::const_iterator iend = workspaces.end();
-  for (std::set<std::string>::const_iterator itr = workspaces.begin();
+  auto workspaces = ads.getObjectNames();
+  auto iend = workspaces.end();
+  for (auto itr = workspaces.begin();
        itr != iend; ++itr) {
     QString name = QString::fromStdString(*itr);
     if (name.endsWith("_raw") || name.endsWith("_nxs")) {
@@ -4920,7 +4918,7 @@ void SANSRunWindow::initQResolutionSettings() {
 }
 
 /**
- * Initialize the background corrections, ie reset all fields 
+ * Initialize the background corrections, ie reset all fields
  */
 void SANSRunWindow::initializeBackgroundCorrection() {
   m_uiForm.sansBackgroundCorrectionWidget->resetEntries();
@@ -5036,7 +5034,8 @@ void SANSRunWindow::addBackgroundCorrectionToPythonScript(
  */
 bool SANSRunWindow::hasUserFileValidFileExtension() {
   auto userFile = m_uiForm.userfile_edit->text().trimmed();
-  QString checkValidity = "i.has_user_file_valid_extension('" + userFile +"')\n";
+  QString checkValidity =
+      "i.has_user_file_valid_extension('" + userFile + "')\n";
 
   QString resultCheckValidity(runPythonCode(checkValidity, false));
   resultCheckValidity = resultCheckValidity.simplified();
@@ -5046,10 +5045,11 @@ bool SANSRunWindow::hasUserFileValidFileExtension() {
   }
 
   if (!isValid) {
-    QMessageBox::critical(this, "User File extension issue",
-                                "The specified user file does not seem to have a \n"
-				"valid file extension. Make sure that the user file \n" 
-				"has a .txt extension.");
+    QMessageBox::critical(
+        this, "User File extension issue",
+        "The specified user file does not seem to have a \n"
+        "valid file extension. Make sure that the user file \n"
+        "has a .txt extension.");
   }
 
   return isValid;
@@ -5074,7 +5074,7 @@ bool SANSRunWindow::isValidUserFile() {
   QString filetext = m_uiForm.userfile_edit->text().trimmed();
   if (filetext.isEmpty()) {
     QMessageBox::warning(this, "Error loading user file",
-      "No user file has been specified");
+                         "No user file has been specified");
     m_cfg_loaded = false;
     return false;
   }
@@ -5082,7 +5082,7 @@ bool SANSRunWindow::isValidUserFile() {
   QFile user_file(filetext);
   if (!user_file.open(QIODevice::ReadOnly)) {
     QMessageBox::critical(this, "Error loading user file",
-      "Could not open user file \"" + filetext + "\"");
+                          "Could not open user file \"" + filetext + "\"");
     m_cfg_loaded = false;
     return false;
   }
@@ -5091,6 +5091,5 @@ bool SANSRunWindow::isValidUserFile() {
   return true;
 }
 
-
 } // namespace CustomInterfaces
 } // namespace MantidQt
diff --git a/MantidQt/CustomInterfaces/test/ALCBaselineModellingModelTest.h b/MantidQt/CustomInterfaces/test/ALCBaselineModellingModelTest.h
index 48ef6e3ca0bfb37ed24f9c98b89f976a85f5c16c..f7221adf15a644a49979708138b8b66319a5fb53 100644
--- a/MantidQt/CustomInterfaces/test/ALCBaselineModellingModelTest.h
+++ b/MantidQt/CustomInterfaces/test/ALCBaselineModellingModelTest.h
@@ -3,8 +3,6 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include <boost/assign.hpp>
-
 #include "MantidAPI/FrameworkManager.h"
 #include "MantidAPI/FunctionFactory.h"
 #include "MantidAPI/ITableWorkspace.h"
@@ -18,37 +16,33 @@
 using namespace Mantid::API;
 using namespace MantidQt::CustomInterfaces;
 
-class ALCBaselineModellingModelTest : public CxxTest::TestSuite
-{
-  ALCBaselineModellingModel* m_model;
+class ALCBaselineModellingModelTest : public CxxTest::TestSuite {
+  ALCBaselineModellingModel *m_model;
 
 public:
   // This pair of boilerplate methods prevent the suite being created statically
   // This means the constructor isn't called when running other tests
-  static ALCBaselineModellingModelTest *createSuite() { return new ALCBaselineModellingModelTest(); }
-  static void destroySuite( ALCBaselineModellingModelTest *suite ) { delete suite; }
+  static ALCBaselineModellingModelTest *createSuite() {
+    return new ALCBaselineModellingModelTest();
+  }
+  static void destroySuite(ALCBaselineModellingModelTest *suite) {
+    delete suite;
+  }
 
-  ALCBaselineModellingModelTest()
-  {
+  ALCBaselineModellingModelTest() {
     FrameworkManager::Instance(); // To make sure everything is initialized
   }
 
-  void setUp()
-  {
-    m_model = new ALCBaselineModellingModel();
-  }
+  void setUp() { m_model = new ALCBaselineModellingModel(); }
 
-  void tearDown()
-  {
-    delete m_model;
-  }
+  void tearDown() { delete m_model; }
 
-  void test_setData()
-  {
-    std::vector<double> y = boost::assign::list_of(100)(1)(2)(100)(100)(3)(4)(5)(100);
-    std::vector<double> x = boost::assign::list_of(1)(2)(3)(4)(5)(6)(7)(8)(9);
+  void test_setData() {
+    std::vector<double> y = {100, 1, 2, 100, 100, 3, 4, 5, 100};
+    std::vector<double> x = {1, 2, 3, 4, 5, 6, 7, 8, 9};
 
-    MatrixWorkspace_sptr data = WorkspaceFactory::Instance().create("Workspace2D", 1, y.size(), y.size());
+    MatrixWorkspace_sptr data = WorkspaceFactory::Instance().create(
+        "Workspace2D", 1, y.size(), y.size());
     data->dataY(0) = y;
     data->dataX(0) = x;
 
@@ -65,20 +59,21 @@ public:
     TS_ASSERT_EQUALS(modelData->readE(0), data->readE(0));
   }
 
-  void test_fit()
-  {
-    std::vector<double> e = boost::assign::list_of(10.0)(1.0)(1.41)(10.0)(10.0)(1.73)(2.0)(2.5)(10.0);
-    std::vector<double> y = boost::assign::list_of(100)(1)(2)(100)(100)(3)(4)(5)(100);
-    std::vector<double> x = boost::assign::list_of(1)(2)(3)(4)(5)(6)(7)(8)(9);
+  void test_fit() {
+    std::vector<double> e = {10.0, 1.0, 1.41, 10.0, 10.0, 1.73, 2.0, 2.5, 10.0};
+    std::vector<double> y = {100, 1, 2, 100, 100, 3, 4, 5, 100};
+    std::vector<double> x = {1, 2, 3, 4, 5, 6, 7, 8, 9};
 
-    MatrixWorkspace_sptr data = WorkspaceFactory::Instance().create("Workspace2D", 1, y.size(), y.size());
+    MatrixWorkspace_sptr data = WorkspaceFactory::Instance().create(
+        "Workspace2D", 1, y.size(), y.size());
     data->dataE(0) = e;
     data->dataY(0) = y;
     data->dataX(0) = x;
 
     m_model->setData(data);
 
-    IFunction_const_sptr func = FunctionFactory::Instance().createInitialized("name=FlatBackground,A0=0");
+    IFunction_const_sptr func = FunctionFactory::Instance().createInitialized(
+        "name=FlatBackground,A0=0");
 
     std::vector<IALCBaselineModellingModel::Section> sections;
     sections.emplace_back(2, 3);
@@ -90,18 +85,16 @@ public:
     IFunction_const_sptr fittedFunc = m_model->fittedFunction();
     TS_ASSERT(fittedFunc);
 
-    if (fittedFunc)
-    {
+    if (fittedFunc) {
       TS_ASSERT_EQUALS(fittedFunc->name(), "FlatBackground");
       TS_ASSERT_DELTA(fittedFunc->getParameter("A0"), 2.13979, 1E-5);
-      TS_ASSERT_DELTA(fittedFunc->getError(0),0.66709,1E-5);
+      TS_ASSERT_DELTA(fittedFunc->getError(0), 0.66709, 1E-5);
     }
 
     MatrixWorkspace_const_sptr corrected = m_model->correctedData();
     TS_ASSERT(corrected);
 
-    if (corrected)
-    {
+    if (corrected) {
       TS_ASSERT_EQUALS(corrected->getNumberHistograms(), 1);
       TS_ASSERT_EQUALS(corrected->blocksize(), 9);
 
@@ -110,47 +103,40 @@ public:
       TS_ASSERT_DELTA(corrected->readY(0)[5], 0.86021, 1E-5);
       TS_ASSERT_DELTA(corrected->readY(0)[8], 97.86021, 1E-5);
 
-      TS_ASSERT_EQUALS (corrected->readE(0), data->readE(0));
+      TS_ASSERT_EQUALS(corrected->readE(0), data->readE(0));
     }
 
     ITableWorkspace_sptr parameters = m_model->parameterTable();
     TS_ASSERT(parameters);
 
-    if (parameters)
-    {
+    if (parameters) {
       // Check table dimensions
       TS_ASSERT_EQUALS(parameters->rowCount(), 2);
       TS_ASSERT_EQUALS(parameters->columnCount(), 3);
 
       // Check table entries
-      TS_ASSERT_EQUALS(parameters->String(0,0), "A0");
-      TS_ASSERT_DELTA (parameters->Double(0,1), 2.13978, 1E-5);
-      TS_ASSERT_DELTA (parameters->Double(0,2), 0.66709, 1E-5);
-      TS_ASSERT_EQUALS(parameters->String(1,0), "Cost function value");
-      TS_ASSERT_DELTA (parameters->Double(1,1), 0.46627, 1E-5);
-      TS_ASSERT_EQUALS(parameters->Double(1,2), 0);
+      TS_ASSERT_EQUALS(parameters->String(0, 0), "A0");
+      TS_ASSERT_DELTA(parameters->Double(0, 1), 2.13978, 1E-5);
+      TS_ASSERT_DELTA(parameters->Double(0, 2), 0.66709, 1E-5);
+      TS_ASSERT_EQUALS(parameters->String(1, 0), "Cost function value");
+      TS_ASSERT_DELTA(parameters->Double(1, 1), 0.46627, 1E-5);
+      TS_ASSERT_EQUALS(parameters->Double(1, 2), 0);
     }
 
     TS_ASSERT_EQUALS(m_model->sections(), sections);
   }
 
-  void test_exportWorkspace()
-  {
+  void test_exportWorkspace() {
     TS_ASSERT_THROWS_NOTHING(m_model->exportWorkspace());
   }
 
-  void test_exportTable()
-  {
+  void test_exportTable() {
     TS_ASSERT_THROWS_NOTHING(m_model->exportSections());
   }
 
-  void test_exportModel()
-  {
-    TS_ASSERT_THROWS_NOTHING(m_model->exportModel());
-  }
+  void test_exportModel() { TS_ASSERT_THROWS_NOTHING(m_model->exportModel()); }
 
-  void test_noData()
-  {
+  void test_noData() {
     // Set a null shared pointer
     MatrixWorkspace_const_sptr data = MatrixWorkspace_const_sptr();
     m_model->setData(data);
@@ -158,8 +144,6 @@ public:
     TS_ASSERT_THROWS_NOTHING(m_model->data());
     TS_ASSERT_THROWS_NOTHING(m_model->correctedData());
   }
-
 };
 
-
 #endif /* MANTID_CUSTOMINTERFACES_ALCBASELINEMODELLINGMODELTEST_H_ */
diff --git a/MantidQt/CustomInterfaces/test/ALCBaselineModellingPresenterTest.h b/MantidQt/CustomInterfaces/test/ALCBaselineModellingPresenterTest.h
index e624a9444fa4a797fa933a41c4c5ceb4453fde8d..68f034ebb248031a952001969b7f52b77330bd2b 100644
--- a/MantidQt/CustomInterfaces/test/ALCBaselineModellingPresenterTest.h
+++ b/MantidQt/CustomInterfaces/test/ALCBaselineModellingPresenterTest.h
@@ -5,7 +5,6 @@
 #include <gmock/gmock.h>
 
 #include <boost/scoped_ptr.hpp>
-#include <boost/assign/list_of.hpp>
 
 #include "MantidAPI/FrameworkManager.h"
 #include "MantidAPI/FunctionFactory.h"
@@ -18,8 +17,7 @@ using namespace MantidQt::CustomInterfaces;
 using namespace testing;
 using boost::scoped_ptr;
 
-class MockALCBaselineModellingView : public IALCBaselineModellingView
-{
+class MockALCBaselineModellingView : public IALCBaselineModellingView {
 public:
   void requestFit() { emit fitRequested(); }
   void requestAddSection() { emit addSectionRequested(); }
@@ -32,9 +30,11 @@ public:
   MOCK_CONST_METHOD0(function, QString());
   MOCK_CONST_METHOD1(sectionRow, SectionRow(int));
 
-  MOCK_METHOD2(setDataCurve, void(const QwtData&, const std::vector<double>&));
-  MOCK_METHOD2(setCorrectedCurve, void(const QwtData&, const std::vector<double>&));
-  MOCK_METHOD1(setBaselineCurve, void(const QwtData&));
+  MOCK_METHOD2(setDataCurve,
+               void(const QwtData &, const std::vector<double> &));
+  MOCK_METHOD2(setCorrectedCurve,
+               void(const QwtData &, const std::vector<double> &));
+  MOCK_METHOD1(setBaselineCurve, void(const QwtData &));
   MOCK_METHOD1(setFunction, void(IFunction_const_sptr));
 
   MOCK_CONST_METHOD0(noOfSectionRows, int());
@@ -46,16 +46,15 @@ public:
   MOCK_METHOD2(updateSectionSelector, void(int, SectionSelector));
   MOCK_METHOD1(deleteSectionSelector, void(int));
 
-  MOCK_METHOD1(setSectionSelectors, void(const std::vector<SectionSelector>&));
+  MOCK_METHOD1(setSectionSelectors, void(const std::vector<SectionSelector> &));
   MOCK_METHOD3(updateSectionSelector, void(size_t, double, double));
 
-  MOCK_METHOD1(displayError, void(const QString&));
+  MOCK_METHOD1(displayError, void(const QString &));
 
   MOCK_METHOD0(help, void());
 };
 
-class MockALCBaselineModellingModel : public IALCBaselineModellingModel
-{
+class MockALCBaselineModellingModel : public IALCBaselineModellingModel {
 public:
   void changeData() { emit dataChanged(); }
   void changeFittedFunction() { emit fittedFunctionChanged(); }
@@ -65,53 +64,57 @@ public:
   MOCK_CONST_METHOD0(correctedData, MatrixWorkspace_const_sptr());
   MOCK_CONST_METHOD0(data, MatrixWorkspace_const_sptr());
 
-  MOCK_METHOD2(fit, void(IFunction_const_sptr, const std::vector<Section>&));
+  MOCK_METHOD2(fit, void(IFunction_const_sptr, const std::vector<Section> &));
 };
 
 MATCHER_P(FunctionName, name, "") { return arg->name() == name; }
 
-MATCHER_P3(FunctionParameter, param, value, delta, "")
-{
+MATCHER_P3(FunctionParameter, param, value, delta, "") {
   return fabs(arg->getParameter(param) - value) < delta;
 }
 
-MATCHER_P3(QwtDataX, i, value, delta, "") { return fabs(arg.x(i) - value) < delta; }
-MATCHER_P3(QwtDataY, i, value, delta, "") { return fabs(arg.y(i) - value) < delta; }
-MATCHER_P3(VectorValue, i, value, delta, "") { return fabs(arg.at(i) - value) < delta; }
+MATCHER_P3(QwtDataX, i, value, delta, "") {
+  return fabs(arg.x(i) - value) < delta;
+}
+MATCHER_P3(QwtDataY, i, value, delta, "") {
+  return fabs(arg.y(i) - value) < delta;
+}
+MATCHER_P3(VectorValue, i, value, delta, "") {
+  return fabs(arg.at(i) - value) < delta;
+}
 
-class ALCBaselineModellingPresenterTest : public CxxTest::TestSuite
-{
-  MockALCBaselineModellingView* m_view;
-  MockALCBaselineModellingModel* m_model;
-  ALCBaselineModellingPresenter* m_presenter;
+class ALCBaselineModellingPresenterTest : public CxxTest::TestSuite {
+  MockALCBaselineModellingView *m_view;
+  MockALCBaselineModellingModel *m_model;
+  ALCBaselineModellingPresenter *m_presenter;
 
   // To save myself some typing
-  IALCBaselineModellingView::SectionRow sectionRow(double min, double max)
-  {
+  IALCBaselineModellingView::SectionRow sectionRow(double min, double max) {
     return std::make_pair(QString::number(min), QString::number(max));
   }
 
 public:
   // This pair of boilerplate methods prevent the suite being created statically
   // This means the constructor isn't called when running otherl tests
-  static ALCBaselineModellingPresenterTest *createSuite() { return new ALCBaselineModellingPresenterTest(); }
-  static void destroySuite( ALCBaselineModellingPresenterTest *suite ) { delete suite; }
+  static ALCBaselineModellingPresenterTest *createSuite() {
+    return new ALCBaselineModellingPresenterTest();
+  }
+  static void destroySuite(ALCBaselineModellingPresenterTest *suite) {
+    delete suite;
+  }
 
-  ALCBaselineModellingPresenterTest()
-  {
+  ALCBaselineModellingPresenterTest() {
     FrameworkManager::Instance(); // To make sure everything is initialized
   }
 
-  void setUp()
-  {
+  void setUp() {
     m_view = new NiceMock<MockALCBaselineModellingView>();
     m_model = new NiceMock<MockALCBaselineModellingModel>();
     m_presenter = new ALCBaselineModellingPresenter(m_view, m_model);
     m_presenter->initialize();
   }
 
-  void tearDown()
-  {
+  void tearDown() {
     TS_ASSERT(Mock::VerifyAndClearExpectations(m_view));
     TS_ASSERT(Mock::VerifyAndClearExpectations(m_model));
 
@@ -121,12 +124,11 @@ public:
   }
 
   // Creates a workspace with x = [1,2,3...size], y = x + deltaY and e = 1
-  MatrixWorkspace_sptr createTestWs(size_t size, double deltaY = 0)
-  {
-    MatrixWorkspace_sptr ws = WorkspaceFactory::Instance().create("Workspace2D", 1, size, size);
+  MatrixWorkspace_sptr createTestWs(size_t size, double deltaY = 0) {
+    MatrixWorkspace_sptr ws =
+        WorkspaceFactory::Instance().create("Workspace2D", 1, size, size);
 
-    for (size_t i = 0; i < size; ++i)
-    {
+    for (size_t i = 0; i < size; ++i) {
       ws->dataX(0)[i] = static_cast<double>(i + 1);
       ws->dataY(0)[i] = ws->dataX(0)[i] + deltaY;
       ws->dataE(0)[i] = 1;
@@ -135,9 +137,9 @@ public:
     return ws;
   }
 
-  void test_initialize()
-  {
-    // Not using m_view and m_present, because they are already initialized after setUp()
+  void test_initialize() {
+    // Not using m_view and m_present, because they are already initialized
+    // after setUp()
     MockALCBaselineModellingView view;
     MockALCBaselineModellingModel model;
     ALCBaselineModellingPresenter presenter(&view, &model);
@@ -145,61 +147,63 @@ public:
     presenter.initialize();
   }
 
-  void test_dataChanged()
-  {
+  void test_dataChanged() {
     ON_CALL(*m_view, noOfSectionRows()).WillByDefault(Return(3));
     ON_CALL(*m_model, data()).WillByDefault(Return(createTestWs(3, 1)));
 
-    EXPECT_CALL(*m_view, setDataCurve(AllOf(Property(&QwtData::size, 3),
-                                            QwtDataX(0, 1, 1E-8), QwtDataX(2, 3, 1E-8),
-                                            QwtDataY(0, 2, 1E-8), QwtDataY(2, 4, 1E-8)),
-                                      AllOf(Property(&std::vector<double>::size,3),
-                                            VectorValue(0, 1, 1E-6),
-                                            VectorValue(2, 1, 1E-6))));
+    EXPECT_CALL(
+        *m_view,
+        setDataCurve(AllOf(Property(&QwtData::size, 3), QwtDataX(0, 1, 1E-8),
+                           QwtDataX(2, 3, 1E-8), QwtDataY(0, 2, 1E-8),
+                           QwtDataY(2, 4, 1E-8)),
+                     AllOf(Property(&std::vector<double>::size, 3),
+                           VectorValue(0, 1, 1E-6), VectorValue(2, 1, 1E-6))));
 
     m_model->changeData();
   }
 
-  void test_correctedChanged()
-  {
-    ON_CALL(*m_model, correctedData()).WillByDefault(Return(createTestWs(3, 2)));
+  void test_correctedChanged() {
+    ON_CALL(*m_model, correctedData())
+        .WillByDefault(Return(createTestWs(3, 2)));
 
-    EXPECT_CALL(*m_view, setCorrectedCurve(AllOf(Property(&QwtData::size, 3),
-                                            QwtDataX(0, 1, 1E-8), QwtDataX(2, 3, 1E-8),
-                                            QwtDataY(0, 3, 1E-8), QwtDataY(2, 5, 1E-8)),
-                                           AllOf(Property(&std::vector<double>::size,3),
-                                            VectorValue(0, 1, 1E-6),
-                                            VectorValue(2, 1, 1E-6))));
+    EXPECT_CALL(*m_view,
+                setCorrectedCurve(
+                    AllOf(Property(&QwtData::size, 3), QwtDataX(0, 1, 1E-8),
+                          QwtDataX(2, 3, 1E-8), QwtDataY(0, 3, 1E-8),
+                          QwtDataY(2, 5, 1E-8)),
+                    AllOf(Property(&std::vector<double>::size, 3),
+                          VectorValue(0, 1, 1E-6), VectorValue(2, 1, 1E-6))));
 
     m_model->changeCorrectedData();
   }
 
-  void test_correctedChanged_toEmpty()
-  {
-    ON_CALL(*m_model, correctedData()).WillByDefault(Return(MatrixWorkspace_const_sptr()));
+  void test_correctedChanged_toEmpty() {
+    ON_CALL(*m_model, correctedData())
+        .WillByDefault(Return(MatrixWorkspace_const_sptr()));
 
-    EXPECT_CALL(*m_view, setCorrectedCurve(Property(&QwtData::size, 0),_));
+    EXPECT_CALL(*m_view, setCorrectedCurve(Property(&QwtData::size, 0), _));
 
     m_model->changeCorrectedData();
   }
 
-  void test_fittedFunctionChanged()
-  {
-    auto f = FunctionFactory::Instance().createInitialized("name=FlatBackground,A0=5");
+  void test_fittedFunctionChanged() {
+    auto f = FunctionFactory::Instance().createInitialized(
+        "name=FlatBackground,A0=5");
 
     ON_CALL(*m_model, fittedFunction()).WillByDefault(Return(f));
     ON_CALL(*m_model, data()).WillByDefault(Return(createTestWs(3)));
 
-    EXPECT_CALL(*m_view, setBaselineCurve(AllOf(Property(&QwtData::size, 3),
-                                                QwtDataX(0, 1, 1E-8), QwtDataX(2, 3, 1E-8),
-                                                QwtDataY(0, 5, 1E-8), QwtDataY(2, 5, 1E-8))));
+    EXPECT_CALL(*m_view, setBaselineCurve(AllOf(
+                             Property(&QwtData::size, 3), QwtDataX(0, 1, 1E-8),
+                             QwtDataX(2, 3, 1E-8), QwtDataY(0, 5, 1E-8),
+                             QwtDataY(2, 5, 1E-8))));
 
     m_model->changeFittedFunction();
   }
 
-  void test_fittedFunctionChanged_toEmpty()
-  {
-    ON_CALL(*m_model, fittedFunction()).WillByDefault(Return(IFunction_const_sptr()));
+  void test_fittedFunctionChanged_toEmpty() {
+    ON_CALL(*m_model, fittedFunction())
+        .WillByDefault(Return(IFunction_const_sptr()));
 
     EXPECT_CALL(*m_view, setFunction(IFunction_const_sptr()));
     EXPECT_CALL(*m_view, setBaselineCurve(Property(&QwtData::size, 0)));
@@ -207,44 +211,44 @@ public:
     m_model->changeFittedFunction();
   }
 
-
-  void test_addSection()
-  {
+  void test_addSection() {
     ON_CALL(*m_model, data()).WillByDefault(Return(createTestWs(10)));
     ON_CALL(*m_view, noOfSectionRows()).WillByDefault(Return(1));
 
     Expectation tableExtended = EXPECT_CALL(*m_view, setNoOfSectionRows(2));
 
-    EXPECT_CALL(*m_view, setSectionRow(1, Pair(QString("1"), QString("10")))).After(tableExtended);
+    EXPECT_CALL(*m_view, setSectionRow(1, Pair(QString("1"), QString("10"))))
+        .After(tableExtended);
 
-    EXPECT_CALL(*m_view, addSectionSelector(1, Pair(1,10)));
+    EXPECT_CALL(*m_view, addSectionSelector(1, Pair(1, 10)));
 
     m_view->requestAddSection();
   }
 
-  void test_addSection_toEmptyWS()
-  {
-    ON_CALL(*m_model, data()).WillByDefault(Return(MatrixWorkspace_const_sptr()));
+  void test_addSection_toEmptyWS() {
+    ON_CALL(*m_model, data())
+        .WillByDefault(Return(MatrixWorkspace_const_sptr()));
 
     EXPECT_CALL(*m_view, noOfSectionRows()).Times(0);
-    EXPECT_CALL(*m_view, setSectionRow(_,_)).Times(0);
-    EXPECT_CALL(*m_view, addSectionSelector(_,_)).Times(0);
+    EXPECT_CALL(*m_view, setSectionRow(_, _)).Times(0);
+    EXPECT_CALL(*m_view, addSectionSelector(_, _)).Times(0);
     EXPECT_CALL(*m_view, displayError(_)).Times(1);
 
     m_view->requestAddSection();
   }
 
-  void test_removeSection()
-  {
+  void test_removeSection() {
     ON_CALL(*m_view, noOfSectionRows()).WillByDefault(Return(3));
-    ON_CALL(*m_view, sectionRow(0)).WillByDefault(Return(sectionRow(1,2)));
-    ON_CALL(*m_view, sectionRow(1)).WillByDefault(Return(sectionRow(3,4)));
-    ON_CALL(*m_view, sectionRow(2)).WillByDefault(Return(sectionRow(5,6)));
+    ON_CALL(*m_view, sectionRow(0)).WillByDefault(Return(sectionRow(1, 2)));
+    ON_CALL(*m_view, sectionRow(1)).WillByDefault(Return(sectionRow(3, 4)));
+    ON_CALL(*m_view, sectionRow(2)).WillByDefault(Return(sectionRow(5, 6)));
 
     Expectation tableShrinked = EXPECT_CALL(*m_view, setNoOfSectionRows(2));
 
-    EXPECT_CALL(*m_view, setSectionRow(0, Pair(QString("1"), QString("2")))).After(tableShrinked);
-    EXPECT_CALL(*m_view, setSectionRow(1, Pair(QString("5"), QString("6")))).After(tableShrinked);
+    EXPECT_CALL(*m_view, setSectionRow(0, Pair(QString("1"), QString("2"))))
+        .After(tableShrinked);
+    EXPECT_CALL(*m_view, setSectionRow(1, Pair(QString("5"), QString("6"))))
+        .After(tableShrinked);
 
     ExpectationSet selectorsCleared;
 
@@ -252,113 +256,110 @@ public:
     selectorsCleared += EXPECT_CALL(*m_view, deleteSectionSelector(1));
     selectorsCleared += EXPECT_CALL(*m_view, deleteSectionSelector(2));
 
-    EXPECT_CALL(*m_view, addSectionSelector(0, Pair(1,2))).After(selectorsCleared);
-    EXPECT_CALL(*m_view, addSectionSelector(1, Pair(5,6))).After(selectorsCleared);
+    EXPECT_CALL(*m_view, addSectionSelector(0, Pair(1, 2)))
+        .After(selectorsCleared);
+    EXPECT_CALL(*m_view, addSectionSelector(1, Pair(5, 6)))
+        .After(selectorsCleared);
 
     m_view->requestRemoveSection(1);
   }
 
-  void test_onSectionSelectorModified()
-  {
-    ON_CALL(*m_view, sectionSelector(5)).WillByDefault(Return(std::make_pair(1,2)));
+  void test_onSectionSelectorModified() {
+    ON_CALL(*m_view, sectionSelector(5))
+        .WillByDefault(Return(std::make_pair(1, 2)));
 
     EXPECT_CALL(*m_view, setSectionRow(5, Pair(QString("1"), QString("2"))));
 
     m_view->modifySectionSelector(5);
   }
 
-  void test_onSectionRowModified()
-  {
+  void test_onSectionRowModified() {
     IALCBaselineModellingView::SectionRow row(QString("3"), QString("4"));
     ON_CALL(*m_view, sectionRow(4)).WillByDefault(Return(row));
 
-    EXPECT_CALL(*m_view, updateSectionSelector(4, Pair(3,4)));
+    EXPECT_CALL(*m_view, updateSectionSelector(4, Pair(3, 4)));
     m_view->modifySectionRow(4);
   }
 
-  void test_fit()
-  {
+  void test_fit() {
     ON_CALL(*m_view, noOfSectionRows()).WillByDefault(Return(2));
-    ON_CALL(*m_view, sectionRow(0)).WillByDefault(Return(sectionRow(10,20)));
-    ON_CALL(*m_view, sectionRow(1)).WillByDefault(Return(sectionRow(40,55)));
+    ON_CALL(*m_view, sectionRow(0)).WillByDefault(Return(sectionRow(10, 20)));
+    ON_CALL(*m_view, sectionRow(1)).WillByDefault(Return(sectionRow(40, 55)));
 
-    ON_CALL(*m_view, function()).WillByDefault(Return(QString("name=FlatBackground,A0=3")));
+    ON_CALL(*m_view, function())
+        .WillByDefault(Return(QString("name=FlatBackground,A0=3")));
 
     EXPECT_CALL(*m_model, fit(AllOf(FunctionName("FlatBackground"),
                                     FunctionParameter("A0", 3, 1E-8)),
-                              ElementsAre(Pair(10, 20),
-                                          Pair(40, 55))));
+                              ElementsAre(Pair(10, 20), Pair(40, 55))));
 
     m_view->requestFit();
   }
 
-  void test_fit_exception()
-  {
+  void test_fit_exception() {
     // Any valid set of sections
     ON_CALL(*m_view, noOfSectionRows()).WillByDefault(Return(1));
-    ON_CALL(*m_view, sectionRow(0)).WillByDefault(Return(sectionRow(1,2)));
+    ON_CALL(*m_view, sectionRow(0)).WillByDefault(Return(sectionRow(1, 2)));
 
     // Valid function
-    ON_CALL(*m_view, function()).WillByDefault(Return(QString("name=FlatBackground,A0=3")));
+    ON_CALL(*m_view, function())
+        .WillByDefault(Return(QString("name=FlatBackground,A0=3")));
 
     std::string errorMsg = "Bad error";
 
-    ON_CALL(*m_model, fit(_,_)).WillByDefault(Throw(std::runtime_error(errorMsg)));
+    ON_CALL(*m_model, fit(_, _))
+        .WillByDefault(Throw(std::runtime_error(errorMsg)));
     EXPECT_CALL(*m_view, displayError(QString::fromStdString(errorMsg)));
 
     m_view->requestFit();
   }
 
-  void test_fit_badFunction()
-  {
+  void test_fit_badFunction() {
     // Any valid set of sections
     ON_CALL(*m_view, noOfSectionRows()).WillByDefault(Return(1));
-    ON_CALL(*m_view, sectionRow(0)).WillByDefault(Return(sectionRow(1,2)));
+    ON_CALL(*m_view, sectionRow(0)).WillByDefault(Return(sectionRow(1, 2)));
 
     // Invalid function
     ON_CALL(*m_view, function()).WillByDefault(Return(QString("bla-bla")));
 
-    EXPECT_CALL(*m_model, fit(_,_)).Times(0);
+    EXPECT_CALL(*m_model, fit(_, _)).Times(0);
     EXPECT_CALL(*m_view, displayError(_));
 
     m_view->requestFit();
   }
 
-  void test_fit_emptyFunction()
-  {
+  void test_fit_emptyFunction() {
     // Any valid set of sections
     ON_CALL(*m_view, noOfSectionRows()).WillByDefault(Return(1));
-    ON_CALL(*m_view, sectionRow(0)).WillByDefault(Return(sectionRow(1,2)));
+    ON_CALL(*m_view, sectionRow(0)).WillByDefault(Return(sectionRow(1, 2)));
 
     // Empty function
     ON_CALL(*m_view, function()).WillByDefault(Return(QString("")));
 
-    EXPECT_CALL(*m_model, fit(_,_)).Times(0);
+    EXPECT_CALL(*m_model, fit(_, _)).Times(0);
     EXPECT_CALL(*m_view, displayError(_));
 
     m_view->requestFit();
   }
 
-  void test_fit_noSections()
-  {
+  void test_fit_noSections() {
     // No sections
     ON_CALL(*m_view, noOfSectionRows()).WillByDefault(Return(0));
 
     // Any valid function
-    ON_CALL(*m_view, function()).WillByDefault(Return(QString("name=FlatBackground,A0=0")));
+    ON_CALL(*m_view, function())
+        .WillByDefault(Return(QString("name=FlatBackground,A0=0")));
 
-    EXPECT_CALL(*m_model, fit(_,_)).Times(0);
+    EXPECT_CALL(*m_model, fit(_, _)).Times(0);
     EXPECT_CALL(*m_view, displayError(_));
 
     m_view->requestFit();
   }
 
-  void test_helpPage ()
-  {
+  void test_helpPage() {
     EXPECT_CALL(*m_view, help()).Times(1);
     m_view->help();
   }
 };
 
-
 #endif /* MANTIDQT_CUSTOMINTERFACES_ALCBASELINEMODELLINGTEST_H_ */
diff --git a/MantidQt/CustomInterfaces/test/ALCPeakFittingModelTest.h b/MantidQt/CustomInterfaces/test/ALCPeakFittingModelTest.h
index 40cfd07b19d0df0ebc3e398e5482dfdcd75d5cdd..fe1db6a092f9de9a16a1476c2bf346c5f9336392 100644
--- a/MantidQt/CustomInterfaces/test/ALCPeakFittingModelTest.h
+++ b/MantidQt/CustomInterfaces/test/ALCPeakFittingModelTest.h
@@ -3,8 +3,6 @@
 
 #include <cxxtest/TestSuite.h>
 
-#include <boost/assign.hpp>
-
 #include "MantidAPI/MatrixWorkspace.h"
 #include "MantidAPI/WorkspaceFactory.h"
 #include "MantidAPI/FunctionFactory.h"
@@ -18,34 +16,28 @@
 using namespace Mantid::API;
 using namespace MantidQt::CustomInterfaces;
 
-class ALCPeakFittingModelTest : public CxxTest::TestSuite
-{
-  ALCPeakFittingModel* m_model;
+class ALCPeakFittingModelTest : public CxxTest::TestSuite {
+  ALCPeakFittingModel *m_model;
 
 public:
   // This pair of boilerplate methods prevent the suite being created statically
   // This means the constructor isn't called when running other tests
-  static ALCPeakFittingModelTest *createSuite() { return new ALCPeakFittingModelTest(); }
-  static void destroySuite( ALCPeakFittingModelTest *suite ) { delete suite; }
+  static ALCPeakFittingModelTest *createSuite() {
+    return new ALCPeakFittingModelTest();
+  }
+  static void destroySuite(ALCPeakFittingModelTest *suite) { delete suite; }
 
-  ALCPeakFittingModelTest()
-  {
+  ALCPeakFittingModelTest() {
     FrameworkManager::Instance(); // To make sure everything is initialized
   }
 
-  void setUp()
-  {
-    m_model = new ALCPeakFittingModel();
-  }
+  void setUp() { m_model = new ALCPeakFittingModel(); }
 
-  void tearDown()
-  {
-    delete m_model;
-  }
+  void tearDown() { delete m_model; }
 
-  void test_setData()
-  {
-    MatrixWorkspace_sptr data = WorkspaceFactory::Instance().create("Workspace2D", 1, 1, 1);
+  void test_setData() {
+    MatrixWorkspace_sptr data =
+        WorkspaceFactory::Instance().create("Workspace2D", 1, 1, 1);
 
     QSignalSpy spy(m_model, SIGNAL(dataChanged()));
 
@@ -55,56 +47,51 @@ public:
     TS_ASSERT_EQUALS(m_model->data(), data);
   }
 
-  void test_fit()
-  {
-    std::vector<double> x = boost::assign::list_of(1.00)(2.00)(3.00)(4.00)(5.00)(6.00)(7.00)(8.00);
-    std::vector<double> y = boost::assign::list_of(0.00)(0.01)(0.02)(0.37)(1.00)(0.37)(0.01)(0.00);
+  void test_fit() {
+    std::vector<double> x = {1.00, 2.00, 3.00, 4.00, 5.00, 6.00, 7.00, 8.00};
+    std::vector<double> y = {0.00, 0.01, 0.02, 0.37, 1.00, 0.37, 0.01, 0.00};
 
-    MatrixWorkspace_sptr data = WorkspaceFactory::Instance().create("Workspace2D", 1, y.size(), y.size());
+    MatrixWorkspace_sptr data = WorkspaceFactory::Instance().create(
+        "Workspace2D", 1, y.size(), y.size());
     data->dataY(0) = y;
     data->dataX(0) = x;
 
     m_model->setData(data);
 
-    IFunction_const_sptr func = FunctionFactory::Instance().createInitialized("name=FlatBackground");
+    IFunction_const_sptr func =
+        FunctionFactory::Instance().createInitialized("name=FlatBackground");
 
     TS_ASSERT_THROWS_NOTHING(m_model->fitPeaks(func));
 
     IFunction_const_sptr fittedFunc = m_model->fittedPeaks();
     TS_ASSERT(fittedFunc);
 
-    if (fittedFunc)
-    {
+    if (fittedFunc) {
       TS_ASSERT_EQUALS(fittedFunc->name(), "FlatBackground");
-      TS_ASSERT_DELTA (fittedFunc->getParameter("A0"), 0.2225, 1E-4);
+      TS_ASSERT_DELTA(fittedFunc->getParameter("A0"), 0.2225, 1E-4);
     }
 
     ITableWorkspace_sptr parameters = m_model->parameterTable();
     TS_ASSERT(parameters);
 
-    if (parameters)
-    {
+    if (parameters) {
       // Check table dimensions
       TS_ASSERT_EQUALS(parameters->rowCount(), 2);
       TS_ASSERT_EQUALS(parameters->columnCount(), 3);
 
       // Check table entries
-      TS_ASSERT_EQUALS(parameters->String(0,0), "A0");
-      TS_ASSERT_DELTA (parameters->Double(0,1), 0.2225, 1E-4);
-      TS_ASSERT_DELTA (parameters->Double(0,2), 0.3535, 1E-4);
-      TS_ASSERT_EQUALS(parameters->String(1,0), "Cost function value");
-      TS_ASSERT_DELTA (parameters->Double(1,1), 0.1254, 1E-4);
-      TS_ASSERT_DELTA (parameters->Double(1,2), 0.0000, 1E-4);
+      TS_ASSERT_EQUALS(parameters->String(0, 0), "A0");
+      TS_ASSERT_DELTA(parameters->Double(0, 1), 0.2225, 1E-4);
+      TS_ASSERT_DELTA(parameters->Double(0, 2), 0.3535, 1E-4);
+      TS_ASSERT_EQUALS(parameters->String(1, 0), "Cost function value");
+      TS_ASSERT_DELTA(parameters->Double(1, 1), 0.1254, 1E-4);
+      TS_ASSERT_DELTA(parameters->Double(1, 2), 0.0000, 1E-4);
     }
-
   }
 
-  void test_exportWorkspace()
-  {
-    TS_ASSERT_THROWS_NOTHING (m_model->exportWorkspace());
+  void test_exportWorkspace() {
+    TS_ASSERT_THROWS_NOTHING(m_model->exportWorkspace());
   }
-
 };
 
-
 #endif /* MANTID_CUSTOMINTERFACES_ALCPEAKFITTINGMODELTEST_H_ */
diff --git a/MantidQt/CustomInterfaces/test/CMakeLists.txt b/MantidQt/CustomInterfaces/test/CMakeLists.txt
index 90a9052d4ad7a8d395b05b89573a29a00b3dd24d..f593d538ead2833dd11651a78febceb87ffbef3d 100644
--- a/MantidQt/CustomInterfaces/test/CMakeLists.txt
+++ b/MantidQt/CustomInterfaces/test/CMakeLists.txt
@@ -4,6 +4,7 @@ if ( CXXTEST_FOUND )
   include_directories( ../../../Framework/TestHelpers/inc ../../../Framework/DataObjects/inc )
 
   set ( TESTHELPER_SRCS ../../../Framework/TestHelpers/src/ComponentCreationHelper.cpp 
+                        ../../../Framework/TestHelpers/src/InstrumentCreationHelper.cpp
                         ../../../Framework/TestHelpers/src/WorkspaceCreationHelper.cpp
                         ../../../Framework/TestHelpers/src/ScopedFileHelper.cpp
                         ../../../Framework/TestHelpers/src/TearDownWorld.cpp
diff --git a/MantidQt/CustomInterfaces/test/EnggDiffractionPresenterTest.h b/MantidQt/CustomInterfaces/test/EnggDiffractionPresenterTest.h
index e30998c75ee4cd7b2f6ad774648d71b0863ecce7..b7452050648f33c5e252ddff9440f1a61ddfbbaa 100644
--- a/MantidQt/CustomInterfaces/test/EnggDiffractionPresenterTest.h
+++ b/MantidQt/CustomInterfaces/test/EnggDiffractionPresenterTest.h
@@ -177,6 +177,8 @@ public:
     EXPECT_CALL(mockView, newCalibLoaded(testing::_, testing::_, mockFname))
         .Times(1);
 
+    EXPECT_CALL(mockView, plotCalibWorkspace()).Times(0);
+
     // No errors/warnings
     EXPECT_CALL(mockView, userError(testing::_, testing::_)).Times(0);
     EXPECT_CALL(mockView, userWarning(testing::_, testing::_)).Times(0);
@@ -300,6 +302,12 @@ public:
     // when a separate thread finished (here the thread is mocked)
     EXPECT_CALL(mockView, enableCalibrateAndFocusActions(true)).Times(1);
 
+    // plots peaks and curves
+    // the test doesnt get to here as it finishes at EnggCalibrate algo
+    EXPECT_CALL(mockView, plotCalibWorkspace()).Times(0);
+    EXPECT_CALL(mockView, plotVanCurvesCalibOutput()).Times(0);
+    EXPECT_CALL(mockView, plotDifcZeroCalibOutput(testing::_)).Times(0);
+
     // No warnings/error pop-ups: some exception(s) are thrown (because there
     // are missing settings and/or files) but these must be caught
     // and error messages logged
@@ -329,6 +337,12 @@ public:
     EXPECT_CALL(mockView, newVanadiumNo()).Times(1).WillOnce(Return(g_vanNo));
     EXPECT_CALL(mockView, newCeriaNo()).Times(1).WillOnce(Return(g_ceriaNo));
 
+    // plots peaks and curves
+    // the test doesnt get to here as it finishes at EnggCalibrate algo
+    EXPECT_CALL(mockView, plotCalibWorkspace()).Times(0);
+    EXPECT_CALL(mockView, plotVanCurvesCalibOutput()).Times(0);
+    EXPECT_CALL(mockView, plotDifcZeroCalibOutput(testing::_)).Times(0);
+
     // No errors/warnings
     EXPECT_CALL(mockView, userError(testing::_, testing::_)).Times(0);
     EXPECT_CALL(mockView, userWarning(testing::_, testing::_)).Times(0);
@@ -486,6 +500,11 @@ public:
     // when a separate thread finished (here the thread is mocked)
     EXPECT_CALL(mockView, enableCalibrateAndFocusActions(true)).Times(1);
 
+    // tests whether the plot functions have been called
+    EXPECT_CALL(mockView, plotCalibWorkspace()).Times(0);
+    EXPECT_CALL(mockView, plotVanCurvesCalibOutput()).Times(0);
+    EXPECT_CALL(mockView, plotDifcZeroCalibOutput(testing::_)).Times(0);
+
     // No warnings/error pop-ups: some exception(s) are thrown (because there
     // are missing settings and/or files) but these must be caught
     // and error messages logged
diff --git a/MantidQt/CustomInterfaces/test/EnggDiffractionViewMock.h b/MantidQt/CustomInterfaces/test/EnggDiffractionViewMock.h
index a9b32637fb6643500508ae93a6117d1a3d416ebb..03bba829d035f8ac46c0fb24231a32fd4b3ed8b0 100644
--- a/MantidQt/CustomInterfaces/test/EnggDiffractionViewMock.h
+++ b/MantidQt/CustomInterfaces/test/EnggDiffractionViewMock.h
@@ -128,14 +128,14 @@ public:
   // virtual bool focusedOutWorkspace() const;
   MOCK_CONST_METHOD0(focusedOutWorkspace, bool());
 
+  // virtual bool plotCalibWorkspace
+  MOCK_CONST_METHOD0(plotCalibWorkspace, bool());
+
   // void saveSettings() const;
   MOCK_CONST_METHOD0(saveSettings, void());
 
-  // std::string saveOutputFiles
-  MOCK_CONST_METHOD0(saveOutputFiles, bool());
-
-  // virtual void plotFocusedSpectrum();
-  MOCK_METHOD1(plotFocusedSpectrum, void(const std::string &));
+  // virtual bool saveFocusedOutputFiles
+  MOCK_CONST_METHOD0(saveFocusedOutputFiles, bool());
 
   // void plotFocusStatus();
   MOCK_METHOD0(plotFocusStatus, void());
@@ -143,11 +143,22 @@ public:
   // void plotRepChanged();
   MOCK_METHOD1(plotRepChanged, void(int idx));
 
+  // virtual void plotFocusedSpectrum();
+  MOCK_METHOD1(plotFocusedSpectrum, void(const std::string &));
+
   // virtual void plotWaterfallSpectrum
   MOCK_METHOD1(plotWaterfallSpectrum, void(const std::string &wsName));
 
   // virtual void plotReplacingWindow
-  MOCK_METHOD1(plotReplacingWindow, void(const std::string &wsName));
+  MOCK_METHOD3(plotReplacingWindow,
+               void(const std::string &wsName, const std::string &spectrum,
+                    const std::string &type));
+
+  // virtual void plotVanCurvesCalibOutput();
+  MOCK_METHOD0(plotVanCurvesCalibOutput, void());
+
+  // virtual void plotDifcZeroCalibOutput();
+  MOCK_METHOD1(plotDifcZeroCalibOutput, void(const std::string &pyCode));
 };
 
 #endif // MANTID_CUSTOMINTERFACES_ENGGDIFFRACTIONVIEWMOCK_H
diff --git a/MantidQt/CustomInterfaces/test/MuonAnalysisHelperTest.h b/MantidQt/CustomInterfaces/test/MuonAnalysisHelperTest.h
index e6c36afa0ec844b66503dc88d07d1ce56c1d9954..697ab1e7d6c5f0887163ad350d82ff8dce6745fa 100644
--- a/MantidQt/CustomInterfaces/test/MuonAnalysisHelperTest.h
+++ b/MantidQt/CustomInterfaces/test/MuonAnalysisHelperTest.h
@@ -9,50 +9,43 @@
 #include "MantidGeometry/Instrument.h"
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
 
-#include <boost/assign/list_of.hpp>
-
 using namespace MantidQt::CustomInterfaces::MuonAnalysisHelper;
 
 using namespace Mantid;
 using namespace Mantid::API;
 
-class MuonAnalysisHelperTest : public CxxTest::TestSuite
-{
+class MuonAnalysisHelperTest : 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 MuonAnalysisHelperTest *createSuite() { return new MuonAnalysisHelperTest(); }
-  static void destroySuite( MuonAnalysisHelperTest *suite ) { delete suite; }
+  static MuonAnalysisHelperTest *createSuite() {
+    return new MuonAnalysisHelperTest();
+  }
+  static void destroySuite(MuonAnalysisHelperTest *suite) { delete suite; }
 
-  MuonAnalysisHelperTest()
-  {
+  MuonAnalysisHelperTest() {
     FrameworkManager::Instance(); // So that framework is initialized
   }
 
-  void test_getRunLabel_singleWs()
-  {
+  void test_getRunLabel_singleWs() {
     std::string label = getRunLabel(createWs("MUSR", 15189));
     TS_ASSERT_EQUALS(label, "MUSR00015189");
   }
 
-  void test_getRunLabel_argus()
-  {
+  void test_getRunLabel_argus() {
     std::string label = getRunLabel(createWs("ARGUS", 26577));
     TS_ASSERT_EQUALS(label, "ARGUS0026577");
   }
 
-  void test_getRunLabel_singleWs_tooBigRunNumber()
-  {
+  void test_getRunLabel_singleWs_tooBigRunNumber() {
     std::string label = getRunLabel(createWs("EMU", 999999999));
     TS_ASSERT_EQUALS(label, "EMU999999999");
   }
 
-  void test_getRunLabel_wsList()
-  {
+  void test_getRunLabel_wsList() {
     std::vector<Workspace_sptr> list;
 
-    for (int i = 15189; i <= 15193; ++i)
-    {
+    for (int i = 15189; i <= 15193; ++i) {
       list.push_back(createWs("MUSR", i));
     }
 
@@ -60,13 +53,11 @@ public:
     TS_ASSERT_EQUALS(label, "MUSR00015189-93");
   }
 
-  void test_getRunLabel_wsList_wrongOrder()
-  {
-    std::vector<int> runNumbers = boost::assign::list_of(10)(3)(5)(1)(6);
+  void test_getRunLabel_wsList_wrongOrder() {
+    std::vector<int> runNumbers = {10, 3, 5, 1, 6};
     std::vector<Workspace_sptr> list;
 
-    for (auto it = runNumbers.begin(); it != runNumbers.end(); ++it)
-    {
+    for (auto it = runNumbers.begin(); it != runNumbers.end(); ++it) {
       list.push_back(createWs("EMU", *it));
     }
 
@@ -74,15 +65,18 @@ public:
     TS_ASSERT_EQUALS(label, "EMU00000001-10");
   }
 
-  void test_sumWorkspaces()
-  {
-    MatrixWorkspace_sptr ws1 = WorkspaceCreationHelper::Create2DWorkspace123(1, 3);
-    MatrixWorkspace_sptr ws2 = WorkspaceCreationHelper::Create2DWorkspace123(1, 3);
-    MatrixWorkspace_sptr ws3 = WorkspaceCreationHelper::Create2DWorkspace123(1, 3);
+  void test_sumWorkspaces() {
+    MatrixWorkspace_sptr ws1 =
+        WorkspaceCreationHelper::Create2DWorkspace123(1, 3);
+    MatrixWorkspace_sptr ws2 =
+        WorkspaceCreationHelper::Create2DWorkspace123(1, 3);
+    MatrixWorkspace_sptr ws3 =
+        WorkspaceCreationHelper::Create2DWorkspace123(1, 3);
 
-    std::vector<Workspace_sptr> wsList = boost::assign::list_of(ws1)(ws2)(ws3);
+    std::vector<Workspace_sptr> wsList = {ws1, ws2, ws3};
 
-    auto result = boost::dynamic_pointer_cast<MatrixWorkspace>(sumWorkspaces(wsList));
+    auto result =
+        boost::dynamic_pointer_cast<MatrixWorkspace>(sumWorkspaces(wsList));
 
     TS_ASSERT(result);
     if (!result)
@@ -101,21 +95,19 @@ public:
   }
 
 private:
-
   // Creates a single-point workspace with instrument and runNumber set
-  Workspace_sptr createWs(const std::string& instrName, int runNumber)
-  {
-    Geometry::Instrument_const_sptr instr = boost::make_shared<Geometry::Instrument>(instrName);
+  Workspace_sptr createWs(const std::string &instrName, int runNumber) {
+    Geometry::Instrument_const_sptr instr =
+        boost::make_shared<Geometry::Instrument>(instrName);
 
-    MatrixWorkspace_sptr ws = WorkspaceFactory::Instance().create("Workspace2D", 1, 1, 1);
+    MatrixWorkspace_sptr ws =
+        WorkspaceFactory::Instance().create("Workspace2D", 1, 1, 1);
     ws->setInstrument(instr);
 
     ws->mutableRun().addProperty("run_number", runNumber);
 
     return ws;
   }
-
 };
 
-
 #endif /* MANTID_CUSTOMINTERFACES_MUONANALYSISHELPERTEST_H_ */
diff --git a/MantidQt/CustomInterfaces/test/ReflGenerateNotebookTest.h b/MantidQt/CustomInterfaces/test/ReflGenerateNotebookTest.h
index 783100727c35021863b75e23989350e1d1529316..925001e1d09701abdd053b25ec9d920780fe7b25 100644
--- a/MantidQt/CustomInterfaces/test/ReflGenerateNotebookTest.h
+++ b/MantidQt/CustomInterfaces/test/ReflGenerateNotebookTest.h
@@ -21,7 +21,6 @@ using namespace testing;
 class ReflGenerateNotebookTest : public CxxTest::TestSuite {
 
 private:
-
   ITableWorkspace_sptr createWorkspace(const std::string &wsName) {
     ITableWorkspace_sptr ws = WorkspaceFactory::Instance().createTable();
 
@@ -55,37 +54,36 @@ private:
     auto ws = createWorkspace(wsName);
     TableRow row = ws->appendRow();
     row << "12345"
-    << "0.5"
-    << ""
-    << "0.1"
-    << "1.6"
-    << "0.04" << 1.0 << 0 << "";
+        << "0.5"
+        << ""
+        << "0.1"
+        << "1.6"
+        << "0.04" << 1.0 << 0 << "";
     row = ws->appendRow();
     row << "12346"
-    << "1.5"
-    << ""
-    << "1.4"
-    << "2.9"
-    << "0.04" << 1.0 << 0 << "";
+        << "1.5"
+        << ""
+        << "1.4"
+        << "2.9"
+        << "0.04" << 1.0 << 0 << "";
     row = ws->appendRow();
     row << "24681"
-    << "0.5"
-    << ""
-    << "0.1"
-    << "1.6"
-    << "0.04" << 1.0 << 1 << "";
+        << "0.5"
+        << ""
+        << "0.1"
+        << "1.6"
+        << "0.04" << 1.0 << 1 << "";
     row = ws->appendRow();
     row << "24682"
-    << "1.5"
-    << ""
-    << "1.4"
-    << "2.9"
-    << "0.04" << 1.0 << 1 << "";
+        << "1.5"
+        << ""
+        << "1.4"
+        << "2.9"
+        << "0.04" << 1.0 << 1 << "";
     return ws;
   }
 
-  void createModel(const std::string &wsName)
-  {
+  void createModel(const std::string &wsName) {
     ITableWorkspace_sptr prefilled_ws = createPrefilledWorkspace(wsName);
     m_model.reset(new QReflTableModel(prefilled_ws));
   }
@@ -94,11 +92,10 @@ private:
   std::string m_instrument;
   QReflTableModel_sptr m_model;
   std::set<int> m_rows;
-  std::map<int,std::set<int> > m_groups;
+  std::map<int, std::set<int>> m_groups;
   ColNumbers col_nums;
 
 public:
-
   // This pair of boilerplate methods prevent the suite being created statically
   // This means the constructor isn't called when running other tests
   static ReflGenerateNotebookTest *createSuite() {
@@ -106,98 +103,89 @@ public:
   }
   static void destroySuite(ReflGenerateNotebookTest *suite) { delete suite; }
 
-  ReflGenerateNotebookTest() : col_nums(0, 2, 8, 1, 3, 4, 5, 6, 7) { FrameworkManager::Instance(); }
+  ReflGenerateNotebookTest() : col_nums(0, 2, 8, 1, 3, 4, 5, 6, 7) {
+    FrameworkManager::Instance();
+  }
 
   // Create a notebook to test
-  void setUp()
-  {
+  void setUp() {
     m_wsName = "TESTWORKSPACE";
     m_instrument = "INSTRUMENT";
 
     createModel(m_wsName);
 
     // Populate rows with every index in the model
-    for(int idx = 0; idx < m_model->rowCount(); ++idx)
+    for (int idx = 0; idx < m_model->rowCount(); ++idx)
       m_rows.insert(idx);
 
-    //Map group numbers to the set of rows in that group we want to process
-    for(auto it = m_rows.begin(); it != m_rows.end(); ++it)
-      m_groups[m_model->data(m_model->index(*it, col_nums.group)).toInt()].insert(*it);
+    // Map group numbers to the set of rows in that group we want to process
+    for (auto it = m_rows.begin(); it != m_rows.end(); ++it)
+      m_groups[m_model->data(m_model->index(*it, col_nums.group)).toInt()]
+          .insert(*it);
   }
 
-  void testGenerateNotebook()
-  {
-    std::unique_ptr<ReflGenerateNotebook> notebook(new ReflGenerateNotebook(m_wsName, m_model, m_instrument,
-                                                   col_nums.runs, col_nums.transmission, col_nums.options, col_nums.angle,
-                                                   col_nums.qmin, col_nums.qmax, col_nums.dqq, col_nums.scale, col_nums.group));
+  void testGenerateNotebook() {
+    auto notebook = Mantid::Kernel::make_unique<ReflGenerateNotebook>(
+        m_wsName, m_model, m_instrument, col_nums.runs, col_nums.transmission,
+        col_nums.options, col_nums.angle, col_nums.qmin, col_nums.qmax,
+        col_nums.dqq, col_nums.scale, col_nums.group);
 
-    std::string generatedNotebook = notebook->generateNotebook(m_groups, m_rows);
+    std::string generatedNotebook =
+        notebook->generateNotebook(m_groups, m_rows);
 
     std::vector<std::string> notebookLines;
     boost::split(notebookLines, generatedNotebook, boost::is_any_of("\n"));
 
     const std::string result[] = {
-      "{",
-      "   \"metadata\" : {",
-      "      \"name\" : \"Mantid Notebook\"",
-      "   },",
-      "   \"nbformat\" : 3,",
-      "   \"nbformat_minor\" : 0,",
-      "   \"worksheets\" : [",
-      "      {",
-      "         \"cells\" : [",
-      "            {",
-      "               \"cell_type\" : \"markdown\",",
+        "{", "   \"metadata\" : {", "      \"name\" : \"Mantid Notebook\"",
+        "   },", "   \"nbformat\" : 3,", "   \"nbformat_minor\" : 0,",
+        "   \"worksheets\" : [", "      {", "         \"cells\" : [",
+        "            {", "               \"cell_type\" : \"markdown\",",
     };
 
     // Check that the first 10 lines are output as expected
-    for (int i=0; i<11; ++i)
-    {
+    for (int i = 0; i < 11; ++i) {
       TS_ASSERT_EQUALS(notebookLines[i], result[i])
     }
-
   }
 
-  void testPlot1DString()
-  {
+  void testPlot1DString() {
     std::vector<std::string> ws_names;
     ws_names.emplace_back("workspace1");
     ws_names.emplace_back("workspace2");
 
     std::string output = plot1DString(ws_names, "Plot Title");
 
-    const std::string result = "fig = plots([workspace1, workspace2], title=Plot Title, legendLocation=[1, 1, 4])\n";
+    const std::string result = "fig = plots([workspace1, workspace2], "
+                               "title=Plot Title, legendLocation=[1, 1, 4])\n";
 
     TS_ASSERT_EQUALS(output, result)
   }
 
-  void testTableString()
-  {
+  void testTableString() {
     std::string output = tableString(m_model, col_nums, m_rows);
 
     std::vector<std::string> notebookLines;
     boost::split(notebookLines, output, boost::is_any_of("\n"));
 
     const std::string result[] = {
-      "Run(s) | Angle | Transmission Run(s) | Q min | Q max | dQ/Q | Scale | Group | Options",
-      "------ | ----- | ------------------- | ----- | ----- | ---- | ----- | ----- | -------",
-      "12345 | 0.5 |  | 0.1 | 1.6 | 0.04 | 1 | 0 | ",
-      "12346 | 1.5 |  | 1.4 | 2.9 | 0.04 | 1 | 0 | ",
-      "24681 | 0.5 |  | 0.1 | 1.6 | 0.04 | 1 | 1 | ",
-      "24682 | 1.5 |  | 1.4 | 2.9 | 0.04 | 1 | 1 | ",
-      ""
-    };
-
-    int i=0;
-    for (auto it = notebookLines.begin(); it != notebookLines.end(); ++it, ++i)
-    {
+        "Run(s) | Angle | Transmission Run(s) | Q min | Q max | dQ/Q | Scale | "
+        "Group | Options",
+        "------ | ----- | ------------------- | ----- | ----- | ---- | ----- | "
+        "----- | -------",
+        "12345 | 0.5 |  | 0.1 | 1.6 | 0.04 | 1 | 0 | ",
+        "12346 | 1.5 |  | 1.4 | 2.9 | 0.04 | 1 | 0 | ",
+        "24681 | 0.5 |  | 0.1 | 1.6 | 0.04 | 1 | 1 | ",
+        "24682 | 1.5 |  | 1.4 | 2.9 | 0.04 | 1 | 1 | ", ""};
+
+    int i = 0;
+    for (auto it = notebookLines.begin(); it != notebookLines.end();
+         ++it, ++i) {
       TS_ASSERT_EQUALS(*it, result[i])
     }
-
   }
 
-  void testVectorString()
-  {
+  void testVectorString() {
     std::vector<std::string> stringVector;
     stringVector.emplace_back("A");
     stringVector.emplace_back("B");
@@ -212,29 +200,27 @@ public:
 
     const std::string intOutput = vectorString(intVector);
 
-    // Test string list output is correct for vector of strings and vector of ints
+    // Test string list output is correct for vector of strings and vector of
+    // ints
     TS_ASSERT_EQUALS(stringOutput, "A, B, C")
     TS_ASSERT_EQUALS(intOutput, "1, 2, 3")
   }
 
-  void testTitleString()
-  {
+  void testTitleString() {
     // Test with workspace name
     std::string output = titleString("TEST_WORKSPACE");
 
     const std::string result[] = {
-      "Processed data from workspace: TEST_WORKSPACE",
-      "---------------",
-      "Notebook generated from the ISIS Reflectometry (Polref) Interface",
-      ""
-    };
+        "Processed data from workspace: TEST_WORKSPACE", "---------------",
+        "Notebook generated from the ISIS Reflectometry (Polref) Interface",
+        ""};
 
     std::vector<std::string> notebookLines;
     boost::split(notebookLines, output, boost::is_any_of("\n"));
 
-    int i=0;
-    for (auto it = notebookLines.begin(); it != notebookLines.end(); ++it, ++i)
-    {
+    int i = 0;
+    for (auto it = notebookLines.begin(); it != notebookLines.end();
+         ++it, ++i) {
       TS_ASSERT_EQUALS(*it, result[i])
     }
 
@@ -242,64 +228,43 @@ public:
     std::string outputEmptyStr = titleString("");
 
     const std::string resultEmptyStr[] = {
-      "Processed data",
-      "---------------",
-      "Notebook generated from the ISIS Reflectometry (Polref) Interface",
-      ""
-    };
+        "Processed data", "---------------",
+        "Notebook generated from the ISIS Reflectometry (Polref) Interface",
+        ""};
 
     std::vector<std::string> notebookLinesEmptyStr;
     boost::split(notebookLinesEmptyStr, outputEmptyStr, boost::is_any_of("\n"));
 
-    i=0;
-    for (auto it = notebookLinesEmptyStr.begin(); it != notebookLinesEmptyStr.end(); ++it, ++i)
-    {
+    i = 0;
+    for (auto it = notebookLinesEmptyStr.begin();
+         it != notebookLinesEmptyStr.end(); ++it, ++i) {
       TS_ASSERT_EQUALS(*it, resultEmptyStr[i])
     }
-
   }
 
-  void testStitchGroupString()
-  {
-    boost::tuple<std::string, std::string> output = stitchGroupString(m_rows, m_instrument, m_model, col_nums);
+  void testStitchGroupString() {
+    boost::tuple<std::string, std::string> output =
+        stitchGroupString(m_rows, m_instrument, m_model, col_nums);
 
     const std::string result[] = {
-      "#Stitch workspaces",
-      "IvsQ_12345_12346_24681_24682, _ = Stitch1DMany(InputWorkspaces = 'IvsQ_12345, IvsQ_12346, IvsQ_24681,"
-        " IvsQ_24682', Params = '0.1, -0.04, 2.9', StartOverlaps = '1.4, 0.1, 1.4', EndOverlaps = '1.6, 2.9, 1.6')",
-      ""
-    };
+        "#Stitch workspaces",
+        "IvsQ_12345_12346_24681_24682, _ = Stitch1DMany(InputWorkspaces = "
+        "'IvsQ_12345, IvsQ_12346, IvsQ_24681,"
+        " IvsQ_24682', Params = '0.1, -0.04, 2.9', StartOverlaps = '1.4, 0.1, "
+        "1.4', EndOverlaps = '1.6, 2.9, 1.6')",
+        ""};
 
     std::vector<std::string> notebookLines;
     boost::split(notebookLines, boost::get<0>(output), boost::is_any_of("\n"));
 
-    int i=0;
-    for (auto it = notebookLines.begin(); it != notebookLines.end(); ++it, ++i)
-    {
+    int i = 0;
+    for (auto it = notebookLines.begin(); it != notebookLines.end();
+         ++it, ++i) {
       TS_ASSERT_EQUALS(*it, result[i])
     }
-
-  }
-
-  void testPlotsFunctionString()
-  {
-    std::string output = plotsFunctionString();
-
-    std::vector<std::string> notebookLines;
-    boost::split(notebookLines, output, boost::is_any_of("\n"));
-
-    const std::string result[] = {
-      "#Import some useful tools for plotting",
-        "from MantidIPython import *"
-    };
-
-    // Check that the lines are output as expected
-    TS_ASSERT_EQUALS(notebookLines[0], result[0]);
-    TS_ASSERT_EQUALS(notebookLines[1], result[1]);
   }
 
-  void testPlotsString()
-  {
+  void testPlotsString() {
     std::vector<std::string> unstitched_ws;
     unstitched_ws.emplace_back("TEST_WS1");
     unstitched_ws.emplace_back("TEST_WS2");
@@ -311,63 +276,64 @@ public:
     std::string output = plotsString(unstitched_ws, IvsLam_ws, "TEST_WS5");
 
     const std::string result[] = {
-      "#Group workspaces to be plotted on same axes",
-      "unstitchedGroupWS = GroupWorkspaces(InputWorkspaces = 'TEST_WS1, TEST_WS2')",
-      "IvsLamGroupWS = GroupWorkspaces(InputWorkspaces = 'TEST_WS3, TEST_WS4')",
-      "#Plot workspaces",
-      "fig = plots([unstitchedGroupWS, TEST_WS5, IvsLamGroupWS], title=['I vs Q Unstitched', 'I vs Q Stitiched', 'I vs Lambda'], legendLocation=[1, 1, 4])",
-      ""
-    };
+        "#Group workspaces to be plotted on same axes",
+        "unstitchedGroupWS = GroupWorkspaces(InputWorkspaces = 'TEST_WS1, "
+        "TEST_WS2')",
+        "IvsLamGroupWS = GroupWorkspaces(InputWorkspaces = 'TEST_WS3, "
+        "TEST_WS4')",
+        "#Plot workspaces", "fig = plots([unstitchedGroupWS, TEST_WS5, "
+                            "IvsLamGroupWS], title=['I vs Q Unstitched', 'I vs "
+                            "Q Stitiched', 'I vs Lambda'], legendLocation=[1, "
+                            "1, 4])",
+        ""};
 
     std::vector<std::string> notebookLines;
     boost::split(notebookLines, output, boost::is_any_of("\n"));
 
-    int i=0;
-    for (auto it = notebookLines.begin(); it != notebookLines.end(); ++it, ++i)
-    {
+    int i = 0;
+    for (auto it = notebookLines.begin(); it != notebookLines.end();
+         ++it, ++i) {
       TS_ASSERT_EQUALS(*it, result[i])
     }
-
   }
 
-  void testReduceRowString()
-  {
-    boost::tuple<std::string, std::string, std::string> output = reduceRowString(1, m_instrument, m_model, col_nums);
+  void testReduceRowString() {
+    boost::tuple<std::string, std::string, std::string> output =
+        reduceRowString(1, m_instrument, m_model, col_nums);
 
     const std::string result[] = {
-      "TOF_12346 = Load(Filename = 'INSTRUMENT12346')",
-      "IvsQ_12346, IvsLam_12346, theta_12346 = ReflectometryReductionOneAuto(InputWorkspace = 'TOF_12346', ThetaIn = 1.5)",
-      "IvsQ_12346 = Rebin(IvsQ_12346, Params = '1.4, -0.04, 2.9')",
-      ""
-    };
+        "TOF_12346 = Load(Filename = 'INSTRUMENT12346')",
+        "IvsQ_12346, IvsLam_12346, theta_12346 = "
+        "ReflectometryReductionOneAuto(InputWorkspace = 'TOF_12346', ThetaIn = "
+        "1.5)",
+        "IvsQ_12346 = Rebin(IvsQ_12346, Params = '1.4, -0.04, 2.9')", ""};
 
     std::vector<std::string> notebookLines;
     boost::split(notebookLines, boost::get<0>(output), boost::is_any_of("\n"));
 
-    int i=0;
-    for (auto it = notebookLines.begin(); it != notebookLines.end(); ++it, ++i)
-    {
+    int i = 0;
+    for (auto it = notebookLines.begin(); it != notebookLines.end();
+         ++it, ++i) {
       TS_ASSERT_EQUALS(*it, result[i])
     }
-
   }
 
-  void testPlusString()
-  {
+  void testPlusString() {
     std::string output = plusString("INPUT_WS", "OUTPUT_WS");
-    const std::string result = "OUTPUT_WS = Plus('LHSWorkspace' = OUTPUT_WS, 'RHSWorkspace' = INPUT_WS)\n";
+    const std::string result = "OUTPUT_WS = Plus('LHSWorkspace' = OUTPUT_WS, "
+                               "'RHSWorkspace' = INPUT_WS)\n";
     TS_ASSERT_EQUALS(output, result)
   }
 
-  void testLoadRunString()
-  {
-    boost::tuple<std::string, std::string> output = loadRunString("12345", m_instrument);
-    const std::string result = "TOF_12345 = Load(Filename = 'INSTRUMENT12345')\n";
+  void testLoadRunString() {
+    boost::tuple<std::string, std::string> output =
+        loadRunString("12345", m_instrument);
+    const std::string result =
+        "TOF_12345 = Load(Filename = 'INSTRUMENT12345')\n";
     TS_ASSERT_EQUALS(boost::get<0>(output), result)
   }
 
-  void testGetRunNumber()
-  {
+  void testGetRunNumber() {
     // Test with no run number in string
     std::string output = getRunNumber("TEST_WORKSPACE");
     const std::string result = "TEST_WORKSPACE";
@@ -379,32 +345,32 @@ public:
     TS_ASSERT_EQUALS(output1, result1)
   }
 
-  void testScaleString()
-  {
+  void testScaleString() {
     boost::tuple<std::string, std::string> output = scaleString("12345", 1.0);
-    const std::string result = "IvsQ_12345 = Scale(InputWorkspace = IvsQ_12345, Factor = 1)\n";
+    const std::string result =
+        "IvsQ_12345 = Scale(InputWorkspace = IvsQ_12345, Factor = 1)\n";
     TS_ASSERT_EQUALS(boost::get<0>(output), result)
   }
 
-  void testVectorParamString()
-  {
+  void testVectorParamString() {
     std::vector<std::string> stringVector;
     stringVector.emplace_back("A");
     stringVector.emplace_back("B");
     stringVector.emplace_back("C");
 
-    const std::string stringOutput = vectorParamString("PARAM_NAME", stringVector);
+    const std::string stringOutput =
+        vectorParamString("PARAM_NAME", stringVector);
 
     TS_ASSERT_EQUALS(stringOutput, "PARAM_NAME = 'A, B, C'")
   }
 
-  void testRebinString()
-  {
-    boost::tuple<std::string, std::string> output = rebinString(1, "12345", m_model, col_nums);
-    const std::string result = "IvsQ_12345 = Rebin(IvsQ_12345, Params = '1.4, -0.04, 2.9')\n";
+  void testRebinString() {
+    boost::tuple<std::string, std::string> output =
+        rebinString(1, "12345", m_model, col_nums);
+    const std::string result =
+        "IvsQ_12345 = Rebin(IvsQ_12345, Params = '1.4, -0.04, 2.9')\n";
     TS_ASSERT_EQUALS(boost::get<0>(output), result)
   }
-
 };
 
-#endif //MANTID_CUSTOMINTERFACES_REFLGENERATENOTEBOOKTEST_H
+#endif // MANTID_CUSTOMINTERFACES_REFLGENERATENOTEBOOKTEST_H
diff --git a/MantidQt/DesignerPlugins/inc/MantidQtDesignerPlugins/PluginCollectionInterface.h b/MantidQt/DesignerPlugins/inc/MantidQtDesignerPlugins/PluginCollectionInterface.h
index 21e1e5764737950eb0e1e816d9e710f71d9b31a0..5e1a7f1e94a84c9d963c69efe65a7b97abcdd323 100644
--- a/MantidQt/DesignerPlugins/inc/MantidQtDesignerPlugins/PluginCollectionInterface.h
+++ b/MantidQt/DesignerPlugins/inc/MantidQtDesignerPlugins/PluginCollectionInterface.h
@@ -20,6 +20,7 @@
 #include "MantidQtAPI/AlgorithmPropertiesWidget.h"
 #include "MantidQtMantidWidgets/ProcessingAlgoWidget.h"
 #include "MantidQtMantidWidgets/MessageDisplay.h"
+#include "MantidQtMantidWidgets/PreviewPlot.h"
 
 /** 
 The PluginCollectionInterface implements the interface for the plugin library and holds a 
@@ -152,4 +153,9 @@ DECLARE_WIDGET_PLUGIN(MessageDisplayPlugin,
 DECLARE_WIDGET_PLUGIN(DataSelectorPlugin,
     MantidQt::MantidWidgets::DataSelector,
     "Choose a file path or workspace to work with");
+
+DECLARE_WIDGET_PLUGIN(PreviewPlotPlugin,
+    MantidQt::MantidWidgets::PreviewPlot,
+    "Curve plots for workspace spectra");
+
 #endif
diff --git a/MantidQt/DesignerPlugins/src/PluginCollectionInterface.cpp b/MantidQt/DesignerPlugins/src/PluginCollectionInterface.cpp
index da97057d28ba9beef5b7412bbba77a1da7efacca..796948fc89e2eab4fcc6912b64fa1b1819783b85 100644
--- a/MantidQt/DesignerPlugins/src/PluginCollectionInterface.cpp
+++ b/MantidQt/DesignerPlugins/src/PluginCollectionInterface.cpp
@@ -28,7 +28,7 @@ PluginCollectionInterface::PluginCollectionInterface(QObject *parent) : QObject(
   m_widgets.append(new FitBrowserPlugin(this));
   m_widgets.append(new MuonFitBrowserPlugin(this));
   m_widgets.append(new MessageDisplayPlugin(this));
-
+  m_widgets.append(new PreviewPlotPlugin(this));
 }
 
 /**
diff --git a/MantidQt/MantidWidgets/CMakeLists.txt b/MantidQt/MantidWidgets/CMakeLists.txt
index df7a6979379d41a38075ba6c378bc91996be036d..041dd34cbf60823cbaca236f4516e791064b4127 100644
--- a/MantidQt/MantidWidgets/CMakeLists.txt
+++ b/MantidQt/MantidWidgets/CMakeLists.txt
@@ -279,6 +279,7 @@ qt4_wrap_cpp ( MOCCED_FILES ${MOC_FILES} )
 set ( ALL_SRC ${SRC_FILES} ${MOCCED_FILES} )
 
 qt4_wrap_ui ( UI_HDRS ${UI_FILES} ) 
+qt4_add_resources ( RES_FILES ${PROJECT_SOURCE_DIR}/images/MantidWidgets.qrc )
 
 include_directories ( ${QSCINTILLA_INCLUDE_DIR} )
 add_definitions ( -DQSCINTILLA_DLL )     # Will only have an effect on Windows (as is desired)
@@ -288,7 +289,7 @@ add_definitions ( -DQSCINTILLA_DLL )     # Will only have an effect on Windows (
 add_definitions ( -DIN_MANTIDQT_MANTIDWIDGETS -DQT_QTPROPERTYBROWSER_IMPORT )
 # Use a precompiled header where they are supported
 enable_precompiled_headers( inc/MantidQtMantidWidgets/PrecompiledHeader.h ALL_SRC )
-add_library ( MantidWidgets ${ALL_SRC} ${INC_FILES} ${UI_HDRS} )
+add_library ( MantidWidgets ${ALL_SRC} ${INC_FILES} ${UI_HDRS} ${RES_FILES} )
 
 if (OSX_VERSION VERSION_GREATER 10.8)
   set_target_properties ( MantidWidgets PROPERTIES INSTALL_RPATH "@loader_path/../MacOS")
diff --git a/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/AlgorithmSelectorWidget.h b/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/AlgorithmSelectorWidget.h
index e2d3bd0a5545539db11b0d2d752b868192354519..08096cc64644d70452928cfe1dcdc88178cde3ce 100644
--- a/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/AlgorithmSelectorWidget.h
+++ b/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/AlgorithmSelectorWidget.h
@@ -27,6 +27,20 @@ namespace MantidWidgets
   class AlgorithmTreeWidget;
   class FindAlgComboBox;
 
+  /**
+   * Represents the algorithm selected by the user
+   * Contains name and version
+   */
+  struct SelectedAlgorithm {
+    QString name;
+    int version;
+    /// implicit conversion to QString
+    operator QString() { return name; }
+    /// constructor
+    SelectedAlgorithm(const QString nameIn, const int versionIn)
+        : name(nameIn), version(versionIn){};
+  };
+
   //============================================================================
   /** A widget consisting of a ComboBox and a TreeWidget
    * to allow a user to select an algorithm either by category
@@ -42,8 +56,7 @@ namespace MantidWidgets
   public:
     AlgorithmSelectorWidget(QWidget *parent);
     ~AlgorithmSelectorWidget() override;
-    void getSelectedAlgorithm(QString& algName, int& version);
-    QString getSelectedAlgorithm();
+    SelectedAlgorithm getSelectedAlgorithm();
     void setSelectedAlgorithm(QString & algName);
     bool showExecuteButton() const;
     void showExecuteButton(const bool);
@@ -87,7 +100,7 @@ signals:
     void mousePressEvent(QMouseEvent *e) override;
     void mouseMoveEvent(QMouseEvent *e) override;
     void mouseDoubleClickEvent(QMouseEvent *e) override;
-    void getSelectedAlgorithm(QString& algName, int& version);
+    SelectedAlgorithm getSelectedAlgorithm();
 
   public slots:
     void update();
@@ -110,7 +123,7 @@ signals:
     Q_OBJECT
   public:
     ~FindAlgComboBox() override {}
-    void getSelectedAlgorithm(QString& algName, int& version);
+    SelectedAlgorithm getSelectedAlgorithm();
 
   signals:
     void enterPressed();
diff --git a/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/CatalogSearch.h b/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/CatalogSearch.h
index e1cc2314bb847e29b2f61d1c52a29ea6b58652f7..b518db5b06ee0e9ac88c71061c40020a9bbcda98 100644
--- a/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/CatalogSearch.h
+++ b/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/CatalogSearch.h
@@ -111,9 +111,9 @@ namespace MantidQt
       /// Updates the dataFile text boxes with relevant info about the selected dataFile.
       void updateDataFileLabels(QTableWidgetItem* item);
       /// Obtain all file extensions from the provided column (dataFileResults -> File name).
-      std::set<std::string> getDataFileExtensions(Mantid::API::Column_sptr column);
+      std::unordered_set<std::string> getDataFileExtensions(Mantid::API::Column_sptr column);
       /// Add the list of file extensions to the "Filter type..." drop-down.
-      void populateDataFileType(const std::set<std::string> &extensions);
+      void populateDataFileType(const std::unordered_set<std::string> &extensions);
       /// Disable the download button if user can access the files locally from the archives.
       void disableDownloadButtonIfArchives(int row);
 
diff --git a/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/InstrumentView/InstrumentWidget.h b/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/InstrumentView/InstrumentWidget.h
index f957a2e0c9d740960fce2d8ec43fc96e22f5c62f..ce60e108d6c5f8e325cd475fb0b53020e689ed68 100644
--- a/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/InstrumentView/InstrumentWidget.h
+++ b/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/InstrumentView/InstrumentWidget.h
@@ -150,6 +150,8 @@ namespace MantidQt
 			void integrationRangeChanged(double, double);
 			void glOptionChanged(bool);
 			void requestSelectComponent(const QString &);
+			void preDeletingHandle();
+			void clearingHandle();
 
 		protected:
 			/// Implements AlgorithmObserver's finish handler
@@ -274,9 +276,22 @@ namespace MantidQt
 			bool m_blocked;
 			QList<int> m_selectedDetectors;
 			bool m_instrumentDisplayContextMenuOn;
-		};
-
-	}//MantidWidgets
+		private:
+			/// ADS notification handlers
+                  void preDeleteHandle(
+                      const std::string &ws_name,
+                      const boost::shared_ptr<Mantid::API::Workspace>
+                          workspace_ptr) override;
+                  void afterReplaceHandle(
+                      const std::string &wsName,
+                      const boost::shared_ptr<Mantid::API::Workspace>
+                          workspace_ptr) override;
+                  void renameHandle(const std::string &oldName,
+                                    const std::string &newName) override;
+                  void clearADSHandle() override;
+                };
+
+        }//MantidWidgets
 }//MantidQt
 
-#endif /*INSTRUMENTWIDGET_H_*/
\ No newline at end of file
+#endif /*INSTRUMENTWIDGET_H_*/
diff --git a/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/InstrumentView/Shape2DCollection.h b/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/InstrumentView/Shape2DCollection.h
index 4d74ef5fe2c3ebc38f6b87492fb44e0f8e3088f6..8a080442a197b11e6676b497c7fe2364d76e8661 100644
--- a/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/InstrumentView/Shape2DCollection.h
+++ b/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/InstrumentView/Shape2DCollection.h
@@ -73,7 +73,7 @@ namespace MantidQt
 										// is a point in real space masked by any of the shapes
 			bool isMasked(double x, double y)const;
 			// collect all screen pixels that are masked by the shapes
-			void getMaskedPixels(QList<QPoint>& pixels)const;
+			QList<QPoint> getMaskedPixels()const;
 
 			// set the bounding rect of the current shape such that its real rect is given by the argument
 			void setCurrentBoundingRectReal(const QRectF& rect);
diff --git a/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/RenameParDialog.h b/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/RenameParDialog.h
index 916b8208563ac1525e1dbe6d701e93269921833e..5780f014492f46fb6d13e3d4e66cac6333fd3851 100644
--- a/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/RenameParDialog.h
+++ b/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/RenameParDialog.h
@@ -23,7 +23,7 @@ namespace MantidQt
       RenameParDialog(const std::vector<std::string>& old_params,
         const std::vector<std::string>& new_params,
         QWidget *parent=NULL);
-      void setOutput(std::vector<std::string>& out)const;
+      std::vector<std::string> setOutput() const;
     protected slots:
       void uniqueIndexedNames(bool);
       void doNotRename(bool);
diff --git a/MantidQt/MantidWidgets/src/AlgorithmSelectorWidget.cpp b/MantidQt/MantidWidgets/src/AlgorithmSelectorWidget.cpp
index 3f48ee2a809db624236740eafe4b5499b512875a..4e0ff697db38d75fb8d28d60e444fe28f6832e70 100644
--- a/MantidQt/MantidWidgets/src/AlgorithmSelectorWidget.cpp
+++ b/MantidQt/MantidWidgets/src/AlgorithmSelectorWidget.cpp
@@ -99,18 +99,13 @@ namespace MantidWidgets
   //---------------------------------------------------------------------------
   /** Slot called to execute whatever is the selected algorithm
    **/
-  void AlgorithmSelectorWidget::executeSelected()
-  {
-    QString algName;
-    int version;
-    this->getSelectedAlgorithm(algName,version);
-    if (!algName.isEmpty())
-    {
-      emit executeAlgorithm(algName, version);
+  void AlgorithmSelectorWidget::executeSelected() {
+    auto alg = this->getSelectedAlgorithm();
+    if (!alg.name.isEmpty()) {
+      emit executeAlgorithm(alg.name, alg.version);
     }
   }
 
-
   //---------------------------------------------------------------------------
   /** Show the selection in the tree when it changes in the combo */
   void AlgorithmSelectorWidget::findAlgTextChanged(const QString& text)
@@ -123,46 +118,33 @@ namespace MantidWidgets
     m_tree->blockSignals(false);
 
     // Emit the signal
-    QString algName;
-    int version;
-    this->getSelectedAlgorithm(algName,version);
-    emit algorithmSelectionChanged(algName, version);
+    auto alg = this->getSelectedAlgorithm();
+    emit algorithmSelectionChanged(alg.name, alg.version);
   }
 
   //---------------------------------------------------------------------------
   /** Show the selection in the combo when it changes in the tree */
   void AlgorithmSelectorWidget::treeSelectionChanged()
   {
-    QString algName;
-    int version;
-    this->getSelectedAlgorithm(algName,version);
+    auto alg = this->getSelectedAlgorithm();
     // Select in the combo box
     m_findAlg->blockSignals(true);
-    m_findAlg->setCurrentIndex(m_findAlg->findText(algName,Qt::MatchFixedString));
+    m_findAlg->setCurrentIndex(
+        m_findAlg->findText(alg.name, Qt::MatchFixedString));
     m_findAlg->blockSignals(false);
     // Emit the signal
-    emit algorithmSelectionChanged(algName, version);
+    emit algorithmSelectionChanged(alg.name, alg.version);
   }
 
   //---------------------------------------------------------------------------
   /** Return the selected algorithm.
    * The tree has priority. If nothing is selected in the tree,
    * return the ComboBox selection */
-  void AlgorithmSelectorWidget::getSelectedAlgorithm(QString& algName, int& version)
-  {
-    algName.clear();
-    m_tree->getSelectedAlgorithm(algName, version);
-    if (algName.isEmpty())
-      m_findAlg->getSelectedAlgorithm(algName, version);
-  }
-
-  //---------------------------------------------------------------------------
-  /** @return just the name of the selected algorithm */
-  QString AlgorithmSelectorWidget::getSelectedAlgorithm()
-  {
-    QString algName; int version;
-    this->getSelectedAlgorithm(algName, version);
-    return algName;
+  SelectedAlgorithm AlgorithmSelectorWidget::getSelectedAlgorithm() {
+    SelectedAlgorithm alg = m_tree->getSelectedAlgorithm();
+    if (alg.name.isEmpty())
+      alg = m_findAlg->getSelectedAlgorithm();
+    return alg;
   }
 
   //---------------------------------------------------------------------------
@@ -219,31 +201,26 @@ namespace MantidWidgets
   //============================================================================
   //======================= AlgorithmTreeWidget ================================
   //============================================================================
-  /** Return the selected algorithm in the tree */
-  void AlgorithmTreeWidget::getSelectedAlgorithm(QString& algName, int& version)
-  {
-    QList<QTreeWidgetItem*> items = this->selectedItems();
-    if ( items.size() == 0 )
-    {
-      // Nothing selected
-      algName = "";
-      version = 0;
-    }
-    else if ( items[0]->childCount() != 0 && !items[0]->text(0).contains(" v."))
-    {
-      algName = "";
-      version = 0;
-    }
-    else
-    {
+  /** Return the selected algorithm in the tree 
+   * @returns :: algorithm selected by user
+   */
+  SelectedAlgorithm AlgorithmTreeWidget::getSelectedAlgorithm() {
+    SelectedAlgorithm alg("", 0);
+
+    auto isCategoryName = [](const QTreeWidgetItem *item) {
+      return (item->childCount() != 0 && !item->text(0).contains(" v."));
+    };
+
+    QList<QTreeWidgetItem *> items = this->selectedItems();
+    if (items.size() > 0 && !isCategoryName(items[0])) {
       QString str = items[0]->text(0);
       QStringList lst = str.split(" v.");
-      algName = lst[0];
-      version = lst[1].toInt();
+      alg.name = lst[0];
+      alg.version = lst[1].toInt();
     }
+    return alg;
   }
 
-
   //---------------------------------------------------------------------------
   /** SLOT called when clicking the mouse around the tree */
   void AlgorithmTreeWidget::mousePressEvent (QMouseEvent *e)
@@ -281,13 +258,10 @@ namespace MantidWidgets
   /** SLOT called when double-clicking on an entry in the tree */
   void AlgorithmTreeWidget::mouseDoubleClickEvent(QMouseEvent *e)
   {
-    QString algName;
-    int version;
-    this->getSelectedAlgorithm(algName,version);
-    if ( ! algName.isEmpty() )
-    {
+    auto alg = this->getSelectedAlgorithm();
+    if (!alg.name.isEmpty()) {
       // Emit the signal that we are executing
-      emit executeAlgorithm(algName, version);
+      emit executeAlgorithm(alg.name, alg.version);
       return;
     }
     QTreeWidget::mouseDoubleClickEvent(e);
@@ -436,7 +410,7 @@ namespace MantidWidgets
 
   //---------------------------------------------------------------------------
   /** Return the selected algorithm */
-  void FindAlgComboBox::getSelectedAlgorithm(QString& algName, int& version)
+  SelectedAlgorithm FindAlgComboBox::getSelectedAlgorithm()
   {
     //typed selection
     QString typedText = this->currentText().stripWhiteSpace(); //text as typed in the combobox
@@ -450,9 +424,7 @@ namespace MantidWidgets
         typedText = stripAlias(typedText);
       }
     }
-    //set return values
-    algName = typedText;
-    version = -1;
+    return SelectedAlgorithm(typedText, -1);
   }
 
 
diff --git a/MantidQt/MantidWidgets/src/CatalogSearch.cpp b/MantidQt/MantidWidgets/src/CatalogSearch.cpp
index e167dd5e63439a387315eeffe40e0a9ebc5ab271..1930ad929a2c871f2272451d5256337d4d45b90a 100644
--- a/MantidQt/MantidWidgets/src/CatalogSearch.cpp
+++ b/MantidQt/MantidWidgets/src/CatalogSearch.cpp
@@ -968,7 +968,7 @@ namespace MantidQt
 
       // Obtain the list of extensions of all dataFiles for the chosen investigation.
       // "File name" is the first column of "dataFileResults" so we make use of it.
-      std::set<std::string> extensions = getDataFileExtensions(workspace.get()->getColumn(headerIndexByName(dataFileTable, "Name")));
+      auto extensions = getDataFileExtensions(workspace.get()->getColumn(headerIndexByName(dataFileTable, "Name")));
 
       // Populate the "Filter type..." combo-box with all possible file extensions.
       populateDataFileType(extensions);
@@ -1057,9 +1057,9 @@ namespace MantidQt
      * @param column :: The fileName column in the dataFile workspace.
      * @return A set containing all file extensions.
      */
-    std::set<std::string> CatalogSearch::getDataFileExtensions(Mantid::API::Column_sptr column)
+    std::unordered_set<std::string> CatalogSearch::getDataFileExtensions(Mantid::API::Column_sptr column)
     {
-      std::set<std::string> extensions;
+      std::unordered_set<std::string> extensions;
 
       // For every filename in the column...
       for (unsigned row = 0; row < column->size(); row++)
@@ -1075,11 +1075,11 @@ namespace MantidQt
     /**
      * Add the list of file extensions to the "Filter type..." drop-down.
      */
-    void CatalogSearch::populateDataFileType(const std::set<std::string> &extensions)
+    void CatalogSearch::populateDataFileType(const std::unordered_set<std::string> &extensions)
     {
-      for( std::set<std::string>::const_iterator iter = extensions.begin(); iter != extensions.end(); ++iter)
+      for(const auto &extension : extensions)
       {
-        m_icatUiForm.dataFileFilterCombo->addItem(QString::fromStdString("." + *iter));
+        m_icatUiForm.dataFileFilterCombo->addItem(QString::fromStdString("." + extension));
       }
     }
 
diff --git a/MantidQt/MantidWidgets/src/FitPropertyBrowser.cpp b/MantidQt/MantidWidgets/src/FitPropertyBrowser.cpp
index 15bed28f07e341420080682b1ce558c60a49593a..7f3b60b8aa8cbdfe3341c042d2a37d45a9338bd0 100644
--- a/MantidQt/MantidWidgets/src/FitPropertyBrowser.cpp
+++ b/MantidQt/MantidWidgets/src/FitPropertyBrowser.cpp
@@ -1688,8 +1688,8 @@ void FitPropertyBrowser::populateWorkspaceNames()
   //QStringList tmp = m_appWindow->mantidUI->getWorkspaceNames();
 
   QStringList tmp;
-  std::set<std::string> sv = Mantid::API::AnalysisDataService::Instance().getObjectNames();
-  for (std::set<std::string>::const_iterator it = sv.begin(); it != sv.end(); ++it)
+  auto sv = Mantid::API::AnalysisDataService::Instance().getObjectNames();
+  for (auto it = sv.begin(); it != sv.end(); ++it)
   {
     tmp<<QString::fromStdString(*it);
   }
diff --git a/MantidQt/MantidWidgets/src/InstrumentSelector.cpp b/MantidQt/MantidWidgets/src/InstrumentSelector.cpp
index 166517650604f66b075470347321144ab20ea21c..c0433af448ba45da6505edf703091ec55e4da7f0 100644
--- a/MantidQt/MantidWidgets/src/InstrumentSelector.cpp
+++ b/MantidQt/MantidWidgets/src/InstrumentSelector.cpp
@@ -14,6 +14,7 @@
 #include <Poco/NotificationCenter.h>
 #include <Poco/AutoPtr.h>
 #include <Poco/NObserver.h>
+#include <set>
 
 namespace
 {
@@ -180,18 +181,16 @@ namespace MantidWidgets
       m_currentFacility = &(mantidSettings.getFacility(mantidSettings.getFacilityNames()[0]));
     }
 
-    const std::vector<InstrumentInfo> & instruments = m_currentFacility->instruments();
-    std::vector<InstrumentInfo>::const_iterator iend = instruments.end();
+    const auto &instruments = m_currentFacility->instruments();
     std::set<std::string> alphabetizedNames;
-    for( std::vector<InstrumentInfo>::const_iterator itr = instruments.begin(); itr != iend; ++itr )
+    for( auto itr = instruments.cbegin(); itr != instruments.cend(); ++itr )
     {
       alphabetizedNames.insert(itr->name());
     }
-    std::set<std::string>::const_iterator namesEnd = alphabetizedNames.end();
-    for( std::set<std::string>::const_iterator itr = alphabetizedNames.begin(); itr != namesEnd; ++itr )
+    for(const auto &name_std_str : alphabetizedNames)
     {
-      QString name = QString::fromStdString(*itr);
-      std::string prefix = m_currentFacility->instrument(*itr).shortName();
+      QString name = QString::fromStdString(name_std_str);
+      std::string prefix = m_currentFacility->instrument(name_std_str).shortName();
       QString shortName = QString::fromStdString(prefix);
       this->addItem(name, QVariant(shortName));
     }
diff --git a/MantidQt/MantidWidgets/src/InstrumentView/InstrumentActor.cpp b/MantidQt/MantidWidgets/src/InstrumentView/InstrumentActor.cpp
index 5762e751f8a24b7c91b9a3a25a2656cb24429065..4b0614b53c7eda9b1061d0d5bba70f4c00c1ad15 100644
--- a/MantidQt/MantidWidgets/src/InstrumentView/InstrumentActor.cpp
+++ b/MantidQt/MantidWidgets/src/InstrumentView/InstrumentActor.cpp
@@ -685,7 +685,7 @@ namespace MantidQt
 				try
 				{
 					// Find if the detector is masked
-					const std::set<detid_t>& dets = sharedWorkspace->getSpectrum(wi)->getDetectorIDs();
+					const auto &dets = sharedWorkspace->getSpectrum(wi)->getDetectorIDs();
 					bool masked = false;
 
 					if (mask)
@@ -1222,8 +1222,10 @@ namespace MantidQt
 
 			// get the workspace indices of monitors in order to exclude them from finding of the max value
 			auto monitorIDs = getInstrument()->getMonitors();
-			std::vector<size_t> monitorIndices;
-			workspace->getIndicesFromDetectorIDs(monitorIDs, monitorIndices);
+      // clang-format off
+      // because it indents this line half way across the page (?)
+			auto monitorIndices = workspace->getIndicesFromDetectorIDs(monitorIDs);
+      // clang-format on
 
 			// check that there is at least 1 non-monitor spectrum
 			if (monitorIndices.size() == m_specIntegrs.size())
diff --git a/MantidQt/MantidWidgets/src/InstrumentView/InstrumentWidget.cpp b/MantidQt/MantidWidgets/src/InstrumentView/InstrumentWidget.cpp
index f6dc7a4e59d0859847173f02cf9058286ad82504..5f84d74a718d6797031eadff14c2b0354b4b632f 100644
--- a/MantidQt/MantidWidgets/src/InstrumentView/InstrumentWidget.cpp
+++ b/MantidQt/MantidWidgets/src/InstrumentView/InstrumentWidget.cpp
@@ -1282,6 +1282,45 @@ namespace MantidQt
 				}
 			}
 		}
+
+		/**
+		* Closes the window if the associated workspace is deleted.
+		* @param ws_name :: Name of the deleted workspace.
+		* @param workspace_ptr :: Pointer to the workspace to be deleted
+		*/
+		void InstrumentWidget::preDeleteHandle(
+			const std::string &ws_name,
+			const boost::shared_ptr<Workspace> workspace_ptr) {
+			if (hasWorkspace(ws_name)) {
+				emit preDeletingHandle();
+				close();
+				return;
+			}
+			Mantid::API::IPeaksWorkspace_sptr pws =
+				boost::dynamic_pointer_cast<Mantid::API::IPeaksWorkspace>(workspace_ptr);
+			if (pws) {
+				deletePeaksWorkspace(pws);
+				return;
+			}
+		}
+
+		void InstrumentWidget::afterReplaceHandle(
+			const std::string &wsName, const boost::shared_ptr<Workspace> workspace) {
+			handleWorkspaceReplacement(wsName, workspace);
+		}
+
+		void InstrumentWidget::renameHandle(const std::string &oldName,
+			const std::string &newName) {
+			if (hasWorkspace(oldName)) {
+				renameWorkspace(newName);
+				setWindowTitle(QString("Instrument - ") + getWorkspaceName());
+			}
+		}
+
+		void InstrumentWidget::clearADSHandle() {
+			emit clearingHandle();
+			close();
+		}
 	}//MantidWidgets
 }//MantidQt
 
diff --git a/MantidQt/MantidWidgets/src/InstrumentView/InstrumentWidgetMaskTab.cpp b/MantidQt/MantidWidgets/src/InstrumentView/InstrumentWidgetMaskTab.cpp
index 8e590e6c3f434b94d7c8af95a99f1add7b23010e..105e340c78f473f8ecef24e7f17d37ee5a3f2931 100644
--- a/MantidQt/MantidWidgets/src/InstrumentView/InstrumentWidgetMaskTab.cpp
+++ b/MantidQt/MantidWidgets/src/InstrumentView/InstrumentWidgetMaskTab.cpp
@@ -985,7 +985,7 @@ namespace MantidQt
 		std::string InstrumentWidgetMaskTab::generateMaskWorkspaceName(bool temp) const
 		{
 			if (temp) return "__MaskTab_MaskWorkspace";
-			std::set<std::string> wsNames = Mantid::API::AnalysisDataService::Instance().getObjectNames();
+			auto wsNames = Mantid::API::AnalysisDataService::Instance().getObjectNames();
 			int maxIndex = 0;
 			const std::string baseName = "MaskWorkspace";
 			for (auto name = wsNames.begin(); name != wsNames.end(); ++name)
diff --git a/MantidQt/MantidWidgets/src/InstrumentView/Projection3D.cpp b/MantidQt/MantidWidgets/src/InstrumentView/Projection3D.cpp
index 4163a6cbe903b2d34acf0b3e17a93a88c7be9190..cdfa8512b5913b30e210d988ebdf024830b60949 100644
--- a/MantidQt/MantidWidgets/src/InstrumentView/Projection3D.cpp
+++ b/MantidQt/MantidWidgets/src/InstrumentView/Projection3D.cpp
@@ -273,8 +273,7 @@ namespace MantidQt
 			m_instrActor->cacheDetPos();
 
 			// find the layer of visible detectors
-			QList<QPoint> pixels;
-			m_maskShapes.getMaskedPixels(pixels);
+			QList<QPoint> pixels = m_maskShapes.getMaskedPixels();
 			double zmin = 1.0;
 			double zmax = 0.0;
 			QSet<int> ids;
diff --git a/MantidQt/MantidWidgets/src/InstrumentView/Shape2DCollection.cpp b/MantidQt/MantidWidgets/src/InstrumentView/Shape2DCollection.cpp
index 6437b1b63cf9cb8a8d03e9c4e2988eae4c68dbda..018b3d46b547c1b94459647446005fd860507f27 100644
--- a/MantidQt/MantidWidgets/src/InstrumentView/Shape2DCollection.cpp
+++ b/MantidQt/MantidWidgets/src/InstrumentView/Shape2DCollection.cpp
@@ -702,9 +702,8 @@ namespace MantidQt
 			return false;
 		}
 
-		void Shape2DCollection::getMaskedPixels(QList<QPoint>& pixels)const
-		{
-			pixels.clear();
+		QList<QPoint> Shape2DCollection::getMaskedPixels() const {
+			QList<QPoint> pixels;
 			QTransform inv = m_transform.inverted();
 			for (int i = m_viewport.left(); i <= m_viewport.right(); ++i)
 			{
@@ -721,6 +720,7 @@ namespace MantidQt
 					}
 				}
 			}
+      return pixels;
 		}
 
 		/**
diff --git a/MantidQt/MantidWidgets/src/ProcessingAlgoWidget.cpp b/MantidQt/MantidWidgets/src/ProcessingAlgoWidget.cpp
index 34cd5433a753b5c585fb9013af147d63e23c9442..b64b81bbba4d4ce9813659a822178c3f4c25add8 100644
--- a/MantidQt/MantidWidgets/src/ProcessingAlgoWidget.cpp
+++ b/MantidQt/MantidWidgets/src/ProcessingAlgoWidget.cpp
@@ -132,12 +132,11 @@ void ProcessingAlgoWidget::btnLoadClicked()
  */
 void ProcessingAlgoWidget::changeAlgorithm()
 {
-  QString algName;
-  int version;
-  ui.algoSelector->getSelectedAlgorithm(algName,version);
+  auto alg = ui.algoSelector->getSelectedAlgorithm();
   try
   {
-    m_alg = AlgorithmManager::Instance().createUnmanaged(algName.toStdString(), version);
+    m_alg = AlgorithmManager::Instance().createUnmanaged(alg.name.toStdString(),
+                                                         alg.version);
     m_alg->initialize();
   }
   catch (std::runtime_error &)
diff --git a/MantidQt/MantidWidgets/src/RenameParDialog.cpp b/MantidQt/MantidWidgets/src/RenameParDialog.cpp
index f4a08dc14690cd2f995a5fd9d47695bdbfbc232b..2435c60292a604e4233978aca69a75130814d3ab 100644
--- a/MantidQt/MantidWidgets/src/RenameParDialog.cpp
+++ b/MantidQt/MantidWidgets/src/RenameParDialog.cpp
@@ -96,16 +96,17 @@ QString RenameParDialog::makeUniqueIndexedName(const QString& name)
 
 /**
  * Output the new names to a vector 
- * @param out :: Reference to a vector for output
+ * @returns :: new names in a vector
  */
-void RenameParDialog::setOutput(std::vector<std::string>& out)const
+std::vector<std::string> RenameParDialog::setOutput() const
 {
-  out.clear();
+  std::vector<std::string> out;
   QAbstractItemModel* model = m_uiForm.tableWidget->model();
   for(int row=0;row< m_uiForm.tableWidget->rowCount(); ++row)
   {
     out.push_back(model->data(model->index(row,1)).toString().toStdString());
   }
+  return out;
 }
 
 void RenameParDialog::uniqueIndexedNames(bool ok)
diff --git a/MantidQt/MantidWidgets/src/SaveWorkspaces.cpp b/MantidQt/MantidWidgets/src/SaveWorkspaces.cpp
index 1a611ae0e0187c035f81b9a1c3922a15c4ab4cf2..0abc6145c5c32b49500e2288858ede744013a625 100644
--- a/MantidQt/MantidWidgets/src/SaveWorkspaces.cpp
+++ b/MantidQt/MantidWidgets/src/SaveWorkspaces.cpp
@@ -87,8 +87,8 @@ void SaveWorkspaces::setupLine1(QHBoxLayout * const lineOne)
 void SaveWorkspaces::setupLine2(QHBoxLayout * const lineTwo, const QHash<const QCheckBox * const, QString> & defSavs)
 {
   m_workspaces = new QListWidget();
-  std::set<std::string> ws = AnalysisDataService::Instance().getObjectNames();
-  std::set<std::string>::const_iterator it = ws.begin(), wsEnd = ws.end();
+  auto ws = AnalysisDataService::Instance().getObjectNames();
+  auto it = ws.begin(), wsEnd = ws.end();
   for( ; it != wsEnd; ++it)
   {
     Workspace *wksp =  FrameworkManager::Instance().getWorkspace(*it);
diff --git a/MantidQt/MantidWidgets/src/SlicingAlgorithmDialog.cpp b/MantidQt/MantidWidgets/src/SlicingAlgorithmDialog.cpp
index 7a157fe63bee473e6c1d792bbd550a4cfa696e94..16f7d598731d73cc8e7652592ffb834763f4befa 100644
--- a/MantidQt/MantidWidgets/src/SlicingAlgorithmDialog.cpp
+++ b/MantidQt/MantidWidgets/src/SlicingAlgorithmDialog.cpp
@@ -64,9 +64,8 @@ namespace MantidQt
       //Configure workspace selector
       ui.workspace_selector->setValidatingAlgorithm(m_algName);
       ui.workspace_selector->clear();
-      typedef std::set<std::string> WorkspaceNames;
-      WorkspaceNames names = AnalysisDataService::Instance().getObjectNames();
-      WorkspaceNames::iterator it = names.begin();
+      auto names = AnalysisDataService::Instance().getObjectNames();
+      auto it = names.begin();
       while(it != names.end())
       {
         IMDEventWorkspace_sptr ws = boost::dynamic_pointer_cast<IMDEventWorkspace>(AnalysisDataService::Instance().retrieve(*it));
diff --git a/MantidQt/MantidWidgets/src/UserFunctionDialog.cpp b/MantidQt/MantidWidgets/src/UserFunctionDialog.cpp
index 7168dee88aa50d6f80acf71aae6bbbb595c5c61c..3f78d7986f2422cefa000606cec61a58e1bcc7a8 100644
--- a/MantidQt/MantidWidgets/src/UserFunctionDialog.cpp
+++ b/MantidQt/MantidWidgets/src/UserFunctionDialog.cpp
@@ -215,8 +215,8 @@ void UserFunctionDialog::checkParameters(QString& expr)
   {
     return;
   }
-  std::set<std::string> vars1 = e1.getVariables();
-  std::set<std::string> vars2 = e2.getVariables();
+  auto vars1 = e1.getVariables();
+  auto vars2 = e2.getVariables();
   vars1.erase("x");
   vars2.erase("x");
 
@@ -244,8 +244,7 @@ void UserFunctionDialog::checkParameters(QString& expr)
     RenameParDialog dlg(all,common);
     if (dlg.exec() == QDialog::Accepted)
     {
-      std::vector<std::string> vars_new;
-      dlg.setOutput(vars_new);
+      auto vars_new = dlg.setOutput();
       std::vector<std::string>::const_iterator v_old = common.begin();
       std::vector<std::string>::const_iterator v_new = vars_new.begin();
       for(; v_old != common.end(); ++v_old,++v_new)
@@ -278,10 +277,10 @@ void UserFunctionDialog::updateFunction()
     m_uiForm.leParams->setText("");
     return;
   }
-  std::set<std::string> vars = e.getVariables();
+  auto vars = e.getVariables();
   vars.erase("x");
   QString params;
-  for(std::set<std::string>::iterator it=vars.begin();it!=vars.end();++it)
+  for(auto it=vars.begin();it!=vars.end();++it)
   {
     if (it != vars.begin())
     {
diff --git a/MantidQt/MantidWidgets/src/WorkspaceSelector.cpp b/MantidQt/MantidWidgets/src/WorkspaceSelector.cpp
index 93e2207b19170eb953952493ab483e017457e894..01e9e6bdc4f4277bb910383bef25f43581b52bfd 100644
--- a/MantidQt/MantidWidgets/src/WorkspaceSelector.cpp
+++ b/MantidQt/MantidWidgets/src/WorkspaceSelector.cpp
@@ -305,7 +305,7 @@ void WorkspaceSelector::refresh()
   clear();
   if ( m_optional ) addItem("");
   auto& ads = Mantid::API::AnalysisDataService::Instance();
-  std::set<std::string> items;
+  std::unordered_set<std::string> items;
   if ( showHiddenWorkspaces() )
   {
     items = ads.getObjectNamesInclHidden();
@@ -315,7 +315,7 @@ void WorkspaceSelector::refresh()
     items = ads.getObjectNames();
   }
 
-  for ( std::set<std::string>::iterator it = items.begin(); it != items.end(); ++it )
+  for ( auto it = items.begin(); it != items.end(); ++it )
   {
     QString name = QString::fromStdString(*it);
     if ( checkEligibility( name, ads.retrieve(*it) ) )
diff --git a/MantidQt/MantidWidgets/test/AlgorithmHintStrategyTest.h b/MantidQt/MantidWidgets/test/AlgorithmHintStrategyTest.h
index b074ca283ee1edf0903f10d9298cc5eb54fda5b8..2e12f4fef242f56f30260cba99d453656f45896a 100644
--- a/MantidQt/MantidWidgets/test/AlgorithmHintStrategyTest.h
+++ b/MantidQt/MantidWidgets/test/AlgorithmHintStrategyTest.h
@@ -5,6 +5,8 @@
 #include "MantidAPI/FrameworkManager.h"
 #include "MantidAPI/AlgorithmManager.h"
 #include "MantidAPI/MatrixWorkspace.h"
+#include "MantidKernel/ArrayProperty.h"
+#include "MantidKernel/BoundedValidator.h"
 #include "MantidQtMantidWidgets/HintStrategy.h"
 #include "MantidQtMantidWidgets/AlgorithmHintStrategy.h"
 
@@ -14,43 +16,74 @@ using namespace Mantid::API;
 //=====================================================================================
 // Functional tests
 //=====================================================================================
-class AlgorithmHintStrategyTest : public CxxTest::TestSuite
-{
+class AlgorithmHintStrategyTest : public CxxTest::TestSuite {
+
+  // Inner class :: Fake Algorithm
+  class FakeAlgorithm : public Algorithm {
+
+  public:
+    FakeAlgorithm() {}
+    ~FakeAlgorithm() {}
+    const std::string name() const { return "Fake Algorithm"; };
+    int version() const { return 1; };
+    const std::string category() const { return ""; };
+    const std::string summary() const { return "A Fake Algorithm"; };
+
+  private:
+    void init() {
+      declareProperty("IntValue", 0);
+      declareProperty("DoubleValue", 0.01);
+      declareProperty("BoolValue", false);
+      declareProperty("StringValue", "Empty");
+      auto mustBePositive =
+          boost::make_shared<Mantid::Kernel::BoundedValidator<int>>();
+      mustBePositive->setLower(0);
+      declareProperty("PositiveIntValue", 0, mustBePositive);
+      declareProperty("PositiveIntValue1", 0, mustBePositive);
+      declareProperty(new Mantid::Kernel::ArrayProperty<int>("IntArray"));
+      declareProperty(new Mantid::Kernel::ArrayProperty<double>("DoubleArray"));
+      declareProperty(
+          new Mantid::Kernel::ArrayProperty<std::string>("StringArray"));
+    };
+    void exec() { return; };
+  };
+
 public:
   // This pair of boilerplate methods prevent the suite being created statically
   // This means the constructor isn't called when running other tests
-  static AlgorithmHintStrategyTest *createSuite() { return new AlgorithmHintStrategyTest(); }
-  static void destroySuite( AlgorithmHintStrategyTest *suite ) { delete suite; }
+  static AlgorithmHintStrategyTest *createSuite() {
+    return new AlgorithmHintStrategyTest();
+  }
+  static void destroySuite(AlgorithmHintStrategyTest *suite) { delete suite; }
 
-  AlgorithmHintStrategyTest()
-  {
-    FrameworkManager::Instance();
-    m_propAlg = AlgorithmManager::Instance().create("PropertyAlgorithm");
-    //Expected hints for PropertyAlgorithm
-    m_propMap["IntValue"]          = "";
-    m_propMap["DoubleValue"]       = "";
-    m_propMap["BoolValue"]         = "";
-    m_propMap["StringValue"]       = "";
-    m_propMap["PositiveIntValue"]  = "";
+  AlgorithmHintStrategyTest() {
+    m_propAlg = static_cast<IAlgorithm_sptr>(new FakeAlgorithm());
+    m_propAlg->initialize();
+    // Expected hints for PropertyAlgorithm
+    m_propMap["IntValue"] = "";
+    m_propMap["DoubleValue"] = "";
+    m_propMap["BoolValue"] = "";
+    m_propMap["StringValue"] = "";
+    m_propMap["PositiveIntValue"] = "";
     m_propMap["PositiveIntValue1"] = "";
-    m_propMap["IntArray"]          = "";
-    m_propMap["DoubleArray"]       = "";
-    m_propMap["StringArray"]       = "";
+    m_propMap["IntArray"] = "";
+    m_propMap["DoubleArray"] = "";
+    m_propMap["StringArray"] = "";
   }
 
-  void testCreateHints()
-  {
-    boost::scoped_ptr<HintStrategy> strategy(new AlgorithmHintStrategy(m_propAlg, std::set<std::string>()));
+  void testCreateHints() {
+    boost::scoped_ptr<HintStrategy> strategy(
+        new AlgorithmHintStrategy(m_propAlg, std::set<std::string>()));
     TS_ASSERT_EQUALS(m_propMap, strategy->createHints());
   }
 
-  void testBlacklist()
-  {
+  void testBlacklist() {
     std::set<std::string> blacklist;
     blacklist.insert("DoubleValue");
     blacklist.insert("IntArray");
 
-    boost::scoped_ptr<HintStrategy> strategy(new AlgorithmHintStrategy(m_propAlg, blacklist));
+    boost::scoped_ptr<HintStrategy> strategy(
+        new AlgorithmHintStrategy(m_propAlg, blacklist));
     auto expected = m_propMap;
     expected.erase("DoubleValue");
     expected.erase("IntArray");
@@ -59,7 +92,7 @@ public:
 
 protected:
   IAlgorithm_sptr m_propAlg;
-  std::map<std::string,std::string> m_propMap;
+  std::map<std::string, std::string> m_propMap;
 };
 
 #endif /*MANTID_MANTIDWIDGETS_ALGORITHMHINTSTRATEGYTEST_H */
diff --git a/MantidQt/Python/mantidqt.sip b/MantidQt/Python/mantidqt.sip
index 14a7d414739466085de9045f0ed3b604071bb77e..a68145afc7f639e6664f027bc403f97ef208b5c2 100644
--- a/MantidQt/Python/mantidqt.sip
+++ b/MantidQt/Python/mantidqt.sip
@@ -21,6 +21,14 @@
 %Import QtGui/QtGuimod.sip
 %Include qwttypes.sip
 
+%ModuleHeaderCode
+#include <MantidQtAPI/WorkspaceObserver.h>
+%End
+
+%InitialisationCode
+qRegisterMetaType<Mantid::API::Workspace_sptr>();
+qRegisterMetaType<std::string>();
+%End
 /***************************************************************************/
 /**************** Exceptions ***********************************************/
 /***************************************************************************/
diff --git a/MantidQt/RefDetectorViewer/inc/MantidQtRefDetectorViewer/RefIVConnections.h b/MantidQt/RefDetectorViewer/inc/MantidQtRefDetectorViewer/RefIVConnections.h
index dd1a37e0c5b17546de841f8717b10820b0474756..014020308f26f564b67661dc03bcc8204aae331d 100644
--- a/MantidQt/RefDetectorViewer/inc/MantidQtRefDetectorViewer/RefIVConnections.h
+++ b/MantidQt/RefDetectorViewer/inc/MantidQtRefDetectorViewer/RefIVConnections.h
@@ -10,6 +10,7 @@
 #include "MantidQtSpectrumViewer/TrackingPicker.h"
 #include "MantidQtRefDetectorViewer/RefImageDisplay.h"
 #include "MantidQtSpectrumViewer/GraphDisplay.h"
+#include "MantidQtSpectrumViewer/ColorMaps.h"
 #include "DllOption.h"
 
 /**
@@ -100,6 +101,8 @@ signals:
 
 private:
   RefIVConnections() {}
+  void setColorScale(MantidQt::SpectrumView::ColorMaps::ColorScale positive,
+                     MantidQt::SpectrumView::ColorMaps::ColorScale negative);
 
 private:
 
diff --git a/MantidQt/RefDetectorViewer/src/RefIVConnections.cpp b/MantidQt/RefDetectorViewer/src/RefIVConnections.cpp
index fede037dfe08d334af22b6e2ac84e3a69c6ce4ab..b3c3ab4f2136f4965e2075063add9ee50dcd8829 100644
--- a/MantidQt/RefDetectorViewer/src/RefIVConnections.cpp
+++ b/MantidQt/RefDetectorViewer/src/RefIVConnections.cpp
@@ -2,7 +2,6 @@
 #include <qwt_plot_canvas.h>
 
 #include "MantidQtRefDetectorViewer/RefIVConnections.h"
-#include "MantidQtSpectrumViewer/ColorMaps.h"
 
 namespace MantidQt
 {
@@ -211,11 +210,8 @@ RefIVConnections::RefIVConnections( Ui_RefImageViewer*  ui,
   m_ivUI->color_scale->setScaledContents(true);
   m_ivUI->color_scale->setMinimumHeight(15);
   m_ivUI->color_scale->setMinimumWidth(15);
-  std::vector<QRgb> positiveColorTable;
-  ColorMaps::GetColorMap( ColorMaps::HEAT, 256, positiveColorTable );
-
-  std::vector<QRgb> negativeColorTable;
-  ColorMaps::GetColorMap( ColorMaps::GRAY, 256, negativeColorTable );
+  auto positiveColorTable = ColorMaps::GetColorMap(ColorMaps::HEAT, 256);
+  auto negativeColorTable = ColorMaps::GetColorMap(ColorMaps::GRAY, 256);
 
   showColorScale( positiveColorTable, negativeColorTable );
 
@@ -445,109 +441,50 @@ void RefIVConnections::intensitySliderMoved()
 
 /* COLOUR MAP SLOTS */
 
-void RefIVConnections::heatColorScale()
-{
-  std::vector<QRgb> positiveColorTable;
-  ColorMaps::GetColorMap( ColorMaps::HEAT, 256, positiveColorTable );
-
-  std::vector<QRgb> negativeColorTable;
-  ColorMaps::GetColorMap( ColorMaps::GRAY, 256, negativeColorTable );
-
-  m_imageDisplay->setColorScales( positiveColorTable, negativeColorTable );
-  showColorScale( positiveColorTable, negativeColorTable );
+void RefIVConnections::heatColorScale() {
+  setColorScale(ColorMaps::HEAT, ColorMaps::GRAY);
 }
 
-
-void RefIVConnections::grayColorScale()
-{
-  std::vector<QRgb> positiveColorTable;
-  ColorMaps::GetColorMap( ColorMaps::GRAY, 256, positiveColorTable );
-
-  std::vector<QRgb> negativeColorTable;
-  ColorMaps::GetColorMap( ColorMaps::HEAT, 256, negativeColorTable );
-
-  m_imageDisplay->setColorScales( positiveColorTable, negativeColorTable );
-  showColorScale( positiveColorTable, negativeColorTable );
+void RefIVConnections::grayColorScale() {
+  setColorScale(ColorMaps::GRAY, ColorMaps::HEAT);
 }
 
-
-void RefIVConnections::negativeGrayColorScale()
-{
-  std::vector<QRgb> positiveColorTable;
-  ColorMaps::GetColorMap( ColorMaps::NEGATIVE_GRAY,256, positiveColorTable);
-
-  std::vector<QRgb> negativeColorTable;
-  ColorMaps::GetColorMap( ColorMaps::HEAT, 256, negativeColorTable );
-
-  m_imageDisplay->setColorScales( positiveColorTable, negativeColorTable );
-  showColorScale( positiveColorTable, negativeColorTable );
+void RefIVConnections::negativeGrayColorScale() {
+  setColorScale(ColorMaps::NEGATIVE_GRAY, ColorMaps::HEAT);
 }
 
-
-void RefIVConnections::greenYellowColorScale()
-{
-  std::vector<QRgb> positiveColorTable;
-  ColorMaps::GetColorMap( ColorMaps::GREEN_YELLOW, 256, positiveColorTable);
-
-  std::vector<QRgb> negativeColorTable;
-  ColorMaps::GetColorMap( ColorMaps::GRAY, 256, negativeColorTable );
-
-  m_imageDisplay->setColorScales( positiveColorTable, negativeColorTable );
-  showColorScale( positiveColorTable, negativeColorTable );
+void RefIVConnections::greenYellowColorScale() {
+  setColorScale(ColorMaps::GREEN_YELLOW, ColorMaps::GRAY);
 }
 
-
-void RefIVConnections::rainbowColorScale()
-{
-  std::vector<QRgb> positiveColorTable;
-  ColorMaps::GetColorMap( ColorMaps::RAINBOW, 256, positiveColorTable );
-
-  std::vector<QRgb> negativeColorTable;
-  ColorMaps::GetColorMap( ColorMaps::GRAY, 256, negativeColorTable );
-
-  m_imageDisplay->setColorScales( positiveColorTable, negativeColorTable );
-  showColorScale( positiveColorTable, negativeColorTable );
+void RefIVConnections::rainbowColorScale() {
+  setColorScale(ColorMaps::RAINBOW, ColorMaps::GRAY);
 }
 
-
-void RefIVConnections::optimalColorScale()
-{
-  std::vector<QRgb> positiveColorTable;
-  ColorMaps::GetColorMap( ColorMaps::OPTIMAL, 256, positiveColorTable );
-
-  std::vector<QRgb> negativeColorTable;
-  ColorMaps::GetColorMap( ColorMaps::GRAY, 256, negativeColorTable );
-
-  m_imageDisplay->setColorScales( positiveColorTable, negativeColorTable );
-  showColorScale( positiveColorTable, negativeColorTable );
+void RefIVConnections::optimalColorScale() {
+  setColorScale(ColorMaps::OPTIMAL, ColorMaps::GRAY);
 }
 
-
-void RefIVConnections::multiColorScale()
-{
-  std::vector<QRgb> positiveColorTable;
-  ColorMaps::GetColorMap( ColorMaps::MULTI, 256, positiveColorTable );
-
-  std::vector<QRgb> negativeColorTable;
-  ColorMaps::GetColorMap( ColorMaps::GRAY, 256, negativeColorTable );
-
-  m_imageDisplay->setColorScales( positiveColorTable, negativeColorTable );
-  showColorScale( positiveColorTable, negativeColorTable );
+void RefIVConnections::multiColorScale() {
+  setColorScale(ColorMaps::MULTI, ColorMaps::GRAY);
 }
 
-
-void RefIVConnections::spectrumColorScale()
-{
-  std::vector<QRgb> positiveColorTable;
-  ColorMaps::GetColorMap( ColorMaps::SPECTRUM, 256, positiveColorTable );
-
-  std::vector<QRgb> negativeColorTable;
-  ColorMaps::GetColorMap( ColorMaps::GRAY, 256, negativeColorTable );
-
-  m_imageDisplay->setColorScales( positiveColorTable, negativeColorTable );
-  showColorScale( positiveColorTable, negativeColorTable );
+void RefIVConnections::spectrumColorScale() {
+  setColorScale(ColorMaps::SPECTRUM, ColorMaps::GRAY);
 }
 
+/**
+ * Set the color scale to the given positive and negative scales
+ * @param positive :: [input] Color scale for positive values
+ * @param negative :: [input] Color scale for negative values
+ */
+void RefIVConnections::setColorScale(ColorMaps::ColorScale positive,
+                                     ColorMaps::ColorScale negative) {
+  auto positiveColorTable = ColorMaps::GetColorMap(positive, 256);
+  auto negativeColorTable = ColorMaps::GetColorMap(negative, 256);
+  m_imageDisplay->setColorScales(positiveColorTable, negativeColorTable);
+  showColorScale(positiveColorTable, negativeColorTable);
+}
 
 /**
  *  Set the pix map that shows the color scale from the specified positive
diff --git a/MantidQt/SliceViewer/CMakeLists.txt b/MantidQt/SliceViewer/CMakeLists.txt
index 686cb9b5b3813cb45806bb74c8083c5ad4614cc8..e2fbbf0254fd450c003a32332236d74928866dbe 100644
--- a/MantidQt/SliceViewer/CMakeLists.txt
+++ b/MantidQt/SliceViewer/CMakeLists.txt
@@ -175,8 +175,10 @@ if ( CXXTEST_FOUND )
 
   include_directories( ../../Framework/TestHelpers/inc ../../Framework/DataObjects/inc ../../Framework/Crystal/inc )
 
-  set ( TESTHELPER_SRCS ../../Framework/TestHelpers/src/WorkspaceCreationHelper.cpp 
-  ../../Framework/TestHelpers/src/ComponentCreationHelper.cpp 
+  set ( TESTHELPER_SRCS
+    ../../Framework/TestHelpers/src/InstrumentCreationHelper.cpp
+    ../../Framework/TestHelpers/src/WorkspaceCreationHelper.cpp
+    ../../Framework/TestHelpers/src/ComponentCreationHelper.cpp
   )
 
   cxxtest_add_test ( SliceViewerTest ${TEST_FILES} ${GMOCK_TEST_FILES} )
diff --git a/MantidQt/SliceViewer/src/ConcretePeaksPresenter.cpp b/MantidQt/SliceViewer/src/ConcretePeaksPresenter.cpp
index 0e5248654833674e2c4b5adfe6947b0880d8d21e..fae693f43c71d48a7bfaf8e87b8b4ec0e8f8e23f 100644
--- a/MantidQt/SliceViewer/src/ConcretePeaksPresenter.cpp
+++ b/MantidQt/SliceViewer/src/ConcretePeaksPresenter.cpp
@@ -580,7 +580,16 @@ bool ConcretePeaksPresenter::addPeakAt(double plotCoordsPointX,
   alg->initialize();
   alg->setProperty("Workspace", peaksWS);
   alg->setProperty("HKL", std::vector<double>(hkl));
-  alg->execute();
+
+
+// Execute the algorithm
+try {
+    alg->execute();
+} catch (...) {
+    g_log.warning("ConcretePeaksPresenter: Could not add the peak. Make sure "
+                  "that it is added within a valid workspace region");
+}
+
 
   // Reproduce the views. Proxy representations recreated for all peaks.
   this->produceViews();
@@ -593,6 +602,7 @@ bool ConcretePeaksPresenter::addPeakAt(double plotCoordsPointX,
   this->informOwnerUpdate();
 
   return alg->isExecuted();
+
 }
 
 bool ConcretePeaksPresenter::hasPeakAddMode() const {
diff --git a/MantidQt/SliceViewer/src/QPeaksTableModel.cpp b/MantidQt/SliceViewer/src/QPeaksTableModel.cpp
index e33322a1a5d4fddf1e59840f01ad83d89b362c9c..33707353adb809e05b3a7b2d6cfba77d897c50a8 100644
--- a/MantidQt/SliceViewer/src/QPeaksTableModel.cpp
+++ b/MantidQt/SliceViewer/src/QPeaksTableModel.cpp
@@ -343,7 +343,7 @@ namespace MantidQt
 
         // hide some columns based on the techniques
         { // shrink variable scope
-          std::set<std::string> techniques = instrInfo.techniques();
+          auto techniques = instrInfo.techniques();
           // required for showing final and delta energy
           const std::string IGS("TOF Indirect Geometry Spectroscopy");
           // required for showing initial and delta energy
diff --git a/MantidQt/SliceViewer/src/SliceViewerFunctions.cpp b/MantidQt/SliceViewer/src/SliceViewerFunctions.cpp
index 955e785521df03958ee3b2766c73a7b8cdac56ae..046c57f882ee3533b59f0e6b47a27676f27ea512 100644
--- a/MantidQt/SliceViewer/src/SliceViewerFunctions.cpp
+++ b/MantidQt/SliceViewer/src/SliceViewerFunctions.cpp
@@ -71,7 +71,7 @@ bool EXPORT_OPT_MANTIDQT_SLICEVIEWER shouldAutoScaleForNewlySetWorkspace(
 */
 bool EXPORT_OPT_MANTIDQT_SLICEVIEWER isRebinInConsistentState(
     Mantid::API::IMDWorkspace *rebinnedWS, bool useRebinMode) {
-  return (rebinnedWS != nullptr) && useRebinMode;
+  return rebinnedWS && useRebinMode;
 }
 }
 }
diff --git a/MantidQt/SpectrumViewer/inc/MantidQtSpectrumViewer/ArrayDataSource.h b/MantidQt/SpectrumViewer/inc/MantidQtSpectrumViewer/ArrayDataSource.h
index 0ce3f3a116fda77bfc0b61082182a0e9fe020033..c44ea86b298bf0c080295bbd553d5203c0e2d8b2 100644
--- a/MantidQt/SpectrumViewer/inc/MantidQtSpectrumViewer/ArrayDataSource.h
+++ b/MantidQt/SpectrumViewer/inc/MantidQtSpectrumViewer/ArrayDataSource.h
@@ -65,8 +65,7 @@ class EXPORT_OPT_MANTIDQT_SPECTRUMVIEWER ArrayDataSource: public SpectrumDataSou
                                       bool isLogX) override;
 
     /// Get a list containing pairs of strings with information about x,y
-    void getInfoList(double x, double y,
-                     std::vector<std::string> &list) override;
+    std::vector<std::string> getInfoList(double x, double y) override;
 
   private:
     std::vector<float> m_data;
diff --git a/MantidQt/SpectrumViewer/inc/MantidQtSpectrumViewer/ColorMaps.h b/MantidQt/SpectrumViewer/inc/MantidQtSpectrumViewer/ColorMaps.h
index ea1b0a596314606b3ffd1aa732611a1ca6ba69d6..b833b38c8839d35d398b4d7b8d34d50e5dc9853a 100644
--- a/MantidQt/SpectrumViewer/inc/MantidQtSpectrumViewer/ColorMaps.h
+++ b/MantidQt/SpectrumViewer/inc/MantidQtSpectrumViewer/ColorMaps.h
@@ -59,25 +59,19 @@ public:
        };
 
   /// Get the specified color scale
-  static void GetColorMap( ColorScale          name, 
-                           size_t              n_colors,
-                           std::vector<QRgb> & color_table );
+  static std::vector<QRgb> GetColorMap(ColorScale name, size_t n_colors);
 
   /// Get look up table to brighten image
-  static void GetIntensityMap( double                 control_s,
-                               size_t                 n_entries,
-                               std::vector<double>  & intensity_table );
-
-  private:
-
-    /// Fill out a color table by interpolating the given base RGB components
-    static void InterpolateColorScale( double              base_red[],
-                                       double              base_green[], 
-                                       double              base_blue[], 
-                                       size_t              n_base_colors,
-                                       size_t              n_colors,
-                                       std::vector<QRgb> & color_table );
-
+  static std::vector<double> GetIntensityMap(double control_s,
+                                             size_t n_entries);
+
+private:
+  /// Fill out a color table by interpolating the given base RGB components
+  static std::vector<QRgb> InterpolateColorScale(double base_red[],
+                                                 double base_green[],
+                                                 double base_blue[],
+                                                 size_t n_base_colors,
+                                                 size_t n_colors);
 };
 
 } // namespace SpectrumView
diff --git a/MantidQt/SpectrumViewer/inc/MantidQtSpectrumViewer/MatrixWSDataSource.h b/MantidQt/SpectrumViewer/inc/MantidQtSpectrumViewer/MatrixWSDataSource.h
index 2037dc63450b846232cdfca7c55a7ce7fb417f16..1c693a9c6c9fb98b0f0f654efe39bc539f97b2db 100644
--- a/MantidQt/SpectrumViewer/inc/MantidQtSpectrumViewer/MatrixWSDataSource.h
+++ b/MantidQt/SpectrumViewer/inc/MantidQtSpectrumViewer/MatrixWSDataSource.h
@@ -92,10 +92,7 @@ class EXPORT_OPT_MANTIDQT_SPECTRUMVIEWER MatrixWSDataSource: public SpectrumData
     void setEModeHandler( EModeHandler* emodeHandler );
 
     /// Get a list containing pairs of strings with information about x,y
-    void getInfoList( double x,
-                      double y,
-                      std::vector<std::string> &list );
-
+    std::vector<std::string> getInfoList(double x, double y) override;
 
   private:
     Mantid::API::MatrixWorkspace_const_sptr m_matWs;
diff --git a/MantidQt/SpectrumViewer/inc/MantidQtSpectrumViewer/SVConnections.h b/MantidQt/SpectrumViewer/inc/MantidQtSpectrumViewer/SVConnections.h
index 3aeaefe6eacda1019d67c2ff9d7e16345936e109..920bd279c61fb273b22af33d5209904bfdc56a49 100644
--- a/MantidQt/SpectrumViewer/inc/MantidQtSpectrumViewer/SVConnections.h
+++ b/MantidQt/SpectrumViewer/inc/MantidQtSpectrumViewer/SVConnections.h
@@ -11,6 +11,7 @@
 #include "MantidQtSpectrumViewer/SpectrumDisplay.h"
 #include "MantidQtSpectrumViewer/GraphDisplay.h"
 #include "MantidQtSpectrumViewer/DllOptionSV.h"
+#include "MantidQtSpectrumViewer/ColorMaps.h"
 
 
 /**
@@ -102,6 +103,8 @@ public slots:
 private:
   /// Event filter for mouse wheel capture
   bool eventFilter(QObject *object, QEvent *event);
+  void setColorScale(ColorMaps::ColorScale positive,
+                     ColorMaps::ColorScale negative);
 
   Ui_SpectrumViewer*  m_svUI;
   SpectrumView*       m_svMainWindow;
diff --git a/MantidQt/SpectrumViewer/inc/MantidQtSpectrumViewer/SpectrumDataSource.h b/MantidQt/SpectrumViewer/inc/MantidQtSpectrumViewer/SpectrumDataSource.h
index 12fadc0f2019516f6876a2980568c5760225cbc9..82430bd0e3e393cffe0ec6c8d3012eaa318c6000 100644
--- a/MantidQt/SpectrumViewer/inc/MantidQtSpectrumViewer/SpectrumDataSource.h
+++ b/MantidQt/SpectrumViewer/inc/MantidQtSpectrumViewer/SpectrumDataSource.h
@@ -103,9 +103,7 @@ class EXPORT_OPT_MANTIDQT_SPECTRUMVIEWER SpectrumDataSource
     virtual DataArray_const_sptr getDataArray( bool is_log_x );
 
     /// Get list of pairs of strings with info about the data at location x, y
-    virtual void getInfoList( double x,
-                              double y,
-                              std::vector<std::string> &list ) = 0;
+    virtual std::vector<std::string> getInfoList(double x, double y) = 0;
 
   protected:
     double m_totalXMin;
diff --git a/MantidQt/SpectrumViewer/src/ArrayDataSource.cpp b/MantidQt/SpectrumViewer/src/ArrayDataSource.cpp
index 30953f04ffdcde5c30572b985a691b892834a208..e17ccbc2e22ab5f4e9748d169dc6d7746fdba71c 100644
--- a/MantidQt/SpectrumViewer/src/ArrayDataSource.cpp
+++ b/MantidQt/SpectrumViewer/src/ArrayDataSource.cpp
@@ -151,16 +151,14 @@ DataArray_const_sptr ArrayDataSource::getDataArray( bool isLogX )
  *
  * @param x    The x-coordinate of the point of interest in the data.
  * @param y    The y-coordinate of the point of interest in the data.
- * @param list Vector that will be filled out with the information strings.
+ * @returns Vector filled with the information strings.
  */
-void ArrayDataSource::getInfoList( double x,
-                                   double y,
-                                   std::vector<std::string> &list )
-{
-  list.clear();
+std::vector<std::string> ArrayDataSource::getInfoList(double x, double y) {
+  std::vector<std::string> list;
 
   SVUtils::PushNameValue( "X", 8, 3, x, list );
   SVUtils::PushNameValue( "Y", 8, 3, y, list );
+  return list;
 }
 
 } // namespace SpectrumView
diff --git a/MantidQt/SpectrumViewer/src/ColorMaps.cpp b/MantidQt/SpectrumViewer/src/ColorMaps.cpp
index ccea13d4e082bcc60014d747c3f4d303d4bbc476..118038c8ebb98ac7215637b6d7b87b507b473b4d 100644
--- a/MantidQt/SpectrumViewer/src/ColorMaps.cpp
+++ b/MantidQt/SpectrumViewer/src/ColorMaps.cpp
@@ -17,88 +17,74 @@ namespace SpectrumView
  * @param n_colors     The number of colors to use when forming the
  *                     color map.  The number of colors must be at least 7
  *                     for some of the constructed color maps.
- * @param color_table  Vector of colors that will be cleard and filled out
+ * @returns :: color table vector of colors that will be filled out
  *                     with the requested color map.
  */
-void ColorMaps::GetColorMap( ColorScale          name,
-                             size_t              n_colors,
-                             std::vector<QRgb> & color_table )
-{
-  if ( name == HEAT )
-  {
-    double base_red[]    = { 40, 127, 230, 255, 255 };
-    double base_green[]  = { 20,   0, 127, 180, 255 };
-    double base_blue[]   = { 20,   0,   0,  77, 255 };
-    size_t n_base_colors = 5;
-    InterpolateColorScale( base_red, base_green, base_blue,
-                           n_base_colors, n_colors, color_table );
+std::vector<QRgb> ColorMaps::GetColorMap(ColorScale name, size_t n_colors) {
+  std::vector<double> base_red, base_green, base_blue;
+  size_t n_base_colors(0);
+  switch (name) {
+  case HEAT: {
+    base_red = {40, 127, 230, 255, 255};
+    base_green = {20, 0, 127, 180, 255};
+    base_blue = {20, 0, 0, 77, 255};
+    n_base_colors = 5;
+    break;
   }
-  else if ( name == GRAY )
-  {
-    double base_red[]   = { 30 , 255 };
-    double base_green[] = { 30 , 255 };
-    double base_blue[]  = { 30 , 255 };
-    size_t n_base_colors = 2;
-    InterpolateColorScale( base_red, base_green, base_blue,
-                           n_base_colors, n_colors, color_table );
+  case GRAY: {
+    base_red = {30, 255};
+    base_green = {30, 255};
+    base_blue = {30, 255};
+    n_base_colors = 2;
+    break;
   }
-  else if ( name == NEGATIVE_GRAY )
-  {
-    double base_red[]   = { 255, 30 };
-    double base_green[] = { 255, 30 };
-    double base_blue[]  = { 255, 30 };
-    size_t n_base_colors = 2;
-    InterpolateColorScale( base_red, base_green, base_blue,
-                           n_base_colors, n_colors, color_table );
+  case NEGATIVE_GRAY: {
+    base_red = {255, 30};
+    base_green = {255, 30};
+    base_blue = {255, 30};
+    n_base_colors = 2;
+    break;
   }
-  else if ( name == GREEN_YELLOW )
-  {
-    double base_red[]   = { 40, 255 };
-    double base_green[] = { 80, 255 };
-    double base_blue[]  = {  0,   0 };
-    size_t n_base_colors = 2;
-    InterpolateColorScale( base_red, base_green, base_blue,
-                           n_base_colors, n_colors, color_table );
+  case GREEN_YELLOW: {
+    base_red = {40, 255};
+    base_green = {80, 255};
+    base_blue = {0, 0};
+    n_base_colors = 2;
+    break;
   }
-  else if ( name == RAINBOW )
-  {
-    double base_red[]   = {  0,   0,   0, 153, 255, 255, 255 };
-    double base_green[] = {  0,   0, 255, 255, 255, 153,   0 };
-    double base_blue[]  = { 77, 204, 255,  77,   0,   0,   0 };
-    size_t n_base_colors = 7;
-    InterpolateColorScale( base_red, base_green, base_blue,
-                           n_base_colors, n_colors, color_table );
+  case RAINBOW: {
+    base_red = {0, 0, 0, 153, 255, 255, 255};
+    base_green = {0, 0, 255, 255, 255, 153, 0};
+    base_blue = {77, 204, 255, 77, 0, 0, 0};
+    n_base_colors = 7;
+    break;
   }
-  else if ( name == OPTIMAL )
-  {
-    double base_red[]   = { 30, 200, 230,  30, 255 };
-    double base_green[] = { 30,  30, 230,  30, 255 };
-    double base_blue[]  = { 30,  30,  30, 255, 255 };
-    size_t n_base_colors = 5;
-    InterpolateColorScale( base_red, base_green, base_blue,
-                           n_base_colors, n_colors, color_table );
+  case OPTIMAL: {
+    base_red = {30, 200, 230, 30, 255};
+    base_green = {30, 30, 230, 30, 255};
+    base_blue = {30, 30, 30, 255, 255};
+    n_base_colors = 5;
+    break;
   }
-  else if ( name == MULTI )
-  {
-    double base_red[]   = { 30,  30,  30, 230, 245, 255 };
-    double base_green[] = { 30,  30, 200,  30, 245, 255 };
-    double base_blue[]  = { 30, 200,  30,  30,  30, 255 };
-    size_t n_base_colors = 6;
-    InterpolateColorScale( base_red, base_green, base_blue,
-                           n_base_colors, n_colors, color_table );
+  case MULTI: {
+    base_red = {30, 30, 30, 230, 245, 255};
+    base_green = {30, 30, 200, 30, 245, 255};
+    base_blue = {30, 200, 30, 30, 30, 255};
+    n_base_colors = 6;
+    break;
   }
-  else if ( name == SPECTRUM )
-  {
-    double base_red[]   = { 100, 235,   0, 130 };
-    double base_green[] = {   0, 255, 235,   0 };
-    double base_blue[]  = {   0,   0, 255, 130 };
-    size_t n_base_colors = 4;
-    InterpolateColorScale( base_red, base_green, base_blue,
-                           n_base_colors, n_colors, color_table );
+  case SPECTRUM: {
+    base_red = {100, 235, 0, 130};
+    base_green = {0, 255, 235, 0};
+    base_blue = {0, 0, 255, 130};
+    n_base_colors = 4;
+    break;
   }
+  }
+  return InterpolateColorScale(base_red.data(), base_green.data(),
+                               base_blue.data(), n_base_colors, n_colors);
 }
 
-
 /**
  * Get an intensity lookup table to adjust the apparent brightness of a
  * displayed image.  The lookup table makes an adjustment to the image
@@ -116,14 +102,12 @@ void ColorMaps::GetColorMap( ColorScale          name,
  *                         should be quite large (10,000-100,000) to preserve
  *                         smooth color transitions even a lower intensity
  *                         values, when the control parameter is large.
- * @param intensity_table
+ * @returns :: intensity lookup table
  */
-void ColorMaps::GetIntensityMap( double                control_s,
-                                 size_t                n_entries,
-                                 std::vector<double> & intensity_table )
-{
+std::vector<double> ColorMaps::GetIntensityMap(double control_s,
+                                               size_t n_entries) {
 
-  intensity_table.clear();
+  std::vector<double> intensity_table;
   intensity_table.resize( n_entries );
                                         // restrict control range to [0,100]
   double MAX_CONTROL = 100.0;
@@ -160,38 +144,36 @@ void ColorMaps::GetIntensityMap( double                control_s,
                                            // further, but due to rounding
                                            // errors, it might exceed 1.
   }
+  return intensity_table;
 }
 
+/**
+ *  Build a color table by interpolating between a base set of colors.
+ *  The "base" color arrays must all be of the same length ( the length
+ *  being the number of base colors given.  The base color values must
+ *  be between 0 and 255.  The arrays of base colors must be of length
+ *  two or more.
+ *  The calling routine must provide red, green and blue arrays, each
+ *  of the same length (n_colors) to hold the color table being
+ *  constructed.
+ *
+ *  @param base_red       Red components of the base colors to interpolate.
+ *  @param base_green     Green components of the base colors to interpolate.
+ *  @param base_blue      Blue components of the base colors to interpolate.
+ *  @param n_base_colors  The number of key colors that will be interpolated
+ *                        form the color table.
+ *  @param n_colors       The number of colors to be created in the output
+ *                        color table.
+ *  @returns :: color table vector containing n_colors qRgb colors,
+ *                        interpolated from the specified base colors.
+ */
 
-  /**
-   *  Build a color table by interpolating between a base set of colors.
-   *  The "base" color arrays must all be of the same length ( the length
-   *  being the number of base colors given.  The base color values must
-   *  be between 0 and 255.  The arrays of base colors must be of length
-   *  two or more.
-   *  The calling routine must provide red, green and blue arrays, each
-   *  of the same length (n_colors) to hold the color table being
-   *  constructed.
-   *
-   *  @param base_red       Red components of the base colors to interpolate.
-   *  @param base_green     Green components of the base colors to interpolate.
-   *  @param base_blue      Blue components of the base colors to interpolate.
-   *  @param n_base_colors  The number of key colors that will be interpolated
-   *                        form the color table.
-   *  @param n_colors       The number of colors to be created in the output
-   *                        color table.
-   *  @param color_table    Vector containing n_colors qRgb colors,
-   *                        interpolated from the specified base colors.
-   */
-
-void ColorMaps::InterpolateColorScale( double base_red[],
-                                       double base_green[],
-                                       double base_blue[],
-                                       size_t n_base_colors,
-                                       size_t n_colors,
-                                       std::vector<QRgb> & color_table )
-{
-  color_table.clear();
+std::vector<QRgb> ColorMaps::InterpolateColorScale(double base_red[],
+                                                   double base_green[],
+                                                   double base_blue[],
+                                                   size_t n_base_colors,
+                                                   size_t n_colors) {
+  std::vector<QRgb> color_table;
   color_table.resize( n_colors );
                                       // first output color is first base color
   color_table[0] = qRgb( (unsigned char)base_red[0],
@@ -226,6 +208,7 @@ void ColorMaps::InterpolateColorScale( double base_red[],
                      (unsigned char) ( (1.0-t) * base_blue[base_index]+
                                           t    * base_blue[base_index + 1] ) );
   }
+  return color_table;
 }
 
 } // namespace SpectrumView
diff --git a/MantidQt/SpectrumViewer/src/GraphDisplay.cpp b/MantidQt/SpectrumViewer/src/GraphDisplay.cpp
index 3b3f3f25de46e91737a218ce8c00db2f5d172919..1df34fa6d7f6ff38850709846306fb7875fddb96 100644
--- a/MantidQt/SpectrumViewer/src/GraphDisplay.cpp
+++ b/MantidQt/SpectrumViewer/src/GraphDisplay.cpp
@@ -234,11 +234,11 @@ void GraphDisplay::showInfoList( double x, double y )
     {
       if ( m_isVertical )
       {
-        m_dataSource->getInfoList( m_imageX, y, info_list );
+        info_list = m_dataSource->getInfoList(m_imageX, y);
       }
       else
       {
-        m_dataSource->getInfoList( x, m_imageY, info_list );
+        info_list = m_dataSource->getInfoList(x, m_imageY);
       }
     }
     else
diff --git a/MantidQt/SpectrumViewer/src/MatrixWSDataSource.cpp b/MantidQt/SpectrumViewer/src/MatrixWSDataSource.cpp
index 766471d5b4894464f0f7557c8b55eac0fcef17f1..894333a90197ca7c2506aa84335fde70107b2909 100644
--- a/MantidQt/SpectrumViewer/src/MatrixWSDataSource.cpp
+++ b/MantidQt/SpectrumViewer/src/MatrixWSDataSource.cpp
@@ -263,14 +263,11 @@ void MatrixWSDataSource::setEModeHandler( EModeHandler* emodeHandler )
  *
  * @param x    The x-coordinate of the point of interest in the data.
  * @param y    The y-coordinate of the point of interest in the data.
- * @param list Vector that will be filled out with the information strings.
+ * @returns Vector filled out with the information strings.
  */
-void MatrixWSDataSource::getInfoList( double x,
-                                      double y,
-                                      std::vector<std::string> &list )
-{
+std::vector<std::string> MatrixWSDataSource::getInfoList(double x, double y) {
   // First get the info that is always available for any matrix workspace
-  list.clear();
+  std::vector<std::string> list;
 
   int row = (int)y;
   restrictRow( row );
@@ -288,7 +285,7 @@ void MatrixWSDataSource::getInfoList( double x,
     SVUtils::PushNameValue( x_label, 8, 3, x, list );
   }
 
-  std::set<detid_t> ids = spec->getDetectorIDs();
+  auto ids = spec->getDetectorIDs();
   if ( !ids.empty() )
   {
     list.emplace_back("Det ID");
@@ -300,7 +297,7 @@ void MatrixWSDataSource::getInfoList( double x,
   /* first make sure we can get the needed information */
   if ( !(m_instrument && m_source && m_sample) )
   {
-    return;
+    return list;
   }
 
   try
@@ -309,14 +306,14 @@ void MatrixWSDataSource::getInfoList( double x,
     if ( old_unit == 0 )
     {
       g_log.debug("No UNITS on MatrixWorkspace X-axis");
-      return;
+      return list;
     }
 
     auto det = m_matWs->getDetector( row );
     if ( det == 0 )
     {
       g_log.debug() << "No DETECTOR for row " << row << " in MatrixWorkspace" << std::endl;
-      return;
+      return list;
     }
 
     double l1        = m_source->getDistance(*m_sample);
@@ -467,6 +464,7 @@ void MatrixWSDataSource::getInfoList( double x,
   {
     g_log.debug() << "Failed to get information from Workspace:" << e.what() << std::endl;
   }
+  return list;
 }
 
 
diff --git a/MantidQt/SpectrumViewer/src/SVConnections.cpp b/MantidQt/SpectrumViewer/src/SVConnections.cpp
index 1b8ad53b73c38d814d3924926326a1d8bc4a9b84..bec961cce325b5ac994f454e1b05bc8bdc738444 100644
--- a/MantidQt/SpectrumViewer/src/SVConnections.cpp
+++ b/MantidQt/SpectrumViewer/src/SVConnections.cpp
@@ -6,7 +6,6 @@
 #include "MantidQtAPI/MantidColorMap.h"
 
 #include "MantidQtSpectrumViewer/SVConnections.h"
-#include "MantidQtSpectrumViewer/ColorMaps.h"
 
 namespace MantidQt
 {
@@ -156,11 +155,8 @@ SVConnections::SVConnections( Ui_SpectrumViewer* ui,
   m_svUI->color_scale->setScaledContents(true);
   m_svUI->color_scale->setMinimumHeight(15);
   m_svUI->color_scale->setMinimumWidth(15);
-  std::vector<QRgb> positive_color_table;
-  ColorMaps::GetColorMap( ColorMaps::HEAT, 256, positive_color_table );
-
-  std::vector<QRgb> negative_color_table;
-  ColorMaps::GetColorMap( ColorMaps::GRAY, 256, negative_color_table );
+  auto positive_color_table = ColorMaps::GetColorMap(ColorMaps::HEAT, 256);
+  auto negative_color_table = ColorMaps::GetColorMap(ColorMaps::GRAY, 256);
 
   showColorScale( positive_color_table, negative_color_table );
 
@@ -489,151 +485,78 @@ void SVConnections::intensitySliderMoved()
   }
 }
 
-
 /**
- * Set the heat color scale.
+ * Set the given color scale
+ * @param positive :: [input] positive color scale
+ * @param negative :: [input] negative color scale
  */
-void SVConnections::heatColorScale()
-{
-  std::vector<QRgb> positive_color_table;
-  ColorMaps::GetColorMap( ColorMaps::HEAT, 256, positive_color_table );
-
-  std::vector<QRgb> negative_color_table;
-  ColorMaps::GetColorMap( ColorMaps::GRAY, 256, negative_color_table );
-
-  for(auto displ = m_spectrumDisplays.begin(); displ != m_spectrumDisplays.end(); ++displ) {
-    (**displ).setColorScales( positive_color_table, negative_color_table );
+void SVConnections::setColorScale(ColorMaps::ColorScale positive,
+                                  ColorMaps::ColorScale negative) {
+  auto positiveTable = ColorMaps::GetColorMap(positive, 256);
+  auto negativeTable = ColorMaps::GetColorMap(negative, 256);
+  for (auto displ = m_spectrumDisplays.begin();
+       displ != m_spectrumDisplays.end(); ++displ) {
+    (**displ).setColorScales(positiveTable, negativeTable);
   }
-  showColorScale( positive_color_table, negative_color_table );
+  showColorScale(positiveTable, negativeTable);
 }
 
+/**
+ * Set the heat color scale.
+ */
+void SVConnections::heatColorScale() {
+  setColorScale(ColorMaps::HEAT, ColorMaps::GRAY);
+}
 
 /**
  * Set the gray color scale.
  */
-void SVConnections::grayColorScale()
-{
-  std::vector<QRgb> positive_color_table;
-  ColorMaps::GetColorMap( ColorMaps::GRAY, 256, positive_color_table );
-
-  std::vector<QRgb> negative_color_table;
-  ColorMaps::GetColorMap( ColorMaps::HEAT, 256, negative_color_table );
-
-  for(auto displ = m_spectrumDisplays.begin(); displ != m_spectrumDisplays.end(); ++displ) {
-    (**displ).setColorScales( positive_color_table, negative_color_table );
-  }
-  showColorScale( positive_color_table, negative_color_table );
+void SVConnections::grayColorScale() {
+  setColorScale(ColorMaps::GRAY, ColorMaps::HEAT);
 }
 
-
 /**
  * Set the inverse gray color scale.
  */
-void SVConnections::negativeGrayColorScale()
-{
-  std::vector<QRgb> positive_color_table;
-  ColorMaps::GetColorMap( ColorMaps::NEGATIVE_GRAY,256, positive_color_table);
-
-  std::vector<QRgb> negative_color_table;
-  ColorMaps::GetColorMap( ColorMaps::HEAT, 256, negative_color_table );
-
-  for(auto displ = m_spectrumDisplays.begin(); displ != m_spectrumDisplays.end(); ++displ) {
-    (**displ).setColorScales( positive_color_table, negative_color_table );
-  }
-  showColorScale( positive_color_table, negative_color_table );
+void SVConnections::negativeGrayColorScale() {
+  setColorScale(ColorMaps::NEGATIVE_GRAY, ColorMaps::HEAT);
 }
 
-
 /**
  * Set the green and yellow color scale.
  */
-void SVConnections::greenYellowColorScale()
-{
-  std::vector<QRgb> positive_color_table;
-  ColorMaps::GetColorMap( ColorMaps::GREEN_YELLOW, 256, positive_color_table);
-
-  std::vector<QRgb> negative_color_table;
-  ColorMaps::GetColorMap( ColorMaps::GRAY, 256, negative_color_table );
-
-  for(auto displ = m_spectrumDisplays.begin(); displ != m_spectrumDisplays.end(); ++displ) {
-    (**displ).setColorScales( positive_color_table, negative_color_table );
-  }
-  showColorScale( positive_color_table, negative_color_table );
+void SVConnections::greenYellowColorScale() {
+  setColorScale(ColorMaps::GREEN_YELLOW, ColorMaps::GRAY);
 }
 
-
 /**
  * Set the rainbow color scale.
  */
-void SVConnections::rainbowColorScale()
-{
-  std::vector<QRgb> positive_color_table;
-  ColorMaps::GetColorMap( ColorMaps::RAINBOW, 256, positive_color_table );
-
-  std::vector<QRgb> negative_color_table;
-  ColorMaps::GetColorMap( ColorMaps::GRAY, 256, negative_color_table );
-
-  for(auto displ = m_spectrumDisplays.begin(); displ != m_spectrumDisplays.end(); ++displ) {
-    (**displ).setColorScales( positive_color_table, negative_color_table );
-  }
-  showColorScale( positive_color_table, negative_color_table );
+void SVConnections::rainbowColorScale() {
+  setColorScale(ColorMaps::RAINBOW, ColorMaps::GRAY);
 }
 
-
 /**
  * Set the optimal color scale.
  */
-void SVConnections::optimalColorScale()
-{
-  std::vector<QRgb> positive_color_table;
-  ColorMaps::GetColorMap( ColorMaps::OPTIMAL, 256, positive_color_table );
-
-  std::vector<QRgb> negative_color_table;
-  ColorMaps::GetColorMap( ColorMaps::GRAY, 256, negative_color_table );
-
-  for(auto displ = m_spectrumDisplays.begin(); displ != m_spectrumDisplays.end(); ++displ) {
-    (**displ).setColorScales( positive_color_table, negative_color_table );
-  }
-  showColorScale( positive_color_table, negative_color_table );
+void SVConnections::optimalColorScale() {
+  setColorScale(ColorMaps::OPTIMAL, ColorMaps::GRAY);
 }
 
-
 /**
  * Set the multi color scale.
  */
-void SVConnections::multiColorScale()
-{
-  std::vector<QRgb> positive_color_table;
-  ColorMaps::GetColorMap( ColorMaps::MULTI, 256, positive_color_table );
-
-  std::vector<QRgb> negative_color_table;
-  ColorMaps::GetColorMap( ColorMaps::GRAY, 256, negative_color_table );
-
-  for(auto displ = m_spectrumDisplays.begin(); displ != m_spectrumDisplays.end(); ++displ) {
-    (**displ).setColorScales( positive_color_table, negative_color_table );
-  }
-  showColorScale( positive_color_table, negative_color_table );
+void SVConnections::multiColorScale() {
+  setColorScale(ColorMaps::MULTI, ColorMaps::GRAY);
 }
 
-
 /**
  * Set the spectrum color scale.
  */
-void SVConnections::spectrumColorScale()
-{
-  std::vector<QRgb> positive_color_table;
-  ColorMaps::GetColorMap( ColorMaps::SPECTRUM, 256, positive_color_table );
-
-  std::vector<QRgb> negative_color_table;
-  ColorMaps::GetColorMap( ColorMaps::GRAY, 256, negative_color_table );
-
-  for(auto displ = m_spectrumDisplays.begin(); displ != m_spectrumDisplays.end(); ++displ) {
-    (**displ).setColorScales( positive_color_table, negative_color_table );
-  }
-  showColorScale( positive_color_table, negative_color_table );
+void SVConnections::spectrumColorScale() {
+  setColorScale(ColorMaps::SPECTRUM, ColorMaps::GRAY);
 }
 
-
 /**
  * Slot to handle loading a color map from file.
  */
@@ -654,8 +577,7 @@ void SVConnections::loadColorMap()
 
   int n_colors = (int)positive_color_table.size();
 
-  std::vector<QRgb> negative_color_table;
-  ColorMaps::GetColorMap( ColorMaps::GRAY, n_colors, negative_color_table );
+  auto negative_color_table = ColorMaps::GetColorMap(ColorMaps::GRAY, n_colors);
 
   for(auto displ = m_spectrumDisplays.begin(); displ != m_spectrumDisplays.end(); ++displ) {
     (**displ).setColorScales( positive_color_table, negative_color_table );
diff --git a/MantidQt/SpectrumViewer/src/SpectrumDisplay.cpp b/MantidQt/SpectrumViewer/src/SpectrumDisplay.cpp
index 6c5482213591c42c45d914c162b516175d581d72..31970bb57724caea8a24e628396df03fcbed5cf9 100644
--- a/MantidQt/SpectrumViewer/src/SpectrumDisplay.cpp
+++ b/MantidQt/SpectrumViewer/src/SpectrumDisplay.cpp
@@ -54,12 +54,8 @@ SpectrumDisplay::SpectrumDisplay(  QwtPlot*         spectrumPlot,
   m_totalYMin(0.0), m_totalYMax(0.0),
   m_imagePicker(NULL)
 {
-  ColorMaps::GetColorMap( ColorMaps::HEAT,
-                          256,
-                          m_positiveColorTable );
-  ColorMaps::GetColorMap( ColorMaps::GRAY,
-                          256,
-                          m_negativeColorTable );
+  m_positiveColorTable = ColorMaps::GetColorMap(ColorMaps::HEAT, 256);
+  m_negativeColorTable = ColorMaps::GetColorMap(ColorMaps::GRAY, 256);
 
   m_spectrumPlotItem = new SpectrumPlotItem;
   setupSpectrumPlotItem();
@@ -380,7 +376,7 @@ void SpectrumDisplay::setColorScales( std::vector<QRgb> & positiveColorTable,
 void SpectrumDisplay::setIntensity( double controlParameter )
 {
   size_t DEFAULT_SIZE = 100000;
-  ColorMaps::GetIntensityMap( controlParameter, DEFAULT_SIZE, m_intensityTable);
+  m_intensityTable = ColorMaps::GetIntensityMap(controlParameter, DEFAULT_SIZE);
   m_spectrumPlotItem->setIntensityTable( &m_intensityTable );
   updateImage();
 }
@@ -546,8 +542,7 @@ void SpectrumDisplay::setVGraph( double x, bool isFront )
  */
 std::vector<std::string> SpectrumDisplay::showInfoList( double x, double y )
 {
-  std::vector<std::string> info_list;
-  m_dataSource->getInfoList( x, y, info_list );
+  std::vector<std::string> info_list = m_dataSource->getInfoList(x, y);
   int n_infos = (int)info_list.size() / 2;
 
   m_imageTable->setRowCount(n_infos + 1);
diff --git a/Testing/Data/DocTest/iris26176_graphite002_iqt.nxs.md5 b/Testing/Data/DocTest/iris26176_graphite002_iqt.nxs.md5
new file mode 100644
index 0000000000000000000000000000000000000000..25b4cf6fdc93abed1c8357d547d37da70bb3d35e
--- /dev/null
+++ b/Testing/Data/DocTest/iris26176_graphite002_iqt.nxs.md5
@@ -0,0 +1 @@
+7b19671db11606d64851b757636c4103
diff --git a/Testing/Data/UnitTest/iris26176_graphite002_iqt.nxs.md5 b/Testing/Data/UnitTest/iris26176_graphite002_iqt.nxs.md5
new file mode 100644
index 0000000000000000000000000000000000000000..25b4cf6fdc93abed1c8357d547d37da70bb3d35e
--- /dev/null
+++ b/Testing/Data/UnitTest/iris26176_graphite002_iqt.nxs.md5
@@ -0,0 +1 @@
+7b19671db11606d64851b757636c4103
diff --git a/Testing/SystemTests/tests/analysis/BASISAutoReduction.py b/Testing/SystemTests/tests/analysis/BASISAutoReduction.py
index 96d7cde15414977eff8d5c313750eb2255758f73..2ab786fa46e93f0fbbf2a23e6a84960c92bc64c1 100644
--- a/Testing/SystemTests/tests/analysis/BASISAutoReduction.py
+++ b/Testing/SystemTests/tests/analysis/BASISAutoReduction.py
@@ -1,4 +1,4 @@
-#pylint: disable=no-init,attribute-defined-outside-init
+#pylint: disable=no-init,attribute-defined-outside-init
 """
 System Test for BASIS autoreduction
 """
@@ -71,5 +71,5 @@ class BASISAutoReductionTest(stresstesting.MantidStressTest):
         self.disableChecking.append('Axes')
         self.disableChecking.append('SpectraMap')
         self.disableChecking.append('Instrument')
-        return 'data_ws_sqw','BASISAutoReduction.nxs'
+        return 'data_ws_sqw','BASISAutoReductionReference.nxs'
 
diff --git a/Testing/SystemTests/tests/analysis/HFIRTestsAPIv2.py b/Testing/SystemTests/tests/analysis/HFIRTestsAPIv2.py
index 81eab361aefb80608ab7023fa68c21f8eef06282..3e1e8fba0f3fbaddd4d92c3d8eef0bf60806d8ac 100644
--- a/Testing/SystemTests/tests/analysis/HFIRTestsAPIv2.py
+++ b/Testing/SystemTests/tests/analysis/HFIRTestsAPIv2.py
@@ -1,32 +1,40 @@
-#pylint: disable=invalid-name,no-init
+# pylint: disable=invalid-name,no-init,bad-builtin,attribute-defined-outside-init,protected-access,too-many-arguments
+
 """
     System tests for HFIR SANS reduction.
 
     The following tests were converted from the unittest framework
     that is part of python to the stresstesting framework used in Mantid.
 """
-import stresstesting
-from mantid.api import *
-from mantid.simpleapi import *
-from reduction_workflow.instruments.sans.hfir_command_interface import *
 import types
+
 import traceback
 import math
 import os
 
+import stresstesting
+from mantid.api import *
+from mantid.simpleapi import *
+from reduction_workflow.instruments.sans.hfir_command_interface import *
+
+
 # Set directory containing the test data, relative to the Mantid release directory.
 TEST_DIR = "."
 data_search_dirs = ConfigService.Instance()["datasearch.directories"].split(';')
 for item in data_search_dirs:
     if item.endswith("SANS2D/"):
         TEST_DIR = item
-if len(TEST_DIR)==0:
+if len(TEST_DIR) == 0:
     raise RuntimeError, "Could not locate test data directory: [...]/Data/SANS2D"
 
-def _diff_iq(x,y):
-    return x-y
-def _add(x,y):
-    return x+y
+
+def _diff_iq(x, y):
+    return x - y
+
+
+def _add(x, y):
+    return x + y
+
 
 def _read_IGOR(filepath):
     """
@@ -40,14 +48,16 @@ def _read_IGOR(filepath):
         for line in f:
             toks = line.split()
             try:
-                q    = float(toks[0])
-                iq   = float(toks[1])
-                diq  = float(toks[2])
+                q = float(toks[0])
+                iq = float(toks[1])
+                diq = float(toks[2])
                 data.append([q, iq, diq])
             except:
                 print "_read_IGOR:", sys.exc_value
+                raise
     return data
 
+
 def _check_result(ws, test_file, tolerance=1e-6):
     """
         Compare the data in two reduced data files.
@@ -60,49 +70,53 @@ def _check_result(ws, test_file, tolerance=1e-6):
     x = ws.dataX(0)[:len(ws.dataX(0))]
     y = ws.dataY(0)
     e = ws.dataE(0)
-    data_mantid = zip(x,y,e)
+    data_mantid = zip(x, y, e)
 
     # Read the test data to compare with
     data_igor = _read_IGOR(test_file)
 
     # Check length
-    if not len(data_mantid)==len(data_igor):
+    if not len(data_mantid) == len(data_igor):
         print "Incompatible data lengths"
         return False
 
     # Utility methods for manipulating the lists
-    def _diff_chi2(x,y):
-        return (x[1]-y[1])*(x[1]-y[1])/(x[2]*x[2])
-    def _diff_iq(x,y):
-        return x[1]-y[1]
-    def _diff_err(x,y):
-        return x[2]-y[2]
-    def _add(x,y):
-        return x+y
+    def _diff_chi2(x, y):
+        return (x[1] - y[1]) * (x[1] - y[1]) / (x[2] * x[2])
+
+    def _diff_iq(x, y):
+        return x[1] - y[1]
+
+    def _diff_err(x, y):
+        return x[2] - y[2]
+
+    def _add(x, y):
+        return x + y
 
     # Check that I(q) is the same for both data sets
     deltas = map(_diff_iq, data_mantid, data_igor)
-    delta  = reduce(_add, deltas)/len(deltas)
-    if math.fabs(delta)>tolerance or math.isnan(delta):
+    delta = reduce(_add, deltas) / len(deltas)
+    if math.fabs(delta) > tolerance or math.isnan(delta):
         passed = False
         print "Sum of I(q) deltas is outside tolerance: %g > %g" % (math.fabs(delta), tolerance)
 
     # Then compare the errors
     deltas = map(_diff_err, data_mantid, data_igor)
-    delta_err  = reduce(_add, deltas)/len(deltas)
-    if math.fabs(delta_err)>tolerance or math.isnan(delta):
+    delta_err = reduce(_add, deltas) / len(deltas)
+    if math.fabs(delta_err) > tolerance or math.isnan(delta):
         passed = False
         print "Sum of dI(q) deltas is outside tolerance: %g > %g" % (math.fabs(delta_err), tolerance)
 
     # Compute chi2 of our result relative to IGOR
     deltas = map(_diff_chi2, data_mantid, data_igor)
-    chi2  = reduce(_add, deltas)/len(data_igor)
-    if chi2>10.0*tolerance or math.isnan(delta):
-        passed= False
-        print "Chi2 is outside tolerance: %g > %g" % (chi2, 10.0*tolerance)
+    chi2 = reduce(_add, deltas) / len(data_igor)
+    if chi2 > 10.0 * tolerance or math.isnan(delta):
+        passed = False
+        print "Chi2 is outside tolerance: %g > %g" % (chi2, 10.0 * tolerance)
 
     return passed
 
+
 def do_cleanup():
     Files = ["GPSANS_reduction.log",
              "BioSANS_exp61_scan0004_0001_Iq.txt",
@@ -123,8 +137,8 @@ def do_cleanup():
             os.remove(absfile)
     return True
 
-class HFIRTestsAPIv2(stresstesting.MantidStressTest):
 
+class HFIRTestsAPIv2(stresstesting.MantidStressTest):
     def cleanup(self):
         do_cleanup()
         return True
@@ -167,6 +181,7 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest):
                     return self._test_method()
                 except:
                     print traceback.format_exc()
+                    raise
                 return False
 
         self.all_passed = True
@@ -175,12 +190,12 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest):
         self.failed_tests = []
         for current_item in dir(self):
             m = getattr(self, current_item)
-            if current_item.startswith("test_") and type(m)==types.MethodType:
+            if current_item.startswith("test_") and type(m) == types.MethodType:
                 self.n_tests += 1
                 t = TestStub(m)
                 result = t.run_test()
                 self._cleanup()
-                if result is None or result==True:
+                if result is None or result == True:
                     self.n_passed += 1
                 else:
                     self.failed_tests.append(current_item)
@@ -188,7 +203,7 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest):
 
     def test_data_path(self):
         self.assertEqual(ReductionSingleton()._data_path, '.')
-        #any path that definitely exists on a computer with Mantid installed
+        # any path that definitely exists on a computer with Mantid installed
         test_path = os.path.normcase(ConfigService.Instance()['instrumentDefinition.directory'])
         DataPath(test_path)
         self.assertEqual(ReductionSingleton()._data_path, test_path)
@@ -298,7 +313,7 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest):
         self.assertEqual(sdd, 6000.0)
 
         ws = AnalysisDataService.retrieve("BioSANS_test_data_Iq")
-        self.assertTrue(_check_result(ws, TEST_DIR+"reduced_center_calculated.txt", tolerance=1e-4))
+        self.assertTrue(_check_result(ws, TEST_DIR + "reduced_center_calculated.txt", tolerance=1e-4))
 
     def test_reduction_1(self):
         GPSANS()
@@ -311,20 +326,25 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest):
 
         ws = AnalysisDataService.retrieve("BioSANS_test_data_Iq")
         data = ws.dataY(0)
-        check = [0.19472,0.204269,0.215354,0.230114,0.238961,0.237201,0.247843,0.248424,0.253676,0.254327,
-                 0.254366,0.252931,0.258339,0.259297,0.257155,0.254059,0.252383,0.252826,0.256604,0.256754,
-                 0.255592,0.256813,0.248569,0.25331,0.251032,0.246424,0.249477,0.250939,0.251959,0.24925,0.250372,
-                 0.246148,0.250478,0.244621,0.247428,0.246431,0.245041,0.241647,0.24307,0.240096,0.242797,0.238182,
-                 0.237548,0.239789,0.241477,0.23456,0.237372,0.233715,0.233789,0.232262,0.231589,0.230986,0.231646,
-                 0.231331,0.230484,0.2277,0.226819,0.224341,0.227239,0.223228,0.221232,0.222011,0.224747,0.219533,
-                 0.216973,0.218734,0.21668,0.218366,0.214926,0.213985,0.214469,0.210473,0.209867,0.209066,
-                 0.208965,0.207498,0.204505,0.205786,0.202186,0.200442,0.200485,0.200554,0.200499,0.198152,0.193945,
-                 0.192082,0.193783,0.193787,0.190557,0.190471,0.186827,0.190088,0.188204,0.187547,0.182206,
-                 0.181384,0.180358,0.182663,0.178844,0.176556]
+        check = [0.19472, 0.204269, 0.215354, 0.230114, 0.238961, 0.237201, 0.247843, 0.248424, 0.253676, 0.254327,
+                 0.254366, 0.252931, 0.258339, 0.259297, 0.257155, 0.254059, 0.252383, 0.252826, 0.256604, 0.256754,
+                 0.255592, 0.256813, 0.248569, 0.25331, 0.251032, 0.246424, 0.249477, 0.250939, 0.251959, 0.24925,
+                 0.250372,
+                 0.246148, 0.250478, 0.244621, 0.247428, 0.246431, 0.245041, 0.241647, 0.24307, 0.240096, 0.242797,
+                 0.238182,
+                 0.237548, 0.239789, 0.241477, 0.23456, 0.237372, 0.233715, 0.233789, 0.232262, 0.231589, 0.230986,
+                 0.231646,
+                 0.231331, 0.230484, 0.2277, 0.226819, 0.224341, 0.227239, 0.223228, 0.221232, 0.222011, 0.224747,
+                 0.219533,
+                 0.216973, 0.218734, 0.21668, 0.218366, 0.214926, 0.213985, 0.214469, 0.210473, 0.209867, 0.209066,
+                 0.208965, 0.207498, 0.204505, 0.205786, 0.202186, 0.200442, 0.200485, 0.200554, 0.200499, 0.198152,
+                 0.193945,
+                 0.192082, 0.193783, 0.193787, 0.190557, 0.190471, 0.186827, 0.190088, 0.188204, 0.187547, 0.182206,
+                 0.181384, 0.180358, 0.182663, 0.178844, 0.176556]
 
         deltas = map(_diff_iq, data, check)
-        delta  = reduce(_add, deltas)/len(deltas)
-        self.assertTrue(math.fabs(delta)<0.00001)
+        delta = reduce(_add, deltas) / len(deltas)
+        self.assertTrue(math.fabs(delta) < 0.00001)
 
     def test_no_solid_angle(self):
         GPSANS()
@@ -353,31 +373,31 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest):
 
         ws = AnalysisDataService.retrieve("BioSANS_test_data_Iq")
         data = ws.dataY(0)
-        check = [0.268942,0.272052,0.269806,0.27129,0.273852,
-                 0.271301,0.271732,0.271103,0.270996,0.269677,
-                 0.27098,0.266802,0.26789,0.268222,0.266125,
-                 0.262736,0.262752,0.263827,0.26315,0.262775,
-                 0.261541,0.260818,0.258955,0.257675,0.255908,
-                 0.254088,0.256778,0.256883,0.253568,0.25636,
-                 0.252323,0.251833,0.251914,0.252298,0.249375,
-                 0.247718,0.247768,0.244636,0.245604,0.243996,
-                 0.244332,0.244363,0.242985,0.242234,0.241118,
-                 0.241411,0.24084,0.239293,0.2392,0.236565,
-                 0.234557,0.233974,0.232905,0.231898,0.231085,
-                 0.229586,0.22862,0.227001,0.226783,0.225837,
-                 0.224835,0.223807,0.222296,0.221557,0.220464,
-                 0.219139,0.217611,0.217049,0.21606,0.215739,
-                 0.216233,0.213467,0.213141,0.213275,0.219695,
-                 0.216121,0.215502,0.21792,0.209364,0.209368,
-                 0.2064,0.205844,0.20431,0.203443,0.202442,
-                 0.200195,0.199408,0.19853,0.195654,
-                 0.195514,0.193086,0.193388,0.19137,
-                 0.190122,0.189119,0.18864,0.185473,
-                 0.184958,0.183981,0.182581]
+        check = [0.268942, 0.272052, 0.269806, 0.27129, 0.273852,
+                 0.271301, 0.271732, 0.271103, 0.270996, 0.269677,
+                 0.27098, 0.266802, 0.26789, 0.268222, 0.266125,
+                 0.262736, 0.262752, 0.263827, 0.26315, 0.262775,
+                 0.261541, 0.260818, 0.258955, 0.257675, 0.255908,
+                 0.254088, 0.256778, 0.256883, 0.253568, 0.25636,
+                 0.252323, 0.251833, 0.251914, 0.252298, 0.249375,
+                 0.247718, 0.247768, 0.244636, 0.245604, 0.243996,
+                 0.244332, 0.244363, 0.242985, 0.242234, 0.241118,
+                 0.241411, 0.24084, 0.239293, 0.2392, 0.236565,
+                 0.234557, 0.233974, 0.232905, 0.231898, 0.231085,
+                 0.229586, 0.22862, 0.227001, 0.226783, 0.225837,
+                 0.224835, 0.223807, 0.222296, 0.221557, 0.220464,
+                 0.219139, 0.217611, 0.217049, 0.21606, 0.215739,
+                 0.216233, 0.213467, 0.213141, 0.213275, 0.219695,
+                 0.216121, 0.215502, 0.21792, 0.209364, 0.209368,
+                 0.2064, 0.205844, 0.20431, 0.203443, 0.202442,
+                 0.200195, 0.199408, 0.19853, 0.195654,
+                 0.195514, 0.193086, 0.193388, 0.19137,
+                 0.190122, 0.189119, 0.18864, 0.185473,
+                 0.184958, 0.183981, 0.182581]
 
         deltas = map(_diff_iq, data, check)
-        delta  = reduce(_add, deltas)/len(deltas)
-        self.assertTrue(math.fabs(delta)<0.00001)
+        delta = reduce(_add, deltas) / len(deltas)
+        self.assertTrue(math.fabs(delta) < 0.00001)
 
     def test_straight_Q1D(self):
         GPSANS()
@@ -389,27 +409,27 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest):
 
         ws = AnalysisDataService.retrieve("BioSANS_test_data_Iq")
         data = ws.dataY(0)
-        check = [0.269037,0.272176,0.269917,0.271416,0.273988,0.271432,
-                 0.271857,0.271232,0.271118,0.269797,0.271095,0.266912,
-                 0.268015,0.268356,0.266256,0.26287,0.262888,0.263964,
-                 0.263281,0.262905,0.261669,0.26094,0.259081,0.257802,
-                 0.256029,0.254228,0.256913,0.257021,0.253692,0.256491,
-                 0.252454,0.251969,0.25204,0.252423,0.249516,0.247844,
-                 0.247895,0.24476,0.245734,0.244125,0.244474,0.244491,
-                 0.243126,0.242359,0.241239,0.24154,0.240976,0.239421,
-                 0.23933,0.236688,0.234685,0.234105,0.233034,0.232036,
-                 0.231208,0.229714,0.228749,0.227122,0.226918,0.225969,
-                 0.22497,0.223933,0.222426,0.221684,0.2206,0.219277,
-                 0.217739,0.217173,0.216193,0.215869,0.216354,0.213597,
-                 0.213271,0.213407,0.219829,0.216259,0.215635,0.218058,
-                 0.209499,0.209503,0.206529,0.205981,0.20445,0.203577,
-                 0.202577,0.200334,0.199544,0.198663,0.195786,
-                 0.195653,0.19322,0.193537,0.191503,0.190253,
-                 0.189253,0.188771,0.1856,0.185099,0.184111,0.182717]
+        check = [0.269037, 0.272176, 0.269917, 0.271416, 0.273988, 0.271432,
+                 0.271857, 0.271232, 0.271118, 0.269797, 0.271095, 0.266912,
+                 0.268015, 0.268356, 0.266256, 0.26287, 0.262888, 0.263964,
+                 0.263281, 0.262905, 0.261669, 0.26094, 0.259081, 0.257802,
+                 0.256029, 0.254228, 0.256913, 0.257021, 0.253692, 0.256491,
+                 0.252454, 0.251969, 0.25204, 0.252423, 0.249516, 0.247844,
+                 0.247895, 0.24476, 0.245734, 0.244125, 0.244474, 0.244491,
+                 0.243126, 0.242359, 0.241239, 0.24154, 0.240976, 0.239421,
+                 0.23933, 0.236688, 0.234685, 0.234105, 0.233034, 0.232036,
+                 0.231208, 0.229714, 0.228749, 0.227122, 0.226918, 0.225969,
+                 0.22497, 0.223933, 0.222426, 0.221684, 0.2206, 0.219277,
+                 0.217739, 0.217173, 0.216193, 0.215869, 0.216354, 0.213597,
+                 0.213271, 0.213407, 0.219829, 0.216259, 0.215635, 0.218058,
+                 0.209499, 0.209503, 0.206529, 0.205981, 0.20445, 0.203577,
+                 0.202577, 0.200334, 0.199544, 0.198663, 0.195786,
+                 0.195653, 0.19322, 0.193537, 0.191503, 0.190253,
+                 0.189253, 0.188771, 0.1856, 0.185099, 0.184111, 0.182717]
 
         deltas = map(_diff_iq, data, check)
-        delta  = reduce(_add, deltas)/len(deltas)
-        self.assertTrue(math.fabs(delta)<0.00001)
+        delta = reduce(_add, deltas) / len(deltas)
+        self.assertTrue(math.fabs(delta) < 0.00001)
 
     def test_transmission(self):
         GPSANS()
@@ -424,27 +444,27 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest):
 
         ws = AnalysisDataService.retrieve("BioSANS_test_data_Iq")
         data = ws.dataY(0)
-        check = [0.514758,0.520759,0.516451,0.51932,0.524206,0.519275,
-                 0.520125,0.518997,0.518729,0.516198,0.518718,0.51072,
-                 0.512816,0.513449,0.509453,0.502968,0.503003,0.505098,
-                 0.503835,0.503088,0.500716,0.499304,0.495777,0.49332,
-                 0.489926,0.486497,0.491656,0.491858,0.48546,0.490808,
-                 0.483111,0.482176,0.482359,0.483098,0.477528,0.474279,
-                 0.474485,0.468472,0.470305,0.467228,0.467934,0.467971,
-                 0.465358,0.463885,0.461762,0.462352,0.461285,0.458322,
-                 0.458118,0.453064,0.44927,0.448151,0.446129,0.444207,
-                 0.442629,0.439792,0.437958,0.434826,0.434443,0.432655,
-                 0.430731,0.428771,0.425893,0.424477,0.422421,0.419886,
-                 0.416942,0.415876,0.414037,0.41339,0.414353,0.409062,
-                 0.408431,0.408712,0.419282,0.412833,0.41062,0.414427,
-                 0.400056,0.400141,0.394724,0.393821,0.390721,0.38932,
-                 0.387497,0.383062,0.381603,0.380016,0.374635,0.374214,
-                 0.369733,0.370353,0.366464,0.364109,0.362184,0.361299,
-                 0.355246,0.354339,0.352412,0.349748]
+        check = [0.514758, 0.520759, 0.516451, 0.51932, 0.524206, 0.519275,
+                 0.520125, 0.518997, 0.518729, 0.516198, 0.518718, 0.51072,
+                 0.512816, 0.513449, 0.509453, 0.502968, 0.503003, 0.505098,
+                 0.503835, 0.503088, 0.500716, 0.499304, 0.495777, 0.49332,
+                 0.489926, 0.486497, 0.491656, 0.491858, 0.48546, 0.490808,
+                 0.483111, 0.482176, 0.482359, 0.483098, 0.477528, 0.474279,
+                 0.474485, 0.468472, 0.470305, 0.467228, 0.467934, 0.467971,
+                 0.465358, 0.463885, 0.461762, 0.462352, 0.461285, 0.458322,
+                 0.458118, 0.453064, 0.44927, 0.448151, 0.446129, 0.444207,
+                 0.442629, 0.439792, 0.437958, 0.434826, 0.434443, 0.432655,
+                 0.430731, 0.428771, 0.425893, 0.424477, 0.422421, 0.419886,
+                 0.416942, 0.415876, 0.414037, 0.41339, 0.414353, 0.409062,
+                 0.408431, 0.408712, 0.419282, 0.412833, 0.41062, 0.414427,
+                 0.400056, 0.400141, 0.394724, 0.393821, 0.390721, 0.38932,
+                 0.387497, 0.383062, 0.381603, 0.380016, 0.374635, 0.374214,
+                 0.369733, 0.370353, 0.366464, 0.364109, 0.362184, 0.361299,
+                 0.355246, 0.354339, 0.352412, 0.349748]
 
         deltas = map(_diff_iq, data, check)
-        delta  = reduce(_add, deltas)/len(deltas)
-        self.assertTrue(math.fabs(delta)<0.001)
+        delta = reduce(_add, deltas) / len(deltas)
+        self.assertTrue(math.fabs(delta) < 0.001)
 
     def test_spreader_transmission(self):
         GPSANS()
@@ -475,10 +495,10 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest):
         Reduce1D()
 
         property_manager = PropertyManagerDataService.retrieve(ReductionSingleton().get_reduction_table_name())
-        p=property_manager.getProperty("TransmissionAlgorithm")
+        _p = property_manager.getProperty("TransmissionAlgorithm")
 
         ws = AnalysisDataService.retrieve("BioSANS_test_data_Iq")
-        self.assertTrue(_check_result(ws, TEST_DIR+"reduced_transmission.txt", 0.0001))
+        self.assertTrue(_check_result(ws, TEST_DIR + "reduced_transmission.txt", 0.0001))
 
     def test_center_by_hand(self):
         GPSANS()
@@ -491,7 +511,7 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest):
         Reduce1D()
 
         ws = AnalysisDataService.retrieve("BioSANS_test_data_Iq")
-        self.assertTrue(_check_result(ws, TEST_DIR+"reduced_center_by_hand.txt", 0.0001))
+        self.assertTrue(_check_result(ws, TEST_DIR + "reduced_center_by_hand.txt", 0.0001))
 
     def test_background(self):
         GPSANS()
@@ -506,9 +526,9 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest):
 
         ws = AnalysisDataService.retrieve("BioSANS_test_data_Iq")
         data = ws.dataY(0)
-        self.assertAlmostEqual(data[0], 0.0,10)
-        self.assertAlmostEqual(data[10], 0.0,10)
-        self.assertAlmostEqual(data[20], 0.0,10)
+        self.assertAlmostEqual(data[0], 0.0, 10)
+        self.assertAlmostEqual(data[10], 0.0, 10)
+        self.assertAlmostEqual(data[20], 0.0, 10)
 
     def test_background_multiple_files(self):
         """
@@ -528,9 +548,9 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest):
 
         ws = AnalysisDataService.retrieve("BioSANS_test_data_Iq")
         data = ws.dataY(0)
-        self.assertAlmostEqual(data[0], 0.0,10)
-        self.assertAlmostEqual(data[10], 0.0,10)
-        self.assertAlmostEqual(data[20], 0.0,10)
+        self.assertAlmostEqual(data[0], 0.0, 10)
+        self.assertAlmostEqual(data[10], 0.0, 10)
+        self.assertAlmostEqual(data[20], 0.0, 10)
 
     def test_bck_w_transmission(self):
         GPSANS()
@@ -540,16 +560,16 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest):
         SensitivityCorrection("BioSANS_flood_data.xml", dark_current="BioSANS_dark_current.xml")
         DarkCurrent("BioSANS_dark_current.xml")
         Background("BioSANS_test_data.xml")
-        SetTransmission(0.6,0.1)
-        SetBckTransmission(0.6,0.1)
+        SetTransmission(0.6, 0.1)
+        SetBckTransmission(0.6, 0.1)
         AzimuthalAverage(binning="0.01,0.001,0.11", error_weighting=True)
         Reduce1D()
 
         ws = AnalysisDataService.retrieve("test_data_Iq")
         data = ws.dataY(0)
-        self.assertAlmostEqual(data[0], 0.0,10)
-        self.assertAlmostEqual(data[10], 0.0,10)
-        self.assertAlmostEqual(data[20], 0.0,10)
+        self.assertAlmostEqual(data[0], 0.0, 10)
+        self.assertAlmostEqual(data[10], 0.0, 10)
+        self.assertAlmostEqual(data[20], 0.0, 10)
 
     def test_transmission_by_hand_w_sensitivity(self):
         GPSANS()
@@ -563,33 +583,33 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest):
 
         ws = AnalysisDataService.retrieve("BioSANS_test_data_Iq")
         data = ws.dataY(0)
-        check = [0.374914,0.393394,0.414756,0.443152,0.460175,0.456802,
-                 0.477264,0.478456,0.488523,0.489758,0.489871,0.487127,
-                 0.497585,0.499346,0.49526,0.489273,0.486082,0.486923,
-                 0.494208,0.494531,0.492264,0.494608,0.478766,0.487872,
-                 0.48357,0.474654,0.48052,0.483367,0.485269,0.480079,
-                 0.482254,0.47413,0.48245,0.471207,0.476589,0.474701,
-                 0.472014,0.465479,0.468236,0.462524,0.46773,0.458851,
-                 0.457653,0.461929,0.465216,0.451887,0.45733,0.450281,
-                 0.45045,0.447508,0.446209,0.445063,0.446328,0.445735,
-                 0.444096,0.438758,0.43707,0.432302,0.437903,0.430176,
-                 0.426317,0.427858,0.433131,0.423087,0.418146,0.421584,
-                 0.417606,0.420891,0.414255,0.412448,0.413393,0.405706,
-                 0.404541,0.403016,0.402806,0.400023,0.394248,0.396725,
-                 0.389808,0.386475,0.386525,0.386674,0.386575,0.382081,
-                 0.373986,0.370391,0.37367,0.373686,0.367479,0.36732,
-                 0.36031,0.366588,0.362994,0.361712,0.351433,0.349867,
-                 0.3479,0.352355,0.344987,0.340605]
+        check = [0.374914, 0.393394, 0.414756, 0.443152, 0.460175, 0.456802,
+                 0.477264, 0.478456, 0.488523, 0.489758, 0.489871, 0.487127,
+                 0.497585, 0.499346, 0.49526, 0.489273, 0.486082, 0.486923,
+                 0.494208, 0.494531, 0.492264, 0.494608, 0.478766, 0.487872,
+                 0.48357, 0.474654, 0.48052, 0.483367, 0.485269, 0.480079,
+                 0.482254, 0.47413, 0.48245, 0.471207, 0.476589, 0.474701,
+                 0.472014, 0.465479, 0.468236, 0.462524, 0.46773, 0.458851,
+                 0.457653, 0.461929, 0.465216, 0.451887, 0.45733, 0.450281,
+                 0.45045, 0.447508, 0.446209, 0.445063, 0.446328, 0.445735,
+                 0.444096, 0.438758, 0.43707, 0.432302, 0.437903, 0.430176,
+                 0.426317, 0.427858, 0.433131, 0.423087, 0.418146, 0.421584,
+                 0.417606, 0.420891, 0.414255, 0.412448, 0.413393, 0.405706,
+                 0.404541, 0.403016, 0.402806, 0.400023, 0.394248, 0.396725,
+                 0.389808, 0.386475, 0.386525, 0.386674, 0.386575, 0.382081,
+                 0.373986, 0.370391, 0.37367, 0.373686, 0.367479, 0.36732,
+                 0.36031, 0.366588, 0.362994, 0.361712, 0.351433, 0.349867,
+                 0.3479, 0.352355, 0.344987, 0.340605]
 
         # Check that I(q) is the same for both data sets
         deltas = map(_diff_iq, data, check)
-        delta  = reduce(_add, deltas)/len(deltas)
-        self.assertTrue(math.fabs(delta)<0.00001)
+        delta = reduce(_add, deltas) / len(deltas)
+        self.assertTrue(math.fabs(delta) < 0.00001)
 
     def test_SampleGeometry_functions(self):
         print "SKIPPING test_SampleGeometry_functions()"
         return
-        #pylint: disable=unreachable
+        # pylint: disable=unreachable
         GPSANS()
         DataPath(TEST_DIR)
         AppendDataFile("BioSANS_test_data.xml")
@@ -606,38 +626,38 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest):
         ws = AnalysisDataService.retrieve("BioSANS_test_data")
         data = [ws.dataY(0)[0], ws.dataY(1)[0], ws.dataY(2)[0], ws.dataY(3)[0], ws.dataY(4)[0], ws.dataY(5)[0]]
 
-        check = [500091.0,60.0,40.8333,13.6333, 13.4667,13.6667]
-                # Check that I(q) is the same for both data sets
+        check = [500091.0, 60.0, 40.8333, 13.6333, 13.4667, 13.6667]
+        # Check that I(q) is the same for both data sets
         deltas = map(_diff_iq, data, check)
-        delta  = reduce(_add, deltas)/len(deltas)
-        self.assertTrue(math.fabs(delta)<0.1)
+        delta = reduce(_add, deltas) / len(deltas)
+        self.assertTrue(math.fabs(delta) < 0.1)
 
     def test_noDC_eff_with_DC(self):
-        ref = [28.06525, 136.94662, -16.20412,   0.00000, 147.79915, 146.42713, 302.00869,
-               0.00000,   0.00000,-1869.20724,-2190.89681,-1892.14939,-2140.79608,-1980.60037,
-               -2096.75974,-2221.30118,-2263.51541,-2264.89989,-2364.83528,
-               -2420.58152,-2444.51906,-2418.28886,-2606.16991,-2556.93660,
-               -2623.71380,-2547.79671,-2670.60962,-2714.35237,-2717.01692,
-               -2730.84974,-2768.92925,-2753.96396,-2732.66316,-2795.89687,
-               -2780.37320,-2755.38910,-2814.88120,-2830.74081,-2803.42030,
-               -2815.33244,-2754.70444,-2718.55136,-2740.03811,-2754.60415,
-               -2815.96387,-2754.62039,-2781.54596,-2765.26282,-2676.04665,
-               -2762.33751,-2722.94832,-2707.74990,-2730.50371,-2721.71272,
-               -2682.02439,-2703.36446,-2679.47677,-2658.57573,-2669.41871,
-               -2618.90655,-2638.41601,-2614.69128,-2583.29713,-2589.39730,
-               -2567.19209,-2535.09328,-2539.43296,-2489.60117,-2500.76844,
-               -2456.22248,-2444.13734,-2392.68589,-2410.98591,-2348.68064,
-               -2334.84651,-2310.41426,-2250.24085,-2220.02192,-2184.65990,
-               -2154.19638,-2099.56797,-2058.51585,-2004.05601,-1966.52356,
-               -1910.47283,-1876.72098,-1817.69045,-1768.62167,-1721.56444,
-               -1666.47199,-1608.86707,-1544.26178,-1492.78389,-1438.69256,
-               -1358.60437,-1299.34476,-1221.57010,-1080.69421,-609.77891, -77.72765]
+        ref = [28.06525, 136.94662, -16.20412, 0.00000, 147.79915, 146.42713, 302.00869,
+               0.00000, 0.00000, -1869.20724, -2190.89681, -1892.14939, -2140.79608, -1980.60037,
+               -2096.75974, -2221.30118, -2263.51541, -2264.89989, -2364.83528,
+               -2420.58152, -2444.51906, -2418.28886, -2606.16991, -2556.93660,
+               -2623.71380, -2547.79671, -2670.60962, -2714.35237, -2717.01692,
+               -2730.84974, -2768.92925, -2753.96396, -2732.66316, -2795.89687,
+               -2780.37320, -2755.38910, -2814.88120, -2830.74081, -2803.42030,
+               -2815.33244, -2754.70444, -2718.55136, -2740.03811, -2754.60415,
+               -2815.96387, -2754.62039, -2781.54596, -2765.26282, -2676.04665,
+               -2762.33751, -2722.94832, -2707.74990, -2730.50371, -2721.71272,
+               -2682.02439, -2703.36446, -2679.47677, -2658.57573, -2669.41871,
+               -2618.90655, -2638.41601, -2614.69128, -2583.29713, -2589.39730,
+               -2567.19209, -2535.09328, -2539.43296, -2489.60117, -2500.76844,
+               -2456.22248, -2444.13734, -2392.68589, -2410.98591, -2348.68064,
+               -2334.84651, -2310.41426, -2250.24085, -2220.02192, -2184.65990,
+               -2154.19638, -2099.56797, -2058.51585, -2004.05601, -1966.52356,
+               -1910.47283, -1876.72098, -1817.69045, -1768.62167, -1721.56444,
+               -1666.47199, -1608.86707, -1544.26178, -1492.78389, -1438.69256,
+               -1358.60437, -1299.34476, -1221.57010, -1080.69421, -609.77891, -77.72765]
         BIOSANS()
         SetSampleDetectorOffset(837.9)
-        #SolidAngle() # name clash with SolidAngle algorithm
+        # SolidAngle() # name clash with SolidAngle algorithm
         MonitorNormalization()
         AzimuthalAverage(n_bins=100, n_subpix=1, log_binning=True)
-        #IQxQy(nbins=100)
+        # IQxQy(nbins=100)
         DirectBeamCenter("BioSANS_empty_cell.xml")
         SensitivityCorrection('BioSANS_flood_data.xml', min_sensitivity=0.5, max_sensitivity=1.5,
                               dark_current='BioSANS_empty_trans.xml', use_sample_dc=False)
@@ -659,29 +679,29 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest):
                                     msg="result point %d: %g, found %g" % (i, ref[i], res[i]))
 
     def test_DC_eff_with_DC(self):
-        ref = [28.0476,136.906,-16.3079,0,147.757,146.403,301.982,
-               0,0,-1869.21,-2190.93,-1892.16,-2140.81,-1980.62,-2096.79,
-               -2221.34,-2263.55,-2264.93,-2364.87,-2420.61,-2444.56,
-               -2418.32,-2606.21,-2556.98,-2623.75,-2547.84,-2670.66,
-               -2714.39,-2717.06,-2730.89,-2768.96,-2754.01,-2732.7,
-               -2795.93,-2780.41,-2755.42,-2814.92,-2830.79,-2803.46,
-               -2815.38,-2754.75,-2718.6,-2740.08,-2754.65,-2816.01,
-               -2754.66,-2781.59,-2765.3,-2676.09,-2762.38,-2722.99,
-               -2707.8,-2730.55,-2721.76,-2682.07,-2703.41,-2679.52,
-               -2658.62,-2669.46,-2618.95,-2638.46,-2614.74,-2583.34,
-               -2589.44,-2567.23,-2535.14,-2539.48,-2489.64,-2500.81,
-               -2456.26,-2444.18,-2392.73,-2411.03,-2348.73,-2334.89,
-               -2310.46,-2250.28,-2220.07,-2184.7,-2154.24,-2099.61,
-               -2058.56,-2004.1,-1966.57,-1910.52,-1876.76,-1817.73,
-               -1768.67,-1721.61,-1666.51,-1608.91,-1544.31,
-               -1492.83,-1438.74,-1358.65,-1299.39,-1221.61,-1080.73,-609.821,-77.7712]
+        ref = [28.0476, 136.906, -16.3079, 0, 147.757, 146.403, 301.982,
+               0, 0, -1869.21, -2190.93, -1892.16, -2140.81, -1980.62, -2096.79,
+               -2221.34, -2263.55, -2264.93, -2364.87, -2420.61, -2444.56,
+               -2418.32, -2606.21, -2556.98, -2623.75, -2547.84, -2670.66,
+               -2714.39, -2717.06, -2730.89, -2768.96, -2754.01, -2732.7,
+               -2795.93, -2780.41, -2755.42, -2814.92, -2830.79, -2803.46,
+               -2815.38, -2754.75, -2718.6, -2740.08, -2754.65, -2816.01,
+               -2754.66, -2781.59, -2765.3, -2676.09, -2762.38, -2722.99,
+               -2707.8, -2730.55, -2721.76, -2682.07, -2703.41, -2679.52,
+               -2658.62, -2669.46, -2618.95, -2638.46, -2614.74, -2583.34,
+               -2589.44, -2567.23, -2535.14, -2539.48, -2489.64, -2500.81,
+               -2456.26, -2444.18, -2392.73, -2411.03, -2348.73, -2334.89,
+               -2310.46, -2250.28, -2220.07, -2184.7, -2154.24, -2099.61,
+               -2058.56, -2004.1, -1966.57, -1910.52, -1876.76, -1817.73,
+               -1768.67, -1721.61, -1666.51, -1608.91, -1544.31,
+               -1492.83, -1438.74, -1358.65, -1299.39, -1221.61, -1080.73, -609.821, -77.7712]
         BIOSANS()
         SetSampleDetectorOffset(837.9)
-        #SolidAngle()
+        # SolidAngle()
         DarkCurrent("BioSANS_dark_current.xml")
         MonitorNormalization()
         AzimuthalAverage(n_bins=100, n_subpix=1, log_binning=True)
-        #IQxQy(nbins=100)
+        # IQxQy(nbins=100)
         DirectBeamCenter("BioSANS_empty_cell.xml")
         SensitivityCorrection('BioSANS_flood_data.xml', min_sensitivity=0.5,
                               max_sensitivity=1.5, dark_current='BioSANS_empty_trans.xml', use_sample_dc=False)
@@ -703,27 +723,27 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest):
                                     msg="result point %d: %g, found %g" % (i, ref[i], res[i]))
 
     def test_DC_eff_noDC(self):
-        ref = [10.4139,124.814,25.0443,0,38.3413,133.417,0,0,-1733.56,-1627.57,
-               -1811.38,-1851.58,-1888.38,-1957.07,-2056.47,-2117.52,
-               -2139.32,-2176.94,-2239.91,-2350.65,-2417.75,-2406.99,-2525.48,
-               -2551.45,-2566.83,-2499.38,-2632.35,-2662.17,-2653.14,-2718.65,
-               -2740.78,-2758.94,-2712,-2771.35,-2761.38,-2724.05,-2809.97,
-               -2815.92,-2801.25,-2824.54,-2726.76,-2716.63,-2737.83,-2752.06,
-               -2798.95,-2757.7,-2787.58,-2753.12,-2691.47,-2759.93,-2703.94,
-               -2705.55,-2722.64,-2714.75,-2685.28,-2693.49,-2685.75,-2655.65,
-               -2662.42,-2614.47,-2633.12,-2602.29,-2579.4,-2591.17,-2565.28,
-               -2529.61,-2533.85,-2491.87,-2496.78,-2458.25,-2437.25,
-               -2398.16,-2407.29,-2350.32,-2340.43,-2301.5,-2254.37,-2224.97,
-               -2186.64,-2146.73,-2096.71,-2058.12,-2006.2,-1968.6,-1914.93,
-               -1874.31,-1819.05,-1767.14,-1722.35,-1670.38,-1606.61,
-               -1544.51,-1496.24,-1438.21,-1360.12,-1299.68,-1221.61,-1080.91,-610.638,-71.9557]
+        ref = [10.4139, 124.814, 25.0443, 0, 38.3413, 133.417, 0, 0, -1733.56, -1627.57,
+               -1811.38, -1851.58, -1888.38, -1957.07, -2056.47, -2117.52,
+               -2139.32, -2176.94, -2239.91, -2350.65, -2417.75, -2406.99, -2525.48,
+               -2551.45, -2566.83, -2499.38, -2632.35, -2662.17, -2653.14, -2718.65,
+               -2740.78, -2758.94, -2712, -2771.35, -2761.38, -2724.05, -2809.97,
+               -2815.92, -2801.25, -2824.54, -2726.76, -2716.63, -2737.83, -2752.06,
+               -2798.95, -2757.7, -2787.58, -2753.12, -2691.47, -2759.93, -2703.94,
+               -2705.55, -2722.64, -2714.75, -2685.28, -2693.49, -2685.75, -2655.65,
+               -2662.42, -2614.47, -2633.12, -2602.29, -2579.4, -2591.17, -2565.28,
+               -2529.61, -2533.85, -2491.87, -2496.78, -2458.25, -2437.25,
+               -2398.16, -2407.29, -2350.32, -2340.43, -2301.5, -2254.37, -2224.97,
+               -2186.64, -2146.73, -2096.71, -2058.12, -2006.2, -1968.6, -1914.93,
+               -1874.31, -1819.05, -1767.14, -1722.35, -1670.38, -1606.61,
+               -1544.51, -1496.24, -1438.21, -1360.12, -1299.68, -1221.61, -1080.91, -610.638, -71.9557]
         BIOSANS()
         SetSampleDetectorOffset(837.9)
-        #SolidAngle()
+        # SolidAngle()
         DarkCurrent("BioSANS_dark_current.xml")
         MonitorNormalization()
         AzimuthalAverage(n_bins=100, n_subpix=1, log_binning=True)
-        #IQxQy(nbins=100)
+        # IQxQy(nbins=100)
         DirectBeamCenter("BioSANS_empty_cell.xml")
         SensitivityCorrection('BioSANS_flood_data.xml', min_sensitivity=0.5, max_sensitivity=1.5, use_sample_dc=False)
         DivideByThickness(1)
@@ -753,7 +773,7 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest):
         DirectBeamTransmission(sample_file="BioSANS_sample_trans.xml",
                                empty_file="BioSANS_empty_trans.xml",
                                beam_radius=10.0)
-        SetTransmissionBeamCenter(100,15)
+        SetTransmissionBeamCenter(100, 15)
         AzimuthalAverage(binning="0.01,0.001,0.11", error_weighting=True)
         Reduce1D()
 
@@ -770,8 +790,9 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest):
         AppendDataFile("BioSANS_test_data.xml", "test_data")
         DarkCurrent("BioSANS_dark_current.xml")
         Background("BioSANS_test_data.xml")
-        SetTransmission(0.6,0.1)
-        BckDirectBeamTransmission(sample_file="BioSANS_sample_trans.xml", empty_file="BioSANS_empty_trans.xml", beam_radius=10.0)
+        SetTransmission(0.6, 0.1)
+        BckDirectBeamTransmission(sample_file="BioSANS_sample_trans.xml", empty_file="BioSANS_empty_trans.xml",
+                                  beam_radius=10.0)
         AzimuthalAverage(binning="0.01,0.001,0.11", error_weighting=True)
         Reduce1D()
 
@@ -788,9 +809,10 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest):
         AppendDataFile("BioSANS_test_data.xml", "test_data")
         DarkCurrent("BioSANS_dark_current.xml")
         Background("BioSANS_test_data.xml")
-        SetTransmission(0.6,0.1)
-        BckDirectBeamTransmission(sample_file="BioSANS_sample_trans.xml", empty_file="BioSANS_empty_trans.xml", beam_radius=10.0)
-        SetBckTransmissionBeamCenter(100,15)
+        SetTransmission(0.6, 0.1)
+        BckDirectBeamTransmission(sample_file="BioSANS_sample_trans.xml", empty_file="BioSANS_empty_trans.xml",
+                                  beam_radius=10.0)
+        SetBckTransmissionBeamCenter(100, 15)
         AzimuthalAverage(binning="0.01,0.001,0.11", error_weighting=True)
         Reduce1D()
 
@@ -802,13 +824,14 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest):
     def test_bck_transmission_direct_beam_center(self):
         GPSANS()
         DataPath(TEST_DIR)
-        #DirectBeamCenter("BioSANS_empty_cell.xml")
-        SetBeamCenter(100,15)
+        # DirectBeamCenter("BioSANS_empty_cell.xml")
+        SetBeamCenter(100, 15)
         AppendDataFile("BioSANS_test_data.xml", "test_data")
         DarkCurrent("BioSANS_dark_current.xml")
         Background("BioSANS_test_data.xml")
-        SetTransmission(0.6,0.1)
-        BckDirectBeamTransmission(sample_file="BioSANS_sample_trans.xml", empty_file="BioSANS_empty_trans.xml", beam_radius=10.0)
+        SetTransmission(0.6, 0.1)
+        BckDirectBeamTransmission(sample_file="BioSANS_sample_trans.xml", empty_file="BioSANS_empty_trans.xml",
+                                  beam_radius=10.0)
         BckTransmissionDirectBeamCenter("BioSANS_empty_cell.xml")
         AzimuthalAverage(binning="0.01,0.001,0.11", error_weighting=True)
         Reduce1D()
@@ -820,12 +843,12 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest):
 
     def validate(self):
         print "HFIRTests: %d / %d tests passed" % (self.n_passed, self.n_tests)
-        for item in self.failed_tests:
-            print item
+        for items in self.failed_tests:
+            print items
         return self.all_passed
 
-#pylint: disable=too-many-arguments,unused-argument
-def assertAlmostEqual(first, second, places=None, msg=None, delta=None, rel_delta=None):
+
+def assertAlmostEqual(first, second, places=None, _msg=None, delta=None, rel_delta=None):
     """
         Simple test to compare two numbers
         @return: True of the two numbers agree within tolerance
@@ -840,10 +863,10 @@ def assertAlmostEqual(first, second, places=None, msg=None, delta=None, rel_delt
     if delta is not None:
         if abs(first - second) <= delta:
             return True
-        elif abs(first - second)/abs(second)<rel_delta:
+        elif abs(first - second) / abs(second) < rel_delta:
             print '\n-----> %s != %s but within %s percent' % (str(first),
                                                                str(second),
-                                                               str(rel_delta*100.0))
+                                                               str(rel_delta * 100.0))
             return True
 
         standardMsg = '%s != %s within %s delta' % (str(first),
@@ -853,7 +876,7 @@ def assertAlmostEqual(first, second, places=None, msg=None, delta=None, rel_delt
         if places is None:
             places = 7
 
-        if round(abs(second-first), places) == 0:
+        if round(abs(second - first), places) == 0:
             return True
 
         standardMsg = '%s != %s within %r places' % (str(first),
@@ -861,4 +884,3 @@ def assertAlmostEqual(first, second, places=None, msg=None, delta=None, rel_delt
                                                      places)
     print standardMsg
     return False
-
diff --git a/Testing/SystemTests/tests/analysis/ISISIndirectInelastic.py b/Testing/SystemTests/tests/analysis/ISISIndirectInelastic.py
index 0246a133d19284a48cf5e96959d39dea6cbd7f7a..68a3c67baa45012c87f1486d485e2194a0392747 100644
--- a/Testing/SystemTests/tests/analysis/ISISIndirectInelastic.py
+++ b/Testing/SystemTests/tests/analysis/ISISIndirectInelastic.py
@@ -55,10 +55,10 @@ stresstesting.MantidStressTest
      |   +--IRISFuryAndFuryFit
      |   +--OSIRISFuryAndFuryFit
      |
-     +--ISISIndirectInelasticFuryAndFuryFitMulti
+     +--ISISIndirectInelasticIqtAndIqtFitMulti
      |   |
-     |   +--IRISFuryAndFuryFitMulti
-     |   +--OSIRISFuryAndFuryFitMulti
+     |   +--IRISIqtAndIqtFitMulti
+     |   +--OSIRISIqtAndIqtFitMulti
      |
      +--ISISIndirectInelasticConvFit
      |   |
@@ -78,7 +78,7 @@ from mantid.simpleapi import *
 from mantid.api import FileFinder
 
 # Import our workflows.
-from IndirectDataAnalysis import furyfitSeq, furyfitMult
+from IndirectDataAnalysis import furyfitSeq
 
 class ISISIndirectInelasticBase(stresstesting.MantidStressTest):
     '''
@@ -942,8 +942,8 @@ class IRISFuryAndFuryFit(ISISIndirectInelasticFuryAndFuryFit):
 
 #==============================================================================
 
-class ISISIndirectInelasticFuryAndFuryFitMulti(ISISIndirectInelasticBase):
-    '''A base class for the ISIS indirect inelastic Fury/FuryFit tests
+class ISISIndirectInelasticIqtAndIqtFitMulti(ISISIndirectInelasticBase):
+    '''A base class for the ISIS indirect inelastic Iqt/IqtFit tests
 
     The output of Elwin is usually used with MSDFit and so we plug one into
     the other in this test.
@@ -968,21 +968,23 @@ class ISISIndirectInelasticFuryAndFuryFitMulti(ISISIndirectInelasticBase):
                                     BinReductionFactor=self.num_bins,
                                     DryRun=False)
 
-        # Test FuryFit Sequential
-        furyfitSeq_ws = furyfitMult(fury_ws.getName(),
-                                    self.func,
-                                    self.ftype,
-                                    self.startx,
-                                    self.endx,
-                                    Save=False,
-                                    Plot='None')
+        # Test IqtFitMultiple
+        furyfitSeq_ws, params, fit_group = IqtFitMultiple(fury_ws.getName(),
+                                                          self.func,
+                                                          self.ftype,
+                                                          self.startx,
+                                                          self.endx,
+                                                          self.spec_min,
+                                                          self.spec_max)
 
         self.result_names = [fury_ws.getName(),
-                             furyfitSeq_ws]
+                             furyfitSeq_ws.getName()]
 
         #remove workspaces from mantid
         for sample in self.samples:
             DeleteWorkspace(sample)
+        DeleteWorkspace(params)
+        DeleteWorkspace(fit_group)
         DeleteWorkspace(self.resolution)
 
     def _validate_properties(self):
@@ -1009,13 +1011,13 @@ class ISISIndirectInelasticFuryAndFuryFitMulti(ISISIndirectInelasticBase):
 
 #------------------------- OSIRIS tests ---------------------------------------
 
-class OSIRISFuryAndFuryFitMulti(ISISIndirectInelasticFuryAndFuryFitMulti):
+class OSIRISIqtAndIqtFitMulti(ISISIndirectInelasticIqtAndIqtFitMulti):
 
     def skipTests(self):
         return platform.system() == "Darwin"
 
     def __init__(self):
-        ISISIndirectInelasticFuryAndFuryFitMulti.__init__(self)
+        ISISIndirectInelasticIqtAndIqtFitMulti.__init__(self)
 
         # TransformToIqt
         self.samples = ['osi97935_graphite002_red.nxs']
@@ -1024,12 +1026,14 @@ class OSIRISFuryAndFuryFitMulti(ISISIndirectInelasticFuryAndFuryFitMulti):
         self.e_max = 0.4
         self.num_bins = 4
 
-        # Fury Seq Fit
+        # Iqt Fit
         self.func = r'name=LinearBackground,A0=0.510595,A1=0,ties=(A1=0);name=UserFunction,Formula=Intensity*exp( -(x/Tau)^Beta),'\
                      'Intensity=0.489405,Tau=0.105559,Beta=1.61112e-14;ties=(f1.Intensity=1-f0.A0)'
         self.ftype = '1E_s'
         self.startx = 0.0
         self.endx = 0.119681
+        self.spec_min = 0
+        self.spec_max = 41
 
     def get_reference_files(self):
         ref_files = ['II.OSIRISFury.nxs']
@@ -1041,10 +1045,10 @@ class OSIRISFuryAndFuryFitMulti(ISISIndirectInelasticFuryAndFuryFitMulti):
 
 #------------------------- IRIS tests -----------------------------------------
 
-class IRISFuryAndFuryFitMulti(ISISIndirectInelasticFuryAndFuryFitMulti):
+class IRISIqtAndIqtFitMulti(ISISIndirectInelasticIqtAndIqtFitMulti):
 
     def __init__(self):
-        ISISIndirectInelasticFuryAndFuryFitMulti.__init__(self)
+        ISISIndirectInelasticIqtAndIqtFitMulti.__init__(self)
 
         # TransformToIqt
         self.samples = ['irs53664_graphite002_red.nxs']
@@ -1052,8 +1056,10 @@ class IRISFuryAndFuryFitMulti(ISISIndirectInelasticFuryAndFuryFitMulti):
         self.e_min = -0.4
         self.e_max = 0.4
         self.num_bins = 4
+        self.spec_min = 0
+        self.spec_max = 50
 
-        # Fury Seq Fit
+        # Iqt Fit
         self.func = r'name=LinearBackground,A0=0.584488,A1=0,ties=(A1=0);name=UserFunction,Formula=Intensity*exp( -(x/Tau)^Beta),'\
                      'Intensity=0.415512,Tau=4.848013e-14,Beta=0.022653;ties=(f1.Intensity=1-f0.A0)'
         self.ftype = '1S_s'
diff --git a/Testing/SystemTests/tests/analysis/MuonFFTTest.py b/Testing/SystemTests/tests/analysis/MuonFFTTest.py
new file mode 100644
index 0000000000000000000000000000000000000000..7a2d5ccc38dd3b746f87df2ba5d3c06b695212f0
--- /dev/null
+++ b/Testing/SystemTests/tests/analysis/MuonFFTTest.py
@@ -0,0 +1,30 @@
+#pylint: disable=no-init,attribute-defined-outside-init
+import stresstesting
+from mantid.simpleapi import *
+from math import pi
+
+class MuonFFTTest(stresstesting.MantidStressTest):
+    '''Tests the FFT algorithm on a MUSR workspace, to check it can cope with rounding errors in X'''
+
+    def runTest(self):
+        Load(Filename='MUSR00022725.nxs', OutputWorkspace='MUSR00022725')
+        CropWorkspace(InputWorkspace='MUSR00022725', OutputWorkspace='MUSR00022725', XMin=0, XMax=4, EndWorkspaceIndex=63)
+
+        # create a PhaseTable with detector information
+        tab = CreateEmptyTableWorkspace()
+        tab.addColumn('int', 'DetID')
+        tab.addColumn('double', 'Phase')
+        tab.addColumn('double', 'Asym')
+        for i in range(0,32):
+            phi = 2*pi*i/32.
+            tab.addRow([i + 1, 0.2, phi])
+        for i in range(0,32):
+            phi = 2*pi*i/32.
+            tab.addRow([i + 33, 0.2, phi])
+        ows = PhaseQuad(InputWorkspace='MUSR00022725', PhaseTable='tab')
+
+        FFT(ows, Real=0, Imaginary=1, AcceptXRoundingErrors=True, OutputWorkspace='MuonFFTResults')
+
+    def validate(self):
+        self.tolerance = 1E-1
+        return ('MuonFFTResults','MuonFFTMUSR00022725.nxs')
diff --git a/Testing/SystemTests/tests/analysis/Peak2ConvCell_Test.py b/Testing/SystemTests/tests/analysis/Peak2ConvCell_Test.py
index a65bd2ff48a6414ef2c653b77df4d783a35c6479..b45fc1f9ee8b9b98480891195cc3d2bcfa18e147 100644
--- a/Testing/SystemTests/tests/analysis/Peak2ConvCell_Test.py
+++ b/Testing/SystemTests/tests/analysis/Peak2ConvCell_Test.py
@@ -1,931 +1,925 @@
-#pylint: disable=invalid-name,no-init,too-many-arguments,too-many-branches
-#This script creates numerous PeaksWorkspaces for different Crystal Types and Centerings. Random errors
-#are also introduced into the peak's.  Each PeaksWorkspace is sent through the algorithm's FindPeaksMD,
-#FindUBUsingFFT, and SelectByForm to determine the corresponding Primitive and Conventional cells. These
-#results are tested against the theoretical results that should have been gotten
+# pylint: disable=invalid-name,no-init,too-many-arguments,too-many-branches, unused-variable,too-many-return-statements
+# This script creates numerous PeaksWorkspaces for different Crystal Types and Centerings. Random errors
+# are also introduced into the peak's.  Each PeaksWorkspace is sent through the algorithm's FindPeaksMD,
+# FindUBUsingFFT, and SelectByForm to determine the corresponding Primitive and Conventional cells. These
+# results are tested against the theoretical results that should have been gotten
 
-#NOTE; THIS TEST TAKES AN EXTREMELY LONG TIME. DELETE "XXX" IN requiredFiles method to get it to run.
-#!!!!!!!!!  REPLACE THE "XXX" OR else !!!!!!!!!!
+# NOTE; THIS TEST TAKES AN EXTREMELY LONG TIME. DELETE "XXX" IN requiredFiles method to get it to run.
+# !!!!!!!!!  REPLACE THE "XXX" OR else !!!!!!!!!!
 
 
-#import stresstesting
+# import stresstesting
 import numpy
 from numpy import matrix
 import math
 import random
 import mantid
 from mantid.simpleapi import *
-#from mantid.simpleapi import *
-#TODO premultiply cases, fix up.. Maybe not needed Cause Conv cell was "Nigglied"
-#TODO: SWitch cases, if use approx inequality, may get error cause low level code  [does Not](does) premult but when it [should](should not)
-class Peak2ConvCell_Test(object):#(stresstesting.MantidStressTest):
-    conventionalUB=numpy.zeros(shape=(3,3))
-    Cubic=[1,3,5]
-    Tetr=[6,7,11,15,18,21]
-    Orth=[8,13,16,19,23,26,32,36,38,40,42]
-    Hex = [2,4,9,12,22,24]
-    Tricl=[31,44]
-    Mon=[28,29,30,33,34,35,43]
-    MonI=[17,27]
-    MonC=[10,14,20,25,37,39,41]
-    CentP=[3,11,12,21,22,31,32,33,34,35,44]
-    CentF=[1,16,26]
-    CentI=[2,4,5,6,7,8,9,10,14,15,17,18,19,20,24,25,27,37,39,41,42,43]
-    CentC=[10,13,14,17,20,23,25,27,28,29,30,36,37,38,39,40,41]
-
-
-    def CalcConventionalUB(self,a,b,c,alpha,beta,gamma,celltype):
-        Res= matrix([[0.,0.,0.],[0.,0.,0.],[0.,0.,0.]])
-
-        if celltype=='O':
-
-            Res[0,0]=1./a
-            Res[1,1]=1./b
-            Res[2,2]=1./c
-
-        elif celltype=='H':
-            Res[0,0]= a*1.0
-            Res[1,0]= -a/2.
-            Res[1,1]= a*.866
-            Res[2,2]=c*1.0
-            Res=Res.I
+
+
+# from mantid.simpleapi import *
+# TODO premultiply cases, fix up.. Maybe not needed Cause Conv cell was "Nigglied"
+# TODO: SWitch cases, if use approx inequality, may get error cause low level code
+# [does Not](does) premult but when it [should](should not)
+class Peak2ConvCell_Test(object):  # (stresstesting.MantidStressTest):
+    conventionalUB = numpy.zeros(shape=(3, 3))
+    Cubic = [1, 3, 5]
+    Tetr = [6, 7, 11, 15, 18, 21]
+    Orth = [8, 13, 16, 19, 23, 26, 32, 36, 38, 40, 42]
+    Hex = [2, 4, 9, 12, 22, 24]
+    Tricl = [31, 44]
+    Mon = [28, 29, 30, 33, 34, 35, 43]
+    MonI = [17, 27]
+    MonC = [10, 14, 20, 25, 37, 39, 41]
+    CentP = [3, 11, 12, 21, 22, 31, 32, 33, 34, 35, 44]
+    CentF = [1, 16, 26]
+    CentI = [2, 4, 5, 6, 7, 8, 9, 10, 14, 15, 17, 18, 19, 20, 24, 25, 27, 37, 39, 41, 42, 43]
+    CentC = [10, 13, 14, 17, 20, 23, 25, 27, 28, 29, 30, 36, 37, 38, 39, 40, 41]
+
+    def CalcConventionalUB(self, a, b, c, alpha, _beta, _gamma, celltype):
+        Res = matrix([[0., 0., 0.], [0., 0., 0.], [0., 0., 0.]])
+
+        if celltype == 'O':
+
+            Res[0, 0] = 1. / a
+            Res[1, 1] = 1. / b
+            Res[2, 2] = 1. / c
+
+        elif celltype == 'H':
+            Res[0, 0] = a * 1.0
+            Res[1, 0] = -a / 2.
+            Res[1, 1] = a * .866
+            Res[2, 2] = c * 1.0
+            Res = Res.I
         else:
-            if alpha <=90:
+            if alpha <= 90:
                 self.conventionalUB = None
                 return None
-            Res[0,0] = a*1.0
-            Res[1,1] = b*1.0
-            Alpha = (alpha*math.pi/180)
-            Res[2,0] = c*math.cos( Alpha)
-            Res[2,2] = c*math.sin(Alpha)
-         # Now Nigglify the matrix( get 3 smallest sides)
-
-            n =0
-            YY=0
-            if  a <=c:
-                n = (int)(-Res[2,0]/a)
-                YY= Res[2,0] +n*a
+            Res[0, 0] = a * 1.0
+            Res[1, 1] = b * 1.0
+            Alpha = (alpha * math.pi / 180)
+            Res[2, 0] = c * math.cos(Alpha)
+            Res[2, 2] = c * math.sin(Alpha)
+            # Now Nigglify the matrix( get 3 smallest sides)
+
+            n = 0
+            YY = 0
+            if a <= c:
+                n = (int)(-Res[2, 0] / a)
+                YY = Res[2, 0] + n * a
 
             else:
 
-                n= (int)(-a*Res[2,0]/(c*c)-.5)
-                YY=n*Res[2,0]+a
+                n = (int)(-a * Res[2, 0] / (c * c) - .5)
+                YY = n * Res[2, 0] + a
 
-         #print ["A",YY,n]
-            sgn=1
-            if  a <= c:
-
-                if  math.fabs( YY + a ) < math.fabs( YY ) and a <= c :
+                # print ["A",YY,n]
+            sgn = 1
+            if a <= c:
 
+                if math.fabs(YY + a) < math.fabs(YY) and a <= c:
                     YY += a
                     sgn = -1
-                    n=n+1
-
+                    n += 1
 
-            elif( (YY+Res[2,0])*(YY+Res[2,0])+(n+1)*(n+1)*Res[2,2]*Res[2,2] < a*a):
+            elif (YY + Res[2, 0]) * (YY + Res[2, 0]) + (n + 1) * (n + 1) * Res[2, 2] * Res[2, 2] < a * a:
 
-                YY+=Res[2,0]
-                n=n+1
+                YY += Res[2, 0]
+                n += 1
                 sgn = -1
 
-         #print ["B",YY,sgn,n]
+                # print ["B",YY,sgn,n]
 
-            if  n>0 :
-                if  a <= c:
+            if n > 0:
+                if a <= c:
 
-                    Res[2,0]= sgn*YY
-                    Res[2,2] *=sgn
+                    Res[2, 0] = sgn * YY
+                    Res[2, 2] *= sgn
 
                 else:
 
-                    if( YY*Res[2,0]+n*Res[2,2]*Res[2,2] > 0):
-                        sgn =-1
+                    if YY * Res[2, 0] + n * Res[2, 2] * Res[2, 2] > 0:
+                        sgn = -1
 
                     else:
                         sgn = 1
-                    Res[0,0]= sgn*YY
-                    Res[0,2] =sgn*n*Res[2,2]
-
-
-            Res=Res.I
+                    Res[0, 0] = sgn * YY
+                    Res[0, 2] = sgn * n * Res[2, 2]
 
+            Res = Res.I
 
         self.conventionalUB = Res
 
         return Res
 
-
-    def Niggli( self, Res):
-        RUB= Res.I
-        X=RUB*RUB.T
+    def Niggli(self, Res):
+        RUB = Res.I
+        X = RUB * RUB.T
         done = False
 
         while not done:
             done = True
             for i in range(2):
-                if X[i,i]>X[i+1,i+1]:
+                if X[i, i] > X[i + 1, i + 1]:
                     done = False
                     for j in range(3):
-                        sav= RUB[i,j]
-                        RUB[i,j]=RUB[i+1,j]
-                        RUB[i+1,j]=sav
-                    X=RUB*RUB.T
+                        sav = RUB[i, j]
+                        RUB[i, j] = RUB[i + 1, j]
+                        RUB[i + 1, j] = sav
+                    X = RUB * RUB.T
 
             if not done:
                 continue
-         #do bc,ac,then ab
+                # do bc,ac,then ab
             for kk in range(3):
-                jj=2
-                if kk>1:
-                    jj=1
-                    i=0
+                jj = 2
+                if kk > 1:
+                    jj = 1
+                    i = 0
                 else:
-                    i=jj-kk-1
-                if X[i,i]<2*math.fabs(X[i,jj]):
-                    sgn=1
-                    if X[i,jj] >0:
-                        sgn=-1
+                    i = jj - kk - 1
+                if X[i, i] < 2 * math.fabs(X[i, jj]):
+                    sgn = 1
+                    if X[i, jj] > 0:
+                        sgn = -1
                     for j in range(3):
-                        RUB[jj,j]=RUB[jj,j]+sgn*RUB[i,j]
-                    done=False
-                    X=RUB*RUB.T
-
-                    break
+                        RUB[jj, j] += sgn * RUB[i, j]
 
+                    done = False
+                    X = RUB * RUB.T
 
-        if  numpy.linalg.det( RUB )< 0:
-            for  cc in range(3):
-                RUB[0,cc] *=-1
+                    break
 
+        if numpy.linalg.det(RUB) < 0:
+            for cc in range(3):
+                RUB[0, cc] *= -1
 
         return RUB.I
 
-    def CalcNiggliUB( self,a, b,c,alpha, beta, gamma,celltype, Center):
+    def CalcNiggliUB(self, a, b, c, alpha, beta, gamma, celltype, Center):
 
-        if  Center=='P':
-            X = self.CalcConventionalUB( a,b,c,alpha,beta,gamma,celltype)
+        if Center == 'P':
+            X = self.CalcConventionalUB(a, b, c, alpha, beta, gamma, celltype)
             return X
 
-        Res= matrix([[0.,0.,0.],[0.,0.,0.],[0.,0.,0.]])
-        ConvUB = self.CalcConventionalUB(a,b,c,alpha,beta,gamma,celltype)
-        if  ConvUB== None:
+        Res = matrix([[0., 0., 0.], [0., 0., 0.], [0., 0., 0.]])
+        ConvUB = self.CalcConventionalUB(a, b, c, alpha, beta, gamma, celltype)
+        if ConvUB == None:
             return None
 
-        ResP =  numpy.matrix.copy(ConvUB)
-        ResP =ResP.I
+        ResP = numpy.matrix.copy(ConvUB)
+        ResP = ResP.I
 
-        if  celltype=='H' and Center =='I':
-            Center ='R'
+        if celltype == 'H' and Center == 'I':
+            Center = 'R'
 
-        if  Center == 'I':
+        if Center == 'I':
 
-            s1=1
-            s2=1
-            for  r in range(0,3):
+            s1 = 1
+            s2 = 1
+            for r in range(0, 3):
                 for cc in range(3):
 
+                    if cc == 0:
+                        if r > 0:
+                            s1 = (-1) ** r
+                            s2 = -s1
 
-                    if  cc==0:
-                        if  r>0:
-
-                            s1 = (-1)**r
-                            s2 =-s1
+                    Res[r, cc] = ResP[0, cc] / 2 + s1 * ResP[1, cc] / 2 + s2 * ResP[2, cc] / 2
 
-                    Res[r,cc] =ResP[0,cc]/2+s1*ResP[1,cc]/2+s2*ResP[2,cc]/2
+            Res = Res.I
 
+        elif Center == 'F':
 
-            Res=Res.I
-
-        elif  Center =='F':
-
-            if  celltype =='H'  or  celltype=='M':
+            if celltype == 'H' or celltype == 'M':
                 return None
 
-            ss = [0,0,0]
+            ss = [0, 0, 0]
 
-            for  r in range(3):
+            for r in range(3):
                 for cc in range(3):
+                    ss = [1, 1, 1]
+                    ss[r] = 0
 
-                    ss=[1,1,1]
-                    ss[r]=0
-
-                    Res[r,cc]=ss[0]*ResP[0,cc]/2+ss[1]*ResP[1,cc]/2+ss[2]*ResP[2,cc]/2
-
+                    Res[r, cc] = ss[0] * ResP[0, cc] / 2 + ss[1] * ResP[1, cc] / 2 + ss[2] * ResP[2, cc] / 2
 
+            Res = Res.I
 
-            Res=Res.I
+        elif Center == 'A' or Center == 'B' or Center == 'C':
 
-        elif  Center =='A' or Center=='B'or Center=='C':
-
-            if  celltype =='H' :
+            if celltype == 'H':
                 return None
-            if  celltype =='M'  and  Center== 'B':
+            if celltype == 'M' and Center == 'B':
                 return None
 
-            r=2
-            if  Center =='A' :
+            r = 2
+            if Center == 'A':
 
-                r=0
-                if  b==c  and  celltype=='O':# result would be orthorhombic primitive
+                r = 0
+                if b == c and celltype == 'O':  # result would be orthorhombic primitive
                     return None
 
-            elif  Center =='B':
+            elif Center == 'B':
 
-                r=1
-                if  a==c and  celltype=='O':
+                r = 1
+                if a == c and celltype == 'O':
                     return None
 
-            elif  a==b  and  celltype=='O':
+            elif a == b and celltype == 'O':
                 return None
 
-            k=0
-
-            Res[r,0]= ResP[r,0]
-            Res[r,1]= ResP[r,1]
-            Res[r,2]= ResP[r,2]
-            for i in range(1,3):
+            k = 0
 
-                if  k==r:
-                    k=k+1
-                for  cc in range(3) :
+            Res[r, 0] = ResP[r, 0]
+            Res[r, 1] = ResP[r, 1]
+            Res[r, 2] = ResP[r, 2]
+            for i in range(1, 3):
 
-                    R = (r+1)%3
-                    s =   (-1)**i
+                if k == r:
+                    k += 1
+                for cc in range(3):
+                    R = (r + 1) % 3
+                    s = (-1) ** i
 
-                    Res[k,cc]= ResP[(R)%3,cc]/2+s*ResP[(R+1)%3,cc]/2
+                    Res[k, cc] = ResP[(R) % 3, cc] / 2 + s * ResP[(R + 1) % 3, cc] / 2
 
-                k=k+1
+                k += 1
 
-            Res=Res.I
+            Res = Res.I
 
 
 
-        elif  Center =='R':
+        elif Center == 'R':
 
-            if  celltype != 'H' or alpha >120:#alpha =120 planar, >120 no go or c under a-b plane.
+            if celltype != 'H' or alpha > 120:  # alpha =120 planar, >120 no go or c under a-b plane.
 
-                self.conventionalUB=NiggliUB = None
+                self.conventionalUB = NiggliUB = None
                 return None
 
-         #Did not work with 0 error. FindUBUsingFFT failed
-         #Alpha = alpha*math.pi/180
-
-         #Res[0,0] = a
-         #Res[1,0] =(a*math.cos( Alpha ))
-         #Res[1,1] = (a*math.sin( Alpha ))
-         #Res[2,0] =(a*math.cos( Alpha ))
-         #Res[2,1] =(a*Res[1,0] -Res[2,0]*Res[1,0])/Res[1,1]
-         #Res[2,2] =math.sqrt( a*a- Res[2,1]*Res[2,1]-Res[2,0]*Res[2,0])
-            Res[0,0]=.5*a
-            Res[0,1]=math.sqrt(3)*a/2
-            Res[0,2]=.5*b
-            Res[1,0]=-a
-            Res[1,1]=0
-            Res[1,2]=.5*b
-            Res[2,0]=.5*a
-            Res[2,1]=-math.sqrt(3)*a/2
-            Res[2,2]=.5*b
+                # Did not work with 0 error. FindUBUsingFFT failed
+                # Alpha = alpha*math.pi/180
 
+                # Res[0,0] = a
+                # Res[1,0] =(a*math.cos( Alpha ))
+                # Res[1,1] = (a*math.sin( Alpha ))
+                # Res[2,0] =(a*math.cos( Alpha ))
+                # Res[2,1] =(a*Res[1,0] -Res[2,0]*Res[1,0])/Res[1,1]
+                # Res[2,2] =math.sqrt( a*a- Res[2,1]*Res[2,1]-Res[2,0]*Res[2,0])
+            Res[0, 0] = .5 * a
+            Res[0, 1] = math.sqrt(3) * a / 2
+            Res[0, 2] = .5 * b
+            Res[1, 0] = -a
+            Res[1, 1] = 0
+            Res[1, 2] = .5 * b
+            Res[2, 0] = .5 * a
+            Res[2, 1] = -math.sqrt(3) * a / 2
+            Res[2, 2] = .5 * b
 
-            Rhomb2Hex= matrix([[1. ,-1., 0.],[-1. ,0., 1.],[-1. ,-1., -1.]])
+            Rhomb2Hex = matrix([[1., -1., 0.], [-1., 0., 1.], [-1., -1., -1.]])
 
-            self.conventionalUB=Rhomb2Hex*Res
-            Res=Res.I
+            self.conventionalUB = Rhomb2Hex * Res
+            Res = Res.I
 
-            self.conventionalUB=self.Niggli(self.conventionalUB.I)
+            self.conventionalUB = self.Niggli(self.conventionalUB.I)
 
         Res = self.Niggli(Res)
-        if  numpy.linalg.det( Res )< 0:
-            for  cc in range(3):
-                Res[cc,0] *=-1
-
-
+        if numpy.linalg.det(Res) < 0:
+            for cc in range(3):
+                Res[cc, 0] *= -1
 
         return Res
 
-    def Perturb( self,val, error):
-        return val+random.random()*error-error/2
-
-    def Next( self, hkl1):
-      #print "Next"
-        hkl=matrix([[hkl1[0,0]],[hkl1[1,0]],[hkl1[2,0]]])
-        S =(math.fabs( hkl[0,0])+math.fabs( hkl[1,0])+math.fabs( hkl[2,0]))
-      #print ["S=",S]
-      #The sum of abs hkl's = S until not possible. Increasing lexicographically
-        if( hkl[2,0] < 0):
-         #print "Nexta"
-            hkl[2,0] = -hkl[2,0]
-         #print hkl
+    def Perturb(self, val, error):
+        return val + random.random() * error - error / 2
+
+    def Next(self, hkl1):
+        # print "Next"
+        hkl = matrix([[hkl1[0, 0]], [hkl1[1, 0]], [hkl1[2, 0]]])
+        S = (math.fabs(hkl[0, 0]) + math.fabs(hkl[1, 0]) + math.fabs(hkl[2, 0]))
+        # print ["S=",S]
+        # The sum of abs hkl's = S until not possible. Increasing lexicographically
+        if (hkl[2, 0] < 0):
+            # print "Nexta"
+            hkl[2, 0] = -hkl[2, 0]
+            # print hkl
             return hkl
 
-        if  math.fabs( hkl[0,0])+ math.fabs( hkl[1,0]+1 ) <= S:
+        if math.fabs(hkl[0, 0]) + math.fabs(hkl[1, 0] + 1) <= S:
 
-         #print "Nextb"
-            hkl[1,0] +=1
-            hkl[2,0] = -(S -math.fabs( hkl[0,0])- math.fabs( hkl[1,0] ))
-        elif  math.fabs( hkl[0,0]+1 ) <= S:
+            # print "Nextb"
+            hkl[1, 0] += 1
+            hkl[2, 0] = -(S - math.fabs(hkl[0, 0]) - math.fabs(hkl[1, 0]))
+        elif math.fabs(hkl[0, 0] + 1) <= S:
 
-         #print "Nextc"
-            hkl[0,0]=  hkl[0,0]+1.0
-            hkl[1,0] = -(S - math.fabs( hkl[0,0]))
-            hkl[2,0] = 0
+            # print "Nextc"
+            hkl[0, 0] = hkl[0, 0] + 1.0
+            hkl[1, 0] = -(S - math.fabs(hkl[0, 0]))
+            hkl[2, 0] = 0
         else:
 
-         #print "Nextd"
-            hkl[1,0]=0
-            hkl[2,0]=0
-            hkl[0,0] = -S-1
-      #print hkl
+            # print "Nextd"
+            hkl[1, 0] = 0
+            hkl[2, 0] = 0
+            hkl[0, 0] = -S - 1
+            # print hkl
         return hkl
 
-    def FixLatParams( self,List):
-        npos=0
-        nneg=0
-        if len(List)<6:
+    def FixLatParams(self, List):
+        npos = 0
+        nneg = 0
+        if len(List) < 6:
             return List
-        has90=False
-        for i in range(3,6):
-            if math.fabs(List[i]-90)<.05:
-                nneg  =nneg+1
-                has90=True
-            elif List[i] <90:
-                npos=npos+1
+        has90 = False
+        for i in range(3, 6):
+            if math.fabs(List[i] - 90) < .05:
+                nneg += 1
+                has90 = True
+            elif List[i] < 90:
+                npos += 1
             else:
-                nneg=nneg+1
-        over90=False
-        if nneg ==3  or has90 or nneg==1:
-            over90= True
-
-        for i in range(3,6):
-            if  List[i]>90 and not over90:
-                List[i]=180-List[i]
-            elif List[i]<90 and over90:
-                List[i]=180-List[i]
-
-        bdotc = math.cos(List[3]/180.*math.pi)*List[1]*List[2]
-        adotc= math.cos(List[4]/180.*math.pi)*List[0]*List[2]
-        adotb= math.cos(List[5]/180.*math.pi)*List[1]*List[0]
-        if List[0] > List[1] or (List[0] == List[1] and math.fabs(bdotc)>math.fabs(adotc)):
-            List = self.XchangeSides( List,0,1)
-        bdotc = math.cos(List[3]/180.*math.pi)*List[1]*List[2]
-        adotc= math.cos(List[4]/180.*math.pi)*List[0]*List[2]
-        adotb= math.cos(List[5]/180.*math.pi)*List[1]*List[0]
-        if List[1] > List[2] or (List[1] == List[2] and math.fabs(adotc)>math.fabs(adotb)):
-            List = self.XchangeSides(List,1,2)
-        bdotc = math.cos(List[3]/180.*math.pi)*List[1]*List[2]
-        adotc= math.cos(List[4]/180.*math.pi)*List[0]*List[2]
-        adotb= math.cos(List[5]/180.*math.pi)*List[1]*List[0]
-
-        if List[0] > List[1] or (List[0] == List[1] and math.fabs(bdotc)>math.fabs(adotc)):
-            List = self.XchangeSides( List,0,1)
+                nneg += 1
+        over90 = False
+        if nneg == 3 or has90 or nneg == 1:
+            over90 = True
+
+        for i in range(3, 6):
+            if List[i] > 90 and not over90:
+                List[i] = 180 - List[i]
+            elif List[i] < 90 and over90:
+                List[i] = 180 - List[i]
+
+        bdotc = math.cos(List[3] / 180. * math.pi) * List[1] * List[2]
+        adotc = math.cos(List[4] / 180. * math.pi) * List[0] * List[2]
+        adotb = math.cos(List[5] / 180. * math.pi) * List[1] * List[0]
+        if List[0] > List[1] or (List[0] == List[1] and math.fabs(bdotc) > math.fabs(adotc)):
+            List = self.XchangeSides(List, 0, 1)
+        bdotc = math.cos(List[3] / 180. * math.pi) * List[1] * List[2]
+        adotc = math.cos(List[4] / 180. * math.pi) * List[0] * List[2]
+        adotb = math.cos(List[5] / 180. * math.pi) * List[1] * List[0]
+        if List[1] > List[2] or (List[1] == List[2] and math.fabs(adotc) > math.fabs(adotb)):
+            List = self.XchangeSides(List, 1, 2)
+        bdotc = math.cos(List[3] / 180. * math.pi) * List[1] * List[2]
+        adotc = math.cos(List[4] / 180. * math.pi) * List[0] * List[2]
+        adotb = math.cos(List[5] / 180. * math.pi) * List[1] * List[0]
+
+        if List[0] > List[1] or (List[0] == List[1] and math.fabs(bdotc) > math.fabs(adotc)):
+            List = self.XchangeSides(List, 0, 1)
 
         return List
 
-    def FixUpPlusMinus( self, UB):#TODO make increasing lengthed sides too
-        M= matrix([[1.0,0.0,0.0],[0.0,1.0,0.0],[0.0,0.0,1.0]])
-        M1= matrix([[1.0,0.0,0.0],[0.0,1.0,0.0],[0.0,0.0,1.0]])
-        G= UB.T*UB
+    def FixUpPlusMinus(self, UB):  # TODO make increasing lengthed sides too
+        M = matrix([[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]])
+        M1 = matrix([[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]])
+        G = UB.T * UB
         G.I
 
-        if G[0,1]>0:
-            if G[0,2]>0:
-                if G[1,2]>0:
+        if G[0, 1] > 0:
+            if G[0, 2] > 0:
+                if G[1, 2] > 0:
                     return UB
                 else:
-                    M[1,1]=M[2,2]=-1
-            elif G[1,2]>0:
-                M[0,0]=M[2,2]=-1
+                    M[1, 1] = M[2, 2] = -1
+            elif G[1, 2] > 0:
+                M[0, 0] = M[2, 2] = -1
             else:
-                M[1,1]=M[0,0]=-1
+                M[1, 1] = M[0, 0] = -1
         else:
-            if G[0,2]>0:
-                if G[1,2]>0:
-                    M[1,1]=M[0,0]=-1
+            if G[0, 2] > 0:
+                if G[1, 2] > 0:
+                    M[1, 1] = M[0, 0] = -1
                 else:
-                    M[0,0]=M[2,2]=-1
-            elif G[1,2]>0:
-                M[2,2]=M[1,1]=-1
+                    M[0, 0] = M[2, 2] = -1
+            elif G[1, 2] > 0:
+                M[2, 2] = M[1, 1] = -1
             else:
                 return UB
 
+        return UB * M
+        # is closeness to 90 deg( cos of ), and equal sides
 
-        return UB*M
-   # is closeness to 90 deg( cos of ), and equal sides
-    def FixUB(self,UB, tolerance):
+    def FixUB(self, UB, tolerance):
         done = 1
         print "A"
-        while done==1:
-            done=0
-            X = UB.T*UB
+        while done == 1:
+            done = 0
+            X = UB.T * UB
             X.I
 
-            print "B1",X
-            if X[0,0]> X[1,1] or (math.fabs(X[0,0]-X[1,1])<tolerance/10 and math.fabs(X[1,2])>math.fabs(X[0,2])+tolerance/10):
+            print "B1", X
+            if X[0, 0] > X[1, 1] or (math.fabs(X[0, 0] - X[1, 1]) < tolerance / 10 and math.fabs(X[1, 2]) > math.fabs(
+                    X[0, 2]) + tolerance / 10):
                 done = 1
-                for i in range(0,3):
-                    sav= UB[i,0]
-                    UB[i,0]=UB[i,1]
-                    UB[i,1]=sav
+                for i in range(0, 3):
+                    sav = UB[i, 0]
+                    UB[i, 0] = UB[i, 1]
+                    UB[i, 1] = sav
                 print "B"
                 continue
 
             print "B2"
-            if X[1,1]>X[2,2] or (math.fabs(X[1,1]-X[2,2])<tolerance and math.fabs(X[1,0])< math.fabs(X[2,0])-tolerance/10):
+            if X[1, 1] > X[2, 2] or (math.fabs(X[1, 1] - X[2, 2]) < tolerance and math.fabs(X[1, 0]) < math.fabs(
+                    X[2, 0]) - tolerance / 10):
                 done = 1
-                for i in range(0,3):
-                    sav= UB[i,1]
-                    UB[i,1]=UB[i,2]
-                    UB[i,2]=sav
+                for i in range(0, 3):
+                    sav = UB[i, 1]
+                    UB[i, 1] = UB[i, 2]
+                    UB[i, 2] = sav
 
                 print "C"
                 continue
 
             print "B3"
             if numpy.linalg.det(UB) < 0:
-                for i in range(0,3):
-                    UB[i,0]=-1*UB[i,0]
+                for i in range(0, 3):
+                    UB[i, 0] = -1 * UB[i, 0]
 
                 print "D"
-                done=1
+                done = 1
                 continue
             print "E"
-            L= [X[0,1],X[0,2],X[1,2]]
+            L = [X[0, 1], X[0, 2], X[1, 2]]
 
-            nneg=0
-            is90=False
-            odd=-1
-            for i in range(0,3):
+            nneg = 0
+            is90 = False
+            odd = -1
+            for i in range(0, 3):
 
-                if math.fabs(L[i])<tolerance:
-                    is90=True
-                    odd=i
-                    nneg=nneg+1
-                elif L[i]<0:
-                    nneg=nneg+1
+                if math.fabs(L[i]) < tolerance:
+                    is90 = True
+                    odd = i
+                    nneg = nneg + 1
+                elif L[i] < 0:
+                    nneg = nneg + 1
 
-            if nneg==3 or nneg==0:
+            if nneg == 3 or nneg == 0:
                 continue
 
-            for i in range(0,3):
-                if is90 :
-                    if nneg ==1:
-                        odd=i
+            for i in range(0, 3):
+                if is90:
+                    if nneg == 1:
+                        odd = i
                         break
-                    if nneg==2 and odd !=i and L[i]>0:
-                        odd=i
+                    if nneg == 2 and odd != i and L[i] > 0:
+                        odd = i
                         break
 
 
-                elif nneg==1 and L[i]<0:
-                    odd=i
-                elif nneg==2 and L[i]>0:
+                elif nneg == 1 and L[i] < 0:
                     odd = i
-            odd= 2-odd
-            i1=(odd+1)%3
-            i2=(odd+2)%3
-            print ["L=",L, odd,i1,i2, is90,tolerance]
+                elif nneg == 2 and L[i] > 0:
+                    odd = i
+            odd = 2 - odd
+            i1 = (odd + 1) % 3
+            i2 = (odd + 2) % 3
+            print ["L=", L, odd, i1, i2, is90, tolerance]
             print UB
-            for i in range(0,3):
-                UB[i,i1]=-1*UB[i,i1]
-                UB[i,i2]=-1*UB[i,i2]
+            for i in range(0, 3):
+                UB[i, i1] = -1 * UB[i, i1]
+                UB[i, i2] = -1 * UB[i, i2]
             print UB
             done = 1
         return UB
 
+    def getPeaks(self, _Inst, UB, error, Npeaks):
 
-
-
-
-
-
-    def getPeaks( self,Inst,UB, error,Npeaks):
-
-        CreatePeaksWorkspace(InstrumentWorkspace="Sws",NumberOfPeaks=0,OutputWorkspace="Peaks")
-        Peaks=mtd["Peaks"]
-
+        CreatePeaksWorkspace(InstrumentWorkspace="Sws", NumberOfPeaks=0, OutputWorkspace="Peaks")
+        Peaks = mtd["Peaks"]
 
         MinAbsQ = 100000000
-        UBi= matrix([[0.0,0.0,0.0],[0.0,0.0,0.0],[0.0,0.0,0.0]])
+        UBi = matrix([[0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]])
 
         for ii in range(3):
-            for jj in range(ii,3):
+            for jj in range(ii, 3):
 
-                UBi = UB[ii,jj]
-                if  math.fabs( UBi ) < MinAbsQ  and  UBi !=0:
-                    MinAbsQ =  math.fabs(UBi )
+                UBi = UB[ii, jj]
+                if math.fabs(UBi) < MinAbsQ and UBi != 0:
+                    MinAbsQ = math.fabs(UBi)
 
-        hkl=matrix([[0.0],[0.0],[0.0]])
+        hkl = matrix([[0.0], [0.0], [0.0]])
 
-        Error = error*MinAbsQ
-        npeaks=0
+        Error = error * MinAbsQ
+        npeaks = 0
 
-
-        a1= hkl[0,0]
-        a2=hkl[1,0]
-        a3=hkl[2,0]
+        a1 = hkl[0, 0]
+        a2 = hkl[1, 0]
+        a3 = hkl[2, 0]
         done = False
         while not done:
 
-
-            Qs = (UB*hkl)
-            Qs=Qs*(2*math.pi)
+            Qs = (UB * hkl)
+            Qs *= 2 * math.pi
 
             for qs in range(3):
-                Qs[qs,0] = self.Perturb(Qs[qs,0],Error)
-
-
+                Qs[qs, 0] = self.Perturb(Qs[qs, 0], Error)
 
-            if( Qs is not None  and  Qs[2,0] > 0):
-	       #QQ= numpy.array([Qs[0,0],Qs[1,0],Qs[2,0]])
-                QQ = mantid.kernel.V3D(Qs[0,0],Qs[1,0],Qs[2,0])
+            if Qs is not None and Qs[2, 0] > 0:
+                # QQ= numpy.array([Qs[0,0],Qs[1,0],Qs[2,0]])
+                QQ = mantid.kernel.V3D(Qs[0, 0], Qs[1, 0], Qs[2, 0])
                 norm = QQ.norm()
 
+                if .3 < norm < 30:
+                    peak = Peaks.createPeak(QQ, 1.0)
 
-                if norm>.3 and   norm < 30:
-                    peak =Peaks.createPeak(  QQ, 1.0)
-
-                    peak.setQLabFrame(mantid.kernel.V3D(Qs[0,0],Qs[1,0],Qs[2,0]),1.0)
+                    peak.setQLabFrame(mantid.kernel.V3D(Qs[0, 0], Qs[1, 0], Qs[2, 0]), 1.0)
 
                     Peaks.addPeak(peak)
-                    npeaks = npeaks+1
-
+                    npeaks += 1
 
-            hkl = self.Next( hkl)
-            if npeaks>= Npeaks:
-                done =True
-            if math.fabs(hkl[0,0])>15:
+            hkl = self.Next(hkl)
+            if npeaks >= Npeaks:
                 done = True
-            if  math.fabs(hkl[1,0])>15:
+            if math.fabs(hkl[0, 0]) > 15:
                 done = True
-            if math.fabs(hkl[2,0])>15:
+            if math.fabs(hkl[1, 0]) > 15:
+                done = True
+            if math.fabs(hkl[2, 0]) > 15:
                 done = True
-
-
 
         return Peaks
 
-
-    def newSetting( self, side1,side2,Xtal,Center,ang, i1,i2a):
-        C=Center
-        if Center =='A' or Center =='B' or Center=='C':
-            C='C'
-        if  Xtal=='O':
-            if   ang>20 or i1>0 or i2a >1:
+    def newSetting(self, side1, side2, Xtal, Center, ang, i1, i2a):
+        C = Center
+        if Center == 'A' or Center == 'B' or Center == 'C':
+            C = 'C'
+        if Xtal == 'O':
+            if ang > 20 or i1 > 0 or i2a > 1:
                 return False
-            elif (side1==0 and side2 !=0) and (C=='F' or C=='C'):#No Tetragonal "F" or C Center
+            elif (side1 == 0 and side2 != 0) and (C == 'F' or C == 'C'):  # No Tetragonal "F" or C Center
                 return False
-            elif (C=='F'or C=='C') and ( side1==side2 and side1 !=0):
+            elif (C == 'F' or C == 'C') and (side1 == side2 and side1 != 0):
                 return False
             else:
                 return True
 
-        if Xtal=='H':
-            if ang > 20 or i2a>1 or not(C=='P' or C=='I'):
+        if Xtal == 'H':
+            if ang > 20 or i2a > 1 or not (C == 'P' or C == 'I'):
                 return False
-            elif side2>side1:
+            elif side2 > side1:
                 return False
             else:
                 return True
 
-        if  Xtal!='M':
+        if Xtal != 'M':
             return False
         return True
 
-    def MonoClinicRearrange(self, Sides,Xtal,Center, i1,i2a):
-        i1q =i1
-        i2q = (i1+i2a)%3
-        i3q=(i2q+1)%3
-        if  i1q==i3q:
-            i3q = (i3q+1)%3
+    def MonoClinicRearrange(self, Sides, _Xtal, _Center, i1, i2a):
+        i1q = i1
+        i2q = (i1 + i2a) % 3
+        i3q = (i2q + 1) % 3
+        if i1q == i3q:
+            i3q = (i3q + 1) % 3
         a = Sides[i1q]
-        b= Sides[ i2q]
+        b = Sides[i2q]
         c = Sides[i3q]
 
-        return [a,b,c]
+        return [a, b, c]
 
-    def getMatrixAxis( self,v, Xtal):
-        ident= matrix([[1.0,0.0,0.0],[0.0,1.0,0.0],[0.0,0.0,1.0]])
-        if Xtal !='H' or v>=2:
+    def getMatrixAxis(self, v, Xtal):
+        ident = matrix([[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]])
+        if Xtal != 'H' or v >= 2:
             return ident
-        ident[v,v] =0
-        ident[2,2] =0
-        v1= 2
-        ident[v,v1] =1
-        ident[v1,v] =1
+        ident[v, v] = 0
+        ident[2, 2] = 0
+        v1 = 2
+        ident[v, v1] = 1
+        ident[v1, v] = 1
         return ident
 
-    def getLat( self, UB):
-        G=UB.T*UB
-        G1=G.I
-        Res=[math.sqrt(G1[0,0]),math.sqrt(G1[1,1]),math.sqrt(G1[2,2])]
-        Res.append(math.acos( G1[1,2]/Res[1]/Res[2])*180.0/math.pi)
-        Res.append(math.acos( G1[0,2]/Res[0]/Res[2])*180.0/math.pi)
-        Res.append(math.acos( G1[0,1]/Res[0]/Res[1])*180.0/math.pi)
+    def getLat(self, UB):
+        G = UB.T * UB
+        G1 = G.I
+        Res = [math.sqrt(G1[0, 0]), math.sqrt(G1[1, 1]), math.sqrt(G1[2, 2]),
+               math.acos(G1[1, 2] / Res[1] / Res[2]) * 180.0 / math.pi,
+               math.acos(G1[0, 2] / Res[0] / Res[2]) * 180.0 / math.pi,
+               math.acos(G1[0, 1] / Res[0] / Res[1]) * 180.0 / math.pi]
         return Res
 
-
-    def AppendForms( self, condition, Center,CenterTarg, FormNums, List2Append):
-        L= List2Append
+    def AppendForms(self, condition, Center, CenterTarg, FormNums, List2Append):
+        L = List2Append
         if condition and Center != CenterTarg:
             for i in range(len(FormNums)):
                 L.append(FormNums[i])
-        elif Center ==CenterTarg:
+        elif Center == CenterTarg:
             for i in range(len(FormNums)):
                 L.append(FormNums[i])
         return L
 
-    def Xlate(self,Xtal,Center,sides,LatNiggle): #sides are sides of conventional cell
-        if Xtal=='O':
-            C=Center
+    def Xlate(self, Xtal, Center, sides, LatNiggle):  # sides are sides of conventional cell
+        if Xtal == 'O':
+            C = Center
             if sides[0] == sides[1]:
-                if sides[1]==sides[2]:
-                    X="Cubic"
-                    Z1=list(self.Cubic)
+                if sides[1] == sides[2]:
+                    X = "Cubic"
+                    Z1 = list(self.Cubic)
                 else:
-                    X="Tetragonal"
-                    Z1=list(self.Tetr)
-            elif sides[0]==sides[2]:
-                X="Tetragonal"
-                Z1=list(self.Tetr)
-            elif  sides[1]==sides[2]:
-                X="Tetragonal"
-                Z1=list(self.Tetr)
+                    X = "Tetragonal"
+                    Z1 = list(self.Tetr)
+            elif sides[0] == sides[2]:
+                X = "Tetragonal"
+                Z1 = list(self.Tetr)
+            elif sides[1] == sides[2]:
+                X = "Tetragonal"
+                Z1 = list(self.Tetr)
             else:
-                X="Orthorhombic"
-                Z1=list(self.Orth)
+                X = "Orthorhombic"
+                Z1 = list(self.Orth)
 
-            if C=='A' or C =='B':
-                C ='C'
+            if C == 'A' or C == 'B':
+                C = 'C'
 
-        elif Xtal=='H':
-            if Center =='I':
-                C ='R'
-                X='Rhombohedral'
-                Z1=list(self.Hex)
+        elif Xtal == 'H':
+            if Center == 'I':
+                C = 'R'
+                X = 'Rhombohedral'
+                Z1 = list(self.Hex)
             else:
-                C='P'
-                X="Hexagonal"
-                Z1=list(self.Hex)
-        else:#Monoclinic
-            X="Monoclinic"
-            Z1=list(self.Mon)
-            C=Center
-            LL=[math.cos(LatNiggle[5]/180*math.pi)*LatNiggle[0]*LatNiggle[1], math.cos(LatNiggle[4]/180*math.pi)*LatNiggle[0]*LatNiggle[2],math.cos(LatNiggle[3]/180*math.pi)*LatNiggle[2]*LatNiggle[1]]
-
-            if C=='A' or C =='B':
-                C ='C'
-
-            if C=='C' or C=='I':#'I':
-
-                Z1=self.AppendForms( LatNiggle[2]*LatNiggle[2]<4*math.fabs(LL[2])+.001, 'C',C,[10,14,39], Z1)
-                Z1=self.AppendForms( LatNiggle[0]*LatNiggle[0]<4*math.fabs(LL[1])+.001, 'C',C,[20,25,41], Z1)
-
-                Z1=self.AppendForms( LatNiggle[1]*LatNiggle[1]<4*math.fabs(LL[2]+.001), 'C',C,[37], Z1)
-
-                Z1=self.AppendForms( 3*LatNiggle[0]*LatNiggle[0] < LatNiggle[2]*LatNiggle[2]+2*math.fabs(LL[1])+.001, 'I',C,[17], Z1)
-                Z1=self.AppendForms( 3*LatNiggle[1]*LatNiggle[1]<  LatNiggle[2]*LatNiggle[2]+2*math.fabs(LL[2]+.001), 'I',C,[27], Z1)
-
-        if  C=='P':
-            Z2=self.CentP
-        elif C=='F':
-            Z2=self.CentF
-        elif C=='I' or C=='R':
-            Z2=self.CentI
-        elif C=='C':
-            Z2=self.CentC
-        Z1=sorted(Z1)
-        return [X,C, Z1, Z2]
-
-
-
-    def MatchXtlparams( self, List1a, List2, tolerance, message):
-        List1=List1a
-
-
-        self.assertEqual(len(List1a),6,"Not the correct number of Xtal parameters."+message)
-        self.assertEqual(len(List2),6,"Not the correct number of Xtal parameters."+message)
-        Var=["a","b","c","alpha","beta","gamma"]
-        self.assertDelta( List1[0],List2[0],tolerance, message +"for "+Var[0])
-        self.assertDelta( List1[1],List2[1],tolerance, message +"for "+Var[1])
-        self.assertDelta( List1[2],List2[2],tolerance, message +"for "+Var[2])
-        angtolerance = tolerance*180/math.pi
-        if List1[3]<90 and List2[3]>=90:
-            List1[3]= 180-List1[3]
-            List1[4]= 180-List1[4]
-            List1[5]= 180-List1[5]
-
-
-        if List1[0] >List1[1]-tolerance:
-            if List1[1]>List1[2]-tolerance:   # 3 equal sides
+                C = 'P'
+                X = "Hexagonal"
+                Z1 = list(self.Hex)
+        else:  # Monoclinic
+            X = "Monoclinic"
+            Z1 = list(self.Mon)
+            C = Center
+            LL = [math.cos(LatNiggle[5] / 180 * math.pi) * LatNiggle[0] * LatNiggle[1],
+                  math.cos(LatNiggle[4] / 180 * math.pi) * LatNiggle[0] * LatNiggle[2],
+                  math.cos(LatNiggle[3] / 180 * math.pi) * LatNiggle[2] * LatNiggle[1]]
+
+            if C == 'A' or C == 'B':
+                C = 'C'
+
+            if C == 'C' or C == 'I':  # 'I':
+
+                Z1 = self.AppendForms(LatNiggle[2] * LatNiggle[2] < 4 * math.fabs(LL[2]) + .001, 'C', C, [10, 14, 39],
+                                      Z1)
+                Z1 = self.AppendForms(LatNiggle[0] * LatNiggle[0] < 4 * math.fabs(LL[1]) + .001, 'C', C, [20, 25, 41],
+                                      Z1)
+
+                Z1 = self.AppendForms(LatNiggle[1] * LatNiggle[1] < 4 * math.fabs(LL[2] + .001), 'C', C, [37], Z1)
+
+                Z1 = self.AppendForms(
+                    3 * LatNiggle[0] * LatNiggle[0] < LatNiggle[2] * LatNiggle[2] + 2 * math.fabs(LL[1]) + .001, 'I', C,
+                    [17], Z1)
+                Z1 = self.AppendForms(
+                    3 * LatNiggle[1] * LatNiggle[1] < LatNiggle[2] * LatNiggle[2] + 2 * math.fabs(LL[2] + .001), 'I', C,
+                    [27], Z1)
+
+        if C == 'P':
+            Z2 = self.CentP
+        elif C == 'F':
+            Z2 = self.CentF
+        elif C == 'I' or C == 'R':
+            Z2 = self.CentI
+        elif C == 'C':
+            Z2 = self.CentC
+        Z1 = sorted(Z1)
+        return [X, C, Z1, Z2]
+
+    def MatchXtlparams(self, List1a, List2, tolerance, message):
+        List1 = List1a
+
+        self.assertEqual(len(List1a), 6, "Not the correct number of Xtal parameters." + message)
+        self.assertEqual(len(List2), 6, "Not the correct number of Xtal parameters." + message)
+        Var = ["a", "b", "c", "alpha", "beta", "gamma"]
+        self.assertDelta(List1[0], List2[0], tolerance, message + "for " + Var[0])
+        self.assertDelta(List1[1], List2[1], tolerance, message + "for " + Var[1])
+        self.assertDelta(List1[2], List2[2], tolerance, message + "for " + Var[2])
+        angtolerance = tolerance * 180 / math.pi
+        if List1[3] < 90 and List2[3] >= 90:
+            List1[3] = 180 - List1[3]
+            List1[4] = 180 - List1[4]
+            List1[5] = 180 - List1[5]
+
+        if List1[0] > List1[1] - tolerance:
+            if List1[1] > List1[2] - tolerance:  # 3 equal sides
                 match = False
 
-                i=0
-
-                for i in range(0,3):
-                    match= math.fabs(List1[3]-List2[3])<angtolerance and  math.fabs(List1[4]-List2[4])<angtolerance and  math.fabs(List1[5]-List2[5])<angtolerance
+                _i = 0
+                for _i in range(0, 3):
+                    match = math.fabs(List1[3] - List2[3]) < angtolerance and math.fabs(
+                        List1[4] - List2[4]) < angtolerance and math.fabs(List1[5] - List2[5]) < angtolerance
 
                     if match:
                         break
-                    List1=self.XchangeSides( List1,1,0)
+                    List1 = self.XchangeSides(List1, 1, 0)
 
-                    match= math.fabs(List1[3]-List2[3])<angtolerance and  math.fabs(List1[4]-List2[4])<angtolerance and  math.fabs(List1[5]-List2[5])<angtolerance
+                    match = math.fabs(List1[3] - List2[3]) < angtolerance and math.fabs(
+                        List1[4] - List2[4]) < angtolerance and math.fabs(List1[5] - List2[5]) < angtolerance
                     if match:
                         break
 
-                    List1=self.XchangeSides( List1,1,2)
+                    List1 = self.XchangeSides(List1, 1, 2)
 
-                match= math.fabs(List1[3]-List2[3])<angtolerance and  math.fabs(List1[4]-List2[4])<angtolerance and  math.fabs(List1[5]-List2[5])<angtolerance
-                self.assertTrue( match,"Angles do not match in any order")
+                match = math.fabs(List1[3] - List2[3]) < angtolerance and math.fabs(
+                    List1[4] - List2[4]) < angtolerance and math.fabs(List1[5] - List2[5]) < angtolerance
+                self.assertTrue(match, "Angles do not match in any order")
             else:
-                self.assertDelta( List1[5],List2[5],angtolerance,"Error in "+Var[5])
-                if math.fabs(List1[3]-List2[3])>angtolerance:
-                    List1 = self.XchangeSides( List1,0,1)
-                self.assertDelta( List1[3],List2[3],angtolerance,"Error in "+Var[3])
-                self.assertDelta( List1[4],List2[4],angtolerance,"Error in "+Var[4])
-        elif List1[1]> List1[2]-tolerance:
-            self.assertDelta(List1[3],List2[3],angtolerance,"Error in "+Var[3])
-            if math.fabs(List1[4]-List2[4])>angtolerance:
-                List1= self.XchangeSides(List1,1,2)
-
-            self.assertDelta(List1[4],List2[4],angtolerance,"Error in "+Var[5])
-
-            self.assertDelta(List1[5],List2[5],angtolerance,"Error in "+Var[5])
+                self.assertDelta(List1[5], List2[5], angtolerance, "Error in " + Var[5])
+                if math.fabs(List1[3] - List2[3]) > angtolerance:
+                    List1 = self.XchangeSides(List1, 0, 1)
+                self.assertDelta(List1[3], List2[3], angtolerance, "Error in " + Var[3])
+                self.assertDelta(List1[4], List2[4], angtolerance, "Error in " + Var[4])
+        elif List1[1] > List1[2] - tolerance:
+            self.assertDelta(List1[3], List2[3], angtolerance, "Error in " + Var[3])
+            if math.fabs(List1[4] - List2[4]) > angtolerance:
+                List1 = self.XchangeSides(List1, 1, 2)
+
+            self.assertDelta(List1[4], List2[4], angtolerance, "Error in " + Var[5])
+
+            self.assertDelta(List1[5], List2[5], angtolerance, "Error in " + Var[5])
         else:
-            self.assertDelta(List1[3],List2[3],angtolerance,"Error in "+Var[3])
-
-            self.assertDelta(List1[4],List2[4],angtolerance,"Error in "+Var[5])
+            self.assertDelta(List1[3], List2[3], angtolerance, "Error in " + Var[3])
 
-            self.assertDelta(List1[5],List2[5],angtolerance,"Error in "+Var[5])
+            self.assertDelta(List1[4], List2[4], angtolerance, "Error in " + Var[5])
 
+            self.assertDelta(List1[5], List2[5], angtolerance, "Error in " + Var[5])
 
-    def XchangeSides( self, Lat1, s1,s2):
-        Lat=list(Lat1)
-        if s1<0 or s2<0 or s1>=3 or s2>2 or s1==s2:
+    def XchangeSides(self, Lat1, s1, s2):
+        Lat = list(Lat1)
+        if s1 < 0 or s2 < 0 or s1 >= 3 or s2 > 2 or s1 == s2:
             return Lat
-        sav=Lat[s1]
-        Lat[s1]=Lat[s2]
-        Lat[s2]=sav
-        sav=Lat[s1+3]
-        Lat[s1+3]=Lat[s2+3]
-        Lat[s2+3]=sav
+        sav = Lat[s1]
+        Lat[s1] = Lat[s2]
+        Lat[s2] = sav
+        sav = Lat[s1 + 3]
+        Lat[s1 + 3] = Lat[s2 + 3]
+        Lat[s2 + 3] = sav
 
         return Lat
 
-    def GetConvCell( self,Peaks,XtalCenter1,wsName, nOrigIndexed,tolerance,matchLat):
-
-        CopySample(Peaks,wsName,CopyMaterial="0",CopyEnvironment="0",CopyName="0",CopyShape="0",CopyLattice="1")
-        OrLat= mtd[wsName].sample().getOrientedLattice()
-        Lat1= [OrLat.a(),OrLat.b(),OrLat.c(),OrLat.alpha(),OrLat.beta(),OrLat.gamma()]
-        FormXtal=XtalCenter1[2]
-        FormCenter= XtalCenter1[3]
-        i1=0
-        i2=0
-        Lat0= self.FixLatParams( matchLat)
-        Lat1= self.FixLatParams( Lat1)
-       # print "--------------------- Getting the Conventional Cell for--------------------------------"
-       # print Lat1
-       # print Lat0
-       # print [FormXtal,FormCenter]
-        angTolerance = tolerance*180/math.pi
-        while i1< len(FormXtal) and i2 < len(FormCenter):
-            if FormXtal[i1]<FormCenter[i2]:
-                i1=i1+1
-            elif FormXtal[i1]>FormCenter[i2]:
-                i2=i2+1
+    def GetConvCell(self, Peaks, XtalCenter1, wsName, nOrigIndexed, tolerance, matchLat):
+
+        CopySample(Peaks, wsName, CopyMaterial="0", CopyEnvironment="0", CopyName="0", CopyShape="0", CopyLattice="1")
+        OrLat = mtd[wsName].sample().getOrientedLattice()
+        Lat1 = [OrLat.a(), OrLat.b(), OrLat.c(), OrLat.alpha(), OrLat.beta(), OrLat.gamma()]
+        FormXtal = XtalCenter1[2]
+        FormCenter = XtalCenter1[3]
+        i1 = 0
+        i2 = 0
+        Lat0 = self.FixLatParams(matchLat)
+        Lat1 = self.FixLatParams(Lat1)
+        # print "--------------------- Getting the Conventional Cell for--------------------------------"
+        # print Lat1
+        # print Lat0
+        # print [FormXtal,FormCenter]
+        angTolerance = tolerance * 180 / math.pi
+        while i1 < len(FormXtal) and i2 < len(FormCenter):
+            if FormXtal[i1] < FormCenter[i2]:
+                i1 = i1 + 1
+            elif FormXtal[i1] > FormCenter[i2]:
+                i2 = i2 + 1
             else:
-                Res=SelectCellWithForm(Peaks, FormXtal[i1],True)
+                Res = SelectCellWithForm(Peaks, FormXtal[i1], True)
 
-                if Res[0] > .85* nOrigIndexed:
-                    CopySample(Peaks,"Temp",CopyMaterial="0",CopyEnvironment="0",CopyName="0",CopyShape="0",CopyLattice="1")
-                    OrLat= mtd["Temp"].sample().getOrientedLattice()
-                    Lat1= [OrLat.a(),OrLat.b(),OrLat.c(),OrLat.alpha(),OrLat.beta(),OrLat.gamma()]
+                if Res[0] > .85 * nOrigIndexed:
+                    CopySample(Peaks, "Temp", CopyMaterial="0", CopyEnvironment="0", CopyName="0", CopyShape="0",
+                               CopyLattice="1")
+                    OrLat = mtd["Temp"].sample().getOrientedLattice()
+                    Lat1 = [OrLat.a(), OrLat.b(), OrLat.c(), OrLat.alpha(), OrLat.beta(), OrLat.gamma()]
                     Lat1 = self.FixLatParams(Lat1)
-                    print ["Formnum,Lat1,Lat0",FormXtal[i1],Lat1,Lat0]
-                    if  math.fabs(Lat0[0]-Lat1[0])<tolerance and math.fabs(Lat0[1]-Lat1[1])<tolerance and math.fabs(Lat0[2]-Lat1[2])<tolerance:
+                    print ["Formnum,Lat1,Lat0", FormXtal[i1], Lat1, Lat0]
+                    if math.fabs(Lat0[0] - Lat1[0]) < tolerance and math.fabs(Lat0[1] - Lat1[1]) < tolerance \
+                            and math.fabs(Lat0[2] - Lat1[2]) < tolerance:
 
                         for dummy_i in range(3):
-                            if math.fabs(Lat0[3]-Lat1[3])<angTolerance and math.fabs(Lat0[4]-Lat1[4])<angTolerance and math.fabs(Lat0[5]-Lat1[5])<angTolerance:
+                            if math.fabs(Lat0[3] - Lat1[3]) < angTolerance and\
+                                            math.fabs(Lat0[4] - Lat1[4]) < angTolerance and\
+                                            math.fabs(Lat0[5] - Lat1[5]) < angTolerance:
                                 break
-                            if Lat1[0]>Lat1[1]-tolerance:
-                                Lat1=self.XchangeSides( Lat1,0,1)
+                            if Lat1[0] > Lat1[1] - tolerance:
+                                Lat1 = self.XchangeSides(Lat1, 0, 1)
 
-                            if math.fabs(Lat0[3]-Lat1[3])<angTolerance and math.fabs(Lat0[4]-Lat1[4])<angTolerance and math.fabs(Lat0[5]-Lat1[5])<angTolerance:
+                            if math.fabs(Lat0[3] - Lat1[3]) < angTolerance and\
+                                            math.fabs(Lat0[4] - Lat1[4]) < angTolerance and\
+                                math.fabs(Lat0[5] - Lat1[5]) < angTolerance:
                                 break
-                            if Lat1[1]>Lat1[2]- tolerance:
-                                Lat1=self.XchangeSides( Lat1,1,2)
+                            if Lat1[1] > Lat1[2] - tolerance:
+                                Lat1 = self.XchangeSides(Lat1, 1, 2)
 
-                            if math.fabs(Lat0[3]-Lat1[3])<angTolerance and math.fabs(Lat0[4]-Lat1[4])<angTolerance and math.fabs(Lat0[5]-Lat1[5])<angTolerance:
+                            if math.fabs(Lat0[3] - Lat1[3]) < angTolerance and\
+                                            math.fabs(Lat0[4] - Lat1[4]) < angTolerance and\
+                                            math.fabs(Lat0[5] - Lat1[5]) < angTolerance:
                                 break
 
-                        if math.fabs(Lat0[3]-Lat1[3])<angTolerance and math.fabs(Lat0[4]-Lat1[4])<angTolerance and math.fabs(Lat0[5]-Lat1[5])<angTolerance:
+                        if math.fabs(Lat0[3] - Lat1[3]) < angTolerance and\
+                                        math.fabs(Lat0[4] - Lat1[4]) < angTolerance and\
+                                        math.fabs(Lat0[5] - Lat1[5]) < angTolerance:
                             return Lat1
-                    i1=i1+1
-                    i2=i2+1
-                    CopySample(wsName, Peaks,CopyMaterial="0",CopyEnvironment="0",CopyName="0",CopyShape="0",CopyLattice="1")
+                    i1 = i1 + 1
+                    i2 = i2 + 1
+                    CopySample(wsName, Peaks, CopyMaterial="0", CopyEnvironment="0", CopyName="0", CopyShape="0",
+                               CopyLattice="1")
         return []
 
-
-
     def runTest(self):
 
-        CreateSingleValuedWorkspace(OutputWorkspace="Sws",DataValue="3")
+        CreateSingleValuedWorkspace(OutputWorkspace="Sws", DataValue="3")
 
-        CreateSingleValuedWorkspace(OutputWorkspace="Temp",DataValue="3")
-        LoadInstrument(Workspace="Sws",InstrumentName="TOPAZ", RewriteSpectraMap=True)
-        Inst= mtd["Sws"].getInstrument()
+        CreateSingleValuedWorkspace(OutputWorkspace="Temp", DataValue="3")
+        LoadInstrument(Workspace="Sws", InstrumentName="TOPAZ", RewriteSpectraMap=True)
+        Inst = mtd["Sws"].getInstrument()
         startA = 2
-        side1Ratios =[1.0, 1.2,  3.0,  8.0]
-        alphas =[20,50,80,110,140]
-        xtal=['O','M','H']#['O','M','H']
-        centerings = ['P','I','F','A', 'B',  'C']
-      #['P','I','F','A', 'B',  'C']
-        error=[0.0] #[ 0, .05,  0.1, 0, 0.15]
-        Npeaks=150
+        side1Ratios = [1.0, 1.2, 3.0, 8.0]
+        alphas = [20, 50, 80, 110, 140]
+        xtal = ['O', 'M', 'H']  # ['O','M','H']
+        centerings = ['P', 'I', 'F', 'A', 'B', 'C']
+        # ['P','I','F','A', 'B',  'C']
+        error = [0.0]  # [ 0, .05,  0.1, 0, 0.15]
+        Npeaks = 150
         for Error in error:
-            for side1 in range(0,4):#make (0,4)
-                for side2 in range(side1,4):#make side1,4
+            for side1 in range(0, 4):  # make (0,4)
+                for side2 in range(side1, 4):  # make side1,4
                     for Xtal in xtal:
                         for Center in centerings:
                             for ang in alphas:
                                 for i1 in range(3):
-                                    for i2a in range(1,3):
-                                        if self.newSetting( side1,side2,Xtal,Center,ang, i1,i2a):
+                                    for i2a in range(1, 3):
+                                        if self.newSetting(side1, side2, Xtal, Center, ang, i1, i2a):
                                             print "============================================================="
-                                            Sides=[startA, startA*side1Ratios[side1],startA*side1Ratios[side2]]
-                                            Sides= self.MonoClinicRearrange( Sides,Xtal,Center,i1,i2a)
-                                            print [Sides,Error,Xtal,Center,ang,i1,i2a]
+                                            Sides = [startA, startA * side1Ratios[side1], startA * side1Ratios[side2]]
+                                            Sides = self.MonoClinicRearrange(Sides, Xtal, Center, i1, i2a)
+                                            print [Sides, Error, Xtal, Center, ang, i1, i2a]
 
-                                            UBconv= self.CalcConventionalUB(Sides[0],Sides[1],Sides[2],ang,ang,ang,Xtal)
+                                            UBconv = self.CalcConventionalUB(Sides[0], Sides[1], Sides[2], ang, ang,
+                                                                             ang, Xtal)
 
-                                            UBnig= self.CalcNiggliUB(Sides[0],Sides[1],Sides[2],ang,ang,ang,Xtal,Center)
+                                            UBnig = self.CalcNiggliUB(Sides[0], Sides[1], Sides[2], ang, ang, ang, Xtal,
+                                                                      Center)
 
                                             UBconv = self.conventionalUB
-                                            V =self.getMatrixAxis( i1,Xtal)
-                                            if  UBconv == None:
+                                            V = self.getMatrixAxis(i1, Xtal)
+                                            if UBconv == None:
                                                 continue
-                                            if UBnig==None:
+                                            if UBnig == None:
                                                 continue
-                                            UBnig= V*UBnig
-                                            UBconv = V*UBconv
-                  #UBnig1= self.FixUB(UBnig,.05)
+                                            UBnig = V * UBnig
+                                            UBconv = V * UBconv
+                                            # UBnig1= self.FixUB(UBnig,.05)
                                             UBnig = self.FixUpPlusMinus(UBnig)
-                                            UBconv= self.FixUpPlusMinus(UBconv)
-                                            Lat0= self.getLat(UBnig)
+                                            UBconv = self.FixUpPlusMinus(UBconv)
+                                            Lat0 = self.getLat(UBnig)
 
+                                            Lat0 = self.FixLatParams(Lat0)
+                                            print ["UBnig", UBnig, Lat0]
 
+                                            Peaks = self.getPeaks(Inst, UBnig, Error, Npeaks + Error * 300)
 
-                                            Lat0=self.FixLatParams(Lat0)
-                                            print ["UBnig",UBnig,Lat0]
+                                            # -------Failed tests because of FindUBUsingFFT -------------------
 
-                                            Peaks=self.getPeaks(Inst,UBnig, Error,Npeaks +Error*300)
-
-                  #------------------------Failed tests because of FindUBUsingFFT ------------------------------------
-
-                                            if side1==1 and side2==2 and Error==0.0 and Xtal=='M' and Center=='C' and i1==0 and i2a==1 and ang==140:
+                                            if side1 == 1 and side2 == 2 and Error == 0.0 and Xtal == 'M' and \
+                                                            Center == 'C' and i1 == 0 and i2a == 1 and ang == 140:
                                                 continue
 
-                                            if side1==2 and side2==2 and Error==0.0 and Xtal=='M' and Center=='P' and i1==1 and i2a==1 and ang==110:
-                                                continue # one side doubled
+                                            if side1 == 2 and side2 == 2 and Error == 0.0 and Xtal == 'M' and\
+                                                            Center == 'P' and i1 == 1 and i2a == 1 and ang == 110:
+                                                continue  # one side doubled
 
-                                            if side1==3 and side2==3 and Error==0.0 and Xtal=='M' and Center=='I' and i1 == 1 and i2a==2 :
+                                            if side1 == 3 and side2 == 3 and Error == 0.0 and Xtal == 'M' and\
+                                                            Center == 'I' and i1 == 1 and i2a == 2:
                                                 continue
 
-                                            if side1==3 and side2==3 and Error==0.0 and Xtal=='M' and Center=='I' and i1 == 2 and i2a==1 :
+                                            if side1 == 3 and side2 == 3 and Error == 0.0 and Xtal == 'M' and\
+                                                            Center == 'I' and i1 == 2 and i2a == 1:
                                                 continue
 
-                                            if side1==3 and side2==3 and Error==0.0 and Xtal=='H' and Center=='I' and i1 == 2 and i2a==1  and ang==20:
+                                            if side1 == 3 and side2 == 3 and Error == 0.0 and Xtal == 'H' and\
+                                                            Center == 'I' and i1 == 2 and i2a == 1 and ang == 20:
                                                 continue
-                  #------------------------------ end Failed FindUB test----------------------------
-                                            FindUBUsingFFT(Peaks,Lat0[0]*.5,Lat0[2]*2.0,.15)
-                                            InPks=IndexPeaks(Peaks,.10)
-
+                                                # ------------------------------ end Failed FindUB test------------
+                                            FindUBUsingFFT(Peaks, Lat0[0] * .5, Lat0[2] * 2.0, .15)
+                                            InPks = IndexPeaks(Peaks, .10)
 
-                                            CopySample(Peaks,"Sws",CopyMaterial="0",
-                                                       CopyEnvironment="0",CopyName="0",CopyShape="0",CopyLattice="1")
-                                            OrLat= mtd["Sws"].sample().getOrientedLattice()
+                                            CopySample(Peaks, "Sws", CopyMaterial="0",
+                                                       CopyEnvironment="0", CopyName="0", CopyShape="0",
+                                                       CopyLattice="1")
+                                            OrLat = mtd["Sws"].sample().getOrientedLattice()
 
-                                            Lat1= [OrLat.a(),OrLat.b(),OrLat.c(),OrLat.alpha(),OrLat.beta(),OrLat.gamma()]
+                                            Lat1 = [OrLat.a(), OrLat.b(), OrLat.c(), OrLat.alpha(), OrLat.beta(),
+                                                    OrLat.gamma()]
 
-                                            Lat1=self.FixLatParams(Lat1)
+                                            Lat1 = self.FixLatParams(Lat1)
 
-                                            MatchXtalTol= .03*(1+4*Error)*(side1Ratios[side2])
+                                            MatchXtalTol = .03 * (1 + 4 * Error) * (side1Ratios[side2])
                                             print Lat0
                                             print Lat1
-                                            self.MatchXtlparams( Lat1, Lat0, MatchXtalTol, "Niggli values do not match")
+                                            self.MatchXtlparams(Lat1, Lat0, MatchXtalTol, "Niggli values do not match")
 
 
-                  #Now see if the conventional cell is in list
-                                            XtalCenter1= self.Xlate(Xtal,Center,Sides,Lat0) #get proper strings for SelectCellOfType
+                                            # Now see if the conventional cell is in list
+                                            XtalCenter1 = self.Xlate(Xtal, Center, Sides,
+                                                                     Lat0)  # get proper strings for SelectCellOfType
 
-                                            Lat0= self.getLat(UBconv)
-                                            Lat0=self.FixLatParams(Lat0)
-                                            Lat1 = self.GetConvCell( Peaks,XtalCenter1,"Sws",InPks[0],MatchXtalTol,Lat0)
+                                            Lat0 = self.getLat(UBconv)
+                                            Lat0 = self.FixLatParams(Lat0)
+                                            Lat1 = self.GetConvCell(Peaks, XtalCenter1, "Sws", InPks[0], MatchXtalTol,
+                                                                    Lat0)
 
+                                            Lat1 = self.FixLatParams(Lat1)
 
-                                            Lat1=self.FixLatParams(Lat1)
+                                            self.MatchXtlparams(Lat1, Lat0, MatchXtalTol,
+                                                                "Conventional lattice parameter do not match")
+                                            self.assertTrue(len(Lat1) > 4, "Conventional values do not match")
+                                            # "XYXYZS"
 
-                                            self.MatchXtlparams( Lat1, Lat0, MatchXtalTol, "Conventional lattice parameter do not match")
-                                            self.assertTrue( len(Lat1)>4,"Conventional values do not match")
-     #"XYXYZS"
     def requiredFiles(self):
         return []
diff --git a/Testing/SystemTests/tests/analysis/UserAlgotithmsBuild.py b/Testing/SystemTests/tests/analysis/UserAlgotithmsBuild.py
deleted file mode 100644
index 3903f1b304ff2967cb19414ef7961d806127fd0f..0000000000000000000000000000000000000000
--- a/Testing/SystemTests/tests/analysis/UserAlgotithmsBuild.py
+++ /dev/null
@@ -1,42 +0,0 @@
-#pylint: disable=no-init
-import stresstesting
-import sys
-import os
-
-class UserAlgorithmsBuild(stresstesting.MantidStressTest):
-
-    build_success = False
-
-    def skipTests(self):
-        " We skip this test if the system is not Windows."
-        if sys.platform.startswith('win'):
-            return False
-        else:
-            return True
-
-    def runTest(self):
-        """
-            System test for testing that the UserAlgorithm build script works
-        """
-        # Run the build
-        import subprocess
-        retcode = subprocess.call(["C:\\MantidInstall\\UserAlgorithms\\build.bat","--quiet"])
-        if retcode == 0:
-            self.build_success = True
-        else:
-            self.build_success = False
-
-    def cleanup(self):
-        # Remove build files as they will be loaded by the next
-        # process that runs this test and it then can't remove them!
-        install_dir = r'C:\MantidInstall\plugins'
-        lib_name = 'UserAlgorithms'
-        exts = ['.dll', '.exp', '.lib']
-        for ext in exts:
-            try:
-                os.remove(os.path.join(install_dir, lib_name + ext))
-            except OSError:
-                pass
-
-    def validate(self):
-        return self.build_success
diff --git a/Testing/SystemTests/tests/analysis/reference/BASISAutoReduction.nxs.md5 b/Testing/SystemTests/tests/analysis/reference/BASISAutoReduction.nxs.md5
deleted file mode 100644
index a11d29b180180a9000db3894b36ef803ae4e2da9..0000000000000000000000000000000000000000
--- a/Testing/SystemTests/tests/analysis/reference/BASISAutoReduction.nxs.md5
+++ /dev/null
@@ -1 +0,0 @@
-ae57a75f07b36a4f934092f2c4607bfe
\ No newline at end of file
diff --git a/Testing/SystemTests/tests/analysis/reference/BASISAutoReductionReference.nxs.md5 b/Testing/SystemTests/tests/analysis/reference/BASISAutoReductionReference.nxs.md5
new file mode 100644
index 0000000000000000000000000000000000000000..ae13bc5e362d87ee5cc3407a36af04bda02d05fe
--- /dev/null
+++ b/Testing/SystemTests/tests/analysis/reference/BASISAutoReductionReference.nxs.md5
@@ -0,0 +1 @@
+c9aee0e32f07c79cb54b5f22ca81d1f4
\ No newline at end of file
diff --git a/Testing/SystemTests/tests/analysis/reference/MuonFFTMUSR00022725.nxs.md5 b/Testing/SystemTests/tests/analysis/reference/MuonFFTMUSR00022725.nxs.md5
new file mode 100644
index 0000000000000000000000000000000000000000..c7e4a87c8fe32b5eb6ab9bf2ef8d0e7133ec4d90
--- /dev/null
+++ b/Testing/SystemTests/tests/analysis/reference/MuonFFTMUSR00022725.nxs.md5
@@ -0,0 +1 @@
+a063c85be6de5178fd7e7a68ea102eb4
\ No newline at end of file
diff --git a/Vates/ParaviewPlugins/ParaViewFilters/SplatterPlot/vtkSplatterPlot.cxx b/Vates/ParaviewPlugins/ParaViewFilters/SplatterPlot/vtkSplatterPlot.cxx
index 0f8d24d273b32d82510de53c4679d1aa81080c65..d84a88fa150ef722429285cb4c640bc65db5c31c 100644
--- a/Vates/ParaviewPlugins/ParaViewFilters/SplatterPlot/vtkSplatterPlot.cxx
+++ b/Vates/ParaviewPlugins/ParaViewFilters/SplatterPlot/vtkSplatterPlot.cxx
@@ -113,7 +113,8 @@ int vtkSplatterPlot::RequestData(vtkInformation *,
 
     try
     {
-      vtkDataSetToNonOrthogonalDataSet converter(output, m_wsName);
+      auto workspaceProvider = Mantid::Kernel::make_unique<ADSWorkspaceProvider<Mantid::API::IMDWorkspace>>();
+      vtkDataSetToNonOrthogonalDataSet converter(output, m_wsName, std::move(workspaceProvider));
       converter.execute();
     }
     catch (std::invalid_argument &e)
diff --git a/Vates/ParaviewPlugins/ParaViewReaders/MDHWNexusReader/vtkMDHWNexusReader.cxx b/Vates/ParaviewPlugins/ParaViewReaders/MDHWNexusReader/vtkMDHWNexusReader.cxx
index 82cc379f6ba29c3b82ee1437100322493c052a04..40c1721a6a3d6980cd313313980dca0a0fc8a1ed 100644
--- a/Vates/ParaviewPlugins/ParaViewReaders/MDHWNexusReader/vtkMDHWNexusReader.cxx
+++ b/Vates/ParaviewPlugins/ParaViewReaders/MDHWNexusReader/vtkMDHWNexusReader.cxx
@@ -13,6 +13,7 @@
 #include "vtkBox.h"
 #include "vtkUnstructuredGrid.h"
 
+#include "MantidVatesAPI/ADSWorkspaceProvider.h"
 #include "MantidVatesAPI/TimeToTimeStep.h"
 #include "MantidVatesAPI/vtkMDHistoHex4DFactory.h"
 #include "MantidVatesAPI/vtkMDHistoHexFactory.h"
@@ -134,7 +135,8 @@ int vtkMDHWNexusReader::RequestData(vtkInformation * vtkNotUsed(request), vtkInf
 
   try
   {
-    m_presenter->makeNonOrthogonal(output);
+    auto workspaceProvider = Mantid::Kernel::make_unique<ADSWorkspaceProvider<Mantid::API::IMDWorkspace>>();
+    m_presenter->makeNonOrthogonal(output, std::move(workspaceProvider));
   }
   catch (std::invalid_argument &e)
   {
diff --git a/Vates/ParaviewPlugins/ParaViewSources/MDEWSource/vtkMDEWSource.cxx b/Vates/ParaviewPlugins/ParaViewSources/MDEWSource/vtkMDEWSource.cxx
index 2f1553d73e729b98bf3e043340cd03a7099c79ca..18a5ed1ce4666f21ad10ebe3832dc4e4fd108eb2 100644
--- a/Vates/ParaviewPlugins/ParaViewSources/MDEWSource/vtkMDEWSource.cxx
+++ b/Vates/ParaviewPlugins/ParaViewSources/MDEWSource/vtkMDEWSource.cxx
@@ -13,6 +13,7 @@
 
 #include "MantidVatesAPI/BoxInfo.h"
 #include "MantidAPI/IMDWorkspace.h"
+#include "MantidAPI/IMDEventWorkspace.h"
 #include "MantidVatesAPI/MDEWInMemoryLoadingPresenter.h"
 #include "MantidVatesAPI/MDLoadingViewAdapter.h"
 #include "MantidVatesAPI/ADSWorkspaceProvider.h"
@@ -208,7 +209,8 @@ int vtkMDEWSource::RequestData(vtkInformation *, vtkInformationVector **, vtkInf
 
     try
     {
-      m_presenter->makeNonOrthogonal(output);
+      auto workspaceProvider = Mantid::Kernel::make_unique<ADSWorkspaceProvider<Mantid::API::IMDWorkspace>>();
+      m_presenter->makeNonOrthogonal(output, std::move(workspaceProvider));
     }
     catch (std::invalid_argument &e)
     {
@@ -240,9 +242,10 @@ int vtkMDEWSource::RequestInformation(
       vtkErrorMacro(<< "Cannot fetch the specified workspace from Mantid ADS.");
     } else {
       // If the MDEvent workspace has had top level splitting applied to it,
-      // then use the a depth of 1
+      // then use the a deptgit stah of 1
+      auto workspaceProvider = Mantid::Kernel::make_unique<ADSWorkspaceProvider<Mantid::API::IMDEventWorkspace>>();
       if (auto split =
-              Mantid::VATES::findRecursionDepthForTopLevelSplitting(m_wsName)) {
+              Mantid::VATES::findRecursionDepthForTopLevelSplitting(m_wsName, std::move(workspaceProvider))) {
         SetDepth(split.get());
       }
 
diff --git a/Vates/ParaviewPlugins/ParaViewSources/MDHWSource/vtkMDHWSource.cxx b/Vates/ParaviewPlugins/ParaViewSources/MDHWSource/vtkMDHWSource.cxx
index 5c746faf55252339be79aeac22e2a0a2a6ce40c5..9001ee7e33bc5e161f1f483acbb10fe11aa00382 100644
--- a/Vates/ParaviewPlugins/ParaViewSources/MDHWSource/vtkMDHWSource.cxx
+++ b/Vates/ParaviewPlugins/ParaViewSources/MDHWSource/vtkMDHWSource.cxx
@@ -181,7 +181,8 @@ int vtkMDHWSource::RequestData(vtkInformation *, vtkInformationVector **, vtkInf
       
     try
     {
-      m_presenter->makeNonOrthogonal(output);
+      auto workspaceProvider = Mantid::Kernel::make_unique<ADSWorkspaceProvider<Mantid::API::IMDWorkspace>>();
+      m_presenter->makeNonOrthogonal(output, std::move(workspaceProvider));
     }
     catch (std::invalid_argument &e)
     {
diff --git a/Vates/VatesAPI/CMakeLists.txt b/Vates/VatesAPI/CMakeLists.txt
index ecc53db40aa04538d99abfb8c9f496198ba45cb4..441db19ec5355e61f5ed6654fdffc02ef8d51085 100644
--- a/Vates/VatesAPI/CMakeLists.txt
+++ b/Vates/VatesAPI/CMakeLists.txt
@@ -1,4 +1,4 @@
-# This is mainly here so you don't get a complaint when running cmake
+#This is mainly here so you don't get a complaint when running cmake
 cmake_minimum_required( VERSION 2.8.12 )
 
 project( VatesAPI )
@@ -20,6 +20,7 @@ src/MDEWInMemoryLoadingPresenter.cpp
 src/MDHWInMemoryLoadingPresenter.cpp
 src/MDHWLoadingPresenter.cpp
 src/MDHWNexusLoadingPresenter.cpp
+src/MDLoadingViewSimple.cpp
 src/MedianAndBelowThresholdRange.cpp
 src/MetadataToFieldData.cpp
 src/MetadataToFieldData.cpp
@@ -29,6 +30,10 @@ src/MDLoadingPresenter.cpp
 src/Normalization.cpp
 src/NoThresholdRange.cpp
 src/ProgressAction.cpp
+src/PresenterUtilities.cpp
+src/SaveMDWorkspaceToVTK.cpp
+src/SaveMDWorkspaceToVTKImpl.cpp
+src/SingleWorkspaceProvider.cpp
 src/TimeStepToTimeStep.cpp
 src/TimeToTimeStep.cpp
 src/UserDefinedThresholdRange.cpp
@@ -70,6 +75,7 @@ inc/MantidVatesAPI/ConcretePeaksPresenterVsi.h
 inc/MantidVatesAPI/ColorScaleGuard.h
 inc/MantidVatesAPI/DimensionViewFactory.h
 inc/MantidVatesAPI/EventNexusLoadingPresenter.h
+inc/MantidVatesAPI/FactoryChains.h
 inc/MantidVatesAPI/FieldDataToMetadata.h
 inc/MantidVatesAPI/FilteringUpdateProgressAction.h
 inc/MantidVatesAPI/GeometryView.h
@@ -82,6 +88,7 @@ inc/MantidVatesAPI/MDHWLoadingPresenter.h
 inc/MantidVatesAPI/MDHWNexusLoadingPresenter.h
 inc/MantidVatesAPI/MDLoadingPresenter.h
 inc/MantidVatesAPI/MDLoadingView.h
+inc/MantidVatesAPI/MDLoadingViewSimple.h
 inc/MantidVatesAPI/MDLoadingViewAdapter.h
 inc/MantidVatesAPI/MedianAndBelowThresholdRange.h
 inc/MantidVatesAPI/MetaDataExtractorUtils.h
@@ -93,7 +100,11 @@ inc/MantidVatesAPI/MetadataToFieldData.h
 inc/MantidVatesAPI/NoThresholdRange.h
 inc/MantidVatesAPI/NullPeaksPresenterVsi.h
 inc/MantidVatesAPI/PeaksPresenterVsi.h
+inc/MantidVatesAPI/PresenterFactories.h
 inc/MantidVatesAPI/ProgressAction.h
+inc/MantidVatesAPI/SaveMDWorkspaceToVTK.h
+inc/MantidVatesAPI/SaveMDWorkspaceToVTKImpl.h
+inc/MantidVatesAPI/SingleWorkspaceProvider.h
 inc/MantidVatesAPI/SQWLoadingPresenter.h
 inc/MantidVatesAPI/ThresholdRange.h
 inc/MantidVatesAPI/TimeStepToTimeStep.h
@@ -159,10 +170,15 @@ test/MDHWInMemoryLoadingPresenterTest.h
 test/MDHWLoadingPresenterTest.h
 test/MDHWNexusLoadingPresenterTest.h
 test/MDLoadingPresenterTest.h
+test/MDLoadingViewSimpleTest.h
 test/MetaDataExtractorUtilsTest.h
 test/MetadataJsonManagerTest.h
 test/MetadataToFieldDataTest.h
 test/NormalizationTest.h
+test/PresenterUtilitiesTest.h
+test/SaveMDWorkspaceToVTKTest.h
+test/SaveMDWorkspaceToVTKImplTest.h
+test/SingleWorkspaceProviderTest.h
 test/SQWLoadingPresenterTest.h
 test/TimeStepToTimeStepTest.h
 test/TimeToTimeStepTest.h
@@ -246,6 +262,7 @@ if( CXXTEST_FOUND AND GMOCK_FOUND AND GTEST_FOUND )
 
   include_directories( inc ../../Framework/TestHelpers/inc ../../Framework/DataHandling/inc ../../Framework/DataObjects/inc ../../Framework/MDAlgorithms/inc)
   set ( TESTHELPER_SRCS ../../Framework/TestHelpers/src/ComponentCreationHelper.cpp 
+                        ../../Framework/TestHelpers/src/InstrumentCreationHelper.cpp
                         ../../Framework/TestHelpers/src/WorkspaceCreationHelper.cpp
                         ../../Framework/TestHelpers/src/MDEventsTestHelper.cpp 
                         ../../Framework/TestHelpers/src/StartFrameworkManager.cpp )
@@ -261,6 +278,7 @@ if( CXXTEST_FOUND AND GMOCK_FOUND AND GTEST_FOUND )
   vtkIOLegacy
   vtkFiltersExtraction
   vtkFiltersSources
+  vtkPVVTKExtensionsDefault
   ${vtkjsoncpp_LIBRARIES}
   ${POCO_LIBRARIES}
   ${Boost_LIBRARIES}
diff --git a/Vates/VatesAPI/inc/MantidVatesAPI/BoxInfo.h b/Vates/VatesAPI/inc/MantidVatesAPI/BoxInfo.h
index dec4eabbd7d3cd7c9aec07346fcfcada4775bcf6..4341c22c04b10cba709051b7fd7ed8d31800b806 100644
--- a/Vates/VatesAPI/inc/MantidVatesAPI/BoxInfo.h
+++ b/Vates/VatesAPI/inc/MantidVatesAPI/BoxInfo.h
@@ -2,45 +2,50 @@
 #define MANTID_VATESAPI_BOXINFO_H
 
 #include "MantidKernel/System.h"
+#include "MantidVatesAPI/WorkspaceProvider.h"
 #include <boost/optional.hpp>
 
 namespace Mantid
 {
-  namespace VATES
-  {
-     /** 
-    Collection of functions related to box information
-
-    @date 21/05/2015
-
-    Copyright &copy; 2010 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>
-    */
-
-    /**
-     * Function for finding an appropriate initial recursion depth.
-     * @param workspaceName :: name of the workspace
-     * @returns the appropriate recursion depth or nothing
-     */
-    boost::optional<int> DLLExport findRecursionDepthForTopLevelSplitting(const std::string &workspaceName);
-  }
+namespace VATES
+{
+/**
+Collection of functions related to box information
+
+@date 21/05/2015
+
+Copyright &copy; 2010 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>
+*/
+
+/**
+ * Function for finding an appropriate initial recursion depth.
+ * @param workspaceName :: name of the workspace
+ * @param workspaceProvider :: an instance of the a workspace provider
+ * @returns the appropriate recursion depth or nothing
+ */
+boost::optional<int> DLLExport findRecursionDepthForTopLevelSplitting(
+    const std::string &workspaceName,
+    std::unique_ptr<WorkspaceProvider> workspaceProvider);
+}
 }
 
 #endif
diff --git a/Vates/VatesAPI/inc/MantidVatesAPI/FactoryChains.h b/Vates/VatesAPI/inc/MantidVatesAPI/FactoryChains.h
new file mode 100644
index 0000000000000000000000000000000000000000..c707295d93286131a644f5c761c10b5720d37d0c
--- /dev/null
+++ b/Vates/VatesAPI/inc/MantidVatesAPI/FactoryChains.h
@@ -0,0 +1,44 @@
+#ifndef MANTID_VATES_FACTORY_CHAINS_H
+#define MANTID_VATES_FACTORY_CHAINS_H
+
+#include "MantidKernel/System.h"
+
+#include "MantidVatesAPI/MDLoadingView.h"
+#include "MantidVatesAPI/TimeToTimeStep.h"
+#include "MantidVatesAPI/vtkMDHistoHex4DFactory.h"
+#include "MantidVatesAPI/vtkMDHexFactory.h"
+#include "MantidVatesAPI/WorkspaceProvider.h"
+
+#include <vtkPVClipDataSet.h>
+
+namespace Mantid
+{
+namespace VATES
+{
+
+// Forward Decalaration
+class MDLoadingPresenter;
+
+/// Creates a facotry chain for MDHisto workspaces
+std::unique_ptr<vtkMDHistoHex4DFactory<TimeToTimeStep>> DLLExport createFactoryChainForHistoWorkspace(ThresholdRange_scptr threshold,
+                                    VisualNormalization normalization,
+                                    double time);
+
+/// Creates a factory chain for MDEvent workspaces
+std::unique_ptr<vtkMDHexFactory> DLLExport createFactoryChainForEventWorkspace(ThresholdRange_scptr threshold,
+                                    VisualNormalization normalization,
+                                    double time);
+
+/// Function to apply the Change-of-Basis-Matrix
+void DLLExport applyCOBMatrixSettingsToVtkDataSet(MDLoadingPresenter *presenter, vtkDataSet *dataSet,
+    std::unique_ptr<Mantid::VATES::WorkspaceProvider> workspaceProvider);
+
+/// Function to get clipped data sets.
+vtkSmartPointer<vtkPVClipDataSet> DLLExport getClippedDataSet(vtkSmartPointer<vtkDataSet> dataSet);
+
+/// Create name with timestamp attached.
+std::string DLLExport createTimeStampedName(std::string name);
+}
+}
+
+#endif
diff --git a/Vates/VatesAPI/inc/MantidVatesAPI/MDLoadingPresenter.h b/Vates/VatesAPI/inc/MantidVatesAPI/MDLoadingPresenter.h
index eb54f1c94a656400cbbddc59d65b4c9e0d0f48d5..d3257d5d06d62292626db409e154fac3fdb5e6ab 100644
--- a/Vates/VatesAPI/inc/MantidVatesAPI/MDLoadingPresenter.h
+++ b/Vates/VatesAPI/inc/MantidVatesAPI/MDLoadingPresenter.h
@@ -62,7 +62,8 @@ namespace Mantid
         virtual std::string getTimeStepLabel() const = 0;
         virtual void setAxisLabels(vtkDataSet* visualDataSet) = 0;
         virtual void setDefaultCOBandBoundaries(vtkDataSet* visualDataSet);
-        virtual void makeNonOrthogonal(vtkDataSet* visualDataSet);
+        virtual void makeNonOrthogonal(vtkDataSet* visualDataSet,
+                                       std::unique_ptr<Mantid::VATES::WorkspaceProvider> workspaceProvider);
         virtual bool canReadFile() const = 0;
         virtual const std::string& getGeometryXML() const = 0;
         virtual ~MDLoadingPresenter(){}
diff --git a/Vates/VatesAPI/inc/MantidVatesAPI/MDLoadingViewSimple.h b/Vates/VatesAPI/inc/MantidVatesAPI/MDLoadingViewSimple.h
new file mode 100644
index 0000000000000000000000000000000000000000..16bd5db5f11f5e595f845c68509e697079fd8b53
--- /dev/null
+++ b/Vates/VatesAPI/inc/MantidVatesAPI/MDLoadingViewSimple.h
@@ -0,0 +1,53 @@
+#ifndef MANTID_VATES_MD_LOADING_VIEW_SIMPLE_H
+#define MANTID_VATES_MD_LOADING_VIEW_SIMPLE_H
+
+#include "MantidVatesAPI/MDLoadingView.h"
+
+namespace Mantid {
+namespace VATES {
+
+/** MDLoadingViewSimple : Provides an almost hollow MDLoadingView
+which is used by non-paraview based implementations such as the
+SaveMDWorkspaceToVTK algorithm.
+
+Copyright &copy; 2016 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 MDLoadingViewSimple : public MDLoadingView {
+public:
+  double getTime() const override;
+  void setTime(double time);
+
+  size_t getRecursionDepth() const override;
+  void setRecursionDepth(size_t recursionDepth);
+
+  bool getLoadInMemory() const override;
+  void setLoadInMemory(bool loadInMemory);
+
+private:
+  double m_time = 0.0;
+  size_t m_recursionDepth = 5;
+  bool m_loadInMemory = true;
+};
+}
+}
+
+#endif
diff --git a/Vates/VatesAPI/inc/MantidVatesAPI/PresenterFactories.h b/Vates/VatesAPI/inc/MantidVatesAPI/PresenterFactories.h
new file mode 100644
index 0000000000000000000000000000000000000000..75dd4b924d2ac165ecab6aecbfe81b0691e3291a
--- /dev/null
+++ b/Vates/VatesAPI/inc/MantidVatesAPI/PresenterFactories.h
@@ -0,0 +1,52 @@
+#ifndef MANTID_VATES_PRESENTER_FACTORIES_H
+#define MANTID_VATES_PRESENTER_FACTORIES_H
+
+#include "MantidAPI/IMDWorkspace.h"
+#include "MantidKernel/make_unique.h"
+
+namespace Mantid {
+namespace VATES {
+
+// Forward Decalaration
+class MDLoadingView;
+class WorkspaceProvider;
+
+class DLLExport EmptyWorkspaceNamePolicy {
+protected:
+  std::string getWorkspaceName(Mantid::API::IMDWorkspace_sptr) {
+    return "__EmptyWorkspaceNamePolicy";
+  }
+};
+
+class DLLExport NonEmptyWorkspaceNamePolicy {
+protected:
+  std::string getWorkspaceName(Mantid::API::IMDWorkspace_sptr workspace) {
+    return workspace->name();
+  }
+};
+
+/**
+* This templated function sets up an in memory loading presenter.
+* @param view: the loading view type
+* @param wsName: the name of the workspace which is to be displayed
+* @param worksapceProvider: a worksapce provider
+* @returns a new in memory loading presenter.
+*/
+template <class Presenter, class WorkspaceNamePolicy>
+class DLLExport InMemoryPresenterFactory : private WorkspaceNamePolicy {
+  using WorkspaceNamePolicy::getWorkspaceName;
+
+public:
+  std::unique_ptr<Presenter>
+  create(std::unique_ptr<MDLoadingView> view,
+         Mantid::API::IMDWorkspace_sptr workspace,
+         std::unique_ptr<WorkspaceProvider> workspaceProvider) {
+    return Mantid::Kernel::make_unique<Presenter>(std::move(view),
+                                                  workspaceProvider.release(),
+                                                  getWorkspaceName(workspace));
+  }
+};
+
+}
+}
+#endif
diff --git a/Vates/VatesAPI/inc/MantidVatesAPI/SaveMDWorkspaceToVTK.h b/Vates/VatesAPI/inc/MantidVatesAPI/SaveMDWorkspaceToVTK.h
new file mode 100644
index 0000000000000000000000000000000000000000..9d83043ec410c46a182f4380820807fcdcea24cd
--- /dev/null
+++ b/Vates/VatesAPI/inc/MantidVatesAPI/SaveMDWorkspaceToVTK.h
@@ -0,0 +1,56 @@
+#ifndef VATES_API_SAVE_MD_WORKSPACE_TO_VTK_H_
+#define VATES_API_SAVE_MD_WORKSPACE_TO_VTK_H_
+#include "MantidAPI/Algorithm.h"
+#include "MantidKernel/System.h"
+#include <map>
+
+namespace Mantid {
+namespace VATES {
+
+/** SaveMDWorkspaceToVTK : Defines an algorithm to save MDWorkspaces
+to a VTK compatible format in order to load them into ParaView.
+MDHistoWorkspaces are stored in the vts and MDEvent Workspaces
+are stored in the vtu file format. Note that currently only 3D workspaces
+are supported.
+
+Copyright &copy; 2016 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 SaveMDWorkspaceToVTKImpl;
+
+class DLLExport SaveMDWorkspaceToVTK : public Mantid::API::Algorithm {
+public:
+  SaveMDWorkspaceToVTK();
+  ~SaveMDWorkspaceToVTK();
+  virtual const std::string name() const;
+  virtual int version() const;
+  virtual const std::string category() const;
+  virtual const std::string summary() const;
+
+private:
+  void init();
+  void exec();
+  std::map<std::string, std::string> validateInputs();
+  std::unique_ptr<SaveMDWorkspaceToVTKImpl> saver;
+};
+}
+}
+#endif
diff --git a/Vates/VatesAPI/inc/MantidVatesAPI/SaveMDWorkspaceToVTKImpl.h b/Vates/VatesAPI/inc/MantidVatesAPI/SaveMDWorkspaceToVTKImpl.h
new file mode 100644
index 0000000000000000000000000000000000000000..d9e18957c9ea73a649af33f48c0d2bc74b2a0720
--- /dev/null
+++ b/Vates/VatesAPI/inc/MantidVatesAPI/SaveMDWorkspaceToVTKImpl.h
@@ -0,0 +1,93 @@
+#ifndef VATES_API_SAVE_MD_WORKSPACE_TO_VTK_IMPL_H_
+#define VATES_API_SAVE_MD_WORKSPACE_TO_VTK_IMPL_H_
+
+#include "MantidAPI/IMDWorkspace.h"
+#include "MantidKernel/System.h"
+#include "MantidVatesAPI/Normalization.h"
+#include "MantidVatesAPI/ThresholdRange.h"
+
+#include <map>
+#include <vtkSmartPointer.h>
+#include <vtkXMLWriter.h>
+
+namespace Mantid {
+namespace VATES {
+
+// Forward declaration
+class MDLoadingPresenter;
+class vtkDataSetFactory;
+
+/** SaveMDWorkspaceToVTKImpl : Defines the underlying functionaity of
+    SaveMDDdWorkspaceToVTK. MDHistoWorkspaces are stored in the vts and
+    MDEvent Workspaces are stored in the vtu file format.
+
+Copyright &copy; 2016 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 SaveMDWorkspaceToVTKImpl {
+public:
+  SaveMDWorkspaceToVTKImpl();
+  ~SaveMDWorkspaceToVTKImpl() {}
+  void saveMDWorkspace(Mantid::API::IMDWorkspace_sptr workspace,
+                       std::string filename, VisualNormalization normalization,
+                       ThresholdRange_scptr thresholdRange,
+                       int recursionDepth) const;
+
+  const static std::string structuredGridExtension;
+  const static std::string unstructuredGridExtension;
+
+  std::vector<std::string>
+  getAllowedNormalizationsInStringRepresentation() const;
+  std::vector<std::string> getAllowedThresholdsInStringRepresentation() const;
+  VisualNormalization
+  translateStringToVisualNormalization(const std::string normalization) const;
+  ThresholdRange_scptr
+  translateStringToThresholdRange(const std::string thresholdRange) const;
+
+  bool is3DWorkspace(Mantid::API::IMDWorkspace_sptr workspace) const;
+
+private:
+  std::map<std::string, VisualNormalization> m_normalizations;
+  std::vector<std::string> m_thresholds;
+
+  void setupMembers();
+  bool is4DWorkspace(Mantid::API::IMDWorkspace_sptr workspace) const;
+  int writeDataSetToVTKFile(vtkXMLWriter *writer, vtkDataSet *dataSet,
+                            std::string filename) const;
+  double selectTimeSliceValue(Mantid::API::IMDWorkspace_sptr workspace) const;
+  std::string getFullFilename(std::string filename,
+                              bool isHistoWorkspace) const;
+  vtkSmartPointer<vtkXMLWriter> getXMLWriter(bool isHistoWorkspace) const;
+  vtkSmartPointer<vtkDataSet> getDataSetWithOrthogonalCorrection(
+      vtkSmartPointer<vtkDataSet> dataSet, MDLoadingPresenter *presenter,
+      Mantid::API::IMDWorkspace_sptr workspace, bool isHistoWorkspace) const;
+  std::unique_ptr<vtkDataSetFactory>
+  getDataSetFactoryChain(bool isHistWorkspace,
+                         ThresholdRange_scptr thresholdRange,
+                         VisualNormalization normalization, double time) const;
+  std::unique_ptr<MDLoadingPresenter>
+  getPresenter(bool isHistoWorkspace, Mantid::API::IMDWorkspace_sptr workspace,
+               int recursionDepth) const;
+};
+}
+}
+
+#endif
diff --git a/Vates/VatesAPI/inc/MantidVatesAPI/SingleWorkspaceProvider.h b/Vates/VatesAPI/inc/MantidVatesAPI/SingleWorkspaceProvider.h
new file mode 100644
index 0000000000000000000000000000000000000000..806da46e984acd88ee19b90484901569e5cc24ff
--- /dev/null
+++ b/Vates/VatesAPI/inc/MantidVatesAPI/SingleWorkspaceProvider.h
@@ -0,0 +1,47 @@
+#ifndef VATES_API_SINGLE_WORKSPACE_PROVIDER_H_
+#define VATES_API_SINGLE_WORKSPACE_PROVIDER_H_
+
+#include "MantidAPI/Workspace_fwd.h"
+#include "WorkspaceProvider.h"
+
+namespace Mantid {
+namespace VATES {
+
+/** SingleWorkspaceProvider : Provides a single workspace instead of
+    serving a client with workspaces from the ADS
+
+Copyright &copy; 2016 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 SingleWorkspaceProvider : public WorkspaceProvider {
+public:
+  SingleWorkspaceProvider(Mantid::API::Workspace_sptr workspace);
+  bool canProvideWorkspace(std::string wsName) const override;
+  Mantid::API::Workspace_sptr fetchWorkspace(std::string wsName) const override;
+  void disposeWorkspace(std::string wsName) const override;
+
+private:
+  Mantid::API::Workspace_sptr m_workspace;
+};
+}
+}
+
+#endif
diff --git a/Vates/VatesAPI/inc/MantidVatesAPI/vtkDataSetToNonOrthogonalDataSet.h b/Vates/VatesAPI/inc/MantidVatesAPI/vtkDataSetToNonOrthogonalDataSet.h
index 82a7fb0cc387dadf3f6e1a9e21ecd23f504bb0f2..75cd2d31cbf80d5e9a07d21c3db4599c37e95f3c 100644
--- a/Vates/VatesAPI/inc/MantidVatesAPI/vtkDataSetToNonOrthogonalDataSet.h
+++ b/Vates/VatesAPI/inc/MantidVatesAPI/vtkDataSetToNonOrthogonalDataSet.h
@@ -1,6 +1,7 @@
 #ifndef MANTID_VATES_VTKDATASETTONONORTHOGONALDATASET_H_
 #define MANTID_VATES_VTKDATASETTONONORTHOGONALDATASET_H_
 
+#include "MantidVatesAPI/WorkspaceProvider.h"
 #include "MantidKernel/SpecialCoordinateSystem.h"
 #include "MantidKernel/System.h"
 #include "MantidKernel/cow_ptr.h"
@@ -17,52 +18,59 @@ namespace Mantid
 {
 namespace Geometry
 {
-  class OrientedLattice;
+class OrientedLattice;
 }
 
 namespace VATES
 {
 
-  /**
-   * Class that handles converting a dataset from rectilinear coordinates
-   * to a non-orthongonal representation.
-    
-    @date 11/03/2013
+/**
+ * Class that handles converting a dataset from rectilinear coordinates
+ * to a non-orthongonal representation.
 
-    Copyright &copy; 2013 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge National Laboratory & European Spallation Source
+  @date 11/03/2013
 
-    This file is part of Mantid.
+  Copyright &copy; 2013 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge
+ National Laboratory & European Spallation Source
 
-    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.
+  This file is part of Mantid.
 
-    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.
+  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.
 
-    You should have received a copy of the GNU General Public License
-    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  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.
 
-    File change history is stored at: <https://github.com/mantidproject/mantid>
-    Code Documentation is available at: <http://doxygen.mantidproject.org>
-  */
-  class DLLExport vtkDataSetToNonOrthogonalDataSet 
-  {
-  public:
+  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 vtkDataSetToNonOrthogonalDataSet
+{
+public:
     /// Static execution method
-    static void exec(vtkDataSet *dataset, std::string name);
+    static void exec(vtkDataSet *dataset, std::string name,
+                     std::unique_ptr<WorkspaceProvider> workspaceProvider);
     /// Constructor
-    vtkDataSetToNonOrthogonalDataSet(vtkDataSet *dataset, std::string name);
+    vtkDataSetToNonOrthogonalDataSet(
+        vtkDataSet *dataset, std::string name,
+        std::unique_ptr<Mantid::VATES::WorkspaceProvider> workspaceProvider);
     /// Class execution method
     void execute();
     /// Destructor
     virtual ~vtkDataSetToNonOrthogonalDataSet();
-  private:
-    vtkDataSetToNonOrthogonalDataSet& operator=(const vtkDataSetToNonOrthogonalDataSet& other);
-    vtkDataSetToNonOrthogonalDataSet(const vtkDataSetToNonOrthogonalDataSet& other);
+
+private:
+    vtkDataSetToNonOrthogonalDataSet &
+    operator=(const vtkDataSetToNonOrthogonalDataSet &other);
+    vtkDataSetToNonOrthogonalDataSet(
+        const vtkDataSetToNonOrthogonalDataSet &other);
     /// Calculate the skew matrix and basis.
     void createSkewInformation(Geometry::OrientedLattice &ol,
                                Kernel::DblMatrix &w,
@@ -74,19 +82,21 @@ namespace VATES
     /// Add the skew basis to metadata
     void updateMetaData(vtkDataSet *ugrid);
     vtkDataSet *m_dataSet; ///< Pointer to VTK dataset to modify
-    std::string m_wsName; ///< The name of the workspace to fetch
+    std::string m_wsName;  ///< The name of the workspace to fetch
     std::size_t m_numDims; ///< Number of dimensions in workspace
-    Kernel::DblMatrix m_skewMat; ///< The skew matrix for non-orthogonal representation
+    Kernel::DblMatrix
+        m_skewMat; ///< The skew matrix for non-orthogonal representation
     MantidVec m_basisNorm; ///< Holder for the basis normalisation values
-    Kernel::V3D m_basisX; ///< The X direction basis vector
-    Kernel::V3D m_basisY; ///< The Y direction basis vector
-    Kernel::V3D m_basisZ; ///< The Z direction basis vector
-    Kernel::SpecialCoordinateSystem m_coordType; ///< The coordinate system for the workspace
+    Kernel::V3D m_basisX;  ///< The X direction basis vector
+    Kernel::V3D m_basisY;  ///< The Y direction basis vector
+    Kernel::V3D m_basisZ;  ///< The Z direction basis vector
+    Kernel::SpecialCoordinateSystem
+        m_coordType; ///< The coordinate system for the workspace
     std::array<double, 6> m_boundingBox;
-  };
-
+    std::unique_ptr<Mantid::VATES::WorkspaceProvider> m_workspaceProvider;
+};
 
 } // namespace VATES
 } // namespace Mantid
 
-#endif  /* MANTID_VATES_VTKDATASETTONONORTHOGONALDATASET_H_ */
+#endif /* MANTID_VATES_VTKDATASETTONONORTHOGONALDATASET_H_ */
diff --git a/Vates/VatesAPI/src/BoxInfo.cpp b/Vates/VatesAPI/src/BoxInfo.cpp
index e2bbe97adadd3b90f32f71b83b8e7b455eda4034..41c764d696f094686386d250cc1f2ddcc2acba3d 100644
--- a/Vates/VatesAPI/src/BoxInfo.cpp
+++ b/Vates/VatesAPI/src/BoxInfo.cpp
@@ -1,28 +1,32 @@
 #include "MantidVatesAPI/BoxInfo.h"
-#include "MantidVatesAPI/ADSWorkspaceProvider.h"
 #include "MantidAPI/IMDEventWorkspace.h"
+#include "MantidKernel/make_unique.h"
 
 using namespace Mantid::API;
 
-namespace Mantid {
-namespace VATES {
-boost::optional<int> findRecursionDepthForTopLevelSplitting(const std::string &workspaceName) {
-  const int topLevelRecursionDepth = 1;
-  boost::optional<int> recursionDepth;
-  Mantid::VATES::ADSWorkspaceProvider<Mantid::API::IMDEventWorkspace>
-      workspaceProvider;
-  if (workspaceProvider.canProvideWorkspace(workspaceName)) {
-    auto workspace =
-          boost::dynamic_pointer_cast<Mantid::API::IMDEventWorkspace>(
-              workspaceProvider.fetchWorkspace(workspaceName));
-    auto boxController = workspace->getBoxController();
-    boost::optional<std::vector<size_t>> topLevelSplits =
-        boxController->getSplitTopInto();
-    if (boxController->getSplitTopInto()) {
-      recursionDepth = topLevelRecursionDepth;
+namespace Mantid
+{
+namespace VATES
+{
+
+boost::optional<int> findRecursionDepthForTopLevelSplitting(
+    const std::string &workspaceName,
+    std::unique_ptr<WorkspaceProvider> workspaceProvider)
+{
+    const int topLevelRecursionDepth = 1;
+    boost::optional<int> recursionDepth;
+    if (workspaceProvider->canProvideWorkspace(workspaceName)) {
+        auto workspace
+            = boost::dynamic_pointer_cast<Mantid::API::IMDEventWorkspace>(
+                workspaceProvider->fetchWorkspace(workspaceName));
+        auto boxController = workspace->getBoxController();
+        boost::optional<std::vector<size_t>> topLevelSplits
+            = boxController->getSplitTopInto();
+        if (boxController->getSplitTopInto()) {
+            recursionDepth = topLevelRecursionDepth;
+        }
     }
-  }
-  return recursionDepth;
+    return recursionDepth;
 }
 }
 }
diff --git a/Vates/VatesAPI/src/MDHWInMemoryLoadingPresenter.cpp b/Vates/VatesAPI/src/MDHWInMemoryLoadingPresenter.cpp
index 95f22a20e84e401be168b6f9770ebfd4a87f6761..90a088ff2197efa9371dbc7d10d9e8bf0bd57371 100644
--- a/Vates/VatesAPI/src/MDHWInMemoryLoadingPresenter.cpp
+++ b/Vates/VatesAPI/src/MDHWInMemoryLoadingPresenter.cpp
@@ -3,6 +3,7 @@
 #include "MantidAPI/IMDHistoWorkspace.h"
 #include "MantidVatesAPI/MDLoadingView.h"
 #include "MantidVatesAPI/MetaDataExtractorUtils.h"
+#include "MantidVatesAPI/FactoryChains.h"
 #include "MantidVatesAPI/ProgressAction.h"
 #include "MantidVatesAPI/vtkDataSetFactory.h"
 #include "MantidVatesAPI/WorkspaceProvider.h"
@@ -10,6 +11,7 @@
 #include <qwt_double_interval.h>
 #include <vtkUnstructuredGrid.h>
 
+
 namespace Mantid {
 namespace VATES {
 
@@ -104,7 +106,12 @@ MDHWInMemoryLoadingPresenter::execute(vtkDataSetFactory *factory,
   this->extractMetadata(m_cachedVisualHistoWs);
 
   // Transposed workpace is temporary, outside the ADS, and does not have a name. so get it from pre-transposed.
-  this->appendMetadata(visualDataSet, histoWs->getName());
+  // If this fails, create a default name with a time stamp
+  auto name = histoWs->getName();
+  if (name.empty()) {
+    name = createTimeStampedName("HistoWS");
+  }
+  this->appendMetadata(visualDataSet, name);
   return visualDataSet;
 }
 
diff --git a/Vates/VatesAPI/src/MDLoadingPresenter.cpp b/Vates/VatesAPI/src/MDLoadingPresenter.cpp
index 916c21b6b79b1fa3f03fbcfa40106eb1782866af..6aec9aa6ce4ed009bd395da8e188a39448d51ad4 100644
--- a/Vates/VatesAPI/src/MDLoadingPresenter.cpp
+++ b/Vates/VatesAPI/src/MDLoadingPresenter.cpp
@@ -33,12 +33,17 @@ void MDLoadingPresenter::setDefaultCOBandBoundaries(vtkDataSet* visualDataSet) {
 
 /**
  * Make the visual data set non-orthogonal
+ * @param visualDataSet: the vtk visual data set to which the transformation will be applied
+ * @param workspaceProvider: the provider of the underlying workspace
  */
-void MDLoadingPresenter::makeNonOrthogonal(vtkDataSet* visualDataSet)
+void MDLoadingPresenter::makeNonOrthogonal(vtkDataSet* visualDataSet,
+                                           std::unique_ptr<Mantid::VATES::WorkspaceProvider> workspaceProvider)
 {
   std::string wsName = vtkDataSetToWsName::exec(visualDataSet);
-  vtkDataSetToNonOrthogonalDataSet converter(visualDataSet, wsName);
+  vtkDataSetToNonOrthogonalDataSet converter(visualDataSet, wsName, std::move(workspaceProvider));
   converter.execute();
 }
+
+
+}
 }
-}
\ No newline at end of file
diff --git a/Vates/VatesAPI/src/MDLoadingViewSimple.cpp b/Vates/VatesAPI/src/MDLoadingViewSimple.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..78a9d47e865d8687ccba5eb8a1ac8bacb302b2aa
--- /dev/null
+++ b/Vates/VatesAPI/src/MDLoadingViewSimple.cpp
@@ -0,0 +1,31 @@
+#include "MantidVatesAPI/MDLoadingViewSimple.h"
+
+namespace Mantid{
+namespace VATES {
+
+void MDLoadingViewSimple::setTime(double time) {
+  m_time = time;
+}
+
+double MDLoadingViewSimple::getTime() const {
+  return m_time;
+}
+
+void MDLoadingViewSimple::setRecursionDepth(size_t recursionDepth) {
+  m_recursionDepth = recursionDepth;
+}
+
+size_t MDLoadingViewSimple::getRecursionDepth() const{
+  return m_recursionDepth;
+}
+
+void MDLoadingViewSimple::setLoadInMemory(bool loadInMemory) {
+  m_loadInMemory = loadInMemory;
+}
+
+bool MDLoadingViewSimple::getLoadInMemory() const{
+  return m_loadInMemory;
+}
+
+}
+}
diff --git a/Vates/VatesAPI/src/PresenterUtilities.cpp b/Vates/VatesAPI/src/PresenterUtilities.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..728c4af5275f14878b6073c0e1667e8f0e6ebebc
--- /dev/null
+++ b/Vates/VatesAPI/src/PresenterUtilities.cpp
@@ -0,0 +1,155 @@
+#include "MantidVatesAPI/PresenterFactories.h"
+#include "MantidVatesAPI/FactoryChains.h"
+
+#include "MantidVatesAPI/MDLoadingPresenter.h"
+#include "MantidVatesAPI/ThresholdRange.h"
+#include "MantidVatesAPI/vtkMDHistoLineFactory.h"
+#include "MantidVatesAPI/vtkMDHistoQuadFactory.h"
+#include "MantidVatesAPI/vtkMDHistoHexFactory.h"
+#include "MantidVatesAPI/vtkMD0DFactory.h"
+#include "MantidVatesAPI/vtkMDQuadFactory.h"
+#include "MantidVatesAPI/vtkMDLineFactory.h"
+
+
+#include "MantidKernel/Logger.h"
+#include "MantidKernel/make_unique.h"
+
+#include <vtkBox.h>
+
+#include <chrono>
+#include <ctime>
+#include <algorithm>
+
+namespace
+{
+/// Static logger
+Mantid::Kernel::Logger g_log_presenter_utilities("PresenterUtilities");
+}
+
+namespace Mantid
+{
+namespace VATES
+{
+
+/**
+ * Gets a clipped object
+ * @param dataSet: the unclipped data set
+ * @returns a clipped object
+ */
+vtkSmartPointer<vtkPVClipDataSet>
+getClippedDataSet(vtkSmartPointer<vtkDataSet> dataSet)
+{
+    auto box = vtkSmartPointer<vtkBox>::New();
+    box->SetBounds(dataSet->GetBounds());
+    auto clipper = vtkSmartPointer<vtkPVClipDataSet>::New();
+    clipper->SetInputData(dataSet);
+    clipper->SetClipFunction(box);
+    clipper->SetInsideOut(true);
+    clipper->Update();
+    return clipper;
+}
+
+/**
+ * Applies the correct change of basis matrix to the vtk data set. This is
+ * especially important for
+ * non-orthogonal data sets.
+ * @param presenter: a pointer to a presenter instance
+ * @param dataSet: the data set which holds the COB information
+ * @param workspaceProvider: provides one or multiple workspaces
+ */
+void applyCOBMatrixSettingsToVtkDataSet(
+    Mantid::VATES::MDLoadingPresenter *presenter, vtkDataSet *dataSet,
+    std::unique_ptr<Mantid::VATES::WorkspaceProvider> workspaceProvider)
+{
+    try {
+        presenter->makeNonOrthogonal(dataSet, std::move(workspaceProvider));
+    } catch (std::invalid_argument &e) {
+        std::string error = e.what();
+        g_log_presenter_utilities.warning()
+            << "PresenterUtilities: Workspace does not have correct "
+               "information to "
+            << "plot non-orthogonal axes: " << error;
+        // Add the standard change of basis matrix and set the boundaries
+        presenter->setDefaultCOBandBoundaries(dataSet);
+    } catch (...) {
+        g_log_presenter_utilities.warning()
+            << "PresenterUtilities: Workspace does not have correct "
+               "information to "
+            << "plot non-orthogonal axes. Non-orthogonal axes features require "
+               "three dimensions.";
+    }
+}
+
+/**
+ * Creates a factory chain for MDEvent workspaces
+ * @param threshold: the threshold range
+ * @param normalization: the normalization option
+ * @param time: the time slice time
+ * @returns a factory chain
+ */
+std::unique_ptr<vtkMDHexFactory>
+createFactoryChainForEventWorkspace(ThresholdRange_scptr threshold,
+                                    VisualNormalization normalization,
+                                    double time)
+{
+    auto factory = Mantid::Kernel::make_unique<vtkMDHexFactory>(threshold,
+                                                                normalization);
+    factory->setSuccessor(Mantid::Kernel::make_unique<vtkMDQuadFactory>(
+                              threshold, normalization))
+        .setSuccessor(Mantid::Kernel::make_unique<vtkMDLineFactory>(
+            threshold, normalization))
+        .setSuccessor(Mantid::Kernel::make_unique<vtkMD0DFactory>());
+    factory->setTime(time);
+    return factory;
+}
+
+/**
+* Creates a factory chain for MDHisto workspaces
+* @param threshold: the threshold range
+* @param normalization: the normalization option
+* @param time: the time slice time
+* @returns a factory chain
+*/
+std::unique_ptr<vtkMDHistoHex4DFactory<TimeToTimeStep>>
+createFactoryChainForHistoWorkspace(ThresholdRange_scptr threshold,
+                                    VisualNormalization normalization,
+                                    double time)
+{
+    auto factory
+        = Mantid::Kernel::make_unique<vtkMDHistoHex4DFactory<TimeToTimeStep>>(
+            threshold, normalization, time);
+    factory->setSuccessor(Mantid::Kernel::make_unique<vtkMDHistoHexFactory>(
+                              threshold, normalization))
+        .setSuccessor(Mantid::Kernel::make_unique<vtkMDHistoQuadFactory>(
+            threshold, normalization))
+        .setSuccessor(Mantid::Kernel::make_unique<vtkMDHistoLineFactory>(
+            threshold, normalization))
+        .setSuccessor(Mantid::Kernel::make_unique<vtkMD0DFactory>());
+    return factory;
+}
+
+/**
+* Creates a time stamped name
+* @param name: the input name
+* @return a name with a time stamp
+*/
+std::string createTimeStampedName(std::string name)
+{
+    auto currentTime = std::chrono::system_clock::to_time_t(
+        std::chrono::system_clock::now());
+    std::string timeInReadableFormat = std::string(std::ctime(&currentTime));
+    // Replace all white space with double underscore
+    std::replace(timeInReadableFormat.begin(), timeInReadableFormat.end(), ' ',
+                 '_');
+    // Replace all colons with single underscore
+    std::replace(timeInReadableFormat.begin(), timeInReadableFormat.end(), ':',
+                 '_');
+    timeInReadableFormat.erase(std::remove(timeInReadableFormat.begin(),
+                                           timeInReadableFormat.end(), '\n'),
+                               timeInReadableFormat.end());
+    std::string stampedName = name + "_";
+    stampedName = stampedName + timeInReadableFormat;
+    return stampedName;
+}
+}
+}
diff --git a/Vates/VatesAPI/src/SaveMDWorkspaceToVTK.cpp b/Vates/VatesAPI/src/SaveMDWorkspaceToVTK.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..1f9d0bfa722c160dcbe14b3f09ef314d1bcaf24f
--- /dev/null
+++ b/Vates/VatesAPI/src/SaveMDWorkspaceToVTK.cpp
@@ -0,0 +1,119 @@
+#include "MantidAPI/FileProperty.h"
+#include "MantidAPI/IMDEventWorkspace.h"
+#include "MantidAPI/IMDHistoWorkspace.h"
+#include "MantidAPI/IMDWorkspace.h"
+#include "MantidAPI/WorkspaceProperty.h"
+#include "MantidKernel/ListValidator.h"
+#include "MantidVatesAPI/SaveMDWorkspaceToVTK.h"
+
+#include "MantidVatesAPI/Normalization.h"
+#include "MantidVatesAPI/SaveMDWorkspaceToVTKImpl.h"
+
+#include "MantidKernel/BoundedValidator.h"
+#include "MantidKernel/make_unique.h"
+
+namespace Mantid {
+namespace VATES {
+
+DECLARE_ALGORITHM(SaveMDWorkspaceToVTK)
+
+SaveMDWorkspaceToVTK::SaveMDWorkspaceToVTK()
+    : saver(Mantid::Kernel::make_unique<SaveMDWorkspaceToVTKImpl>()) {}
+
+SaveMDWorkspaceToVTK::~SaveMDWorkspaceToVTK() {}
+
+const std::string SaveMDWorkspaceToVTK::name() const {
+  return "SaveMDWorkspaceToVTK";
+}
+
+int SaveMDWorkspaceToVTK::version() const { return 1; }
+
+const std::string SaveMDWorkspaceToVTK::category() const {
+  return "MDAlgorithms";
+}
+
+const std::string SaveMDWorkspaceToVTK::summary() const {
+  std::string summary = "Saves MD workspaces to VTK file types which can be "
+                        "loaded by ParaView. MDHisto workspaces are saved as "
+                        ".vts files and MDEvent workspaces as .vtu files.";
+  return summary;
+}
+
+void SaveMDWorkspaceToVTK::init() {
+  declareProperty(new Mantid::API::WorkspaceProperty<Mantid::API::IMDWorkspace>(
+                      "InputWorkspace", "", Mantid::Kernel::Direction::Input),
+                  "MDWorkspace to save/export");
+
+  std::vector<std::string> extensions = {
+      SaveMDWorkspaceToVTKImpl::structuredGridExtension,
+      SaveMDWorkspaceToVTKImpl::unstructuredGridExtension};
+  declareProperty(new Mantid::API::FileProperty(
+                      "Filename", "", Mantid::API::FileProperty::Save,
+                      extensions, Mantid::Kernel::Direction::Input),
+                  "Save location.");
+
+  auto normalizations = saver->getAllowedNormalizationsInStringRepresentation();
+  declareProperty(
+      "Normalization", "AutoSelect",
+      boost::make_shared<Mantid::Kernel::StringListValidator>(normalizations),
+      "The visual normalization option. The automatic default will choose a "
+      "normalization based on your data type and instrument.");
+
+  auto thresholds = saver->getAllowedThresholdsInStringRepresentation();
+  declareProperty(
+      "ThresholdRange", "IgnoreZerosThresholdRange",
+      boost::make_shared<Mantid::Kernel::StringListValidator>(thresholds),
+      "The threshold range. Currently either no threshold or an ignore-zeros "
+      "policy can be applied.");
+
+  boost::shared_ptr<Mantid::Kernel::BoundedValidator<int>> mustBePositive(
+      new Mantid::Kernel::BoundedValidator<int>());
+  mustBePositive->setLower(1);
+  declareProperty("RecursionDepth", 5, mustBePositive,
+                  "The recursion depth is only required for MDEvent workspaces "
+                  "and determines to which level data should be displayed.");
+}
+
+void SaveMDWorkspaceToVTK::exec() {
+  // Get the input properties
+  Mantid::API::IMDWorkspace_sptr inputWS = this->getProperty("InputWorkspace");
+  std::string filename = this->getProperty("Filename");
+
+  std::string normalizationInStringRepresentation =
+      this->getProperty("Normalization");
+  auto normalization = saver->translateStringToVisualNormalization(
+      normalizationInStringRepresentation);
+
+  std::string thresholdRangeInStringRepresentation =
+      this->getProperty("ThresholdRange");
+  auto thresholdRange = saver->translateStringToThresholdRange(
+      thresholdRangeInStringRepresentation);
+
+  int recursionDepth = this->getProperty("RecursionDepth");
+
+  // Save workspace into file
+  saver->saveMDWorkspace(inputWS, filename, normalization, thresholdRange,
+                         recursionDepth);
+}
+
+std::map<std::string, std::string> SaveMDWorkspaceToVTK::validateInputs() {
+  std::map<std::string, std::string> errorMessage;
+
+  // Check for input workspace type
+  Mantid::API::IMDWorkspace_sptr inputWS = this->getProperty("InputWorkspace");
+  if (!boost::dynamic_pointer_cast<Mantid::API::IMDHistoWorkspace>(inputWS) &&
+      !boost::dynamic_pointer_cast<Mantid::API::IMDEventWorkspace>(inputWS)) {
+    errorMessage.emplace("InputWorkspace",
+                         "Only MDHisto or MDEvent workspaces can be saved.");
+  }
+
+  // Check for the dimensionality
+  if (!saver->is3DWorkspace(inputWS)) {
+    errorMessage.emplace("InputWorkspace", "The MD workspace must be 3D.");
+  }
+
+  // Check for file location
+  return errorMessage;
+}
+}
+}
diff --git a/Vates/VatesAPI/src/SaveMDWorkspaceToVTKImpl.cpp b/Vates/VatesAPI/src/SaveMDWorkspaceToVTKImpl.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..e4b1aa143a09c744b46ea04d0c4c7d1286f42ac4
--- /dev/null
+++ b/Vates/VatesAPI/src/SaveMDWorkspaceToVTKImpl.cpp
@@ -0,0 +1,329 @@
+#include "MantidVatesAPI/Normalization.h"
+#include "MantidVatesAPI/SaveMDWorkspaceToVTKImpl.h"
+
+#include "MantidVatesAPI/IgnoreZerosThresholdRange.h"
+#include "MantidVatesAPI/NoThresholdRange.h"
+
+#include "MantidVatesAPI/MDEWInMemoryLoadingPresenter.h"
+#include "MantidVatesAPI/MDHWInMemoryLoadingPresenter.h"
+#include "MantidVatesAPI/MDLoadingViewSimple.h"
+#include "MantidVatesAPI/FactoryChains.h"
+#include "MantidVatesAPI/PresenterFactories.h"
+#include "MantidVatesAPI/ProgressAction.h"
+#include "MantidVatesAPI/SingleWorkspaceProvider.h"
+#include "MantidVatesAPI/vtkDataSetFactory.h"
+
+#include "MantidAPI/IMDHistoWorkspace.h"
+#include "MantidGeometry/MDGeometry/IMDDimension.h"
+#include "MantidKernel/make_unique.h"
+
+#include <vtkSmartPointer.h>
+#include <vtkXMLStructuredGridWriter.h>
+#include <vtkXMLUnstructuredGridWriter.h>
+
+#include <boost/make_shared.hpp>
+#include <memory>
+
+namespace {
+// This progress object gets called by PV (and is used by the plugins),
+// it does not have much use here.
+class NullProgressAction : public Mantid::VATES::ProgressAction {
+  virtual void eventRaised(double) {}
+};
+
+bool has_suffix(const std::string &stringToCheck, const std::string &suffix) {
+  auto isStringLargerThanSuffix = stringToCheck.size() >= suffix.size();
+  auto isSuffixInString = false;
+  if (isStringLargerThanSuffix) {
+    isSuffixInString =
+        stringToCheck.compare(stringToCheck.size() - suffix.size(),
+                              suffix.size(), suffix) == 0;
+  }
+  return isSuffixInString;
+}
+
+bool isNDWorkspace(Mantid::API::IMDWorkspace_sptr workspace,
+                   const size_t dimensionality) {
+  auto actualNonIntegratedDimensionality =
+      workspace->getNonIntegratedDimensions().size();
+  return actualNonIntegratedDimensionality == dimensionality;
+}
+}
+
+namespace Mantid {
+namespace VATES {
+
+const std::string SaveMDWorkspaceToVTKImpl::structuredGridExtension = "vts";
+const std::string SaveMDWorkspaceToVTKImpl::unstructuredGridExtension = "vtu";
+
+SaveMDWorkspaceToVTKImpl::SaveMDWorkspaceToVTKImpl() { setupMembers(); }
+
+/**
+ * Save an MD workspace to a vts/vtu file.
+ * @param workspace: the workspace which is to be saved.
+ * @param filename: the name of the file to which the workspace is to be saved.
+ * @param normalization: the visual normalization option
+ * @param thresholdRange: a plolicy for the threshold range
+ * @param recursionDepth: the recursion depth for MDEvent Workspaces determines
+ * from which level data should be displayed
+ */
+void SaveMDWorkspaceToVTKImpl::saveMDWorkspace(
+    Mantid::API::IMDWorkspace_sptr workspace, std::string filename,
+    VisualNormalization normalization, ThresholdRange_scptr thresholdRange,
+    int recursionDepth) const {
+  auto isHistoWorkspace =
+      boost::dynamic_pointer_cast<Mantid::API::IMDHistoWorkspace>(workspace) !=
+      nullptr;
+  auto fullFilename = getFullFilename(filename, isHistoWorkspace);
+
+  // Define a time slice.
+  auto time = selectTimeSliceValue(workspace);
+
+  // Get presenter and data set factory set up
+  auto factoryChain = getDataSetFactoryChain(isHistoWorkspace, thresholdRange,
+                                             normalization, time);
+
+  auto presenter = getPresenter(isHistoWorkspace, workspace, recursionDepth);
+
+  // Create the vtk data
+  NullProgressAction nullProgressA;
+  NullProgressAction nullProgressB;
+  auto dataSet =
+      presenter->execute(factoryChain.get(), nullProgressA, nullProgressB);
+
+  // Do an orthogonal correction
+  dataSet = getDataSetWithOrthogonalCorrection(dataSet, presenter.get(),
+                                               workspace, isHistoWorkspace);
+
+  // Write the data to the file
+  vtkSmartPointer<vtkXMLWriter> writer = getXMLWriter(isHistoWorkspace);
+  auto writeSuccessFlag = writeDataSetToVTKFile(writer, dataSet, fullFilename);
+  if (!writeSuccessFlag) {
+    throw std::runtime_error("SaveMDWorkspaceToVTK: VTK could not write "
+                             "your data set to a file.");
+  }
+}
+
+/**
+ * Creates the correct factory chain based
+ * @param isHistoWorkspace: flag if workspace is MDHisto
+ * @param thresholdRange: the threshold range
+ * @param normalization: the normalization option
+ * @param time: the time slice info
+ * @returns a data set factory
+ */
+std::unique_ptr<vtkDataSetFactory>
+SaveMDWorkspaceToVTKImpl::getDataSetFactoryChain(
+    bool isHistoWorkspace, ThresholdRange_scptr thresholdRange,
+    VisualNormalization normalization, double time) const {
+  std::unique_ptr<vtkDataSetFactory> factory;
+  if (isHistoWorkspace) {
+    factory = createFactoryChainForHistoWorkspace(thresholdRange, normalization,
+                                                  time);
+  } else {
+    factory = createFactoryChainForEventWorkspace(thresholdRange, normalization,
+                                                  time);
+  }
+  return factory;
+}
+
+/**
+ * Creates the correct factory chain based
+ * @param isHistoWorkspace: flag if workspace is MDHisto
+ * @param workspace: the workspace
+ * @param recursionDepth: the recursion depth
+ * @returns a presenter for either MDHisto or MDEvent
+*/
+std::unique_ptr<MDLoadingPresenter>
+SaveMDWorkspaceToVTKImpl::getPresenter(bool isHistoWorkspace,
+                                       Mantid::API::IMDWorkspace_sptr workspace,
+                                       int recursionDepth) const {
+  std::unique_ptr<MDLoadingPresenter> presenter = nullptr;
+  auto view = Kernel::make_unique<Mantid::VATES::MDLoadingViewSimple>();
+  auto workspaceProvider =
+      Mantid::Kernel::make_unique<SingleWorkspaceProvider>(workspace);
+  if (isHistoWorkspace) {
+    InMemoryPresenterFactory<MDHWInMemoryLoadingPresenter,
+                             EmptyWorkspaceNamePolicy>
+        presenterFactory;
+    presenter = presenterFactory.create(std::move(view), workspace,
+                                        std::move(workspaceProvider));
+  } else {
+    view->setRecursionDepth(recursionDepth);
+    InMemoryPresenterFactory<MDEWInMemoryLoadingPresenter,
+                             EmptyWorkspaceNamePolicy>
+        presenterFactory;
+    presenter = presenterFactory.create(std::move(view), workspace,
+                                        std::move(workspaceProvider));
+  }
+  return presenter;
+}
+
+/**
+ * Write an unstructured grid or structured grid to a vtk file.
+ * @param writer: a vtk xml writer
+ * @param dataSet: the data set which is to be saved out
+ * @param filename: the file name
+ * @returns a vtk error flag
+ */
+int SaveMDWorkspaceToVTKImpl::writeDataSetToVTKFile(
+    vtkXMLWriter *writer, vtkDataSet *dataSet, std::string filename) const {
+  writer->SetFileName(filename.c_str());
+  writer->SetInputData(dataSet);
+  return writer->Write();
+}
+
+/**
+ * Get all allowed normalizations
+ * @returns all allowed normalization options as strings
+ */
+std::vector<std::string>
+SaveMDWorkspaceToVTKImpl::getAllowedNormalizationsInStringRepresentation()
+    const {
+  std::vector<std::string> normalizations;
+  for (auto it = m_normalizations.begin(); it != m_normalizations.end(); ++it) {
+    normalizations.push_back(it->first);
+  }
+
+  return normalizations;
+}
+
+VisualNormalization
+SaveMDWorkspaceToVTKImpl::translateStringToVisualNormalization(
+    const std::string normalization) const {
+  return m_normalizations.at(normalization);
+}
+
+void SaveMDWorkspaceToVTKImpl::setupMembers() {
+  m_normalizations.insert(
+      std::make_pair("AutoSelect", VisualNormalization::AutoSelect));
+  m_normalizations.insert(
+      std::make_pair("NoNormalization", VisualNormalization::NoNormalization));
+  m_normalizations.insert(std::make_pair(
+      "NumEventsNormalization", VisualNormalization::NumEventsNormalization));
+  m_normalizations.insert(std::make_pair(
+      "VolumeNormalization", VisualNormalization::VolumeNormalization));
+
+  m_thresholds.push_back("IgnoreZerosThresholdRange");
+  m_thresholds.push_back("NoThresholdRange");
+}
+
+std::vector<std::string>
+SaveMDWorkspaceToVTKImpl::getAllowedThresholdsInStringRepresentation() const {
+  return m_thresholds;
+}
+
+ThresholdRange_scptr SaveMDWorkspaceToVTKImpl::translateStringToThresholdRange(
+    const std::string thresholdRange) const {
+  if (thresholdRange == m_thresholds[0]) {
+    return boost::make_shared<IgnoreZerosThresholdRange>();
+  } else if (thresholdRange == m_thresholds[1]) {
+    return boost::make_shared<NoThresholdRange>();
+  } else {
+    throw std::runtime_error("SaveMDWorkspaceToVTK: The selected threshold "
+                             "range seems to be incorrect.");
+  }
+}
+
+/**
+ * Returns a time for a time slice
+ * @param workspace: the workspace
+ * @return either the first time entry in case of a 4D workspace or else 0.0
+ */
+double SaveMDWorkspaceToVTKImpl::selectTimeSliceValue(
+    Mantid::API::IMDWorkspace_sptr workspace) const {
+  double time = 0.0;
+  if (is4DWorkspace(workspace)) {
+    auto timeLikeDimension = workspace->getDimension(3);
+    time = static_cast<double>(timeLikeDimension->getMinimum());
+  }
+  return time;
+}
+
+/**
+ * Checks if a workspace is 4D
+ * @param workspace: the workspace to check
+ * @return true if the workspace is 4D else false
+ */
+bool SaveMDWorkspaceToVTKImpl::is4DWorkspace(
+    Mantid::API::IMDWorkspace_sptr workspace) const {
+  const size_t dimensionality = 4;
+  return isNDWorkspace(workspace, dimensionality);
+}
+
+/**
+ * Checks if a workspace is non 3D
+ * @param workspace: the workspace to check
+ * @return true if the workspace is 3D else false
+ */
+bool SaveMDWorkspaceToVTKImpl::is3DWorkspace(
+    Mantid::API::IMDWorkspace_sptr workspace) const {
+  const size_t dimensionality = 3;
+  return isNDWorkspace(workspace, dimensionality);
+}
+
+/**
+ * Gets the full file name including the correct suffix
+ * @param filename: the name of the file except for the suffix
+ * @param isHistoWorkspace: flag if the workspace is an MDHistoWorkspace or not
+ * @return a full file path including a suffix
+ */
+std::string
+SaveMDWorkspaceToVTKImpl::getFullFilename(std::string filename,
+                                          bool isHistoWorkspace) const {
+  const auto extension =
+      isHistoWorkspace ? structuredGridExtension : unstructuredGridExtension;
+  if (!has_suffix(filename, extension)) {
+    filename += ".";
+    filename += extension;
+  }
+  return filename;
+}
+
+/**
+ * Gets the correct vtk xml writer. For MDHisto workspaces a
+ * vtkXMLStructuredGridWriter is required
+ * which writes into vts files. For MDEvent workspaces a
+ * vtkXMLUnstructuredGridWriter is required
+ * which writes into vtu files.
+ * @param isHistoWorkspace: flag if the workspace is an MDHistoWorkspace or not
+ * @return an vtk xml writer
+ */
+vtkSmartPointer<vtkXMLWriter>
+SaveMDWorkspaceToVTKImpl::getXMLWriter(bool isHistoWorkspace) const {
+  vtkSmartPointer<vtkXMLWriter> writer;
+  if (isHistoWorkspace) {
+    writer = vtkSmartPointer<vtkXMLStructuredGridWriter>::New();
+  } else {
+    writer = vtkSmartPointer<vtkXMLUnstructuredGridWriter>::New();
+  }
+  return writer;
+}
+
+/**
+ * Applies a orthogonal correction to a vtk dataset
+ * @param dataSet: the data set to which the correction will be applied
+ * @param presenter: the presenter
+ * @param workspace: the workspace form which the visual data set was derived
+ * @param isHistoWorkspace: flag if the workspace is an MDHistoWorkspace or not
+ * @return a data set with orthogonal correction if this is required
+ */
+vtkSmartPointer<vtkDataSet>
+SaveMDWorkspaceToVTKImpl::getDataSetWithOrthogonalCorrection(
+    vtkSmartPointer<vtkDataSet> dataSet, MDLoadingPresenter *presenter,
+    Mantid::API::IMDWorkspace_sptr workspace, bool isHistoWorkspace) const {
+  if (!isHistoWorkspace) {
+    vtkSmartPointer<vtkPVClipDataSet> clipped = getClippedDataSet(dataSet);
+    dataSet = clipped->GetOutput();
+  }
+
+  auto workspaceProvider =
+      Mantid::Kernel::make_unique<SingleWorkspaceProvider>(workspace);
+  applyCOBMatrixSettingsToVtkDataSet(presenter, dataSet,
+                                     std::move(workspaceProvider));
+  presenter->setAxisLabels(dataSet);
+
+  return dataSet;
+}
+}
+}
diff --git a/Vates/VatesAPI/src/SingleWorkspaceProvider.cpp b/Vates/VatesAPI/src/SingleWorkspaceProvider.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..dfd4392f795fa50e181659b99e6343a045abb219
--- /dev/null
+++ b/Vates/VatesAPI/src/SingleWorkspaceProvider.cpp
@@ -0,0 +1,35 @@
+#include "MantidAPI/Workspace.h"
+#include "MantidVatesAPI/SingleWorkspaceProvider.h"
+
+namespace Mantid {
+namespace VATES {
+
+SingleWorkspaceProvider::SingleWorkspaceProvider(
+    Mantid::API::Workspace_sptr workspace)
+    : m_workspace(workspace) {}
+
+/**
+ * SingleWorkspaceProvider::canProvideWorkspace
+ * @return true if the pointer the workspace is not nullptr else false
+ */
+bool SingleWorkspaceProvider::canProvideWorkspace(std::string) const {
+  return m_workspace != nullptr;
+}
+
+/**
+ * SingleWorkspaceProvider::fetchWorkspace
+ * @returns the underlying workspace
+ */
+Mantid::API::Workspace_sptr
+    SingleWorkspaceProvider::fetchWorkspace(std::string) const {
+  return m_workspace;
+}
+
+/**
+ * SingleWorkspaceProvider::disposeWorkspace: this is left blank, as we don't
+ * want
+ *        to be able to dispose of the workspace
+ */
+void SingleWorkspaceProvider::disposeWorkspace(std::string) const {}
+}
+}
diff --git a/Vates/VatesAPI/src/vtkDataSetToNonOrthogonalDataSet.cpp b/Vates/VatesAPI/src/vtkDataSetToNonOrthogonalDataSet.cpp
index 88d1313cc177ae4a5f0d73c5a7e01fac70912801..06c7d32442df635b074127fcf1b22516783da64b 100644
--- a/Vates/VatesAPI/src/vtkDataSetToNonOrthogonalDataSet.cpp
+++ b/Vates/VatesAPI/src/vtkDataSetToNonOrthogonalDataSet.cpp
@@ -74,36 +74,44 @@ namespace VATES {
 /**
  * This function constructs and executes the helper class.
  * @param dataset : The VTK data to modify
- * @param name : The MDWorkspace containing the information to construct
- * modification
+ * @param name : The MDWorkspace containing the information to construct.
+ * @param workspaceProvider: The provider of one or multiple workspaces.
+
  */
-void vtkDataSetToNonOrthogonalDataSet::exec(vtkDataSet *dataset,
-                                            std::string name) {
-  vtkDataSetToNonOrthogonalDataSet temp(dataset, name);
-  temp.execute();
+void vtkDataSetToNonOrthogonalDataSet::exec(
+    vtkDataSet *dataset, std::string name,
+    std::unique_ptr<WorkspaceProvider> workspaceProvider)
+{
+    vtkDataSetToNonOrthogonalDataSet temp(dataset, name,
+                                          std::move(workspaceProvider));
+    temp.execute();
 }
 
 /**
  * This is the private class constructor.
  * @param dataset : The VTK data to modify
- * @param name : The MDWorkspace containing the information to construct
- * modification
+ * @param name : The MDWorkspace containing the information to construct.
+ * @param workspaceProvider: The provider of one or multiple workspaces.
  */
 vtkDataSetToNonOrthogonalDataSet::vtkDataSetToNonOrthogonalDataSet(
-    vtkDataSet *dataset, std::string name)
+    vtkDataSet *dataset, std::string name,
+    std::unique_ptr<Mantid::VATES::WorkspaceProvider> workspaceProvider)
     : m_dataSet(dataset), m_wsName(name), m_numDims(3), m_skewMat(),
       m_basisNorm(), m_basisX(1, 0, 0), m_basisY(0, 1, 0), m_basisZ(0, 0, 1),
-      m_coordType(Kernel::HKL) {
-  if (NULL == m_dataSet) {
-    throw std::runtime_error("Cannot construct "
-                             "vtkDataSetToNonOrthogonalDataSet with null VTK "
-                             "dataset");
-  }
-  if (name.empty()) {
-    throw std::runtime_error("Cannot construct "
-                             "vtkDataSetToNonOrthogonalDataSet without "
-                             "associated workspace name");
-  }
+      m_coordType(Kernel::HKL),
+      m_workspaceProvider(std::move(workspaceProvider))
+{
+    if (NULL == m_dataSet) {
+        throw std::runtime_error(
+            "Cannot construct "
+            "vtkDataSetToNonOrthogonalDataSet with null VTK "
+            "dataset");
+    }
+    if (name.empty()) {
+        throw std::runtime_error("Cannot construct "
+                                 "vtkDataSetToNonOrthogonalDataSet without "
+                                 "associated workspace name");
+    }
 }
 
 /**
@@ -118,9 +126,8 @@ void vtkDataSetToNonOrthogonalDataSet::execute() {
     throw std::runtime_error("VTK dataset does not inherit from vtkPointSet");
   }
 
-  // Get the workspace from the ADS
-  ADSWorkspaceProvider<API::IMDWorkspace> workspaceProvider;
-  API::Workspace_sptr ws = workspaceProvider.fetchWorkspace(m_wsName);
+  // Get the workspace from the workspace provider
+  API::Workspace_sptr ws = m_workspaceProvider->fetchWorkspace(m_wsName);
   std::string wsType = ws->id();
 
   Geometry::OrientedLattice oLatt;
diff --git a/Vates/VatesAPI/src/vtkMDHistoHexFactory.cpp b/Vates/VatesAPI/src/vtkMDHistoHexFactory.cpp
index d08b83764dc49727c964e177d871863de56961ce..22447772f1cee2cbe1741fad3ce8fac3d9998fe4 100644
--- a/Vates/VatesAPI/src/vtkMDHistoHexFactory.cpp
+++ b/Vates/VatesAPI/src/vtkMDHistoHexFactory.cpp
@@ -131,6 +131,7 @@ vtkMDHistoHexFactory::create3Dor4D(size_t timestep,
   signal->InitializeArray(std::move(iterator), offset, imageSize);
   visualDataSet->GetCellData()->SetScalars(signal.GetPointer());
 
+
   for (vtkIdType index = 0; index < imageSize; ++index) {
     progressUpdate.eventRaised(double(index) * progressFactor);
     double signalScalar = signal->GetValue(index);
diff --git a/Vates/VatesAPI/test/BoxInfoTest.h b/Vates/VatesAPI/test/BoxInfoTest.h
index f216f3d4ee762079457c2304b9b0eeb895daa369..e472fcd21ce1f0676c1984cc191053b36e3a420d 100644
--- a/Vates/VatesAPI/test/BoxInfoTest.h
+++ b/Vates/VatesAPI/test/BoxInfoTest.h
@@ -6,15 +6,16 @@
 #include <cxxtest/TestSuite.h>
 
 #include "MantidKernel/WarningSuppressions.h"
+#include "MantidVatesAPI/ADSWorkspaceProvider.h"
 #include "MantidVatesAPI/BoxInfo.h"
 #include "MantidAPI/AnalysisDataService.h"
 #include "MantidAPI/BoxController.h"
+#include "MantidAPI/IMDEventWorkspace.h"
 #include "MantidKernel/PropertyWithValue.h"
 #include "MantidTestHelpers/MDEventsTestHelper.h"
 #include "MantidDataObjects/MDLeanEvent.h"
 
 
-
 using namespace Mantid::API;
 using namespace Mantid::DataObjects;
 using namespace Mantid::DataObjects::MDEventsTestHelper;
@@ -26,10 +27,11 @@ public:
     // Arrange
     const std::string wsName = "MD_HISTO_WS";
     auto ws = makeFakeMDHistoWorkspace(1.0, 4, 5, 1.0, 0.1, wsName);
+    auto workspaceProvider = Mantid::Kernel::make_unique<Mantid::VATES::ADSWorkspaceProvider<Mantid::API::IMDEventWorkspace>>();
 
     // Act + Assert
     TSM_ASSERT("Should have no recursion depth for top level splitting.",
-                           boost::none == Mantid::VATES::findRecursionDepthForTopLevelSplitting(wsName));
+                           boost::none == Mantid::VATES::findRecursionDepthForTopLevelSplitting(wsName,std::move(workspaceProvider)));
 
     // Clean up
     AnalysisDataService::Instance().remove(wsName);
@@ -39,10 +41,11 @@ public:
     // Arrange
     const std::string wsName = "MD_EVENT_WS";
     auto ws = makeAnyMDEW<MDLeanEvent<3>, 3>(10, 0.0, 10.0, 1, wsName);
+    auto workspaceProvider = Mantid::Kernel::make_unique<Mantid::VATES::ADSWorkspaceProvider<Mantid::API::IMDEventWorkspace>>();
 
     // Act + Assert
     TSM_ASSERT("Should have no recursion depth for top level splitting.",
-               boost::none == Mantid::VATES::findRecursionDepthForTopLevelSplitting(wsName));
+               boost::none == Mantid::VATES::findRecursionDepthForTopLevelSplitting(wsName, std::move(workspaceProvider)));
 
     // Clean up
     AnalysisDataService::Instance().remove(wsName);
@@ -57,9 +60,10 @@ public:
     boxController->setSplitTopInto(0,10);
     boxController->setSplitTopInto(1, 20);
     boxController->setSplitTopInto(2,30);
+    auto workspaceProvider = Mantid::Kernel::make_unique<Mantid::VATES::ADSWorkspaceProvider<Mantid::API::IMDEventWorkspace>>();
 
     // Act
-    auto result = Mantid::VATES::findRecursionDepthForTopLevelSplitting(wsName);
+    auto result = Mantid::VATES::findRecursionDepthForTopLevelSplitting(wsName, std::move(workspaceProvider));
     // Assert
 
     TSM_ASSERT("Should have recursion depth of 1 for top level splitting.",
@@ -70,4 +74,4 @@ public:
   }
 };
 
-#endif
\ No newline at end of file
+#endif
diff --git a/Vates/VatesAPI/test/MDHWNexusLoadingPresenterTest.h b/Vates/VatesAPI/test/MDHWNexusLoadingPresenterTest.h
index dc910da34633d8bdd2b5c5ecf9fb31db3214fb5b..3b8486e5ecb5b0d434f00f89432a3d3896b90ed7 100644
--- a/Vates/VatesAPI/test/MDHWNexusLoadingPresenterTest.h
+++ b/Vates/VatesAPI/test/MDHWNexusLoadingPresenterTest.h
@@ -7,6 +7,7 @@
 #include <vtkMatrix4x4.h>
 #include <vtkPVChangeOfBasisHelper.h>
 #include <vtkDataArray.h>
+#include "MantidVatesAPI/ADSWorkspaceProvider.h"
 #include "MantidVatesAPI/vtkMD0DFactory.h"
 #include "MantidVatesAPI/vtkMDHistoLineFactory.h"
 #include "MantidVatesAPI/vtkMDHistoQuadFactory.h"
@@ -178,7 +179,8 @@ public:
 
     // Set the COB
     try {
-      presenter.makeNonOrthogonal(product);
+      auto workspaceProvider = Mantid::Kernel::make_unique<ADSWorkspaceProvider<Mantid::API::IMDWorkspace>>();
+      presenter.makeNonOrthogonal(product, std::move(workspaceProvider));
     } catch (...) {
       // Add the standard change of basis matrix and set the boundaries
       presenter.setDefaultCOBandBoundaries(product);
diff --git a/Vates/VatesAPI/test/MDLoadingViewSimpleTest.h b/Vates/VatesAPI/test/MDLoadingViewSimpleTest.h
new file mode 100644
index 0000000000000000000000000000000000000000..60b5ba55d4e08c45cc7e70e0c450fda8fed7824e
--- /dev/null
+++ b/Vates/VatesAPI/test/MDLoadingViewSimpleTest.h
@@ -0,0 +1,40 @@
+#ifndef MD_LOADING_VIEW_SIMPLE_TEST_H
+#define MD_LOADING_VIEW_SIMPLE_TEST_H
+
+#include "MantidVatesAPI/MDLoadingViewSimple.h"
+
+#include <cxxtest/TestSuite.h>
+
+using namespace Mantid::VATES;
+
+class MDLoadingViewSimpleTest : public CxxTest::TestSuite
+{
+
+public:
+
+  void test_that_defaults_are_returned() {
+    MDLoadingViewSimple view;
+
+    TSM_ASSERT_EQUALS("Should have a time of 0.0 by default", view.getTime(), 0.0);
+    TSM_ASSERT_EQUALS("Should have a recursion depth of 5 by default", view.getRecursionDepth(), 5);
+    TSM_ASSERT_EQUALS("Should be set to loadingInMemory to true", view.getLoadInMemory(), true);
+  }
+
+  void test_that_settings_are_correctly_stored() {
+    // Arrange
+    MDLoadingViewSimple view;
+    auto loadingInMemory = false;
+    auto time = 1.0;
+    size_t recursionDepth = 7;
+    view.setLoadInMemory(loadingInMemory);
+    view.setRecursionDepth(recursionDepth);
+    view.setTime(time);
+
+    // Act + Assert
+    TSM_ASSERT_EQUALS("Should have a time of 1.0", view.getTime(), time);
+    TSM_ASSERT_EQUALS("Should have a recursion depth of 7", view.getRecursionDepth(), recursionDepth);
+    TSM_ASSERT_EQUALS("Should be set to loadingInMemory to false", view.getLoadInMemory(), loadingInMemory);
+  }
+};
+
+#endif
diff --git a/Vates/VatesAPI/test/MockObjects.h b/Vates/VatesAPI/test/MockObjects.h
index 20556dd6c2e79469eb5e35d8a978bae9b3ff8635..7e7f24a0c61515a9cf688685ee79cf83e3e3a8e8 100644
--- a/Vates/VatesAPI/test/MockObjects.h
+++ b/Vates/VatesAPI/test/MockObjects.h
@@ -93,12 +93,12 @@ public:
   MOCK_CONST_METHOD0(getSpecialCoordinateSystem,
                      Mantid::Kernel::SpecialCoordinateSystem());
 
-  virtual void getLinePlot(const Mantid::Kernel::VMD &,
-                           const Mantid::Kernel::VMD &,
-                           Mantid::API::MDNormalization,
-                           std::vector<Mantid::coord_t> &,
-                           std::vector<Mantid::signal_t> &,
-                           std::vector<Mantid::signal_t> &) const {}
+  virtual Mantid::API::IMDWorkspace::LinePlot
+  getLinePlot(const Mantid::Kernel::VMD &, const Mantid::Kernel::VMD &,
+              Mantid::API::MDNormalization) const {
+    LinePlot line;
+    return line;
+  }
 
   virtual std::vector<Mantid::API::IMDIterator *>
       createIterators(size_t = 1,
@@ -139,16 +139,12 @@ public:
   }
   MOCK_CONST_METHOD1(
       create, vtkSmartPointer<vtkDataSet>(Mantid::VATES::ProgressAction &));
-  MOCK_CONST_METHOD0(createMeshOnly,
-    vtkDataSet*());
-  MOCK_CONST_METHOD0(createScalarArray,
-    vtkFloatArray*());
-  MOCK_METHOD1(initialize,
-    void(Mantid::API::Workspace_sptr));
+  MOCK_CONST_METHOD0(createMeshOnly, vtkDataSet *());
+  MOCK_CONST_METHOD0(createScalarArray, vtkFloatArray *());
+  MOCK_METHOD1(initialize, void(Mantid::API::Workspace_sptr));
   MOCK_METHOD1(setSuccessorProxy, void(vtkDataSetFactory *));
   MOCK_CONST_METHOD0(hasSuccessor, bool());
-  MOCK_CONST_METHOD0(validate,
-    void());
+  MOCK_CONST_METHOD0(validate, void());
   MOCK_CONST_METHOD0(getFactoryTypeName, std::string());
   MOCK_METHOD1(setRecursionDepth, void(size_t));
 };
diff --git a/Vates/VatesAPI/test/PresenterUtilitiesTest.h b/Vates/VatesAPI/test/PresenterUtilitiesTest.h
new file mode 100644
index 0000000000000000000000000000000000000000..2ba840597fa565a005765ddb3d43915d89809fb5
--- /dev/null
+++ b/Vates/VatesAPI/test/PresenterUtilitiesTest.h
@@ -0,0 +1,23 @@
+#ifndef VATES_API_PRESENTER_UTILITIES_TEST_H_
+#define VATES_API_PRESENTER_UTILITIES_TEST_H_
+
+#include <cxxtest/TestSuite.h>
+#include "MantidVatesAPI/FactoryChains.h"
+
+class PresenterUtilitiesTest : public CxxTest::TestSuite
+{
+public:
+
+  void test_that_time_stamped_name_is_produced() {
+    // Arrange
+    std::string name = "testName";
+    // Act
+    auto timeStampedName = Mantid::VATES::createTimeStampedName(name);
+    // Assert
+    TSM_ASSERT("Time stamped name should be larger than the original name", name.size() < timeStampedName.size());
+    TSM_ASSERT("Time stamped name should start with original name", timeStampedName.find(name) == 0);
+  }
+
+
+};
+#endif
diff --git a/Vates/VatesAPI/test/SaveMDWorkspaceToVTKImplTest.h b/Vates/VatesAPI/test/SaveMDWorkspaceToVTKImplTest.h
new file mode 100644
index 0000000000000000000000000000000000000000..d636d60e4bd9e26ab1913359e183684614449679
--- /dev/null
+++ b/Vates/VatesAPI/test/SaveMDWorkspaceToVTKImplTest.h
@@ -0,0 +1,290 @@
+#ifndef VATES_API_SAVE_MD_WORKSPACE_TO_VTK_IMPL_TEST_H_
+#define VATES_API_SAVE_MD_WORKSPACE_TO_VTK_IMPL_TEST_H_
+
+#include <cxxtest/TestSuite.h>
+#include "MantidVatesAPI/SaveMDWorkspaceToVTKImpl.h"
+#include "MantidVatesAPI/Normalization.h"
+#include "MantidVatesAPI/IgnoreZerosThresholdRange.h"
+#include "MantidTestHelpers/MDEventsTestHelper.h"
+#include "MantidKernel/ConfigService.h"
+
+#include <Poco/File.h>
+
+using namespace Mantid::DataObjects;
+
+class SaveMDWorkspaceToVTKImplTest : public CxxTest::TestSuite
+{
+public:
+    void test_that_vector_of_normalization_strings_has_all_values()
+    {
+        // Arrange
+        Mantid::VATES::SaveMDWorkspaceToVTKImpl saveMDToVTK;
+
+        // Act
+        const auto normalizations
+            = saveMDToVTK.getAllowedNormalizationsInStringRepresentation();
+
+        // Assert
+        TSM_ASSERT_EQUALS("There should be 4 normalization options.",
+                          normalizations.size(), 4);
+        TSM_ASSERT_EQUALS("First normalization should be AutoSelect.",
+                          normalizations[0], "AutoSelect");
+        TSM_ASSERT_EQUALS("First normalization should be NoNormalization.",
+                          normalizations[1], "NoNormalization");
+        TSM_ASSERT_EQUALS(
+            "First normalization should be NumEventsNormalization.",
+            normalizations[2], "NumEventsNormalization");
+        TSM_ASSERT_EQUALS("First normalization should be VolumeNormalization.",
+                          normalizations[3], "VolumeNormalization");
+    }
+
+    void test_string_representation_converts_to_visual_normalization()
+    {
+        // Arrange
+        Mantid::VATES::SaveMDWorkspaceToVTKImpl saveMDToVTK;
+        const auto normalizations
+            = saveMDToVTK.getAllowedNormalizationsInStringRepresentation();
+
+        // Act
+        const auto autoSelect
+            = saveMDToVTK.translateStringToVisualNormalization(
+                normalizations[0]);
+        const auto noNormalization
+            = saveMDToVTK.translateStringToVisualNormalization(
+                normalizations[1]);
+        const auto numEventsNormalization
+            = saveMDToVTK.translateStringToVisualNormalization(
+                normalizations[2]);
+        const auto volumeNormalization
+            = saveMDToVTK.translateStringToVisualNormalization(
+                normalizations[3]);
+
+        // Assert
+        TSM_ASSERT_EQUALS("The visual normalization should be AutoSelect.",
+                          autoSelect, Mantid::VATES::AutoSelect);
+        TSM_ASSERT_EQUALS("The visual normalization should be NoNormalization.",
+                          noNormalization, Mantid::VATES::NoNormalization);
+        TSM_ASSERT_EQUALS(
+            "The visual normalization should be NumEventsNormalization.",
+            numEventsNormalization, Mantid::VATES::NumEventsNormalization);
+        TSM_ASSERT_EQUALS(
+            "The visual normalization should be VolumeNormalization.",
+            volumeNormalization, Mantid::VATES::VolumeNormalization);
+    }
+
+    void test_that_vector_of_threshold_strings_has_all_values()
+    {
+        // Arrange
+        Mantid::VATES::SaveMDWorkspaceToVTKImpl saveMDToVTK;
+
+        // Act
+        const auto thresholds
+            = saveMDToVTK.getAllowedThresholdsInStringRepresentation();
+
+        // Assert
+        TSM_ASSERT_EQUALS("There should be 2 normalization options",
+                          thresholds.size(), 2);
+        TSM_ASSERT_EQUALS(
+            "First normalization should be IgnoreZerosThresholdRange.",
+            thresholds[0], "IgnoreZerosThresholdRange");
+        TSM_ASSERT_EQUALS("Second normalization should be NoThresholdRange.",
+                          thresholds[1], "NoThresholdRange");
+    }
+
+    void test_string_representation_converts_to_TresholdRange()
+    {
+        // Arrange
+        Mantid::VATES::SaveMDWorkspaceToVTKImpl saveMDToVTK;
+        auto thresholds
+            = saveMDToVTK.getAllowedThresholdsInStringRepresentation();
+        // Act
+        auto ignoreZerosThresholdRange
+            = saveMDToVTK.translateStringToThresholdRange(thresholds[0]);
+        auto noThresholdRange
+            = saveMDToVTK.translateStringToThresholdRange(thresholds[1]);
+        // Assert
+        TSM_ASSERT(
+            "Should be a IgnoreZerosTresholdRange",
+            boost::
+                dynamic_pointer_cast<Mantid::VATES::IgnoreZerosThresholdRange>(
+                    ignoreZerosThresholdRange));
+        TSM_ASSERT("Should be a NoTresholdRange",
+                   boost::dynamic_pointer_cast<Mantid::VATES::ThresholdRange>(
+                       noThresholdRange));
+    }
+
+    void test_detects_when_not_3D_workspace()
+    {
+        // Arrange
+        Mantid::VATES::SaveMDWorkspaceToVTKImpl saveMDToVTK;
+        size_t numDims = 4;
+        auto workspace
+            = MDEventsTestHelper::makeFakeMDHistoWorkspace(1.0, numDims);
+
+        // Act
+        const auto is3D = saveMDToVTK.is3DWorkspace(workspace);
+
+        // Assert
+        TSM_ASSERT("Detects a non-3D MD workspace", !is3D);
+    }
+
+    void test_detects_when_3D_workspace()
+    {
+        // Arrange
+        Mantid::VATES::SaveMDWorkspaceToVTKImpl saveMDToVTK;
+        const size_t numDims = 3;
+        auto workspace
+            = MDEventsTestHelper::makeFakeMDHistoWorkspace(1.0, numDims);
+
+        // Act
+        const auto is3D = saveMDToVTK.is3DWorkspace(workspace);
+
+        // Assert
+        TSM_ASSERT("Detects that a 3D MD workspace", is3D);
+    }
+
+    void
+    test_that_saves_MD_Event_workspace_to_vts_file_without_extension_in_path_name()
+    {
+        // Arrange
+        auto workspace = getTestWorkspace("MDEvent");
+
+        const std::string filenameBare = "SaveMDWorkspaceToVTKImplTestFile";
+        const std::string filenameWithExtension = filenameBare + ".vtu";
+
+        auto filenameExpected = getTemporaryFilename(filenameWithExtension);
+        removeTemporaryFile(filenameExpected);
+
+        auto filename = getTemporaryFilename(filenameBare);
+
+        // Act
+        do_test_saving_to_vtk_file(workspace, filename);
+
+        // Assert
+        verify_file_creation(filenameExpected);
+    }
+
+    void
+    test_that_saves_MD_Event_workspace_to_vts_file_with_extension_in_path_name()
+    {
+        // Arrange
+        auto workspace = getTestWorkspace("MDEvent");
+
+        const std::string filename = "SaveMDWorkspaceToVTKImplTestFile.vtu";
+        removeTemporaryFile(filename);
+
+        // Act
+        do_test_saving_to_vtk_file(workspace, filename);
+
+        // Assert
+        verify_file_creation(filename);
+    }
+
+    void
+    test_that_saves_MD_Histo_workspace_to_vts_file_without_extension_in_path_name()
+    {
+        // Arrange
+        auto workspace = getTestWorkspace("MDHisto");
+
+        const std::string filenameBare = "SaveMDWorkspaceToVTKImplTestFile";
+        const std::string filenameWithExtension = filenameBare + ".vts";
+
+        auto filenameExpected = getTemporaryFilename(filenameWithExtension);
+        removeTemporaryFile(filenameExpected);
+
+        auto filename = getTemporaryFilename(filenameBare);
+
+        // Act
+        do_test_saving_to_vtk_file(workspace, filename);
+
+        // Assert
+        verify_file_creation(filenameExpected);
+    }
+
+    void
+    test_that_saves_MD_Histo_workspace_to_vts_file_with_extension_in_path_name()
+    {
+        // Arrange
+        auto workspace = getTestWorkspace("MDHisto");
+
+        std::string filename = "SaveMDWorkspaceToVTKImplTestFile.vts";
+        filename = getTemporaryFilename(filename);
+        removeTemporaryFile(filename);
+
+        // Act
+        do_test_saving_to_vtk_file(workspace, filename);
+
+        // Assert
+        verify_file_creation(filename);
+    }
+
+private:
+    void do_test_saving_to_vtk_file(Mantid::API::IMDWorkspace_sptr workspace,
+                                    std::string filename)
+    {
+        const int recursionDepth = 5;
+
+        Mantid::VATES::SaveMDWorkspaceToVTKImpl saveMDToVTK;
+
+        const auto normalizations
+            = saveMDToVTK.getAllowedNormalizationsInStringRepresentation();
+        const auto normalization
+            = saveMDToVTK.translateStringToVisualNormalization(
+                normalizations[0]);
+
+        const auto thresholds
+            = saveMDToVTK.getAllowedThresholdsInStringRepresentation();
+        const auto threshold
+            = saveMDToVTK.translateStringToThresholdRange(thresholds[0]);
+
+        saveMDToVTK.saveMDWorkspace(workspace, filename, normalization,
+                                    threshold, recursionDepth);
+    }
+
+    Mantid::API::IMDWorkspace_sptr getTestWorkspace(std::string workspaceType)
+    {
+        Mantid::API::IMDWorkspace_sptr workspace;
+        if (workspaceType == "MDEvent") {
+            const std::string name = "SaveMDEventToVTKTestWorkspace";
+            workspace = MDEventsTestHelper::makeFakeMDEventWorkspace(name);
+        } else {
+            const size_t numDims = 3;
+            const size_t numBins = 5;
+            workspace = MDEventsTestHelper::makeFakeMDHistoWorkspace(
+                1.0, numDims, numBins);
+        }
+        return workspace;
+    }
+
+    void verify_file_creation(std::string filename)
+    {
+        // Assert
+        auto fileExists = doesFileExist(filename);
+        TSM_ASSERT("The according file should have been saved out", fileExists);
+        // Cleanup
+        removeTemporaryFile(filename);
+    }
+
+    std::string getTemporaryFilename(std::string filenameWithoutPath) const
+    {
+        auto default_save_directory
+            = Mantid::Kernel::ConfigService::Instance().getString(
+                "defaultsave.directory");
+        std::string filenameWithPath(default_save_directory
+                                     + filenameWithoutPath);
+        return filenameWithPath;
+    }
+
+    void removeTemporaryFile(std::string fileNameWithPath) const
+    {
+        if (Poco::File(fileNameWithPath).exists()) {
+            Poco::File(fileNameWithPath).remove();
+        }
+    }
+
+    bool doesFileExist(std::string filename)
+    {
+        return Poco::File(filename).exists();
+    }
+};
+#endif
diff --git a/Vates/VatesAPI/test/SaveMDWorkspaceToVTKTest.h b/Vates/VatesAPI/test/SaveMDWorkspaceToVTKTest.h
new file mode 100644
index 0000000000000000000000000000000000000000..dc53856c42f7de7f6bcf01c8db0dd9b12fbfc771
--- /dev/null
+++ b/Vates/VatesAPI/test/SaveMDWorkspaceToVTKTest.h
@@ -0,0 +1,124 @@
+#ifndef VATES_API_SAVE_MD_WORKSPACE_TO_VTK_TEST_H_
+#define VATES_API_SAVE_MD_WORKSPACE_TO_VTK_TEST_H_
+
+#include <cxxtest/TestSuite.h>
+#include "MantidVatesAPI/SaveMDWorkspaceToVTK.h"
+#include "MantidTestHelpers/WorkspaceCreationHelper.h"
+#include "MantidTestHelpers/MDEventsTestHelper.h"
+#include <Poco/File.h>
+
+class SaveMDWorkspaceToVTKTest : public CxxTest::TestSuite
+{
+public:
+    void test_that_wrong_workspace_type_throws()
+    {
+        // Arrange
+        auto workspace = WorkspaceCreationHelper::Create2DWorkspace(1, 10);
+
+        Mantid::VATES::SaveMDWorkspaceToVTK alg;
+        alg.setChild(true);
+        alg.setRethrows(true);
+        alg.initialize();
+        alg.setProperty("InputWorkspace", workspace);
+        alg.setProperty("Filename", "test_file_name");
+        alg.setProperty("Normalization", "AutoSelect");
+        alg.setProperty("ThresholdRange", "IgnoreZerosThresholdRange");
+        alg.setProperty("RecursionDepth", 5);
+
+        // Act + Assert
+        TSM_ASSERT_THROWS_ANYTHING(
+            "Wrong workspae type should cause the algorithm to throw",
+            alg.execute());
+    }
+
+    void test_that_non_3D_workspace_throws()
+    {
+        // Arrange
+        const size_t numDims = 4;
+        const size_t numBins = 5;
+        auto workspace = Mantid::DataObjects::MDEventsTestHelper::makeFakeMDHistoWorkspace(
+            1.0, numDims, numBins);
+
+        Mantid::VATES::SaveMDWorkspaceToVTK alg;
+        alg.setChild(true);
+        alg.setRethrows(true);
+        alg.initialize();
+        alg.setProperty("InputWorkspace", workspace);
+        alg.setProperty("Filename", "test_file_name");
+        alg.setProperty("Normalization", "AutoSelect");
+        alg.setProperty("ThresholdRange", "IgnoreZerosThresholdRange");
+        alg.setProperty("RecursionDepth", 5);
+
+        // Act + Assert
+        TSM_ASSERT_THROWS_ANYTHING(
+            "Four dimensional workspace should not be accepted", alg.execute());
+    }
+
+    void test_that_saves_MDHisto_without_issues_under_normal_conditions()
+    {
+        // Algthough the actual saving should be tested in the implementation
+        // file, we should test that the algorithm can run without issues
+        // Arrange
+        const size_t numDims = 3;
+        const size_t numBins = 5;
+        auto workspace = Mantid::DataObjects::MDEventsTestHelper::makeFakeMDHistoWorkspace(
+            1.0, numDims, numBins);
+
+        std::string filename = "SaveMDWorkspaceToVTK_test_file.vts";
+        auto fullFilename = getTemporaryFilename(filename);
+        removeTemporaryFile(fullFilename);
+
+        Mantid::VATES::SaveMDWorkspaceToVTK alg;
+        alg.setChild(true);
+        alg.setRethrows(true);
+        alg.initialize();
+        alg.setProperty("InputWorkspace", workspace);
+        alg.setProperty("Filename", fullFilename);
+        alg.setProperty("Normalization", "AutoSelect");
+        alg.setProperty("ThresholdRange", "IgnoreZerosThresholdRange");
+        alg.setProperty("RecursionDepth", 5);
+
+        // Act and Assert
+        TSM_ASSERT_THROWS_NOTHING("Should save without any issues.",
+                                  alg.execute());
+
+        auto fileExists = doesFileExist(fullFilename);
+        TSM_ASSERT("The file should have been saved out", fileExists);
+
+        // Clean up
+        removeTemporaryFile(fullFilename);
+    }
+
+private:
+    void verify_file_creation(std::string filename)
+    {
+        // Assert
+        auto fileExists = doesFileExist(filename);
+        TSM_ASSERT("The according file should have been saved out", fileExists);
+        // Cleanup
+        removeTemporaryFile(filename);
+    }
+
+    std::string getTemporaryFilename(std::string filenameWithoutPath) const
+    {
+        auto default_save_directory
+            = Mantid::Kernel::ConfigService::Instance().getString(
+                "defaultsave.directory");
+        std::string filenameWithPath(default_save_directory
+                                     + filenameWithoutPath);
+        return filenameWithPath;
+    }
+
+    void removeTemporaryFile(std::string fileNameWithPath) const
+    {
+        if (Poco::File(fileNameWithPath).exists()) {
+            Poco::File(fileNameWithPath).remove();
+        }
+    }
+
+    bool doesFileExist(std::string filename)
+    {
+        return Poco::File(filename).exists();
+    }
+};
+#endif
diff --git a/Vates/VatesAPI/test/SingleWorkspaceProviderTest.h b/Vates/VatesAPI/test/SingleWorkspaceProviderTest.h
new file mode 100644
index 0000000000000000000000000000000000000000..bf1b3a81c0d69361e3ba93f55924abc70cb6b430
--- /dev/null
+++ b/Vates/VatesAPI/test/SingleWorkspaceProviderTest.h
@@ -0,0 +1,46 @@
+#ifndef VATES_API_SINGLE_WORKSPACE_PROVIDER_TEST_H_
+#define VATES_API_SINGLE_WORKSPACE_PROVIDER_TEST_H_
+
+#include <cxxtest/TestSuite.h>
+#include "MantidVatesAPI/SingleWorkspaceProvider.h"
+#include "MantidTestHelpers/MDEventsTestHelper.h"
+#include "MantidAPI/IMDHistoWorkspace.h"
+#include <boost/pointer_cast.hpp>
+
+using namespace Mantid::DataObjects;
+
+class SingleWorkspaceProviderTest : public CxxTest::TestSuite
+{
+public:
+  void test_that_correctly_initiated_provider_can_provide() {
+    // Arrange
+    auto workspace = MDEventsTestHelper::makeFakeMDHistoWorkspace(1.0, 3);
+    Mantid::VATES::SingleWorkspaceProvider provider(workspace);
+    // Act
+    auto canProvide = provider.canProvideWorkspace("");
+    // Assert
+    TSM_ASSERT("Should be able to provide a workspace", canProvide);
+  }
+
+  void test_that_incorrectly_initiated_provider_cannot_provide() {
+    // Arrange
+    Mantid::API::IMDWorkspace_sptr emptyWorkspace;
+    Mantid::VATES::SingleWorkspaceProvider provider(emptyWorkspace);
+    // Act
+    auto canProvide = provider.canProvideWorkspace("");
+    // Assert
+    TSM_ASSERT("Should not be able to provide a workspace", !canProvide);
+  }
+
+  void test_that_workspace_can_be_fetched() {
+    // Arrange
+    auto workspace = MDEventsTestHelper::makeFakeMDHistoWorkspace(1.0, 3);
+    Mantid::VATES::SingleWorkspaceProvider provider(workspace);
+    // Act
+    auto fetchedWorkspace = provider.fetchWorkspace("");
+    // Assert
+    TSM_ASSERT("Should have a handle on a MDHistoWorkspace", boost::dynamic_pointer_cast<Mantid::API::IMDHistoWorkspace>(fetchedWorkspace));
+  }
+};
+
+#endif
diff --git a/Vates/VatesAPI/test/vtkDataSetToNonOrthogonalDataSetTest.h b/Vates/VatesAPI/test/vtkDataSetToNonOrthogonalDataSetTest.h
index 069968ecaae37b87971f6e8fbc73c07c01996024..f5d5ffbfd792251bd138345cb62e656fdc065724 100644
--- a/Vates/VatesAPI/test/vtkDataSetToNonOrthogonalDataSetTest.h
+++ b/Vates/VatesAPI/test/vtkDataSetToNonOrthogonalDataSetTest.h
@@ -2,6 +2,7 @@
 #define MANTID_VATES_VTKDATASETTONONORTHOGONALDATASETTEST_H_
 
 #include <cxxtest/TestSuite.h>
+#include <MantidVatesAPI/ADSWorkspaceProvider.h>
 #include "MantidVatesAPI/vtkDataSetToNonOrthogonalDataSet.h"
 #include "MantidAPI/AlgorithmManager.h"
 #include "MantidAPI/ExperimentInfo.h"
@@ -229,20 +230,23 @@ public:
   void testThrowIfVtkDatasetNull()
   {
     vtkDataSet *dataset = NULL;
-    TS_ASSERT_THROWS(vtkDataSetToNonOrthogonalDataSet temp(dataset, ""),
+    auto workspaceProvider = Mantid::Kernel::make_unique<ADSWorkspaceProvider<Mantid::API::IMDWorkspace>>();
+    TS_ASSERT_THROWS(vtkDataSetToNonOrthogonalDataSet temp(dataset, "", std::move(workspaceProvider)),
                      std::runtime_error);
   }
 
-  void testThrowsIfWorkspaceNameEmpty() {
+  void testThrowsIfWorkspaceNameEmptyAndUsingADSWorkspaceProvider() {
     vtkNew<vtkUnstructuredGrid> dataset;
+    auto workspaceProvider = Mantid::Kernel::make_unique<ADSWorkspaceProvider<Mantid::API::IMDWorkspace>>();
     TS_ASSERT_THROWS(
-        vtkDataSetToNonOrthogonalDataSet temp(dataset.GetPointer(), ""),
+        vtkDataSetToNonOrthogonalDataSet temp(dataset.GetPointer(), "", std::move(workspaceProvider)),
         std::runtime_error);
   }
 
   void testThrowIfVtkDatasetWrongType() {
     vtkNew<vtkRectilinearGrid> grid;
-    vtkDataSetToNonOrthogonalDataSet converter(grid.GetPointer(), "name");
+    auto workspaceProvider = Mantid::Kernel::make_unique<ADSWorkspaceProvider<Mantid::API::IMDWorkspace>>();
+    vtkDataSetToNonOrthogonalDataSet converter(grid.GetPointer(), "name", std::move(workspaceProvider));
     TS_ASSERT_THROWS(converter.execute(), std::runtime_error);
   }
 
@@ -251,7 +255,8 @@ public:
     std::string wsName = createMantidWorkspace(false);
     vtkSmartPointer<vtkUnstructuredGrid> ds;
     ds.TakeReference(createSingleVoxelPoints());
-    vtkDataSetToNonOrthogonalDataSet converter(ds, wsName);
+    auto workspaceProvider = Mantid::Kernel::make_unique<ADSWorkspaceProvider<Mantid::API::IMDWorkspace>>();
+    vtkDataSetToNonOrthogonalDataSet converter(ds, wsName, std::move(workspaceProvider));
     TS_ASSERT_THROWS_NOTHING(converter.execute());
     this->checkUnityTransformation(ds);
   }
@@ -261,7 +266,8 @@ public:
     std::string wsName = createMantidWorkspace(false, true);
     vtkSmartPointer<vtkUnstructuredGrid> ds;
     ds.TakeReference(createSingleVoxelPoints());
-    vtkDataSetToNonOrthogonalDataSet converter(ds, wsName);
+    auto workspaceProvider = Mantid::Kernel::make_unique<ADSWorkspaceProvider<Mantid::API::IMDWorkspace>>();
+    vtkDataSetToNonOrthogonalDataSet converter(ds, wsName, std::move(workspaceProvider));
     TS_ASSERT_THROWS(converter.execute(), std::invalid_argument);
   }
 
@@ -270,7 +276,8 @@ public:
     std::string wsName = createMantidWorkspace(false, false, true);
     vtkSmartPointer<vtkUnstructuredGrid> ds;
     ds.TakeReference(createSingleVoxelPoints());
-    vtkDataSetToNonOrthogonalDataSet converter(ds, wsName);
+    auto workspaceProvider = Mantid::Kernel::make_unique<ADSWorkspaceProvider<Mantid::API::IMDWorkspace>>();
+    vtkDataSetToNonOrthogonalDataSet converter(ds, wsName, std::move(workspaceProvider));
     TS_ASSERT_THROWS(converter.execute(), std::invalid_argument);
   }
 
@@ -279,7 +286,8 @@ public:
     std::string wsName = createMantidWorkspace(false, false, false, true);
     vtkSmartPointer<vtkUnstructuredGrid> ds;
     ds.TakeReference(createSingleVoxelPoints());
-    vtkDataSetToNonOrthogonalDataSet converter(ds, wsName);
+    auto workspaceProvider = Mantid::Kernel::make_unique<ADSWorkspaceProvider<Mantid::API::IMDWorkspace>>();
+    vtkDataSetToNonOrthogonalDataSet converter(ds, wsName, std::move(workspaceProvider));
     TS_ASSERT_THROWS(converter.execute(), std::invalid_argument);
   }
 
@@ -288,7 +296,8 @@ public:
     std::string wsName = createMantidWorkspace(false, false, false, false, true);
     vtkSmartPointer<vtkUnstructuredGrid> ds;
     ds.TakeReference(createSingleVoxelPoints());
-    vtkDataSetToNonOrthogonalDataSet converter(ds, wsName);
+    auto workspaceProvider = Mantid::Kernel::make_unique<ADSWorkspaceProvider<Mantid::API::IMDWorkspace>>();
+    vtkDataSetToNonOrthogonalDataSet converter(ds, wsName, std::move(workspaceProvider));
     TS_ASSERT_THROWS_NOTHING(converter.execute());
   }
 
@@ -297,8 +306,9 @@ public:
     std::string wsName = createMantidWorkspace(false);
     vtkSmartPointer<vtkUnstructuredGrid> ds;
     ds.TakeReference(createSingleVoxelPoints());
+    auto workspaceProvider = Mantid::Kernel::make_unique<ADSWorkspaceProvider<Mantid::API::IMDWorkspace>>();
     TS_ASSERT_THROWS_NOTHING(
-        vtkDataSetToNonOrthogonalDataSet::exec(ds, wsName));
+        vtkDataSetToNonOrthogonalDataSet::exec(ds, wsName, std::move(workspaceProvider)));
   }
 
   void testNonUnitySimpleDataset()
@@ -306,7 +316,8 @@ public:
     std::string wsName = createMantidWorkspace(true);
     vtkSmartPointer<vtkUnstructuredGrid> ds;
     ds.TakeReference(createSingleVoxelPoints());
-    vtkDataSetToNonOrthogonalDataSet converter(ds, wsName);
+    auto workspaceProvider = Mantid::Kernel::make_unique<ADSWorkspaceProvider<Mantid::API::IMDWorkspace>>();
+    vtkDataSetToNonOrthogonalDataSet converter(ds, wsName, std::move(workspaceProvider));
     TS_ASSERT_THROWS_NOTHING(converter.execute());
     // Now, check some values
     /// Get the (1,1,1) point
@@ -351,7 +362,8 @@ public:
     std::string wsName = createMantidWorkspace(false, false, false, false, false, 2.0);
     vtkSmartPointer<vtkUnstructuredGrid> ds;
     ds.TakeReference(createSingleVoxelPoints());
-    vtkDataSetToNonOrthogonalDataSet converter(ds, wsName);
+    auto workspaceProvider = Mantid::Kernel::make_unique<ADSWorkspaceProvider<Mantid::API::IMDWorkspace>>();
+    vtkDataSetToNonOrthogonalDataSet converter(ds, wsName, std::move(workspaceProvider));
     TS_ASSERT_THROWS_NOTHING(converter.execute());
     this->checkUnityTransformation(ds);
   }
@@ -361,7 +373,8 @@ public:
     std::string wsName = createMantidWorkspace(true, false, false, false, false, 2.0);
     vtkSmartPointer<vtkUnstructuredGrid> ds;
     ds.TakeReference(createSingleVoxelPoints());
-    vtkDataSetToNonOrthogonalDataSet converter(ds, wsName);
+    auto workspaceProvider = Mantid::Kernel::make_unique<ADSWorkspaceProvider<Mantid::API::IMDWorkspace>>();
+    vtkDataSetToNonOrthogonalDataSet converter(ds, wsName, std::move(workspaceProvider));
     TS_ASSERT_THROWS_NOTHING(converter.execute());
     // Now, check some values
     /// Get the (1,1,1) point
diff --git a/Vates/VatesAPI/test/vtkMDHexFactoryTest.h b/Vates/VatesAPI/test/vtkMDHexFactoryTest.h
index 37ac405cc3e6cc6bfaff19525e11462ea1c187c3..c77142233a7dc9319a5f85e5389e6fd621ff2e22 100644
--- a/Vates/VatesAPI/test/vtkMDHexFactoryTest.h
+++ b/Vates/VatesAPI/test/vtkMDHexFactoryTest.h
@@ -100,7 +100,7 @@ public:
                             VATES::VolumeNormalization);
     factory.setSuccessor(std::move(uniqueSuccessor));
 
-    ITableWorkspace_sptr ws(new Mantid::DataObjects::TableWorkspace);
+    auto ws = boost::make_shared<Mantid::DataObjects::TableWorkspace>();
     TS_ASSERT_THROWS_NOTHING(factory.initialize(ws));
 
     // Need the raw pointer to test assertions here. Object is not yet deleted
@@ -124,7 +124,7 @@ public:
                             VATES::VolumeNormalization);
     factory.setSuccessor(std::move(uniqueSuccessor));
 
-    ITableWorkspace_sptr ws(new Mantid::DataObjects::TableWorkspace);
+    auto ws = boost::make_shared<Mantid::DataObjects::TableWorkspace>();
     TS_ASSERT_THROWS_NOTHING(factory.initialize(ws));
     TS_ASSERT_THROWS_NOTHING(factory.create(progressUpdater));
 
@@ -138,7 +138,7 @@ public:
                             VATES::VolumeNormalization);
     // factory.SetSuccessor(mockSuccessor); No Successor set.
 
-    ITableWorkspace_sptr ws(new Mantid::DataObjects::TableWorkspace);
+    auto ws = boost::make_shared<Mantid::DataObjects::TableWorkspace>();
     TS_ASSERT_THROWS(factory.initialize(ws), std::runtime_error);
   }
 
diff --git a/Vates/VatesAPI/test/vtkMDLineFactoryTest.h b/Vates/VatesAPI/test/vtkMDLineFactoryTest.h
index 9567de9b9a60ef42f9c42275ba83db185f1ff0da..cf5a6545410046120afa3bbd602f8d3846b72831 100644
--- a/Vates/VatesAPI/test/vtkMDLineFactoryTest.h
+++ b/Vates/VatesAPI/test/vtkMDLineFactoryTest.h
@@ -69,7 +69,7 @@ public:
                              Mantid::VATES::VolumeNormalization);
     factory.setSuccessor(std::move(uniqueSuccessor));
 
-    ITableWorkspace_sptr ws(new Mantid::DataObjects::TableWorkspace);
+    auto ws = boost::make_shared<Mantid::DataObjects::TableWorkspace>();
     TS_ASSERT_THROWS_NOTHING(factory.initialize(ws));
     TS_ASSERT_THROWS_NOTHING(factory.create(progressUpdate));
 
@@ -146,7 +146,7 @@ public:
 
   void setUp()
   {
-    boost::shared_ptr<Mantid::DataObjects::MDEventWorkspace<Mantid::DataObjects::MDEvent<1>,1> > input 
+    boost::shared_ptr<Mantid::DataObjects::MDEventWorkspace<Mantid::DataObjects::MDEvent<1>,1> > input
       = MDEventsTestHelper::makeMDEWFull<1>(2, 10, 10, 4000);
     //Rebin it to make it possible to compare cells to bins.
     using namespace Mantid::API;
@@ -178,9 +178,8 @@ public:
     TS_ASSERT(dynamic_cast<vtkUnstructuredGrid *>(product.GetPointer()) !=
               NULL);
     TS_ASSERT_EQUALS(200000, product->GetNumberOfCells());
-    TS_ASSERT_EQUALS(400000, product->GetNumberOfPoints());    
+    TS_ASSERT_EQUALS(400000, product->GetNumberOfPoints());
   }
 };
 
 #endif
-  
diff --git a/Vates/VatesSimpleGui/ViewWidgets/CMakeLists.txt b/Vates/VatesSimpleGui/ViewWidgets/CMakeLists.txt
index dd587576537f786f627f14a99186d2d4adf06294..b566f8461133884b92b672102e36d547b6fc3411 100644
--- a/Vates/VatesSimpleGui/ViewWidgets/CMakeLists.txt
+++ b/Vates/VatesSimpleGui/ViewWidgets/CMakeLists.txt
@@ -164,6 +164,7 @@ if( CXXTEST_FOUND AND GMOCK_FOUND AND GTEST_FOUND )
 
   include_directories( inc ../../../Framework/TestHelpers/inc ../../../Framework/DataHandling/inc ../../../Framework/DataObjects/inc)
   set ( TESTHELPER_SRCS ../../../Framework/TestHelpers/src/ComponentCreationHelper.cpp 
+                        ../../../Framework/TestHelpers/src/InstrumentCreationHelper.cpp
                         ../../../Framework/TestHelpers/src/WorkspaceCreationHelper.cpp
                         ../../../Framework/TestHelpers/src/MDEventsTestHelper.cpp 
                         ../../../Framework/TestHelpers/src/StartFrameworkManager.cpp )
diff --git a/Vates/VatesSimpleGui/ViewWidgets/inc/MantidVatesSimpleGuiViewWidgets/MdViewerWidget.h b/Vates/VatesSimpleGui/ViewWidgets/inc/MantidVatesSimpleGuiViewWidgets/MdViewerWidget.h
index 5fed9582d6a2f285ecd599db18a6a4813d098b69..7bea189e9af5b015438a78cf83204c7cc1a4f72c 100644
--- a/Vates/VatesSimpleGui/ViewWidgets/inc/MantidVatesSimpleGuiViewWidgets/MdViewerWidget.h
+++ b/Vates/VatesSimpleGui/ViewWidgets/inc/MantidVatesSimpleGuiViewWidgets/MdViewerWidget.h
@@ -114,7 +114,7 @@ protected slots:
   void switchViews(ModeControlWidget::Views v);
   /// Triggered when panel is changed.
   void panelChanged();
-  /// On rebin 
+  /// On rebin
   void onRebin(std::string algorithmType);
   /// On  unbin
   void onUnbin();
@@ -218,12 +218,12 @@ private:
   /// Reset the current view to the appropriate initial view.
   void resetCurrentView(int workspaceType, const std::string& instrumentName);
   /// Render rebinned workspace
-  pqPipelineSource* prepareRebinnedWorkspace(const std::string rebinnedWorkspaceName, std::string sourceType); 
+  pqPipelineSource* prepareRebinnedWorkspace(const std::string rebinnedWorkspaceName, std::string sourceType);
   /// Handle drag and drop of peaks workspcaes
   void handleDragAndDropPeaksWorkspaces(QEvent* e, QString text, QStringList& wsNames);
   /// Set up the default color for the background of the view.
   void setColorForBackground();
-  /// Set the color map 
+  /// Set the color map
   void setColorMap();
   /// Render the original workspace
   pqPipelineSource* renderOriginalWorkspace(const std::string originalWorkspaceName);
diff --git a/Vates/VatesSimpleGui/ViewWidgets/inc/MantidVatesSimpleGuiViewWidgets/ViewBase.h b/Vates/VatesSimpleGui/ViewWidgets/inc/MantidVatesSimpleGuiViewWidgets/ViewBase.h
index 5900e926c104fdf3a6e1ef5de15a58540ddb8625..1797b090793dcd369621f8c3052ed98ac3612f22 100644
--- a/Vates/VatesSimpleGui/ViewWidgets/inc/MantidVatesSimpleGuiViewWidgets/ViewBase.h
+++ b/Vates/VatesSimpleGui/ViewWidgets/inc/MantidVatesSimpleGuiViewWidgets/ViewBase.h
@@ -145,6 +145,8 @@ public:
   void setColorScaleLock(Mantid::VATES::ColorScaleLock* colorScaleLock);
   QPointer<pqPipelineSource> origSrc; ///< The original source
   QPointer<pqPipelineRepresentation> origRep; ///< The original source representation
+  /// Has active source
+  bool hasActiveSource();
 
 public slots:
   /// Set the color scale back to the original bounds.
diff --git a/Vates/VatesSimpleGui/ViewWidgets/src/MdViewerWidget.cpp b/Vates/VatesSimpleGui/ViewWidgets/src/MdViewerWidget.cpp
index a91d1152065705e9a5ea81f316209b1e6cbd5fa2..d8bd3a126a437db6e26c5816f6fcab71cb5352cb 100644
--- a/Vates/VatesSimpleGui/ViewWidgets/src/MdViewerWidget.cpp
+++ b/Vates/VatesSimpleGui/ViewWidgets/src/MdViewerWidget.cpp
@@ -893,7 +893,7 @@ QString MdViewerWidget::getViewForInstrument(const std::string& instrumentName)
   QString associatedView;
   try
   {
-    const std::set<std::string> techniques = Mantid::Kernel::ConfigService::Instance().getInstrument(instrumentName).techniques();
+    const auto techniques = Mantid::Kernel::ConfigService::Instance().getInstrument(instrumentName).techniques();
 
     if (techniques.count("Single Crystal Diffraction") > 0 )
     {
@@ -924,13 +924,13 @@ QString MdViewerWidget::getViewForInstrument(const std::string& instrumentName)
  * @param keyword A keyword
  * @returns True if the keyword is contained in at least one technique else false.
  */
-bool MdViewerWidget::checkIfTechniqueContainsKeyword(const std::set<std::string>& techniques, const std::string& keyword) const
+bool MdViewerWidget::checkIfTechniqueContainsKeyword(const std::set<std::string> &techniques, const std::string &keyword) const
 {
   boost::regex pattern( "(.*)" + keyword + "(.*)");
 
-  for (std::set<std::string>::iterator it = techniques.begin(); it != techniques.end(); ++it)
+  for (auto const &technique : techniques)
   {
-    if (boost::regex_match(*it, pattern))
+    if (boost::regex_match(technique, pattern))
     {
       return true;
     }
diff --git a/Vates/VatesSimpleGui/ViewWidgets/src/StandardView.cpp b/Vates/VatesSimpleGui/ViewWidgets/src/StandardView.cpp
index 7a2a7c80b766f41afff13a5b4ab5cfb0468214c9..8f60afc468b7b52e8152383feeca33311a1de3f9 100644
--- a/Vates/VatesSimpleGui/ViewWidgets/src/StandardView.cpp
+++ b/Vates/VatesSimpleGui/ViewWidgets/src/StandardView.cpp
@@ -229,6 +229,11 @@ void StandardView::render()
 }
 
 void StandardView::onCutButtonClicked() {
+  // check that has active source
+  if (!hasActiveSource()) {
+    return;
+  }
+
   // Apply cut to currently viewed data
   pqObjectBuilder *builder = pqApplicationCore::instance()->getObjectBuilder();
   builder->createFilter("filters", "Cut", this->getPvActiveSrc());
@@ -239,6 +244,11 @@ void StandardView::onCutButtonClicked() {
 }
 
 void StandardView::onScaleButtonClicked() {
+  // check that has active source
+  if (!hasActiveSource()) {
+    return;
+  }
+
   pqObjectBuilder *builder = pqApplicationCore::instance()->getObjectBuilder();
   this->m_scaler = builder->createFilter(
       "filters", "MantidParaViewScaleWorkspace", this->getPvActiveSrc());
diff --git a/Vates/VatesSimpleGui/ViewWidgets/src/ViewBase.cpp b/Vates/VatesSimpleGui/ViewWidgets/src/ViewBase.cpp
index bed671a122fa44d5586adb073224c019cc12b62e..eff772a2e78e9c42e757c1ac1006f329d503af0f 100644
--- a/Vates/VatesSimpleGui/ViewWidgets/src/ViewBase.cpp
+++ b/Vates/VatesSimpleGui/ViewWidgets/src/ViewBase.cpp
@@ -316,7 +316,8 @@ pqPipelineSource* ViewBase::setPluginSource(QString pluginName, QString wsName,
   // We are setting the recursion depth to 1 when we are dealing with MDEvent workspaces
   // with top level splitting, but this is not updated in the plugin line edit field.
   // We do this here.
-  if (auto split = Mantid::VATES::findRecursionDepthForTopLevelSplitting(wsName.toStdString())) {
+  auto workspaceProvider = Mantid::Kernel::make_unique<Mantid::VATES::ADSWorkspaceProvider<Mantid::API::IMDEventWorkspace>>();
+  if (auto split = Mantid::VATES::findRecursionDepthForTopLevelSplitting(wsName.toStdString(), std::move(workspaceProvider))) {
     vtkSMPropertyHelper(src->getProxy(),
               "Recursion Depth").Set(split.get());
   }
@@ -954,6 +955,13 @@ void ViewBase::setAxesGrid(bool on) {
   }
 }
 
+/**
+ * Check if there is an active source available
+ * @returns true if there is an active source else false
+ */
+bool ViewBase::hasActiveSource() {
+  return this->getPvActiveSrc() != nullptr;
+}
 
 } // namespace SimpleGui
 } // namespace Vates
diff --git a/buildconfig/CMake/Bootstrap.cmake b/buildconfig/CMake/Bootstrap.cmake
index 728c1b1bad33867953e984b713b8913a0c4049a0..719b8fe5b478a8b2eb8d5a6d136befa6c2a07c9f 100644
--- a/buildconfig/CMake/Bootstrap.cmake
+++ b/buildconfig/CMake/Bootstrap.cmake
@@ -10,7 +10,7 @@ if( MSVC )
   include ( ExternalProject )
   set( EXTERNAL_ROOT ${PROJECT_SOURCE_DIR}/external )
   set( THIRD_PARTY_GIT_URL "https://github.com/mantidproject/thirdparty-msvc2015.git" )
-  set ( THIRD_PARTY_GIT_SHA1 master )
+  set ( THIRD_PARTY_GIT_SHA1 234367ca799cac7cdc15c643d63492689f23db67 )
   set ( THIRD_PARTY_DIR ${EXTERNAL_ROOT}/src/ThirdParty )
   # Generates a script to do the clone/update in tmp
   set ( _project_name ThirdParty )
diff --git a/buildconfig/CMake/CommonSetup.cmake b/buildconfig/CMake/CommonSetup.cmake
index b28cb78ff216655c68f31be092ae93c14acdad64..e687e43311fae07e7fbc6f760060df069b412e79 100644
--- a/buildconfig/CMake/CommonSetup.cmake
+++ b/buildconfig/CMake/CommonSetup.cmake
@@ -40,7 +40,7 @@ set ( TESTING_TIMEOUT 300 CACHE INTEGER
 ###########################################################################
 
 set ( Boost_NO_BOOST_CMAKE TRUE )
-find_package ( Boost REQUIRED date_time regex )
+find_package ( Boost 1.48.0 REQUIRED date_time regex )
 include_directories( SYSTEM ${Boost_INCLUDE_DIRS} )
 add_definitions ( -DBOOST_ALL_DYN_LINK -DBOOST_ALL_NO_LIB )
 # Need this defined globally for our log time values
diff --git a/buildconfig/CMake/FindBoost.cmake b/buildconfig/CMake/FindBoost.cmake
index 9e546e6a8d07546f4150b26d19edc6ef6959ae7f..abdf04480797ef91d861483da616fc373626e1f1 100644
--- a/buildconfig/CMake/FindBoost.cmake
+++ b/buildconfig/CMake/FindBoost.cmake
@@ -631,7 +631,7 @@ if(_Boost_CHANGE_INCDIR AND NOT _Boost_INCLUDE_DIR_CHANGED)
 endif()
 
 if(NOT Boost_INCLUDE_DIR)
-  set(_boost_INCLUDE_SEARCH_DIRS "")
+  set(_boost_INCLUDE_SEARCH_DIRS "/usr/include/boost148")
   if(BOOST_INCLUDEDIR)
     list(APPEND _boost_INCLUDE_SEARCH_DIRS ${BOOST_INCLUDEDIR})
   elseif(_ENV_BOOST_INCLUDEDIR)
@@ -892,7 +892,7 @@ foreach(c DEBUG RELEASE)
   if(Boost_LIBRARY_DIR_${c})
     set(_boost_LIBRARY_SEARCH_DIRS_${c} ${Boost_LIBRARY_DIR_${c}} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
   else()
-    set(_boost_LIBRARY_SEARCH_DIRS_${c} "")
+    set(_boost_LIBRARY_SEARCH_DIRS_${c} "/usr/lib64/boost148")
     if(BOOST_LIBRARYDIR)
       list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${BOOST_LIBRARYDIR})
     elseif(_ENV_BOOST_LIBRARYDIR)
diff --git a/buildconfig/CMake/WindowsNSIS.cmake b/buildconfig/CMake/WindowsNSIS.cmake
index 2a8acfe8adcfd9122d22eb8896f74372fa3af244..d9aa6568d6e32f7047c669498777d2fcfdde601e 100644
--- a/buildconfig/CMake/WindowsNSIS.cmake
+++ b/buildconfig/CMake/WindowsNSIS.cmake
@@ -131,37 +131,6 @@ endforeach()
 # sqlite
 install ( FILES ${QT_PLUGIN_DIR}/sqldrivers/qsqlite4.dll DESTINATION plugins/qt/sqldrivers )
 
-###########################################################################
-# Include files/libraries required for User compilation
-###########################################################################
-install ( DIRECTORY ${THIRD_PARTY_DIR}/include/boost DESTINATION include PATTERN ".svn" EXCLUDE PATTERN ".git" EXCLUDE )
-install ( DIRECTORY  ${THIRD_PARTY_DIR}/include/Poco DESTINATION include PATTERN ".svn" EXCLUDE PATTERN ".git" EXCLUDE )
-install ( DIRECTORY  ${THIRD_PARTY_DIR}/include/nexus DESTINATION include PATTERN ".svn" EXCLUDE PATTERN ".git" EXCLUDE )
-install ( FILES ${THIRD_PARTY_DIR}/include/napi.h DESTINATION include )
-install ( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Framework/Kernel/inc/MantidKernel DESTINATION include
-          PATTERN ".svn" EXCLUDE PATTERN ".git" EXCLUDE )
-install ( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Framework/Geometry/inc/MantidGeometry DESTINATION include
-          PATTERN ".svn" EXCLUDE PATTERN ".git" EXCLUDE )
-install ( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Framework/API/inc/MantidAPI DESTINATION include
-          PATTERN ".svn" EXCLUDE PATTERN ".git" EXCLUDE )
-# scons
-install ( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/installers/WinInstaller/scons-local/ DESTINATION scons-local
-          PATTERN ".svn" EXCLUDE PATTERN ".git" EXCLUDE )
-# user algorithms
-install ( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Framework/UserAlgorithms/ DESTINATION UserAlgorithms FILES_MATCHING PATTERN "*.h" )
-install ( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Framework/UserAlgorithms/ DESTINATION UserAlgorithms FILES_MATCHING PATTERN "*.cpp" )
-install ( FILES ${CMAKE_CURRENT_SOURCE_DIR}/Framework/UserAlgorithms/build.bat ${CMAKE_CURRENT_SOURCE_DIR}/Framework/UserAlgorithms/createAlg.py
-          ${CMAKE_CURRENT_SOURCE_DIR}/Framework/UserAlgorithms/SConstruct DESTINATION UserAlgorithms )
-# Core library export files to allow linking
-install ( FILES "${CMAKE_CURRENT_BINARY_DIR}/bin/${WINDOWS_DEPLOYMENT_TYPE}/MantidKernel.lib" DESTINATION UserAlgorithms)
-install ( FILES "${CMAKE_CURRENT_BINARY_DIR}/bin/${WINDOWS_DEPLOYMENT_TYPE}/MantidGeometry.lib" DESTINATION UserAlgorithms)
-install ( FILES "${CMAKE_CURRENT_BINARY_DIR}/bin/${WINDOWS_DEPLOYMENT_TYPE}/MantidAPI.lib" DESTINATION UserAlgorithms)
-install ( FILES "${CMAKE_CURRENT_BINARY_DIR}/bin/${WINDOWS_DEPLOYMENT_TYPE}/MantidDataObjects.lib" DESTINATION UserAlgorithms)
-install ( FILES "${CMAKE_CURRENT_BINARY_DIR}/bin/${WINDOWS_DEPLOYMENT_TYPE}/MantidCurveFitting.lib" DESTINATION UserAlgorithms)
-# Third Party libs for building
-install ( FILES ${THIRD_PARTY_DIR}/lib/PocoFoundation.lib ${THIRD_PARTY_DIR}/lib/PocoXML.lib DESTINATION UserAlgorithms)
-install ( FILES ${THIRD_PARTY_DIR}/lib/boost_date_time-mt.lib DESTINATION UserAlgorithms )
-
 ###########################################################################
 # Startup files
 ###########################################################################
diff --git a/buildconfig/Jenkins/buildscript b/buildconfig/Jenkins/buildscript
index 6e9867e7b1273c74482f351c8be53752835e827c..0d17b3136b83ebbb21004ff8b7eefeaf35a0589f 100755
--- a/buildconfig/Jenkins/buildscript
+++ b/buildconfig/Jenkins/buildscript
@@ -22,7 +22,6 @@ export PARAVIEW_DIR=${PARAVIEW_NEXT_DIR}
 # Print out the versions of things we are using
 ###############################################################################
 cmake --version
-echo "SHA1=${sha1}"
 
 ###############################################################################
 # Check job requirements from the name
diff --git a/buildconfig/Jenkins/check_for_changes b/buildconfig/Jenkins/check_for_changes
new file mode 100755
index 0000000000000000000000000000000000000000..6169d21a613eeb9b13f0d6657b26b095a73b589a
--- /dev/null
+++ b/buildconfig/Jenkins/check_for_changes
@@ -0,0 +1,44 @@
+#!/bin/bash -ex
+# return 1 if have matches
+# return 0 if no matches
+FOUND=1
+NOTFOUND=0
+
+TYPE=${1}
+BASE_BRANCH="origin/master"
+if [ $2 ]; then
+    BASE_BRANCH=$2
+fi
+SHA=$(git rev-parse HEAD)
+echo "SHA=${SHA}"
+
+case "$TYPE" in
+    py)
+        exit $(git diff --quiet ${BASE_BRANCH} ${SHA} -- \*\.py)
+    ;;
+    cpp)
+        if $(! git diff --quiet ${BASE_BRANCH} ${SHA} -- \*\.h)
+        then
+            exit $FOUND
+        fi
+        if $(! git diff --quiet ${BASE_BRANCH} ${SHA} -- \*\.cpp)
+        then
+            exit $FOUND
+        fi
+        if $(! git diff --quiet ${BASE_BRANCH} ${SHA} -- \*\.cxx)
+        then
+            exit $FOUND
+        fi
+        if $(! git diff --quiet ${BASE_BRANCH} ${SHA} -- \*\.tcc)
+        then
+            exit $FOUND
+        fi
+        exit $NOTFOUND
+    ;;
+    *)
+        echo "do not have case for type \"$TYPE\""
+    ;;
+esac
+
+# fall-through behavior is that it matches
+exit $FOUND
diff --git a/buildconfig/Jenkins/doctests b/buildconfig/Jenkins/doctests
index 7d4af3bbc201c5a138d0b5abb12f1b87c9684106..66635fa927eee5a8d8a25ae7eeb2e0bdb54a44d2 100755
--- a/buildconfig/Jenkins/doctests
+++ b/buildconfig/Jenkins/doctests
@@ -60,6 +60,22 @@ $SCL_ON_RHEL6 "cmake -DMANTID_DATA_STORE=${MANTID_DATA_STORE} .."
 ###############################################################################
 $SCL_ON_RHEL6 "cmake --build . -- StandardTestData"
 
+###############################################################################
+# Add tests from the examples available on the mantidproject wiki pages
+# The script produces additional RST pages derived from the examples.
+# These will be run together with the standard docs-test RST pages.
+#
+# Only for:
+#   jobs that have the suffix wikitests in their name,
+#   on platforms: Ubuntu
+###############################################################################
+if [[ ${NODE_LABELS} == *ubuntu* ]]; then
+    ON_WT_PLATFORMS=true
+fi
+if [[ "${ON_WT_PLATFORMS}" == true ]] && [[ ${JOB_NAME} == *wikitests* ]]; then
+  $SCL_ON_RHEL6 "python ${WORKSPACE}/tools/scripts/TestWikiPython.py -o ${WORKSPACE}/docs/source/mwTests"
+fi
+
 #####################################################################################
 # Run tests
 #####################################################################################
diff --git a/buildconfig/Jenkins/oclint-buildscript b/buildconfig/Jenkins/oclint-buildscript
new file mode 100755
index 0000000000000000000000000000000000000000..23b90a56fd0ef2b669f863c6411d13996e1a3b10
--- /dev/null
+++ b/buildconfig/Jenkins/oclint-buildscript
@@ -0,0 +1,27 @@
+#!/bin/bash -ex
+SCRIPT_DIR=$(dirname "$0")
+
+cmake --version
+echo "SHA1=${sha1}"
+BUILD_DIR=$WORKSPACE/build
+if [ $(command -v oclint-json-compilation-database) ]; then
+   OCLINT=$(which oclint-json-compilation-database)
+else
+   OCLINT=$HOME/oclint-0.10.2/bin/oclint-json-compilation-database
+fi
+
+if [ -d $BUILD_DIR ]; then
+  rm -rf $BUILD_DIR/bin $BUILD_DIR/ExternalData
+else
+  mkdir $BUILD_DIR
+fi
+
+cd $BUILD_DIR
+cmake -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON ..
+cd $WORKSPACE
+if [ ! -e compile_commands.json ]; then
+  ln -s $BUILD_DIR/compile_commands.json
+fi
+
+$SCRIPT_DIR/oclint.py --oclint $OCLINT $WORKSPACE/compile_commands.json
+echo Finished
diff --git a/buildconfig/Jenkins/oclint.py b/buildconfig/Jenkins/oclint.py
new file mode 100755
index 0000000000000000000000000000000000000000..f69f612f29854cbf3f3f645da0d9c2f2a322d7d2
--- /dev/null
+++ b/buildconfig/Jenkins/oclint.py
@@ -0,0 +1,138 @@
+#!/usr/bin/env python
+
+# -*- coding: utf-8 -*-
+
+import json
+import sys
+import math
+import os
+import xml.etree.cElementTree as ET
+
+
+maxCountPerFile = 1500
+reversed_json_file_name = 'compile_commands'
+
+def load_config_json(filename):
+    if os.path.exists(filename):
+        with open(filename, 'r') as handle:
+            config = json.load(handle)
+    else:
+        config = []
+
+    commandline = [str(item) for item in config]
+
+    return " ".join(commandline)
+
+def split_json(all_json_objects):
+    total_count = len(all_json_objects)
+    sub_file_count = int(math.ceil(float(total_count) / float(maxCountPerFile)))
+
+    sub_files = []
+
+    for i in range(sub_file_count):
+        start = i*maxCountPerFile
+        end = min((i+1)*maxCountPerFile, total_count - 1)
+        sub_json_objects = all_json_objects[start:end]
+        file_name = 'compile_commands%02d.json' %(i+1)
+        sub_files.append(file_name)
+
+        with open(file_name, 'w') as outputHandler:
+            outputHandler.write(json.dumps(sub_json_objects, indent=4))
+
+    return sub_files
+
+
+def lint_jsonfiles(oclint, jsonfiles, config):
+
+    i = 0
+    result_files = []
+    for file_name in jsonfiles:
+        print 'linting ... %s' %file_name
+        input_file = rename(file_name, 'compile_commands.json')
+        out_file = 'oclint%02d.xml' %i
+        lint(oclint, out_file, config)
+        result_files.append(out_file)
+        i += 1
+        os.remove(input_file)
+
+    return result_files
+
+
+def lint(oclint, out_file, config):
+    lint_command = '''%s -- --verbose \
+    %s \
+    --report-type pmd \
+    -o %s''' %  (oclint, config, out_file)
+    print lint_command
+    os.system(lint_command)
+
+
+def combine_outputs(output_files):
+    print "combining output files"
+
+    base_tree = None
+    base_root = None
+
+    for filename in output_files:
+        if not os.path.exists(filename):
+            continue
+
+        tree = ET.ElementTree(file=filename)
+        root = tree.getroot()
+
+        if base_tree is None:
+            base_tree = tree
+            base_root = root
+        else:
+            for child in root:
+                base_root.append(child)
+
+    base_tree.write('oclint.xml', encoding='utf-8', xml_declaration=True)
+
+
+def rename(file_path, new_name):
+    paths = os.path.split(file_path)
+    new_path = os.path.join(paths[0], new_name)
+    os.rename(file_path, new_path)
+    return new_path
+
+if __name__ == "__main__":
+    import argparse
+    parser = argparse.ArgumentParser(description="wrapper around oclint-json-compilation-database")
+    parser.add_argument("compile_commands",
+                        help="location of 'compile_commands.json')")
+    parser.add_argument("--oclint",
+                        default="oclint-json-compilation-database",
+                        help="location of 'oclint-json-compilation-database' "\
+                        + "if not in path")
+    parser.add_argument("--config", default="oclint_config.json",
+                        help="configuration file " \
+                        + "(default='oclint_config.json')")
+    args = parser.parse_args()
+
+    if not os.path.exists(args.compile_commands):
+        parser.error("File '%s' does not exist" % args.compile_commands)
+    if args.oclint != "oclint-json-compilation-database" and \
+       not os.path.exists(args.oclint):
+        parser.error("File '%s' does not exist" % args.oclint)
+
+
+    config = load_config_json(args.config)
+    print config
+
+    with open(args.compile_commands, 'r') as r_handler:
+        json_objects = json.loads(r_handler.read())
+
+    if len(json_objects) <= maxCountPerFile:
+        lint(args.oclint, 'oclint.xml', config)
+    else:
+        json_file = rename(args.compile_commands, 'input.json')
+        try:
+            json_files = split_json(json_objects)
+            xml_files = lint_jsonfiles(args.oclint, json_files, config)
+            combine_outputs(xml_files)
+            for xml_file in xml_files:
+                if os.path.exists(xml_file):
+                    os.remove(xml_file)
+        finally:
+            rename(json_file, args.compile_commands)
diff --git a/buildconfig/Jenkins/oclint_config.json b/buildconfig/Jenkins/oclint_config.json
new file mode 100644
index 0000000000000000000000000000000000000000..186b9b9e2ea110b604d3600ea87d233e96bb4a0b
--- /dev/null
+++ b/buildconfig/Jenkins/oclint_config.json
@@ -0,0 +1,13 @@
+[
+	"-max-priority-1 100",
+	"-max-priority-2 5000",
+	"-max-priority-3 10000",
+	"-rc CYCLOMATIC_COMPLEXITY 10",
+	"-rc LONG_CLASS 1000",
+	"-rc LONG_LINE 200",
+	"-rc LONG_METHOD 100",
+	"-rc MINIMUM_CASES_IN_SWITCH 3",
+	"-rc NPATH_COMPLEXITY 200",
+	"-rc NCSS_METHOD 30",
+	"-rc NESTED_BLOCK_DEPTH 5"
+]
diff --git a/buildconfig/class_maker.py b/buildconfig/class_maker.py
index c929a4ec446d8a1e53aa54bcb16f2f68ec5237f9..f2a81727b02d12a3926dc53b147e5c497b7d8ef4 100755
--- a/buildconfig/class_maker.py
+++ b/buildconfig/class_maker.py
@@ -28,17 +28,17 @@ def write_header(subproject, classname, filename, args):
 
     # Create an Algorithm header; will not use it if not an algo
     algorithm_header = """
-  virtual const std::string name() const;
-  virtual int version() const;
-  virtual const std::string category() const;
-  virtual const std::string summary() const;
+  const std::string name() const final;
+  int version() const final;
+  const std::string category() const final;
+  const std::string summary() const final;
 
 private:
-  void init();
-  void exec();
+  void init() final;
+  void exec() final;
 """
 
-    alg_class_declare = " : public API::Algorithm"
+    alg_class_declare = " final : public API::Algorithm"
     alg_include = '#include "MantidAPI/Algorithm.h"'
 
     if not args.alg:
@@ -79,10 +79,7 @@ namespace %s {
   Code Documentation is available at: <http://doxygen.mantidproject.org>
 */
 class MANTID_%s_DLL %s%s {
-public:
-  %s();
-  virtual ~%s();
-%s};
+public:%s};
 
 } // namespace %s
 } // namespace Mantid
@@ -90,7 +87,7 @@ public:
 #endif /* %s */""" % (guard, guard, subproject,
        alg_include, subproject, classname,
        datetime.datetime.now().date().year, subproject_upper, classname, alg_class_declare,
-       classname, classname, algorithm_header, subproject, guard)
+       algorithm_header, subproject, guard)
 
     f.write(s)
     f.close()
@@ -161,22 +158,12 @@ void %s::exec() {
 
 namespace Mantid {
 namespace %s {
-%s
-//----------------------------------------------------------------------------------------------
-/** Constructor
- */
-%s::%s() {}
-
-//----------------------------------------------------------------------------------------------
-/** Destructor
- */
-%s::~%s() {}
-%s
+%s%s
 } // namespace %s
 } // namespace Mantid
 """ % (
         subproject, args.subfolder, classname, subproject, algorithm_top,
-        classname, classname, classname, classname, algorithm_source, subproject)
+        algorithm_source, subproject)
     f.write(s)
     f.close()
 
diff --git a/buildconfig/dev-packages/rpm/mantid-developer/mantid-developer.spec b/buildconfig/dev-packages/rpm/mantid-developer/mantid-developer.spec
index ff6ebba3a78b953e293d1e2f8866e7597d6dd0fe..2b6a1c558075b21e735531895b486cfc634408b2 100644
--- a/buildconfig/dev-packages/rpm/mantid-developer/mantid-developer.spec
+++ b/buildconfig/dev-packages/rpm/mantid-developer/mantid-developer.spec
@@ -11,8 +11,12 @@ BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 %{?fc20:Requires: rpmfusion-nonfree-release}
 Requires: clang
 Requires: cmake-gui >= 2.8.12
-Requires: boost-devel
 %{?el6:Requires: epel-release}
+%if 0%{?el6}
+Requires: boost148-devel
+%else
+Requires: boost-devel
+%endif
 Requires: doxygen
 Requires: gperftools-devel
 Requires: gperftools-libs
diff --git a/docs/source/algorithms/AlignComponents-v1.rst b/docs/source/algorithms/AlignComponents-v1.rst
new file mode 100644
index 0000000000000000000000000000000000000000..3e0beddd73579aced71e16ecf38c56672fc91fa8
--- /dev/null
+++ b/docs/source/algorithms/AlignComponents-v1.rst
@@ -0,0 +1,156 @@
+
+.. algorithm::
+
+.. summary::
+
+.. alias::
+
+.. properties::
+
+Description
+-----------
+
+This algorithm will take a calibration in the form of a
+:ref:`diffractioncalibration
+workspace<DiffractionCalibrationWorkspace>` from the output of *for
+example* :ref:`algm-GetDetOffsetsMultiPeaks` or
+:ref:`algm-CalibrateRectangularDetectors` and minimize the difference
+between the DIFC of the instrument and calibration workspace by moving
+and rotating instrument components.
+
+The resulting calibrated geometry can be exported by
+:ref:`algm-ExportGeometry`.
+
+ComponentList
+#############
+
+The *ComponentList* can include any instrument component that can be
+moved and rotated by :ref:`algm-MoveInstrumentComponent` and
+:ref:`algm-RotateInstrumentComponent`. For example in POWGEN you can
+list *bank46* or *Column4* (which includes banks 42-46) or *Group3*
+(which all the banks in Column 3 and 4). In the case of a component
+group it is treated as one object and not individual banks. In some
+instruments you can also specify individual tubes or pixel, *e.g.*
+*bank20/tube3* and *bank20/tube3/pixel7*, although that is not the
+intention of the algorithm. You can list multiple components which
+will be refined in turn (*e.g.* in the *Align the Y rotation of bank26
+and bank46 in POWGEN* usage example below).
+
+Masking
+#######
+
+The only masking that is on taken into account when minimising the
+difference in *DIFC* is the masking in the workspace of the
+MaskWorkspace property of AlignComponents.
+
+Fitting Sample/Source
+#####################
+
+When fitting the sample or source position it uses the entire
+instrument and only moves the *Z* position (*i.e.* along the
+beam). You can use a masking workspace to mask part of the instrument
+you don't want to use to align the sample/source position (*e.g.* in
+the *Align sample position in POWGEN* usage example below).
+
+The source and sample positions (in that order) are aligned before an
+components are aligned.
+
+Usage
+-----
+
+**Example - Align the X and Z position of bank26 in POWGEN:**
+
+.. code-block:: python
+
+      LoadCalFile(InstrumentName="PG3",
+            CalFilename="PG3_golden.cal",
+            MakeGroupingWorkspace=False,
+            MakeOffsetsWorkspace=True,
+            MakeMaskWorkspace=True,
+            WorkspaceName="PG3")
+      ws = LoadEmptyInstrument(Filename="POWGEN_Definition_2015-08-01.xml")
+      component="bank26"
+      print "Start position is",ws.getInstrument().getComponentByName(component).getPos()
+      AlignComponents(CalibrationTable="PG3_cal",
+              Workspace=ws,
+	      MaskWorkspace="PG3_mask",
+	      Xposition=True, ZPosition=True,
+              ComponentList=component)
+      ws=mtd['ws']
+      print "Final position is",ws.getInstrument().getComponentByName(component).getPos()
+
+Output:
+
+.. code-block:: none
+
+    Start position is [1.54436,0.863271,-1.9297]
+    Final position is [1.50591,0.863271,-1.92734]
+
+**Example - Align the Y rotation of bank26 and bank46 in POWGEN:**
+
+.. code-block:: python
+
+      LoadCalFile(InstrumentName="PG3",
+	    CalFilename="PG3_golden.cal",
+	    MakeGroupingWorkspace=False,
+	    MakeOffsetsWorkspace=True,
+	    MakeMaskWorkspace=True,
+	    WorkspaceName="PG3")
+      ws = LoadEmptyInstrument(Filename="POWGEN_Definition_2015-08-01.xml")
+      components="bank26,bank46"
+      bank26Rot = ws.getInstrument().getComponentByName("bank26").getRotation().getEulerAngles()
+      bank46Rot = ws.getInstrument().getComponentByName("bank46").getRotation().getEulerAngles()
+      print "Start bank26 rotation is [{:.3f}.{:.3f},{:.3f}]".format(bank26Rot[0], bank26Rot[1], bank26Rot[2])
+      print "Start bank46 rotation is [{:.3f}.{:.3f},{:.3f}]".format(bank46Rot[0], bank46Rot[1], bank46Rot[2])
+      AlignComponents(CalibrationTable="PG3_cal",
+	      Workspace=ws,
+	      MaskWorkspace="PG3_mask",
+	      EulerConvention="YZX",
+              AlphaRotation=True,
+	      ComponentList=components)
+      ws=mtd['ws']
+      bank26Rot = ws.getInstrument().getComponentByName("bank26").getRotation().getEulerAngles()
+      bank46Rot = ws.getInstrument().getComponentByName("bank46").getRotation().getEulerAngles()
+      print "Final bank26 rotation is [{:.3f}.{:.3f},{:.3f}]".format(bank26Rot[0], bank26Rot[1], bank26Rot[2])
+      print "Final bank46 rotation is [{:.3f}.{:.3f},{:.3f}]".format(bank46Rot[0], bank46Rot[1], bank46Rot[2])
+
+Output:
+
+.. code-block:: none
+
+      Start bank26 rotation is [-24.061.0.120,18.016]
+      Start bank46 rotation is [-41.092.0.061,17.795]
+      Final bank26 rotation is [-25.226.0.120,18.016]
+      Final bank46 rotation is [-37.397.0.061,17.795]
+
+**Example - Align sample position in POWGEN:**
+
+.. code-block:: python
+
+      LoadCalFile(InstrumentName="PG3",
+	    CalFilename="PG3_golden.cal",
+	    MakeGroupingWorkspace=False,
+	    MakeOffsetsWorkspace=True,
+	    MakeMaskWorkspace=True,
+	    WorkspaceName="PG3")
+      # Mask banks that don't have calibration data
+      MaskBTP(Workspace='PG3_mask', Instrument='POWGEN',
+	      Bank='22-25,42-45,62-66,82-86,102-105,123,124,143,144,164,184,204')
+      ws = LoadEmptyInstrument(Filename="POWGEN_Definition_2015-08-01.xml")
+      print "Start sample position is",ws.getInstrument().getSample().getPos().getZ()
+      AlignComponents(CalibrationTable="PG3_cal",
+            Workspace=ws,
+            MaskWorkspace="PG3_mask",
+            FitSamplePosition=True)
+      print "Final sample position is {:.5f}".format(mtd['ws'].getInstrument().getSample().getPos().getZ())
+
+Output:
+
+.. code-block:: none
+
+      Start sample position is 0.0
+      Final sample position is 0.02826
+
+.. categories::
+
+.. sourcelink::
diff --git a/docs/source/algorithms/DetectorFloodWeighting-v1.rst b/docs/source/algorithms/DetectorFloodWeighting-v1.rst
index 68f78e13e9da56d2e6ce28321e11fa362144bfc2..e9a090c5cfd5fd9e38756713c8b8b87479040cb4 100644
--- a/docs/source/algorithms/DetectorFloodWeighting-v1.rst
+++ b/docs/source/algorithms/DetectorFloodWeighting-v1.rst
@@ -15,7 +15,7 @@ This algorithm crops the data over the specified wavelength region, and sums it.
 Usage
 -----
 
-**Example - Simple Generation **
+**Example - Simple Generation**
 
 .. testcode:: DetectorFloodWeightingExample
 
@@ -37,7 +37,7 @@ Output:
    Number Histograms 2
    Min X: 0.0 Max X: 10.0
 
-**Example - With Solid Angle Correction **
+**Example - With Solid Angle Correction**
 
 .. testcode:: DetectorFloodWeightingExampleWithCorrection
 
diff --git a/docs/source/algorithms/FFT-v1.rst b/docs/source/algorithms/FFT-v1.rst
index 739d4179ff36cdc17a6ad966519cb37fbb9ceca1..740c9ae52443348cf4a300143ff9312115b9d897 100644
--- a/docs/source/algorithms/FFT-v1.rst
+++ b/docs/source/algorithms/FFT-v1.rst
@@ -65,11 +65,18 @@ The Mantid FFT algorithm returns the complex array :math:`\bar{F}_K` as
 Y values of two spectra in the output workspace, one for the real and
 the other for the imaginary part of the transform. The X values are set
 to the transform frequencies and have the range approximately equal to
-:math:`[-N/L,N/L]`. The actual limits depend sllightly on whether
+:math:`[-N/L,N/L]`. The actual limits depend slightly on whether
 :math:`N` is even or odd and whether the input spectra are histograms or
 point data. The variations are of the order of :math:`\Delta\xi`. The
 zero frequency is always in the bin with index :math:`k=int(N/2)`.
 
+The X values of the input data must be evenly spaced for the FFT algorithm
+to work (all bin widths must be the same). If they contain small rounding
+errors, this requirement can be relaxed by setting the *AcceptXRoundingErrors*
+property, which will continue to process the data even if the spacings between
+different X values are unequal. Large differences in the bin widths will still
+produce a warning.
+
 Example 1
 #########
 
diff --git a/docs/source/algorithms/FuryFitMultiple-v1.rst b/docs/source/algorithms/FuryFitMultiple-v1.rst
deleted file mode 100644
index a64873dc9dcffafa30c65234f384b730bc58347c..0000000000000000000000000000000000000000
--- a/docs/source/algorithms/FuryFitMultiple-v1.rst
+++ /dev/null
@@ -1,51 +0,0 @@
-.. algorithm::
-
-.. summary::
-
-.. alias::
-
-.. properties::
-
-Description
------------
-
-Fits an \*\_iqt file generated by Fury using one of the specified
-functions. The functions available are either one or two exponentials
-(:math:`Intensity \times exp[-(x/\tau)]`), a stretched exponential
-(:math:`Intensity \times exp[-(x/\tau)]\beta`) or a combination of both
-an exponential and stretched exponential.
-
-This routine was originally part of the MODES package.
-
-Workflow
---------
-
-.. diagram:: FuryFitMultiple-v1_wkflw.dot
-
-
-Usage
------
-
-**Example - Running FuryFitMultiple on an reduced workspace.**
-
-.. code-block:: python
-    
-    #create a dummy workspace
-    function = "name=ExpDecay,Height=1,Lifetime=0.035"
-    ws = CreateSampleWorkspace("Histogram", Function="User Defined", UserDefinedFunction=function, XMin=0, XMax=0.5, BinWidth=0.01, XUnit="Time", NumBanks=1)
-
-    #load instrument defintion and parameters
-    LoadInstrument(ws, InstrumentName='IRIS', RewriteSpectraMap=True)
-    param_file = config['instrumentDefinition.directory'] + 'IRIS_graphite_002_Parameters.xml'
-    LoadParameterFile(ws, param_file)
-
-    ws = CropWorkspace(ws, StartWorkspaceIndex=3, EndWorkspaceIndex=12)
-    ws = RenameWorkspace(ws, OutputWorkspace="irs10001_graphite002_iqt")
-
-    #run FuryFitMultiple
-    FuryFitMultiple(RunNumber='10001', InputType='Workspace', Instrument='irs', Analyser='graphite002')
-
-
-.. categories::
-
-.. sourcelink::
diff --git a/docs/source/algorithms/IqtFitMultiple-v1.rst b/docs/source/algorithms/IqtFitMultiple-v1.rst
new file mode 100644
index 0000000000000000000000000000000000000000..8f13a394d0da598edb33ea2465700c347b7ecf50
--- /dev/null
+++ b/docs/source/algorithms/IqtFitMultiple-v1.rst
@@ -0,0 +1,43 @@
+.. algorithm::
+
+.. summary::
+
+.. alias::
+
+.. properties::
+
+Description
+-----------
+
+Fits an \*\_iqt file generated by Iqt using one of the specified
+functions. The functions available are either one or two exponentials
+(:math:`Intensity \times exp[-(x/\tau)]`), a stretched exponential
+(:math:`Intensity \times exp[-(x/\tau)]\beta`) or a combination of both
+an exponential and stretched exponential.
+
+This routine was originally part of the MODES package.
+
+Workflow
+--------
+
+.. diagram:: IqtFitMultiple-v1_wkflw.dot
+
+
+Usage
+-----
+
+**Example - Running IqtFitMultiple on an reduced workspace.**
+
+.. code-block:: python
+    
+    #Load in iqt data
+    input_ws = Load(Filename='iris26176_graphite002_iqt.nxs')
+    function = r'name=LinearBackground,A0=0.027668,A1=0,ties=(A1=0);name=UserFunction,Formula=Intensity*exp(-(x/Tau)^Beta),Intensity=0.972332,Tau=0.0247558,Beta=1;ties=(f1.Intensity=1-f0.A0)'
+
+    #run IqtFitMultiple
+    result, params, fit_group = IqtFitMultiple(InputWorkspace=input_ws, Function=function, FitType='1S_s', StartX=0, EndX=0.2, SpecMin=0, SpecMax=16)
+
+
+.. categories::
+
+.. sourcelink::
diff --git a/docs/source/algorithms/LiquidsRelectometryReduction-v1.rst b/docs/source/algorithms/LiquidsReflectometryReduction-v1.rst
similarity index 100%
rename from docs/source/algorithms/LiquidsRelectometryReduction-v1.rst
rename to docs/source/algorithms/LiquidsReflectometryReduction-v1.rst
diff --git a/docs/source/algorithms/LoadEventNexus-v1.rst b/docs/source/algorithms/LoadEventNexus-v1.rst
index 659192340dbb995c7eadf75fb2eb6c519b717ddb..2faeafa3b2f46b3f0fe3ec04ae09403ae63c61ac 100644
--- a/docs/source/algorithms/LoadEventNexus-v1.rst
+++ b/docs/source/algorithms/LoadEventNexus-v1.rst
@@ -27,6 +27,12 @@ specifying minimum and maximum time-of-flight values. This can speed up
 loading and reduce memory requirements if you are only interested in a
 narrow range of the times-of-flight of your data.
 
+You can specify to load only certain spectra within the file, 
+using the SpectraMax, SpectraMin and SpectraList properties.  
+This will load data only matching those restrictions.  
+At facilities that do not group detectors in hardware such as the SNS, 
+then this will also equate to the detector IDs.
+
 You may also filter out events by providing the start and stop times, in
 seconds, relative to the first pulse (the start of the run).
 
diff --git a/docs/source/algorithms/RenameWorkspace-v1.rst b/docs/source/algorithms/RenameWorkspace-v1.rst
index 74200ee4331950c5e8bbda2da55c24ed4f0046a6..188bc5458874842129092ffc6ccab639c3be4a8d 100644
--- a/docs/source/algorithms/RenameWorkspace-v1.rst
+++ b/docs/source/algorithms/RenameWorkspace-v1.rst
@@ -36,6 +36,7 @@ Usage
    print "*********************************************************************"   
    print "{0:20}|{1:>20}|{2:>20}|".format("Existing WS names: ",myWs.name(),mon_ws.name())
    obj_inADS = AnalysisDataService.getObjectNames()
+   obj_inADS.sort()
    print "{0:20}|{1:>6}| With Names: |{2:>20}|{3:>20}|".format("Exist in ADS: ",len(obj_inADS),obj_inADS[0],obj_inADS[1])
    #
    NameA = RenameWorkspace(myWs)
@@ -43,6 +44,7 @@ Usage
    print "***** After simple rename:"
    print "{0:20}|{1:>20}|{2:>20}|".format("Existing WS names: ",NameA.name(),mon_ws.name())
    obj_inADS = AnalysisDataService.getObjectNames()
+   obj_inADS.sort()
    print "{0:20}|{1:>6}| With Names: |{2:>20}|{3:>20}|".format("Exist in ADS: ",len(obj_inADS),obj_inADS[0],obj_inADS[1])  
 
    print "Old pointer to myWs refers to workspace with new name: ",myWs.name()
@@ -53,6 +55,7 @@ Usage
    #
    print "{0:20}|{1:>20}|{2:>20}|".format("Existing WS names: ",NameB.name(),mon_ws.name())   
    obj_inADS = AnalysisDataService.getObjectNames()
+   obj_inADS.sort()
    print "{0:20}|{1:>6}| With Names: |{2:>20}|{3:>20}|".format("Exist in ADS: ",len(obj_inADS),obj_inADS[0],obj_inADS[1])
    # 
    mon_ws1 = NameB.getMonitorWorkspace()
diff --git a/docs/source/algorithms/RenameWorkspaces-v1.rst b/docs/source/algorithms/RenameWorkspaces-v1.rst
index 99c0c80d2f72b26ab78c00b19d452d9d22669d20..5ff7482af4c4a29a682462aea7ef7a1cacd2a422 100644
--- a/docs/source/algorithms/RenameWorkspaces-v1.rst
+++ b/docs/source/algorithms/RenameWorkspaces-v1.rst
@@ -43,11 +43,15 @@ Usage
    for name in names:
      CreateWorkspace([0], [0], OutputWorkspace=name)
 
-   print 'Workspaces in the ADS _before_ renaming:', mtd.getObjectNames()
+   ws_before_rename = mtd.getObjectNames()
+   ws_before_rename.sort()
+   print 'Workspaces in the ADS _before_ renaming:', ws_before_rename
 
    RenameWorkspaces(names, WorkspaceNames=['new_ws1', 'new_ws2', 'new_ws3'])
 
-   print 'Workspaces in the ADS _after_ renaming:', mtd.getObjectNames()
+   ws_after_rename = mtd.getObjectNames()
+   ws_after_rename.sort()
+   print 'Workspaces in the ADS _after_ renaming:', ws_after_rename
 
 Output:
 
@@ -69,11 +73,15 @@ Output:
    for name in names:
      CreateWorkspace([0], [0], OutputWorkspace=name)
 
-   print 'Workspaces in the ADS _before_ renaming:', mtd.getObjectNames()
+   ws_before_rename = mtd.getObjectNames()
+   ws_before_rename.sort()
+   print 'Workspaces in the ADS _before_ renaming:', ws_before_rename
 
    RenameWorkspaces(names, Prefix='new_', Suffix='_name')
 
-   print 'Workspaces in the ADS _after_ renaming:', mtd.getObjectNames()
+   ws_after_rename = mtd.getObjectNames()
+   ws_after_rename.sort()
+   print 'Workspaces in the ADS _after_ renaming:', ws_after_rename
 
 Output:
 
diff --git a/docs/source/algorithms/SANSDarkRunBackgroundCorrection-v1.rst b/docs/source/algorithms/SANSDarkRunBackgroundCorrection-v1.rst
index 23f3b97e82fb39accf2f51907e60ce3bb8b0b2dd..cc0617b20620097348244ee9a26f231dfa8ab461 100644
--- a/docs/source/algorithms/SANSDarkRunBackgroundCorrection-v1.rst
+++ b/docs/source/algorithms/SANSDarkRunBackgroundCorrection-v1.rst
@@ -28,7 +28,7 @@ The background subtraction can be performed in several ways.
 Usage
 -----
 
-**Example - SANSDarkRunBackgroundCorrection for **
+**Example - SANSDarkRunBackgroundCorrection for**
 
 .. testcode:: SANSDarkRunBackgroundCorrection
 
diff --git a/docs/source/algorithms/SCDCalibratePanels-v1.rst b/docs/source/algorithms/SCDCalibratePanels-v1.rst
index c0dd120839c5de857e8fe9d71e1f3749dcb2e0a8..eea9f1945182b991228d89ac06d4ae9772b9430a 100644
--- a/docs/source/algorithms/SCDCalibratePanels-v1.rst
+++ b/docs/source/algorithms/SCDCalibratePanels-v1.rst
@@ -104,7 +104,7 @@ Usage
     LoadIsawPeaks(Filename='MANDI_801.peaks', OutputWorkspace='peaks')
     #TimeOffset is not stored in xml file, so use DetCal output if you need TimeOffset
     SCDCalibratePanels(PeakWorkspace='peaks',DetCalFilename='mandi_801.DetCal',XmlFilename='mandi_801.xml',a=74,b=74.5,c=99.9,alpha=90,beta=90,gamma=60,usetimeOffset=False)
-    LoadEmptyInstrument(Filename='MANDI_Definition_2013_08_01.xml', OutputWorkspace='MANDI_801_event_DetCal')
+    LoadEmptyInstrument(Filename=config.getInstrumentDirectory() + 'MANDI_Definition_2013_08_01.xml', OutputWorkspace='MANDI_801_event_DetCal')
     CloneWorkspace(InputWorkspace='MANDI_801_event_DetCal', OutputWorkspace='MANDI_801_event_xml')
     LoadParameterFile(Workspace='MANDI_801_event_xml', Filename='mandi_801.xml')
     LoadIsawDetCal(InputWorkspace='MANDI_801_event_DetCal', Filename='mandi_801.DetCal')
diff --git a/docs/source/algorithms/SaveMDWorkspaceToVTK-v1.rst b/docs/source/algorithms/SaveMDWorkspaceToVTK-v1.rst
new file mode 100644
index 0000000000000000000000000000000000000000..44ddae6f819bf99329d604bc90833e572b4a6221
--- /dev/null
+++ b/docs/source/algorithms/SaveMDWorkspaceToVTK-v1.rst
@@ -0,0 +1,53 @@
+.. algorithm::
+
+.. summary::
+
+.. alias::
+
+.. properties::
+
+Description
+-----------
+The algorithm SaveMDWorkspaceToVTK will write an IMDHistoWorkspace or IMDEventWorkspace
+to either a .vts or .vtu file, respectively.This file can be directly loaded into a
+standalone ParaView application. 
+
+To make use of all stored out features, such as axes annotations, it is required to load
+the NonOrthogonalSource plugin. To set this plugin navigate to Tools > Manage Plugins and
+open the Plugin Manager. Enable the `Auto Load` option on the and press `Load Selected`.
+
+Note that it is currently not possible to save out workspaces with more than three dimensions.
+
+
+Usage
+-----
+
+.. testcode:: SaveMDWorkspaceToVTK
+  
+    import os
+    signalInput = [i for i in range(1,28)]
+    errorInput = [1 for i in range(1,28)]
+    
+    ws = CreateMDHistoWorkspace(SignalInput=signalInput, ErrorInput=errorInput, Dimensionality='3',
+                                Extents='-1,1,-1,1,-1,1', NumberOfBins='3,3,3', Names='A,B,C', Units='U,T,W')
+                                
+    ws2 = CreateMDHistoWorkspace(SignalInput='1,2,3,4,5,6,7,8,9', ErrorInput='1,1,1,1,1,1,1,1,1', Dimensionality='2',
+                                Extents='-1,1,-1,1', NumberOfBins='3,3', Names='A,B', Units='U,T')                            
+  
+    savefile = os.path.join(config["defaultsave.directory"], "mdhws.vts")
+    SaveMDWorkspaceToVTK(InputWorkspace = ws, Filename = savefile)
+
+    print "File created:", os.path.exists(savefile)
+
+.. testoutput:: SaveMDWorkspaceToVTK
+
+    File created: True
+
+
+.. testcleanup:: SaveMDWorkspaceToVTK
+
+    os.remove(savefile)
+  
+.. categories::
+
+.. sourcelink::
diff --git a/docs/source/api/python/techniques/PowderDiffractionISIS-v1.rst b/docs/source/api/python/techniques/PowderDiffractionISIS-v1.rst
index 0a7e10533c76425091e7d6b00ee7f471bc9c74ef..b53ae8d381eb54333c207f6047601e85a1062453 100644
--- a/docs/source/api/python/techniques/PowderDiffractionISIS-v1.rst
+++ b/docs/source/api/python/techniques/PowderDiffractionISIS-v1.rst
@@ -246,7 +246,4 @@ Usage
 
    cry_focus.focus_all(expt, "79514", Write_ExtV=False)
 
-.. toctree::
-   :maxdepth: 1
 
-   api/python/index
diff --git a/docs/source/concepts/Algorithm.rst b/docs/source/concepts/Algorithm.rst
index 88ee04818a96259efb1d8ff8a38354e5db4e1ec4..ce35987f8c7e3b78880168aff136ca6868d50367 100644
--- a/docs/source/concepts/Algorithm.rst
+++ b/docs/source/concepts/Algorithm.rst
@@ -102,9 +102,7 @@ Example Algorithms
 Writing your own algorithm
 --------------------------
 
-A primer for this is `here <http://www.mantidproject.org/Writing_an_Algorithm>`__. Also look at the
-examples in the :ref:`UserAlgorithms <UserAlgorithms>` directory of your
-Mantid installation.
+A primer for this is `here <http://www.mantidproject.org/Writing_an_Algorithm>`__.
 
 
 
diff --git a/docs/source/concepts/MDWorkspace.rst b/docs/source/concepts/MDWorkspace.rst
index 5de154941d78215cc4dfd2b69545e99afa156abc..7741bf5839f5875f7da72a05d0f1f96f5b05a7f3 100644
--- a/docs/source/concepts/MDWorkspace.rst
+++ b/docs/source/concepts/MDWorkspace.rst
@@ -31,7 +31,7 @@ Description of MDWorkspace
 -  The class is named MDEventWorkspace.
 
 Structure
-~~~~~~~~~
+#########
 
 The MDWorkspace is a container that can hold a large number of MDEvents.
 The events are organized into "boxes": types are MDBox and MDGridBox. At
diff --git a/docs/source/concepts/MatrixWorkspace.rst b/docs/source/concepts/MatrixWorkspace.rst
index 563094d77749404cc2e8d35ab4c76ec162d0f826..6b74cafa7ae82cec03e06cfc76f45197c28a9ed3 100644
--- a/docs/source/concepts/MatrixWorkspace.rst
+++ b/docs/source/concepts/MatrixWorkspace.rst
@@ -369,7 +369,7 @@ There are more examples how to `Extract and manipulate workspace data here <http
 Workspace algebra
 #################
 
-MatrixWorkspaces can have algebraic operations applied to them directly without the need to call a specific algorithm, e.g. :ref:`algm-Plus <Plus>`
+MatrixWorkspaces can have algebraic operations applied to them directly without the need to call a specific algorithm, e.g. :ref:`Plus <algm-Plus>`
 
 
 The expected operations of +,-,*,/ are supported with either a single number or another workspace as the second argument, e.g.
diff --git a/docs/source/concepts/ORNL_SANS_Reduction.rst b/docs/source/concepts/ORNL_SANS_Reduction.rst
new file mode 100644
index 0000000000000000000000000000000000000000..6848fb49b27dbebef00faf178acb48ab69a3952c
--- /dev/null
+++ b/docs/source/concepts/ORNL_SANS_Reduction.rst
@@ -0,0 +1,484 @@
+.. _Facilities File:
+
+.. role:: xml(literal)
+   :class: highlight
+   
+Reduction for ORNL SANS
+=======================
+
+
+This document explains how to use Mantid to perform reduction of ORNL SANS data.
+Information about the underlying Mantid algorithms involved can be found in the 
+:ref:`SANSReduction <algm-SANSReduction>` algorithm documentation.
+For HFIR reduction specefically, you can also see the :ref:`HFIRSANSReduction <algm-HFIRSANSReduction>` algorithm documentation.
+
+
+Contents
+
+- `Reduction script`_
+
+- `Reduction commands`_
+
+ - `Instrument selection`_
+ - `Beam center`_
+ - `Normalization options`_
+ - `Absolute normalization`_
+ - `Dark current subtraction`_
+ - `Pixel masking`_
+ - `Sensitivity correction`_
+ - `Solid angle correction`_
+ - `Transmission correction`_
+ - `Background subtraction`_
+ - `I(Q) calculation`_
+ - `Wedge calculation`_
+ - `Data stitching`_
+ - `General commands`_
+
+
+.. _`Reduction script`:
+
+Reduction script
+----------------
+
+.. code-block:: python
+  import mantid
+  from mantid.simpleapi import *
+  from reduction_workflow.instruments.sans.hfir_command_interface import *
+
+  GPSANS()
+  SetSampleDetectorDistance(1802.5)
+  SetWavelength(4.86, 0.13)
+  NoSolidAngle()
+  NoNormalization()
+  SetAbsoluteScale(1)
+  AzimuthalAverage(n_bins=100, n_subpix=1, log_binning=False)
+  IQxQy(nbins=100)
+  SetWedges(number_of_wedges=2, wedge_angle=5, wedge_offset=0)
+  SetBeamCenter(95.5, 127.5)
+  NoSensitivityCorrection()
+  SetTransmission(1, 0)
+  ThetaDependentTransmission(False)
+  TransmissionDarkCurrent("HiResSANS_exp5_scan0032_0001.xml")
+  DataPath("/SNS/users/m2d")
+  AppendDataFile(["/SNS/users/m2d/scan30test1.xml"])
+  SaveIq()
+  Reduce()
+
+
+The ``hfir_command_interface`` import statement gives us access the the various commands we will use to set up the reduction process.
+
+The first important part of the script is to declare which instrument you are using.
+This will define the general flow of the reduction process. In this particular case, this is done by calling ``GPSANS()``.
+The ``DataPath()`` command sets the directory where the data file will be found.
+Once this has been done, only the name of the data files need to be supplied to the various reduction commands.
+
+The rest of the commands are setting up options for the reduction. Those commands do not need to be typed in any particular order. They only set options and define the reduction process that will be used later when processing each data file. See the list of commands for more details.
+
+The ``AppendDataFile()`` command appends a data file to the list of files to be reduced. The reducer can process any number of data files, and the same reduction process will be applied to each of them.
+The ``Reduce()`` command tell the reducer to start the reduction process. Since this command does the actual execution, it needs to be the last command in the reduction script.
+
+.. _`Reduction commands`:
+
+Reduction commands
+------------------
+
+The following is a list of reduction commands to apply corrections to the data and produce :math:`I(Q)`.
+
+.. _`Instrument selection`:
+
+Instrument Selection
+^^^^^^^^^^^^^^^^^^^^
+
+Since each instrument has its own configuration parameters, the first command called is the name of the instrument.
+
+``GPSANS()``
+    Sets up the GPSANS reduction options.
+
+``BIOSANS()``
+    Sets up the BIOSANS reduction options.
+
+``EQSANS()``
+    Sets up the EQSANS reduction options.
+
+
+.. _`Beam center`:
+
+Beam Center
+^^^^^^^^^^^
+
+Options for finding the beam center
+
+``SetBeamCenter(x,y)``
+    Sets the beam center location to be used, in pixel coordinates.
+
+``DirectBeamCenter(datafile)``
+   Finds the beam center using the direct beam method. The position of the beam center p is given by
+
+        :math:`p(x,y) = \frac{\sum_i I_i \ d_i(x,y)}{\sum_i I_i}`
+
+    where ``i`` runs over all pixels within the largest square detector area centered on the initial guess for the beam center position. The initial guess is the center of the detector. :math:`I_i` is the detector count for pixel ``i``, and :math:`d_i(x,y)` is the pixel coordinates. The calculation above is repeated iteratively by replacing the initial guess with the position found with the previous iteration. The process stops when the difference between the positions found with two consecutive iterations is smaller than 0.25 pixel.
+
+``ScatteringBeamCenter(datafile, beam_radius=3.0)``
+    Finds the beam center using the scattered beam method. The process is identical to the direct beam method, with the only difference being that the pixels within a distance R (the ``beam_radius`` parameter) of the beam center guess are excluded from the calculation. The direct beam is thus excluded and only the scattered data is used.
+
+``TotalChargeNormalization(normalize_to_beam=True, beam_file='')``
+    [**EQSANS only**] Specifies that we want to normalize by the total proton charge, using the specified ``beam_file`` for the beam profile.
+
+``BeamMonitorNormalization(reference_flux_file)``
+    [**EQSANS only**] Specifies that we want to normalize by the beam monitor, using the specified reference flux file.
+    
+    
+.. _`Normalization options`:
+
+Normalization options
+^^^^^^^^^^^^^^^^^^^^^
+
+``TimeNormalization()``
+    Tells the reducer to normalize the data to counting time.
+
+``MonitorNormalization()``
+    Tells the reducer to normalize the data to the beam monitor.
+
+``NoNormalization()``
+    Tells the reducer not to normalize the data.
+
+
+
+.. _`Absolute normalization`:
+
+Absolute Normalization
+^^^^^^^^^^^^^^^^^^^^^^
+
+``SetAbsoluteScale(factor=1.0)``
+    Sets a multiplicative scale factor to obtain I(Q) in absolute scale.
+
+``SetDirectBeamAbsoluteScale(direct_beam, beamstop_radius=None, attenuator_trans=1.0, sample_thickness=None, apply_sensitivity=False)``
+    Tells the reducer to use the direct beam method to compute the absolute scale factor. The direct_beam parameter is a valid file path to the direct beam data file. attenuator_trans is the attenuator transmission. The sample_thickness should be given in cm. If apply_sensitivity=True, the sensitivity correction will be applied to the direct beam data before the absolute scale factor is computed.
+
+    The absolute cross-section in 1/cm is computed after all corrections including the transmission correction have been applied to the sample data. It is given by:
+    
+        :math:`d\Sigma/d\Omega = \frac{I(Q)}{KD}`
+
+    where *D* is the sample thickness in *cm* and *K* is given by
+
+        :math:`K=N \ \Delta\Omega`
+
+    where *N* is the total empty beam detector counts per monitor count divided by the attenuation factor at the used wavelength, and :math:`\Delta\Omega` is the square of the ratio of the pixel size to the sample-detector distance.
+
+
+.. _`Dark current subtraction`:
+
+Dark current subtraction
+^^^^^^^^^^^^^^^^^^^^^^^^
+
+``NoDarkCurrent()``
+    Lets the reducer know that no dark current should be subtracted.
+
+``DarkCurrent(datafile)``
+    Specifies which data file to use for the dark current. The dark current is subtracted pixel by pixel by normalizing the dark current data by counting time, as follows:
+
+        :math:`I'(x,y) = I_{data}(x,y) - \frac{T_{data}}{T_{dc}} \ I_{dc}(x,y)`
+
+    where the T-values are the counting times for the data set and the dark current (dc).
+
+
+.. _`Pixel masking`:
+
+Pixel masking
+^^^^^^^^^^^^^
+
+``Mask(nx_low=0, nx_high=0, ny_low=0, ny_high=0)``
+    A band of pixels on each side of the detector is masked according to the input parameters.
+
+``MaskRectangle(x_min, x_max, y_min, y_max)``
+    Masks a rectangular region on the detector defined by the given pixel numbers.
+
+``MaskDetectors(det_list)``
+    Masks the given detector IDs.
+
+``MaskDetectorSide(side_to_mask=None)``
+    Masks a detector plane. Choices are 'Front', 'Back', and 'None'. 
+
+
+.. _`Sensitivity correction`:
+
+Sensitivity correction
+^^^^^^^^^^^^^^^^^^^^^^
+
+``SensitivityCorrection(flood_data, min_sensitivity=0.5, max_sensitivity=1.5, dark_current=None, use_sample_dc=False)``
+    The relative detector efficiency is computed the following way
+
+        :math:`S(x,y) = \frac{I_{flood}(x,y)}{1/N_{pixels} \ \sum_{i,j} \ I_{flood}(i,j)}`
+
+    where :math:`I_{flood}(x,y)` is the pixel count of the flood data in pixel (x,y). If a minimum and/or maximum sensitivity is given, the pixels having an efficiency outside the given limits are masked and the efficiency is recomputed without using those pixels.
+    The sample data is then corrected by dividing the intensity in each pixels by the efficiency S
+
+        :math:`I'_{sample}(x,y) = \frac{I_{sample}(x,y)}{S(x,y)}`
+
+    The pixels found to have an efficiency outside the given limits are also masked in the sample data so that they don’t enter any subsequent calculations.
+
+    If ``use_sample_dc`` is set to True, the dark current data that was chosen to be subtracted from the sample data will also be subtracted from the flood data. The subtraction is done before the sensitivity is calculated. Alternatively, a different file can be selected by specifying the ``dark_current`` parameter.
+
+    If the user chose to use the solid angle correction for the reduction process, that correction will be applied to the flood data before the sensitivity is calculated.
+
+    **Note**: The solid angle correction is either not applied at all, or applied to both the flood data to calculate the sensitivity correction and applied to the sample data as part of the reduction process.
+
+``NoSensitivityCorrection()``
+    Tells the reducer not to correct for detector sensitivity.
+
+``SetSensitivityBeamCenter(x,y)``
+    Sets the beam center for the flood data (may be different from the sample data).
+
+``SensitivityDirectBeamCenter(datafile)``
+    Tells the reducer to use the direct beam center finding method for the flood data (see DirectBeamCenter for details).
+
+``SensitivityScatteringBeamCenter(datafile, beam_radius=3.0)``
+    Tells the reducer to use the scattering beam center finding method for the flood data (see ScatteringBeamCenter for details).
+
+
+.. _`Solid angle correction`:
+
+Solid angle correction
+^^^^^^^^^^^^^^^^^^^^^^
+
+``SolidAngle(detector_tubes=False)``
+    Tells the reducer to apply the solid angle correction. The solid angle correction is applied as follows:
+
+        :math:`I'(x,y) = \frac{I(x,y)}{\cos^3(2\theta)}`
+
+        :math:`\sigma_{i'(x,y)} = \frac{\sigma_{I(x,y)}}{|\cos^3(2\theta)|}`
+
+    If ``detector_tubes`` is selected, the correction is calculated according to a tube geometry. The cosine term above then becomes:
+    
+        :math:`\cos^3(2\theta) \rightarrow \cos(\sqrt{\tan^2(\alpha)+1}) \ \cos^2(2\theta)`
+
+    where :math:`\alpha`: is the angle between the projection of the sample-to-pixel vector on the plane defined by the beam (Z) axis and the Y-axis.
+    
+``NoSolidAngle()``
+    Tells the reducer not to apply the solid angle correction.
+
+.. _`Transmission correction`:
+
+Transmission correction
+^^^^^^^^^^^^^^^^^^^^^^^
+
+``SetTransmission(trans, error)``
+    [**HFIR only**] Sets the sample transmission. For each detector pixel, the transmission correction is applied as follows:
+
+.. math::
+
+    I'(x,y) = \frac{I(x,y)}{T^{[1+\sec(2\theta)]/2}}
+
+    \sigma_{I'(x,y)} = \left[ \left[ \frac{\sigma_I}{T^{[1+\sec(2\theta)]/2}} \right]^2 + \left[ \frac{I(x,y)\sigma_T\left( \frac{1+\sec(2\theta)}{2}\right)}{T^{[\sec(2\theta)-1]/2}} \right]^2 \right]^{1/2}
+
+
+``DirectBeamTransmissionsample_file, empty_file, beam_radius=3.0, theta_dependent=True, use_sample_dc=True)``
+    Tells the reducer to use the direct beam method to calculate the sample transmission. The transmission is calculated as follows:
+
+        :math:`T=\frac{\sum_{i; \ d(i,j)<R} \sum_j{\frac{I_{sample}(i,j)}{T_{sample}}}}{\sum_{i; \ d(i,j)<R} \sum_j{\frac{I_{beam}(i,j)}{T_{beam}}}}`
+
+    where :math:`I_{sample}` and :math:`I_{beam}` are the pixel counts for the sample data set and the direct beam data set, respectively. The sums for each data set runs only over the pixels within a distance ``R=beam_radium`` of the beam center. :math:`T_{sample}` and :math:`T_{sample}` are the counting times for each of the two data sets. If the user chose to normalize the data using the beam monitor when setting up the reduction process, the beam monitor will be used to normalize the sample and direct beam data sets instead of the timer.
+    
+    If ``use_sample_dc`` is set to True, the dark current data that was chosen to be subtracted from the sample data will also be subtracted from the flood data.
+
+    Once the transmission is calculated, it is applied to the input data set in the same way as described for ``SetTransmission()``.
+
+``BeamSpreaderTransmission(sample_spreader, direct_spreader, sample_scattering, direct_scattering, spreader_transmission=1.0, spreader_transmission_err=0.0, theta_dependent=True)``
+    Tells the reducer to use the beam spreader ("glassy carbon") method to calculate the sample transmission. The transmission is calculated as follows:
+
+        :math:`T=\frac{N_{gc, sample}/T_{gc, sample} - T_{gc}N_{sample}/T_{sample}}{N_{gc, empty}/T_{gc, empty} - T_{gc}N_{empty}/T_{empty}}`
+
+    where :math:`N_{gc, sample}` and :math:`N_{gc, empty}` are the sums of all pixel counts for the sample and direct beam data sets with glass carbon, and :math:`N_{sample}` and :math:`N_{empty}` are the sums of all the pixel counts for the sample and direct beam without glassy carbon. The T values are the corresponding counting times. If the user chose to normalize the data using the beam monitor when setting up the reduction process, the beam monitor will be used to normalize all data sets instead of the timer.
+
+    If the user chose to use a dark current data set when starting the reduction process, that dark current data will be subtracted from all data sets before the transmission is calculated.
+
+    Once the transmission is calculated, it is applied to the input data set in the same way as described for ``SetTransmission()``.
+
+``NoTransmission()``
+    Tells the reducer not to apply a transmission correction.
+
+``TransmissionDarkCurrent(dark_current)``
+    Sets the dark current to be subtracted for the transmission measurement.
+
+``ThetaDependentTransmission(theta_dependence=True)``
+    If set to False, the transmission correction will be applied by dividing each pixel by the zero-angle transmission, without theta dependence.
+
+``SetTransmissionBeamCenter(x, y)``
+    Sets the beam center position to be used when applying the transmission correction. The beam center position of the sample data is otherwise used.
+    
+``TransmissionDirectBeamCenter(datafile)``
+    Specifies a direct beam data file to use to determine a beam center to use when applying the transmission correction. The beam center position of the sample data is otherwise used.
+
+.. _`Background subtraction`:
+
+Background subtraction
+^^^^^^^^^^^^^^^^^^^^^^
+
+``Background(datafile)``
+    The same reduction steps that are applied to the sample data are applied to the background data set. Those are the dark current subtraction, the data normalization, applying the detector mask, the sensitivity correction, the solid angle correction and the transmission correction. Although the same sensitivity correction is used for both sample and background, the background transmission is calculated separately from the sample transmission. Once all those reduction steps are applied to the background data set, the resulting background is subtracted from the sample data.
+
+``NoBackground()``
+    Tells the reducer not to subtract background.
+
+``NoBckTransmission()``
+    Specifies that we do not want a transmission correction for the background.
+    
+``SetBckTransmission(trans, error, theta_dependent=True)``
+    Sets the background transmission.
+
+``BckDirectBeamTransmission(sample_file, empty_file, beam_radius=3.0, theta_dependent=True)``
+    Similar to ``DirectBeamTransmission``, this command sets the options to measure the background transmission.
+
+``BckBeamSpreaderTransmission(sample_spreader, direct_spreader, sample_scattering, direct_scattering, spreader_transmission=1.0, spreader_transmission_err=0.0, theta_dependent=True)``
+    Similar to ``BeamSpreaderTransmission``, this command sets the options to measure the background transmission.
+
+``BckTransmissionDarkCurrent(dark_current)``
+    Similar to ``TransmissionDarkCurrent``, this command sets the dark current for the background.
+
+``BckThetaDependentTransmission(theta_dependence=True)``
+    Similar to ``ThetaDependentTransmission``, this command sets the theta-dependence option of the transmission correction for the background.
+
+``SetBckTransmissionBeamCenter(x, y)``
+    Similar to ``SetTransmissionBeamCenter``, sets the beam center position to be used when applying the transmission correction. The beam center position of the background data is otherwise used.
+    
+``BckTransmissionDirectBeamCenter(datafile)``
+    Similar to ``TransmissionDirectBeamCenter``,  specifies a direct beam data file to use to determine a beam center to use when applying the transmission correction. The beam center position of the background data is otherwise used.
+
+.. _`I(Q) calculation`:
+
+I(Q) calculation
+^^^^^^^^^^^^^^^^
+
+``AzimuthalAverage(binning=None, suffix="_Iq", error_weighting=False, n_bins=100, n_subpix=1, log_binning=False, align_log_with_decades=False)``
+    Sets the options for azimuthal averaging. The binning parameter sets the binning of the output I(q) distribution in the following format: :math:`Q_{min}, \Delta Q, Q_{max}` (the binning will be found automatically if the ``binning`` parameter is not supplied). When letting the binning be calculated automatically, setting ``log_binning=True`` will tell the reducer to find the best log binning. Setting ``align_log_with_decades=True`` will ensure that ``q`` points fall on decades. The ``suffix`` parameter sets the suffix appended to the I(q) workspace name. If ``error_weighting`` is set to True, the pixel counts will be weighted by a function of the error when computing I(q) (see below).
+
+    The binning of the output *I(Q)* distribution is defined by the user.
+    It runs from :math:`Q_{min}` to :math:`Q_{max}` in steps of :math:`\Delta Q`.
+    Each pixel is divided in :math:`N_{sub} \times N_{sub}` sub-pixels. Each sub-pixel is assigned a count equal to  of the original pixel count.
+
+    The intensity I(Q) in each Q bin is given by
+
+        :math:`I(Q_j) = \frac{1}{\sum_i \ w} \ \sum_i \ wI_i`
+
+    where the sum runs over all sub-pixels *i* such that :math:`Q_j < q_i < Q_{j+1}`, where :math:`q_i` is the q-value of the given sub-pixel:
+
+        :math:`q_i = \frac{4\pi \ \sin(\theta)}{\lambda}`
+
+    The *w* factor is a weight that is set to 1 by default. Alternatively, pixels can be weighted as a function of their error by setting :math:`w=1/\Delta I_i`.
+
+    The resolution in Q is computed using Mildner-Carpenter.
+
+``IQxQy(nbins=100)``
+    Option to produce the reduced I(Qx, Qy).
+
+``NoIQxQy()``
+    Turns off the option to produce the reduced I(Qx, Qy).
+
+``SaveIq(output_dir)``
+    Tells the reducer to save the output I(q) to an ascii file. The file will have a name similar to the input file, with "_Iq" appended to it. The file will be located in the specified directory.
+
+``NoSaveIq()``
+    Do not save the I(q) result.
+
+
+.. _`Wedge calculation`:
+
+Wedge calculation
+^^^^^^^^^^^^^^^^^
+
+Wedge calculation is done as part of the azimuthal averaging algorithm. The image below shows how the wedges are defined. A wedge includes both the forward and backward direction relative to the beam center. Any number of wedges can be used. They will be uniformly distributed around :math:`2\pi`. Each wedge is computed independently, so overlapping wedges are possible. As shown on the figure below, the angular offset is definited with respect to the x-axis.
+
+.. figure:: /images/SANS_wedge_definition.png
+   :figwidth: 10 cm
+   :align: right
+   :alt: Wedge definition.
+    
+``SetWedges(number_of_wedges=2, wedge_angle=30.0, wedge_offset=0.0)``
+    Specifies I(q) wedges to compute.
+    
+    - ``number_of_wedges``: number of wedges to calculate
+    - ``wedge_angle``: opening angle of each wedge, in degrees
+    - ``wedge_offset``: angular offset relative to the x-axis, defining the first wedge.
+    
+    
+.. _`Data stitching`:
+
+Data Stitching
+^^^^^^^^^^^^^^
+
+Data stitching can be done using the SANS reduction UI, or by calling the underlying command directly.
+
+
+``Stitch(data_list=[], q_min=None, q_max=None, output_workspace=None, scale=None, save_output=False)``
+    Stitches a set of SANS data sets
+    
+    - ``data_list``: List of workspaces to stitch.
+    - ``q_min``: Minimum Q-value of the overlap between two consecutive data sets. The q_min argument must be an array when stitching more than two data sets. The length of the array should be 1 less than the number of data sets.
+    - ``q_max``: Maximum Q-value of the overlap between two consecutive data sets (must be an array for more than two data sets). The q_max argument must be an array when stitching more than two data sets. The length of the array should be 1 less than the number of data sets.
+    - ``output_workspace``: Name of the output workspace containing the stitched data.
+    - ``scale``: Scaling factor. The scaling factor should either be a single number or a list of length equal to the number of data sets. The former will scale everything by the given factor, while the latter will assign the given scaling factors to the data sets.
+    - ``save_output``: If true, the output will be saved in the current working directory.
+
+
+
+
+.. _`General commands`:
+
+General commands
+^^^^^^^^^^^^^^^^
+
+``DataPath(path)``
+    Sets the directory containing all data files.
+
+``Reduce()``
+    Tells the reducer to execute the reduction process.
+
+``AppendDataFile(datafile, workspace=None)``
+    Appends a data file to the list of files to be reduced.
+
+``SetSampleDetectorOffset(distance)``
+    Sets an additive sample-detector distance offset, in mm.
+
+``SetSampleDetectorDistance(distance)``
+    Sets the sample-detector distance, in mm. If set, this distance will take priority over the distance found in the data file.
+
+``SetWavelength(wavelength, spread)``
+    Sets the wavelength, in Angstrom. If set, this wavelength will take priority over the wavelength found in the data file.
+
+``ResetWavelength()``
+    Resets the wavelength to the value found in the data file.
+    
+``DivideByThickness(thickness=1.0)``
+    Specifies a thickness to normalize the output I(q) by, in cm.
+    
+``PerformFlightPathCorrection(do_correction=True)``
+    Specifies that we want to perform the flight path correction.
+
+``SetTOFTailsCutoff(low_cut=0.0, high_cut=0.0)``
+    Specifies the TOF width to cut on each side of the TOF distribution.
+
+``UseConfigTOFTailsCutoff(use_config=True)``
+    Use the TOF cut specified in the instrument configuration on /SNS/EQSANS.
+
+``SkipTOFCorrection(skip=True)``
+    Skips the TOF correction. This is likely to give you bad results unless you know what you are doing.
+
+``UseConfigMask(use_config=True)``
+    Use the mask configuration defined in the instrument configuration on /SNS/EQSANS.
+
+``SetWavelengthStep(step=0.1)``
+    Sets the wavelength step size used when binning the TOF data after converting to wavelength. The I(q) is computed independently for each wavelength bin and combined afterwards.
+
+``UseConfig(use_config=True)``
+    Use the instrument configuration on /SNS/EQSANS.
+
+``CombineTransmissionFits(combine_frames=True)``
+    If True and we are running in frame-skipping mode, both frames will be processed together when measuring the transmission.
+
+``BckCombineTransmissionFits(combine_frames=True)``
+    Similar to ``CombineTransmissionFits``, but for the background.
+
+``Resolution(sample_aperture_diameter=10.0)``
+    Specifies that we want to q-resolution to be computed.
+
+.. categories:: Concepts
diff --git a/docs/source/concepts/PointAndSpaceGroups.rst b/docs/source/concepts/PointAndSpaceGroups.rst
index f110533a37f51c6adcb1efc90f91af03610d3d10..cce7a19bcd06314bc955b5039c915a70d09b1a6b 100644
--- a/docs/source/concepts/PointAndSpaceGroups.rst
+++ b/docs/source/concepts/PointAndSpaceGroups.rst
@@ -41,12 +41,14 @@ Any point group can be generated by using a maximum of three symmetry operations
 
 .. math::
 G = \left\{{4^{+}}^0, {4^{+}}^1, {4^{+}}^2, {4^{+}}^3\right\} = \left\{1, 4^{+}, 2, 4^{-}\right\}
-    
+	
+
 So by specifying one single symmetry operation as generator, all symmetry operations of the point group in question are generated. From this it's convenient to expand the example to generate a point group that can be expressed as the product of two cyclic groups - :math:`4/m`. In this point group, an additional mirror plane is present perpendicular to the four fold axis. The point group can be expressed as product of :math:`4` shown above and a cyclic group generated by the symmetry operation :math:`m` (mirror plane perpendicular to :math:`z`):
 
 .. math::
 G' = G \cdot \left\{m^0, m^1\right\} = \left\{1, 4^{+}, 2, 4^{-}\right\} \cdot \left\{1, m\right\} = \left\{1, m, 4^{+}, \bar{4}^{+}, 2, \bar{1}, 4^{-}, \bar{4}^{-}\right\}
-    
+	
+
 This means that :math:`4/m` contains an inversion center as well as a four fold rotoinversion axis which result from the combination of the operations of the two cyclic groups. It's also possible to use a different cyclic group to achive the same result (:math:`\bar{1}`). As mentioned above, for some point groups it's necessary to use three generators, which follows the same principle and is not shown here.
 
 Space groups can be handled in a very similar way if translations are limited to the interval :math:`[0, 1)` so that screw-axes and glide-planes can also be used to generate cyclic groups. Without this limitation, the translational components would not be the same for :math:`S^k` and :math:`S^0`.
diff --git a/docs/source/concepts/Properties.rst b/docs/source/concepts/Properties.rst
index 71d8ab02a89f8b938f78a4585fec228801795fec..943549bdc84ced0b8ae48128a5b29c8ffee900a6 100644
--- a/docs/source/concepts/Properties.rst
+++ b/docs/source/concepts/Properties.rst
@@ -176,7 +176,7 @@ In addition to the above, if used, Workspace properties also have a
 built in validator that requires that input workspaces exist and are of
 the correct type and that output workspaces have a name set.
 
-For more details on using validators, see the :ref:`PropertyAlgorithm <algm-PropertyAlgorithm>`
+For more details on using validators, see the PropertyAlgorithm 
 example or the full documentation for the individual validators (linked
 above).
 
diff --git a/docs/source/concepts/UserAlgorithms.rst b/docs/source/concepts/UserAlgorithms.rst
deleted file mode 100644
index 183221e1c2e79dbd2979313e918bb98749abbc3d..0000000000000000000000000000000000000000
--- a/docs/source/concepts/UserAlgorithms.rst
+++ /dev/null
@@ -1,8 +0,0 @@
-.. _UserAlgorithms:
-
-User Algorithms
-===============
-The code for a number of example algorithms is provided in the UserAlgorithms directory of a Mantid installation, and can also be viewed by following the links that follow. 
-
-
-.. categories:: Concepts
\ No newline at end of file
diff --git a/docs/source/concepts/WorkflowAlgorithm.rst b/docs/source/concepts/WorkflowAlgorithm.rst
index c7241d46bbdfd4bca610281e99c33d3e282f94c2..41eca4fcd37c929ace8f45979bdef780ca192080 100644
--- a/docs/source/concepts/WorkflowAlgorithm.rst
+++ b/docs/source/concepts/WorkflowAlgorithm.rst
@@ -41,7 +41,7 @@ Examples
 ''''''''
 
 -  :ref:`DGSReduction <algm-DgsReduction>`
--  :ref:`MuonLoad <algm-MuonLoad>`
+-  :ref:`MuonProcess <algm-MuonProcess>`
 
 
 
diff --git a/docs/source/diagrams/FuryFitMultiple-v1_wkflw.dot b/docs/source/diagrams/IqtFitMultiple-v1_wkflw.dot
similarity index 97%
rename from docs/source/diagrams/FuryFitMultiple-v1_wkflw.dot
rename to docs/source/diagrams/IqtFitMultiple-v1_wkflw.dot
index adff328186865b853d1b82ebf39ac52e6e3ef727..54202f06b477e3cc0d1c8a037d3dbca4a954e65f 100644
--- a/docs/source/diagrams/FuryFitMultiple-v1_wkflw.dot
+++ b/docs/source/diagrams/IqtFitMultiple-v1_wkflw.dot
@@ -1,5 +1,5 @@
-digraph FuryFitMultiple {
-  label="FuryFitMultiple Flowchart"
+digraph IqtFitMultiple {
+  label="IqtFitMultiple Flowchart"
   $global_style
   
   subgraph params {
diff --git a/docs/source/fitfunctions/BSpline.rst b/docs/source/fitfunctions/BSpline.rst
index bf24ad12857f109a1a5cc41c3b2fd5a8a8d39ba4..a249e8645979abef2d287f4e45a0da5daa65abc5 100644
--- a/docs/source/fitfunctions/BSpline.rst
+++ b/docs/source/fitfunctions/BSpline.rst
@@ -10,19 +10,90 @@ Description
 -----------
 
 This function creates spline using the set of points and interpolates
-the input between them.
+the input between them taking into account the least-squares fit.
 
 First and second derivatives from the spline can be calculated by using
 the derivative1D function.
 
-BSpline function takes a set of attributes and a set of parameters. The
-first attrbiute is 'n' which has integer type and sets the number of
-interpolation points. The parameter names have the form 'yi' where 'y'
-is letter 'y' and 'i' is the parameter's index starting from 0 and have
-the type double. Likewise, the attribute names have the form 'xi'.
+A BSpline is a polynomial function :math:`f(x)` of order N, defined between an interval :math:`a \leqslant x \leqslant b`.
+When using BSplines for interpolation or for fitting, we essentially chain BSplines together so that each
+spline passes through the breakpoints in that interval.
+
+There are conditions at each breakpoint that need to be fulfilled for the overall BSpline to be piecewise-smooth.
+
+Example
+-------
+
+To demonstrate these conditions we can set up a basic BSpline of order 2 with 3 breakpoints:
+
+Breakpoints : :math:`x_0, x_1, x_2`
+
+Our BSpline will be defined as the following: 
+
+.. math::
+
+   B(x) = 
+                               \begin{cases}
+                                 f_1(x)& x_0 \leq x \leq x_1 \\
+                                 f_2(x)& x_1 \leq x \leq x_2 \\
+                               \end{cases}
+                             
+We can write our :math:`B(x)` function as a series :math:`B(x) = \sum_{i=0}^{n+k-2} A_i f_i(x)`
+
+where :math:`A_i` is the coefficient of the BSpline. This coefficient maps to our fitting parameters found below.
+The coefficients :math:`A_0` to :math:`A_i` can be readily retrieved from a least-squares fit.
+
+If :math:`N` is our number of breakpoints for a spline of order :math:`K` then we can expect :math:`N + K - 2` coefficients
+as the -2 accounts for our 2 exterior breakpoints at :math:`x_0` and :math:`x_n`.
+
+To make our BSpline piecewise-smooth we must ensure that these conditions are satisfied:
+
+.. math::
+    
+    f_1(x_0) = y_0\\
+    f_2(x_2) = y_2\\
+    \frac{df_1}{dx}(x_1) = \frac{df_2}{dx}(x_1)\\
+    \frac{d^2 f_1}{dx^2}(x_1) = \frac{d^2 f_2}{dx^2}(x_1)\\
+
+This point of smoothness is represented by the red circle in the graph below of our BSpline function :math:`B(x)`
+      
+.. image:: ../images/BSplineQuadraticExample.jpg
+    :width: 800px
+    :align: center
+    :height: 600px
+    :alt: quadratic example of BSpline
+
+BSplines and Interpolation
+--------------------------
+BSplines are commonly used when interpolating between points. An interpolation is different to a fit as 
+it uses all of the data points to connect a straight line through them. It acts as if all of your data points
+are also breakpoints and a smooth spline of order N will connect the points together.
+
+BSplines and Fitting
+--------------------
+
+Fitting with a BSpline is different to interpolation as it requires your number of breakpoints to be less than your number
+of data points. The reason being, the BSplines will attempt to fit close to the data points but might only pass through
+some of the data points. It is not necessarily going to pass through all data points, only passing through breakpoints is gauranteed.
+
+An example of a fit using BSplines of order 3 can be seen in the image below, our breakpoints have been highlighted in green.
+The original dataset is in black, while the calculated fit using a least-squares fit with 4 breakpoints is in red.
+
+.. image:: ../images/BSplineFittingExample.png
+    :width: 800px
+    :align: center
+    :height: 600px
+    :alt: fitting example using BSplines
 
 .. attributes::
 
+   Uniform;Boolean;true;If set to true, all breakpoints will be evenly spaced between startX and endX
+   Order;Integer;3;The order of the spline you wish to use i.e Order = 2 will use Quadratic Splines
+   NBreak;Integer;\-;The number of breakpoints you wish to have (must be greater than 1)
+   StartX;Double;0.0;Minimum value of X
+   EndX;Double;1.0;Maximum value of X
+   BreakPoints;Double list;\-;If Uniform is set to false, you must supply the breakpoints as a comma-separated list
+
 .. properties::
 
 .. categories::
diff --git a/docs/source/fitfunctions/CubicSpline.rst b/docs/source/fitfunctions/CubicSpline.rst
index bad132ba227a54b5724de70972869e30e8b19ecc..da0fea96097fbd69d47c035509bceb2da2dbbe9f 100644
--- a/docs/source/fitfunctions/CubicSpline.rst
+++ b/docs/source/fitfunctions/CubicSpline.rst
@@ -9,22 +9,90 @@ CubicSpline
 Description
 -----------
 
-This function creates spline using the set of points and interpolates
-the input between them.
+This function creates spline of order 3 using the set of points and interpolates
+the input between them taking into account the least-squares fit
 
 First and second derivatives from the spline can be calculated by using
 the derivative1D function.
 
-CubicSpline function takes a set of attributes and a set of parameters.
-The first attrbiute is 'n' which has integer type and sets the number of
-interpolation points. The parameter names have the form 'yi' where 'y'
-is letter 'y' and 'i' is the parameter's index starting from 0 and have
-the type double. Likewise, the attribute names have the form 'xi'.
+A CubicSpline is a polynomial function :math:`f(x)` of order 3, defined between an interval :math:`a \leqslant x \leqslant b`.
+When using CubicSplines for interpolation or for fitting, we essentially chain `Basis-Splines <<http://docs.mantidproject.org/nightly/fitfunctions/BSpline.html>`__ 
+of order 3 together so that each spline passes through the breakpoints in that interval.
+
+A Cubic Spline is a specific case of `BSpline <http://docs.mantidproject.org/nightly/fitfunctions/BSpline.html>`__
+that only uses polynomials of order 3 to define the spline functions.
+
+Again, as with `BSplines <http://docs.mantidproject.org/nightly/fitfunctions/BSpline.html>`__ , there are certain conditions
+that must be fulfilled at each breakpoint such that the overall Spline is piecewise-smooth.
+
+Example
+-------
+
+To demonstrate these conditions we can set up a basic CubicSpline with 3 breakpoints:
+
+Our CubicSpline will be defined as the following: 
+
+Breakpoints : :math:`x_0, x_1, x_2`
+
+.. math::
+
+   C(x) = 
+                               \begin{cases}
+                                 f_1(x)& x_0 \leq x \leq x_1 \\
+                                 f_2(x)& x_1 \leq x \leq x_2 \\
+                               \end{cases}
+
+Our piecewise functions can be written as :math:`f_1(x) = c_0x^3 + c_1x^2 + c_2x + c_3` and :math:`f_2(x) = c_4x^3 + c_5x^2 + c_6x + c_7`
+
+To make our CubicSpline piecewise-smooth we must ensure that these conditions are satisfied:
+
+.. math::
+    
+    f_1(x_0) = y_0\\
+    f_2(x_2) = y_2\\
+    \frac{df_1}{dx}(x_1) = \frac{df_2}{dx}(x_1)\\
+    \frac{d^2 f_1}{dx^2}(x_1) = \frac{d^2 f_2}{dx^2}(x_1)\\
+
+This point of smoothness is represented by the red circle in the graph below of our CubicSpline function :math:`C(x)`
+
+.. image:: ../images/CubicSplineExample.png
+    :width: 800px
+    :align: center
+    :height: 600px
+    :alt: quadratic example of BSpline
+
+CubicSplines and Fitting
+------------------------
+
+Fitting using a CubicSpline fit function is different to interpolating with a CubicSpline as it requires the number of breakpoints 
+to be less than the number of data points. This allows the CubicSpline to fit as close as possible to the dataset using a least-squares fit
+instead of passing through all data points as with interpolation. The fitted curve will pass through the breakpoints however it may not pass through
+all of the data points in the set.
+
+A example of fitting with a CubicSpline has been provided below, with the breakpoints highlighted in green.
+The original data plot is in black and our fitted CubicSpline with four breakpoints is in red.
+
+.. image:: ../images/BSplineFittingExample.png
+    :width: 800px
+    :align: center
+    :height: 600px
+    :alt: fitting example using BSplines
+    
 
 .. attributes::
 
+   n;Integer;3;Number of breakpoints in Spline
+   x0;Double;\-;Position of first exterior breakpoint
+   x1;Double;\-;Position of the interior breakpoint
+   x2;Double;\-;Position of the last exterior breakpoint
+   
 .. properties::
 
+Even though the number of fitting parameters is set to 3 by default, this number is based off :math:`N + K - 2`.
+Where :math:`N` is the number of breakpoints in the fit, :math:`K` is the order of the spline (stays as 3 for the cubic spline case) and the :math:`-2`
+accounts for our two exterior breakpoints :math:`x_0, x_n`.
+Increasing the number of breakpoints in your fit will increase the number of fitting parameters by the same amount.
+
 .. categories::
 
 .. sourcelink::
diff --git a/docs/source/images/BSplineFittingExample.png b/docs/source/images/BSplineFittingExample.png
new file mode 100644
index 0000000000000000000000000000000000000000..904e7a5e3f02acddc6ff4bce4e0a1283d0cb0e0b
Binary files /dev/null and b/docs/source/images/BSplineFittingExample.png differ
diff --git a/docs/source/images/BSplineQuadraticExample.jpg b/docs/source/images/BSplineQuadraticExample.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..04484d8b6f056f548b4d6691c92386c1f83f7267
Binary files /dev/null and b/docs/source/images/BSplineQuadraticExample.jpg differ
diff --git a/docs/source/images/CubicSplineExample.png b/docs/source/images/CubicSplineExample.png
new file mode 100644
index 0000000000000000000000000000000000000000..a9195bfc578710b6405e2836c6d8d2335b5b846b
Binary files /dev/null and b/docs/source/images/CubicSplineExample.png differ
diff --git a/docs/source/images/SANS_wedge_definition.png b/docs/source/images/SANS_wedge_definition.png
new file mode 100644
index 0000000000000000000000000000000000000000..d4540a1c24fa3d71f8fe14ec6d95c2870b07fbe9
Binary files /dev/null and b/docs/source/images/SANS_wedge_definition.png differ
diff --git a/docs/source/interfaces/Engineering_Diffraction.rst b/docs/source/interfaces/Engineering_Diffraction.rst
index 65b18d25f79af0d080b91e1d006dbf9ee35681a1..7b7297b5c6c6b30213fa24304f379f4b4c6d9ea4 100644
--- a/docs/source/interfaces/Engineering_Diffraction.rst
+++ b/docs/source/interfaces/Engineering_Diffraction.rst
@@ -54,6 +54,17 @@ With the help of Cropped Calibration user can also calibrate according
 to bank or by setting the SpectrumIDs once the Cropped Calibration group
 box has been enabled.
 
+The plot Calibrated Workspace check-box will enable user to plot
+vanadium curves and Ceria peaks. For Ceria peaks there will be two
+workspace generated and plotted, one for each bank, whereas for
+cropped calibration there will only be only one workspace generate
+and plotted, depending on the selected bank or provided Spectrum
+IDs. The workspace contains difc and tzero data which is then
+utilised to plot the Ceria peaks per bank, the graph will plot Peaks
+Fitted and Difc/TZero Straight Line for comparison. More information
+regarding the fit peaks can be found on the
+:ref:`EnggFitPeaks<algm-EnggFitPeaks>` documentation.
+
 Parameters
 ^^^^^^^^^^
 
diff --git a/docs/source/interfaces/SCD_Event_Data_Reduction_Interface.rst b/docs/source/interfaces/SCD_Event_Data_Reduction_Interface.rst
index 70810259a73cbbd9b62933490493a0f6e3542722..7b6082294597680beae88357b29a300a7fc3d96b 100644
--- a/docs/source/interfaces/SCD_Event_Data_Reduction_Interface.rst
+++ b/docs/source/interfaces/SCD_Event_Data_Reduction_Interface.rst
@@ -171,8 +171,8 @@ loaded.  The second calibration file, Filename2, is currently only
 used for the second panel of detectors on the SNAP instrument at the
 SNS.
 
-Check that the maximum |Q| to load is appropriate for the current
-sample and instrument settings.  The max |Q| sets a limit on the
+Check that the maximum \|Q\| to load is appropriate for the current
+sample and instrument settings.  The max \|Q\| sets a limit on the
 sample-frame x,y and z components of the data that is loaded. The
 Apply Lorentz Correction option should also be set at this stage for
 small molecules.  Applying the Lorentz correction helps find the peaks
diff --git a/images/MantidWidgets.qrc b/images/MantidWidgets.qrc
new file mode 100644
index 0000000000000000000000000000000000000000..6e9a5539844aac37f509e6223cdfb5727743cbf5
--- /dev/null
+++ b/images/MantidWidgets.qrc
@@ -0,0 +1,25 @@
+<RCC>
+    <qresource prefix="/PickTools">
+        <file>zoom.png</file>
+        <file>selection-tube.png</file>
+        <file>selection-box.png</file>
+        <file>selection-circle.png</file>
+        <file>selection-pointer.png</file>
+        <file>selection-text.png</file>
+        <file>selection-peak.png</file>
+        <file>selection-peaks.png</file>
+        <file>selection-edit.png</file>
+        <file>eraser.png</file>
+        <file>selection-box-ring.png</file>
+        <file>selection-circle-ring.png</file>
+        <file>brush.png</file>
+    </qresource>
+    <qresource prefix="/MaskTools">
+        <file>selection-circle.png</file>
+        <file>selection-box.png</file>
+        <file>selection-box-ring.png</file>
+        <file>selection-circle-ring.png</file>
+        <file>selection-edit.png</file>
+        <file>brush.png</file>
+    </qresource>
+</RCC>
diff --git a/images/images.qrc b/images/images.qrc
index f574b14d849722bdb4ae85bdc201873be4d0d521..10a384c1c72d41eaa184b163b3572fcfc7afa2dd 100644
--- a/images/images.qrc
+++ b/images/images.qrc
@@ -54,27 +54,4 @@
         <file>MantidPlot_Python_Icon_32x32.png</file>
         <file>Circle_cog_48x48.png</file>
     </qresource>
-    <qresource prefix="/PickTools">
-        <file>zoom.png</file>
-        <file>selection-tube.png</file>
-        <file>selection-box.png</file>
-        <file>selection-circle.png</file>
-        <file>selection-pointer.png</file>
-        <file>selection-text.png</file>
-        <file>selection-peak.png</file>
-        <file>selection-peaks.png</file>
-        <file>selection-edit.png</file>
-        <file>eraser.png</file>
-        <file>selection-box-ring.png</file>
-        <file>selection-circle-ring.png</file>
-        <file>brush.png</file>
-    </qresource>
-    <qresource prefix="/MaskTools">
-        <file>selection-circle.png</file>
-        <file>selection-box.png</file>
-        <file>selection-box-ring.png</file>
-        <file>selection-circle-ring.png</file>
-        <file>selection-edit.png</file>
-        <file>brush.png</file>
-    </qresource>
 </RCC>
diff --git a/instrument/CG2_Definition.xml b/instrument/CG2_Definition.xml
new file mode 100644
index 0000000000000000000000000000000000000000..685eed07041a5edf2f118ca109c896ac8448d549
--- /dev/null
+++ b/instrument/CG2_Definition.xml
@@ -0,0 +1,3203 @@
+<?xml version='1.0' encoding='ASCII'?>
+<instrument xmlns="http://www.mantidproject.org/IDF/1.0" 
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="http://www.mantidproject.org/IDF/1.0 http://schema.mantidproject.org/IDF/1.0/IDFSchema.xsd"
+ name="CG2" valid-from   ="1900-01-31 23:59:59"
+                          valid-to     ="2100-01-31 23:59:59"
+		          last-modified="2010-11-16 12:02:05">
+  <!---->
+  <defaults>
+    <length unit="metre"/>
+    <angle unit="degree"/>
+    <reference-frame>
+      <along-beam axis="z"/>
+      <pointing-up axis="y"/>
+      <handedness val="right"/>
+    </reference-frame>
+  </defaults>
+  <!--SOURCE AND SAMPLE POSITION-->
+  <component type="moderator">
+    <location z="-13.601"/>
+  </component>
+  <type is="Source" name="moderator"/>
+  <component type="sample-position">
+    <location y="0.0" x="0.0" z="0.0"/>
+  </component>
+  <type is="SamplePos" name="sample-position"/>
+  <!--MONITORS-->
+  <component type="monitor1" idlist="monitor1">
+    <location z="-10.5" />
+  </component>
+  <type name="monitor1" is="monitor" />
+ 
+  <component type="timer1" idlist="timer1">
+    <location z="-10.5" />
+  </component>
+  <type name="timer1" is="monitor" />
+  
+  <component type="detector1" name="detector1" idlist="detector1">
+    <location/>
+  </component>
+  <type name="detector1">
+    <component type="tube0">
+      <location/>
+    </component>
+    <component type="tube1">
+      <location/>
+    </component>
+    <component type="tube2">
+      <location/>
+    </component>
+    <component type="tube3">
+      <location/>
+    </component>
+    <component type="tube4">
+      <location/>
+    </component>
+    <component type="tube5">
+      <location/>
+    </component>
+    <component type="tube6">
+      <location/>
+    </component>
+    <component type="tube7">
+      <location/>
+    </component>
+    <component type="tube8">
+      <location/>
+    </component>
+    <component type="tube9">
+      <location/>
+    </component>
+    <component type="tube10">
+      <location/>
+    </component>
+    <component type="tube11">
+      <location/>
+    </component>
+    <component type="tube12">
+      <location/>
+    </component>
+    <component type="tube13">
+      <location/>
+    </component>
+    <component type="tube14">
+      <location/>
+    </component>
+    <component type="tube15">
+      <location/>
+    </component>
+    <component type="tube16">
+      <location/>
+    </component>
+    <component type="tube17">
+      <location/>
+    </component>
+    <component type="tube18">
+      <location/>
+    </component>
+    <component type="tube19">
+      <location/>
+    </component>
+    <component type="tube20">
+      <location/>
+    </component>
+    <component type="tube21">
+      <location/>
+    </component>
+    <component type="tube22">
+      <location/>
+    </component>
+    <component type="tube23">
+      <location/>
+    </component>
+    <component type="tube24">
+      <location/>
+    </component>
+    <component type="tube25">
+      <location/>
+    </component>
+    <component type="tube26">
+      <location/>
+    </component>
+    <component type="tube27">
+      <location/>
+    </component>
+    <component type="tube28">
+      <location/>
+    </component>
+    <component type="tube29">
+      <location/>
+    </component>
+    <component type="tube30">
+      <location/>
+    </component>
+    <component type="tube31">
+      <location/>
+    </component>
+    <component type="tube32">
+      <location/>
+    </component>
+    <component type="tube33">
+      <location/>
+    </component>
+    <component type="tube34">
+      <location/>
+    </component>
+    <component type="tube35">
+      <location/>
+    </component>
+    <component type="tube36">
+      <location/>
+    </component>
+    <component type="tube37">
+      <location/>
+    </component>
+    <component type="tube38">
+      <location/>
+    </component>
+    <component type="tube39">
+      <location/>
+    </component>
+    <component type="tube40">
+      <location/>
+    </component>
+    <component type="tube41">
+      <location/>
+    </component>
+    <component type="tube42">
+      <location/>
+    </component>
+    <component type="tube43">
+      <location/>
+    </component>
+    <component type="tube44">
+      <location/>
+    </component>
+    <component type="tube45">
+      <location/>
+    </component>
+    <component type="tube46">
+      <location/>
+    </component>
+    <component type="tube47">
+      <location/>
+    </component>
+    <component type="tube48">
+      <location/>
+    </component>
+    <component type="tube49">
+      <location/>
+    </component>
+    <component type="tube50">
+      <location/>
+    </component>
+    <component type="tube51">
+      <location/>
+    </component>
+    <component type="tube52">
+      <location/>
+    </component>
+    <component type="tube53">
+      <location/>
+    </component>
+    <component type="tube54">
+      <location/>
+    </component>
+    <component type="tube55">
+      <location/>
+    </component>
+    <component type="tube56">
+      <location/>
+    </component>
+    <component type="tube57">
+      <location/>
+    </component>
+    <component type="tube58">
+      <location/>
+    </component>
+    <component type="tube59">
+      <location/>
+    </component>
+    <component type="tube60">
+      <location/>
+    </component>
+    <component type="tube61">
+      <location/>
+    </component>
+    <component type="tube62">
+      <location/>
+    </component>
+    <component type="tube63">
+      <location/>
+    </component>
+    <component type="tube64">
+      <location/>
+    </component>
+    <component type="tube65">
+      <location/>
+    </component>
+    <component type="tube66">
+      <location/>
+    </component>
+    <component type="tube67">
+      <location/>
+    </component>
+    <component type="tube68">
+      <location/>
+    </component>
+    <component type="tube69">
+      <location/>
+    </component>
+    <component type="tube70">
+      <location/>
+    </component>
+    <component type="tube71">
+      <location/>
+    </component>
+    <component type="tube72">
+      <location/>
+    </component>
+    <component type="tube73">
+      <location/>
+    </component>
+    <component type="tube74">
+      <location/>
+    </component>
+    <component type="tube75">
+      <location/>
+    </component>
+    <component type="tube76">
+      <location/>
+    </component>
+    <component type="tube77">
+      <location/>
+    </component>
+    <component type="tube78">
+      <location/>
+    </component>
+    <component type="tube79">
+      <location/>
+    </component>
+    <component type="tube80">
+      <location/>
+    </component>
+    <component type="tube81">
+      <location/>
+    </component>
+    <component type="tube82">
+      <location/>
+    </component>
+    <component type="tube83">
+      <location/>
+    </component>
+    <component type="tube84">
+      <location/>
+    </component>
+    <component type="tube85">
+      <location/>
+    </component>
+    <component type="tube86">
+      <location/>
+    </component>
+    <component type="tube87">
+      <location/>
+    </component>
+    <component type="tube88">
+      <location/>
+    </component>
+    <component type="tube89">
+      <location/>
+    </component>
+    <component type="tube90">
+      <location/>
+    </component>
+    <component type="tube91">
+      <location/>
+    </component>
+    <component type="tube92">
+      <location/>
+    </component>
+    <component type="tube93">
+      <location/>
+    </component>
+    <component type="tube94">
+      <location/>
+    </component>
+    <component type="tube95">
+      <location/>
+    </component>
+    <component type="tube96">
+      <location/>
+    </component>
+    <component type="tube97">
+      <location/>
+    </component>
+    <component type="tube98">
+      <location/>
+    </component>
+    <component type="tube99">
+      <location/>
+    </component>
+    <component type="tube100">
+      <location/>
+    </component>
+    <component type="tube101">
+      <location/>
+    </component>
+    <component type="tube102">
+      <location/>
+    </component>
+    <component type="tube103">
+      <location/>
+    </component>
+    <component type="tube104">
+      <location/>
+    </component>
+    <component type="tube105">
+      <location/>
+    </component>
+    <component type="tube106">
+      <location/>
+    </component>
+    <component type="tube107">
+      <location/>
+    </component>
+    <component type="tube108">
+      <location/>
+    </component>
+    <component type="tube109">
+      <location/>
+    </component>
+    <component type="tube110">
+      <location/>
+    </component>
+    <component type="tube111">
+      <location/>
+    </component>
+    <component type="tube112">
+      <location/>
+    </component>
+    <component type="tube113">
+      <location/>
+    </component>
+    <component type="tube114">
+      <location/>
+    </component>
+    <component type="tube115">
+      <location/>
+    </component>
+    <component type="tube116">
+      <location/>
+    </component>
+    <component type="tube117">
+      <location/>
+    </component>
+    <component type="tube118">
+      <location/>
+    </component>
+    <component type="tube119">
+      <location/>
+    </component>
+    <component type="tube120">
+      <location/>
+    </component>
+    <component type="tube121">
+      <location/>
+    </component>
+    <component type="tube122">
+      <location/>
+    </component>
+    <component type="tube123">
+      <location/>
+    </component>
+    <component type="tube124">
+      <location/>
+    </component>
+    <component type="tube125">
+      <location/>
+    </component>
+    <component type="tube126">
+      <location/>
+    </component>
+    <component type="tube127">
+      <location/>
+    </component>
+    <component type="tube128">
+      <location/>
+    </component>
+    <component type="tube129">
+      <location/>
+    </component>
+    <component type="tube130">
+      <location/>
+    </component>
+    <component type="tube131">
+      <location/>
+    </component>
+    <component type="tube132">
+      <location/>
+    </component>
+    <component type="tube133">
+      <location/>
+    </component>
+    <component type="tube134">
+      <location/>
+    </component>
+    <component type="tube135">
+      <location/>
+    </component>
+    <component type="tube136">
+      <location/>
+    </component>
+    <component type="tube137">
+      <location/>
+    </component>
+    <component type="tube138">
+      <location/>
+    </component>
+    <component type="tube139">
+      <location/>
+    </component>
+    <component type="tube140">
+      <location/>
+    </component>
+    <component type="tube141">
+      <location/>
+    </component>
+    <component type="tube142">
+      <location/>
+    </component>
+    <component type="tube143">
+      <location/>
+    </component>
+    <component type="tube144">
+      <location/>
+    </component>
+    <component type="tube145">
+      <location/>
+    </component>
+    <component type="tube146">
+      <location/>
+    </component>
+    <component type="tube147">
+      <location/>
+    </component>
+    <component type="tube148">
+      <location/>
+    </component>
+    <component type="tube149">
+      <location/>
+    </component>
+    <component type="tube150">
+      <location/>
+    </component>
+    <component type="tube151">
+      <location/>
+    </component>
+    <component type="tube152">
+      <location/>
+    </component>
+    <component type="tube153">
+      <location/>
+    </component>
+    <component type="tube154">
+      <location/>
+    </component>
+    <component type="tube155">
+      <location/>
+    </component>
+    <component type="tube156">
+      <location/>
+    </component>
+    <component type="tube157">
+      <location/>
+    </component>
+    <component type="tube158">
+      <location/>
+    </component>
+    <component type="tube159">
+      <location/>
+    </component>
+    <component type="tube160">
+      <location/>
+    </component>
+    <component type="tube161">
+      <location/>
+    </component>
+    <component type="tube162">
+      <location/>
+    </component>
+    <component type="tube163">
+      <location/>
+    </component>
+    <component type="tube164">
+      <location/>
+    </component>
+    <component type="tube165">
+      <location/>
+    </component>
+    <component type="tube166">
+      <location/>
+    </component>
+    <component type="tube167">
+      <location/>
+    </component>
+    <component type="tube168">
+      <location/>
+    </component>
+    <component type="tube169">
+      <location/>
+    </component>
+    <component type="tube170">
+      <location/>
+    </component>
+    <component type="tube171">
+      <location/>
+    </component>
+    <component type="tube172">
+      <location/>
+    </component>
+    <component type="tube173">
+      <location/>
+    </component>
+    <component type="tube174">
+      <location/>
+    </component>
+    <component type="tube175">
+      <location/>
+    </component>
+    <component type="tube176">
+      <location/>
+    </component>
+    <component type="tube177">
+      <location/>
+    </component>
+    <component type="tube178">
+      <location/>
+    </component>
+    <component type="tube179">
+      <location/>
+    </component>
+    <component type="tube180">
+      <location/>
+    </component>
+    <component type="tube181">
+      <location/>
+    </component>
+    <component type="tube182">
+      <location/>
+    </component>
+    <component type="tube183">
+      <location/>
+    </component>
+    <component type="tube184">
+      <location/>
+    </component>
+    <component type="tube185">
+      <location/>
+    </component>
+    <component type="tube186">
+      <location/>
+    </component>
+    <component type="tube187">
+      <location/>
+    </component>
+    <component type="tube188">
+      <location/>
+    </component>
+    <component type="tube189">
+      <location/>
+    </component>
+    <component type="tube190">
+      <location/>
+    </component>
+    <component type="tube191">
+      <location/>
+    </component>
+  </type>
+  <type name="tube" outline="yes">
+    <properties/>
+    <component type="pixel">
+      <location y="-0.54825" name="pixel1"/>
+      <location y="-0.54395" name="pixel2"/>
+      <location y="-0.53965" name="pixel3"/>
+      <location y="-0.53535" name="pixel4"/>
+      <location y="-0.53105" name="pixel5"/>
+      <location y="-0.52675" name="pixel6"/>
+      <location y="-0.52245" name="pixel7"/>
+      <location y="-0.51815" name="pixel8"/>
+      <location y="-0.51385" name="pixel9"/>
+      <location y="-0.50955" name="pixel10"/>
+      <location y="-0.50525" name="pixel11"/>
+      <location y="-0.50095" name="pixel12"/>
+      <location y="-0.49665" name="pixel13"/>
+      <location y="-0.49235" name="pixel14"/>
+      <location y="-0.48805" name="pixel15"/>
+      <location y="-0.48375" name="pixel16"/>
+      <location y="-0.47945" name="pixel17"/>
+      <location y="-0.47515" name="pixel18"/>
+      <location y="-0.47085" name="pixel19"/>
+      <location y="-0.46655" name="pixel20"/>
+      <location y="-0.46225" name="pixel21"/>
+      <location y="-0.45795" name="pixel22"/>
+      <location y="-0.45365" name="pixel23"/>
+      <location y="-0.44935" name="pixel24"/>
+      <location y="-0.44505" name="pixel25"/>
+      <location y="-0.44075" name="pixel26"/>
+      <location y="-0.43645" name="pixel27"/>
+      <location y="-0.43215" name="pixel28"/>
+      <location y="-0.42785" name="pixel29"/>
+      <location y="-0.42355" name="pixel30"/>
+      <location y="-0.41925" name="pixel31"/>
+      <location y="-0.41495" name="pixel32"/>
+      <location y="-0.41065" name="pixel33"/>
+      <location y="-0.40635" name="pixel34"/>
+      <location y="-0.40205" name="pixel35"/>
+      <location y="-0.39775" name="pixel36"/>
+      <location y="-0.39345" name="pixel37"/>
+      <location y="-0.38915" name="pixel38"/>
+      <location y="-0.38485" name="pixel39"/>
+      <location y="-0.38055" name="pixel40"/>
+      <location y="-0.37625" name="pixel41"/>
+      <location y="-0.37195" name="pixel42"/>
+      <location y="-0.36765" name="pixel43"/>
+      <location y="-0.36335" name="pixel44"/>
+      <location y="-0.35905" name="pixel45"/>
+      <location y="-0.35475" name="pixel46"/>
+      <location y="-0.35045" name="pixel47"/>
+      <location y="-0.34615" name="pixel48"/>
+      <location y="-0.34185" name="pixel49"/>
+      <location y="-0.33755" name="pixel50"/>
+      <location y="-0.33325" name="pixel51"/>
+      <location y="-0.32895" name="pixel52"/>
+      <location y="-0.32465" name="pixel53"/>
+      <location y="-0.32035" name="pixel54"/>
+      <location y="-0.31605" name="pixel55"/>
+      <location y="-0.31175" name="pixel56"/>
+      <location y="-0.30745" name="pixel57"/>
+      <location y="-0.30315" name="pixel58"/>
+      <location y="-0.29885" name="pixel59"/>
+      <location y="-0.29455" name="pixel60"/>
+      <location y="-0.29025" name="pixel61"/>
+      <location y="-0.28595" name="pixel62"/>
+      <location y="-0.28165" name="pixel63"/>
+      <location y="-0.27735" name="pixel64"/>
+      <location y="-0.27305" name="pixel65"/>
+      <location y="-0.26875" name="pixel66"/>
+      <location y="-0.26445" name="pixel67"/>
+      <location y="-0.26015" name="pixel68"/>
+      <location y="-0.25585" name="pixel69"/>
+      <location y="-0.25155" name="pixel70"/>
+      <location y="-0.24725" name="pixel71"/>
+      <location y="-0.24295" name="pixel72"/>
+      <location y="-0.23865" name="pixel73"/>
+      <location y="-0.23435" name="pixel74"/>
+      <location y="-0.23005" name="pixel75"/>
+      <location y="-0.22575" name="pixel76"/>
+      <location y="-0.22145" name="pixel77"/>
+      <location y="-0.21715" name="pixel78"/>
+      <location y="-0.21285" name="pixel79"/>
+      <location y="-0.20855" name="pixel80"/>
+      <location y="-0.20425" name="pixel81"/>
+      <location y="-0.19995" name="pixel82"/>
+      <location y="-0.19565" name="pixel83"/>
+      <location y="-0.19135" name="pixel84"/>
+      <location y="-0.18705" name="pixel85"/>
+      <location y="-0.18275" name="pixel86"/>
+      <location y="-0.17845" name="pixel87"/>
+      <location y="-0.17415" name="pixel88"/>
+      <location y="-0.16985" name="pixel89"/>
+      <location y="-0.16555" name="pixel90"/>
+      <location y="-0.16125" name="pixel91"/>
+      <location y="-0.15695" name="pixel92"/>
+      <location y="-0.15265" name="pixel93"/>
+      <location y="-0.14835" name="pixel94"/>
+      <location y="-0.14405" name="pixel95"/>
+      <location y="-0.13975" name="pixel96"/>
+      <location y="-0.13545" name="pixel97"/>
+      <location y="-0.13115" name="pixel98"/>
+      <location y="-0.12685" name="pixel99"/>
+      <location y="-0.12255" name="pixel100"/>
+      <location y="-0.11825" name="pixel101"/>
+      <location y="-0.11395" name="pixel102"/>
+      <location y="-0.10965" name="pixel103"/>
+      <location y="-0.10535" name="pixel104"/>
+      <location y="-0.10105" name="pixel105"/>
+      <location y="-0.09675" name="pixel106"/>
+      <location y="-0.09245" name="pixel107"/>
+      <location y="-0.08815" name="pixel108"/>
+      <location y="-0.08385" name="pixel109"/>
+      <location y="-0.07955" name="pixel110"/>
+      <location y="-0.07525" name="pixel111"/>
+      <location y="-0.07095" name="pixel112"/>
+      <location y="-0.06665" name="pixel113"/>
+      <location y="-0.06235" name="pixel114"/>
+      <location y="-0.05805" name="pixel115"/>
+      <location y="-0.05375" name="pixel116"/>
+      <location y="-0.04945" name="pixel117"/>
+      <location y="-0.04515" name="pixel118"/>
+      <location y="-0.04085" name="pixel119"/>
+      <location y="-0.03655" name="pixel120"/>
+      <location y="-0.03225" name="pixel121"/>
+      <location y="-0.02795" name="pixel122"/>
+      <location y="-0.02365" name="pixel123"/>
+      <location y="-0.01935" name="pixel124"/>
+      <location y="-0.01505" name="pixel125"/>
+      <location y="-0.01075" name="pixel126"/>
+      <location y="-0.00645" name="pixel127"/>
+      <location y="-0.00215" name="pixel128"/>
+      <location y="0.00215" name="pixel129"/>
+      <location y="0.00645" name="pixel130"/>
+      <location y="0.01075" name="pixel131"/>
+      <location y="0.01505" name="pixel132"/>
+      <location y="0.01935" name="pixel133"/>
+      <location y="0.02365" name="pixel134"/>
+      <location y="0.02795" name="pixel135"/>
+      <location y="0.03225" name="pixel136"/>
+      <location y="0.03655" name="pixel137"/>
+      <location y="0.04085" name="pixel138"/>
+      <location y="0.04515" name="pixel139"/>
+      <location y="0.04945" name="pixel140"/>
+      <location y="0.05375" name="pixel141"/>
+      <location y="0.05805" name="pixel142"/>
+      <location y="0.06235" name="pixel143"/>
+      <location y="0.06665" name="pixel144"/>
+      <location y="0.07095" name="pixel145"/>
+      <location y="0.07525" name="pixel146"/>
+      <location y="0.07955" name="pixel147"/>
+      <location y="0.08385" name="pixel148"/>
+      <location y="0.08815" name="pixel149"/>
+      <location y="0.09245" name="pixel150"/>
+      <location y="0.09675" name="pixel151"/>
+      <location y="0.10105" name="pixel152"/>
+      <location y="0.10535" name="pixel153"/>
+      <location y="0.10965" name="pixel154"/>
+      <location y="0.11395" name="pixel155"/>
+      <location y="0.11825" name="pixel156"/>
+      <location y="0.12255" name="pixel157"/>
+      <location y="0.12685" name="pixel158"/>
+      <location y="0.13115" name="pixel159"/>
+      <location y="0.13545" name="pixel160"/>
+      <location y="0.13975" name="pixel161"/>
+      <location y="0.14405" name="pixel162"/>
+      <location y="0.14835" name="pixel163"/>
+      <location y="0.15265" name="pixel164"/>
+      <location y="0.15695" name="pixel165"/>
+      <location y="0.16125" name="pixel166"/>
+      <location y="0.16555" name="pixel167"/>
+      <location y="0.16985" name="pixel168"/>
+      <location y="0.17415" name="pixel169"/>
+      <location y="0.17845" name="pixel170"/>
+      <location y="0.18275" name="pixel171"/>
+      <location y="0.18705" name="pixel172"/>
+      <location y="0.19135" name="pixel173"/>
+      <location y="0.19565" name="pixel174"/>
+      <location y="0.19995" name="pixel175"/>
+      <location y="0.20425" name="pixel176"/>
+      <location y="0.20855" name="pixel177"/>
+      <location y="0.21285" name="pixel178"/>
+      <location y="0.21715" name="pixel179"/>
+      <location y="0.22145" name="pixel180"/>
+      <location y="0.22575" name="pixel181"/>
+      <location y="0.23005" name="pixel182"/>
+      <location y="0.23435" name="pixel183"/>
+      <location y="0.23865" name="pixel184"/>
+      <location y="0.24295" name="pixel185"/>
+      <location y="0.24725" name="pixel186"/>
+      <location y="0.25155" name="pixel187"/>
+      <location y="0.25585" name="pixel188"/>
+      <location y="0.26015" name="pixel189"/>
+      <location y="0.26445" name="pixel190"/>
+      <location y="0.26875" name="pixel191"/>
+      <location y="0.27305" name="pixel192"/>
+      <location y="0.27735" name="pixel193"/>
+      <location y="0.28165" name="pixel194"/>
+      <location y="0.28595" name="pixel195"/>
+      <location y="0.29025" name="pixel196"/>
+      <location y="0.29455" name="pixel197"/>
+      <location y="0.29885" name="pixel198"/>
+      <location y="0.30315" name="pixel199"/>
+      <location y="0.30745" name="pixel200"/>
+      <location y="0.31175" name="pixel201"/>
+      <location y="0.31605" name="pixel202"/>
+      <location y="0.32035" name="pixel203"/>
+      <location y="0.32465" name="pixel204"/>
+      <location y="0.32895" name="pixel205"/>
+      <location y="0.33325" name="pixel206"/>
+      <location y="0.33755" name="pixel207"/>
+      <location y="0.34185" name="pixel208"/>
+      <location y="0.34615" name="pixel209"/>
+      <location y="0.35045" name="pixel210"/>
+      <location y="0.35475" name="pixel211"/>
+      <location y="0.35905" name="pixel212"/>
+      <location y="0.36335" name="pixel213"/>
+      <location y="0.36765" name="pixel214"/>
+      <location y="0.37195" name="pixel215"/>
+      <location y="0.37625" name="pixel216"/>
+      <location y="0.38055" name="pixel217"/>
+      <location y="0.38485" name="pixel218"/>
+      <location y="0.38915" name="pixel219"/>
+      <location y="0.39345" name="pixel220"/>
+      <location y="0.39775" name="pixel221"/>
+      <location y="0.40205" name="pixel222"/>
+      <location y="0.40635" name="pixel223"/>
+      <location y="0.41065" name="pixel224"/>
+      <location y="0.41495" name="pixel225"/>
+      <location y="0.41925" name="pixel226"/>
+      <location y="0.42355" name="pixel227"/>
+      <location y="0.42785" name="pixel228"/>
+      <location y="0.43215" name="pixel229"/>
+      <location y="0.43645" name="pixel230"/>
+      <location y="0.44075" name="pixel231"/>
+      <location y="0.44505" name="pixel232"/>
+      <location y="0.44935" name="pixel233"/>
+      <location y="0.45365" name="pixel234"/>
+      <location y="0.45795" name="pixel235"/>
+      <location y="0.46225" name="pixel236"/>
+      <location y="0.46655" name="pixel237"/>
+      <location y="0.47085" name="pixel238"/>
+      <location y="0.47515" name="pixel239"/>
+      <location y="0.47945" name="pixel240"/>
+      <location y="0.48375" name="pixel241"/>
+      <location y="0.48805" name="pixel242"/>
+      <location y="0.49235" name="pixel243"/>
+      <location y="0.49665" name="pixel244"/>
+      <location y="0.50095" name="pixel245"/>
+      <location y="0.50525" name="pixel246"/>
+      <location y="0.50955" name="pixel247"/>
+      <location y="0.51385" name="pixel248"/>
+      <location y="0.51815" name="pixel249"/>
+      <location y="0.52245" name="pixel250"/>
+      <location y="0.52675" name="pixel251"/>
+      <location y="0.53105" name="pixel252"/>
+      <location y="0.53535" name="pixel253"/>
+      <location y="0.53965" name="pixel254"/>
+      <location y="0.54395" name="pixel255"/>
+      <location y="0.54825" name="pixel256"/>
+    </component>
+  </type>
+  <type is="detector" name="pixel">
+    <cylinder id="cyl-approx">
+      <centre-of-bottom-base p="0.0" r="0.0" t="0.0"/>
+      <axis y="1.0" x="0.0" z="0.0"/>
+      <radius val="0.00275"/>
+      <height val="0.0043"/>
+    </cylinder>
+    <algebra val="cyl-approx"/>
+  </type>
+  <type name="tube0">
+    <component type="tube">
+      <location y="0" x="-0.52525" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube1">
+    <component type="tube">
+      <location y="0" x="-0.51975" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube2">
+    <component type="tube">
+      <location y="0" x="-0.51425" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube3">
+    <component type="tube">
+      <location y="0" x="-0.50875" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube4">
+    <component type="tube">
+      <location y="0" x="-0.50325" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube5">
+    <component type="tube">
+      <location y="0" x="-0.49775" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube6">
+    <component type="tube">
+      <location y="0" x="-0.49225" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube7">
+    <component type="tube">
+      <location y="0" x="-0.48675" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube8">
+    <component type="tube">
+      <location y="0" x="-0.48125" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube9">
+    <component type="tube">
+      <location y="0" x="-0.47575" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube10">
+    <component type="tube">
+      <location y="0" x="-0.47025" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube11">
+    <component type="tube">
+      <location y="0" x="-0.46475" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube12">
+    <component type="tube">
+      <location y="0" x="-0.45925" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube13">
+    <component type="tube">
+      <location y="0" x="-0.45375" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube14">
+    <component type="tube">
+      <location y="0" x="-0.44825" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube15">
+    <component type="tube">
+      <location y="0" x="-0.44275" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube16">
+    <component type="tube">
+      <location y="0" x="-0.43725" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube17">
+    <component type="tube">
+      <location y="0" x="-0.43175" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube18">
+    <component type="tube">
+      <location y="0" x="-0.42625" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube19">
+    <component type="tube">
+      <location y="0" x="-0.42075" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube20">
+    <component type="tube">
+      <location y="0" x="-0.41525" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube21">
+    <component type="tube">
+      <location y="0" x="-0.40975" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube22">
+    <component type="tube">
+      <location y="0" x="-0.40425" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube23">
+    <component type="tube">
+      <location y="0" x="-0.39875" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube24">
+    <component type="tube">
+      <location y="0" x="-0.39325" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube25">
+    <component type="tube">
+      <location y="0" x="-0.38775" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube26">
+    <component type="tube">
+      <location y="0" x="-0.38225" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube27">
+    <component type="tube">
+      <location y="0" x="-0.37675" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube28">
+    <component type="tube">
+      <location y="0" x="-0.37125" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube29">
+    <component type="tube">
+      <location y="0" x="-0.36575" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube30">
+    <component type="tube">
+      <location y="0" x="-0.36025" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube31">
+    <component type="tube">
+      <location y="0" x="-0.35475" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube32">
+    <component type="tube">
+      <location y="0" x="-0.34925" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube33">
+    <component type="tube">
+      <location y="0" x="-0.34375" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube34">
+    <component type="tube">
+      <location y="0" x="-0.33825" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube35">
+    <component type="tube">
+      <location y="0" x="-0.33275" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube36">
+    <component type="tube">
+      <location y="0" x="-0.32725" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube37">
+    <component type="tube">
+      <location y="0" x="-0.32175" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube38">
+    <component type="tube">
+      <location y="0" x="-0.31625" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube39">
+    <component type="tube">
+      <location y="0" x="-0.31075" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube40">
+    <component type="tube">
+      <location y="0" x="-0.30525" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube41">
+    <component type="tube">
+      <location y="0" x="-0.29975" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube42">
+    <component type="tube">
+      <location y="0" x="-0.29425" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube43">
+    <component type="tube">
+      <location y="0" x="-0.28875" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube44">
+    <component type="tube">
+      <location y="0" x="-0.28325" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube45">
+    <component type="tube">
+      <location y="0" x="-0.27775" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube46">
+    <component type="tube">
+      <location y="0" x="-0.27225" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube47">
+    <component type="tube">
+      <location y="0" x="-0.26675" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube48">
+    <component type="tube">
+      <location y="0" x="-0.26125" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube49">
+    <component type="tube">
+      <location y="0" x="-0.25575" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube50">
+    <component type="tube">
+      <location y="0" x="-0.25025" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube51">
+    <component type="tube">
+      <location y="0" x="-0.24475" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube52">
+    <component type="tube">
+      <location y="0" x="-0.23925" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube53">
+    <component type="tube">
+      <location y="0" x="-0.23375" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube54">
+    <component type="tube">
+      <location y="0" x="-0.22825" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube55">
+    <component type="tube">
+      <location y="0" x="-0.22275" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube56">
+    <component type="tube">
+      <location y="0" x="-0.21725" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube57">
+    <component type="tube">
+      <location y="0" x="-0.21175" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube58">
+    <component type="tube">
+      <location y="0" x="-0.20625" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube59">
+    <component type="tube">
+      <location y="0" x="-0.20075" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube60">
+    <component type="tube">
+      <location y="0" x="-0.19525" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube61">
+    <component type="tube">
+      <location y="0" x="-0.18975" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube62">
+    <component type="tube">
+      <location y="0" x="-0.18425" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube63">
+    <component type="tube">
+      <location y="0" x="-0.17875" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube64">
+    <component type="tube">
+      <location y="0" x="-0.17325" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube65">
+    <component type="tube">
+      <location y="0" x="-0.16775" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube66">
+    <component type="tube">
+      <location y="0" x="-0.16225" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube67">
+    <component type="tube">
+      <location y="0" x="-0.15675" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube68">
+    <component type="tube">
+      <location y="0" x="-0.15125" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube69">
+    <component type="tube">
+      <location y="0" x="-0.14575" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube70">
+    <component type="tube">
+      <location y="0" x="-0.14025" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube71">
+    <component type="tube">
+      <location y="0" x="-0.13475" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube72">
+    <component type="tube">
+      <location y="0" x="-0.12925" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube73">
+    <component type="tube">
+      <location y="0" x="-0.12375" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube74">
+    <component type="tube">
+      <location y="0" x="-0.11825" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube75">
+    <component type="tube">
+      <location y="0" x="-0.11275" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube76">
+    <component type="tube">
+      <location y="0" x="-0.10725" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube77">
+    <component type="tube">
+      <location y="0" x="-0.10175" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube78">
+    <component type="tube">
+      <location y="0" x="-0.09625" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube79">
+    <component type="tube">
+      <location y="0" x="-0.09075" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube80">
+    <component type="tube">
+      <location y="0" x="-0.08525" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube81">
+    <component type="tube">
+      <location y="0" x="-0.07975" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube82">
+    <component type="tube">
+      <location y="0" x="-0.07425" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube83">
+    <component type="tube">
+      <location y="0" x="-0.06875" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube84">
+    <component type="tube">
+      <location y="0" x="-0.06325" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube85">
+    <component type="tube">
+      <location y="0" x="-0.05775" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube86">
+    <component type="tube">
+      <location y="0" x="-0.05225" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube87">
+    <component type="tube">
+      <location y="0" x="-0.04675" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube88">
+    <component type="tube">
+      <location y="0" x="-0.04125" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube89">
+    <component type="tube">
+      <location y="0" x="-0.03575" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube90">
+    <component type="tube">
+      <location y="0" x="-0.03025" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube91">
+    <component type="tube">
+      <location y="0" x="-0.02475" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube92">
+    <component type="tube">
+      <location y="0" x="-0.01925" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube93">
+    <component type="tube">
+      <location y="0" x="-0.01375" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube94">
+    <component type="tube">
+      <location y="0" x="-0.00825" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube95">
+    <component type="tube">
+      <location y="0" x="-0.00275" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube96">
+    <component type="tube">
+      <location y="0" x="0.00275" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube97">
+    <component type="tube">
+      <location y="0" x="0.00825" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube98">
+    <component type="tube">
+      <location y="0" x="0.01375" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube99">
+    <component type="tube">
+      <location y="0" x="0.01925" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube100">
+    <component type="tube">
+      <location y="0" x="0.02475" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube101">
+    <component type="tube">
+      <location y="0" x="0.03025" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube102">
+    <component type="tube">
+      <location y="0" x="0.03575" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube103">
+    <component type="tube">
+      <location y="0" x="0.04125" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube104">
+    <component type="tube">
+      <location y="0" x="0.04675" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube105">
+    <component type="tube">
+      <location y="0" x="0.05225" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube106">
+    <component type="tube">
+      <location y="0" x="0.05775" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube107">
+    <component type="tube">
+      <location y="0" x="0.06325" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube108">
+    <component type="tube">
+      <location y="0" x="0.06875" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube109">
+    <component type="tube">
+      <location y="0" x="0.07425" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube110">
+    <component type="tube">
+      <location y="0" x="0.07975" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube111">
+    <component type="tube">
+      <location y="0" x="0.08525" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube112">
+    <component type="tube">
+      <location y="0" x="0.09075" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube113">
+    <component type="tube">
+      <location y="0" x="0.09625" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube114">
+    <component type="tube">
+      <location y="0" x="0.10175" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube115">
+    <component type="tube">
+      <location y="0" x="0.10725" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube116">
+    <component type="tube">
+      <location y="0" x="0.11275" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube117">
+    <component type="tube">
+      <location y="0" x="0.11825" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube118">
+    <component type="tube">
+      <location y="0" x="0.12375" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube119">
+    <component type="tube">
+      <location y="0" x="0.12925" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube120">
+    <component type="tube">
+      <location y="0" x="0.13475" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube121">
+    <component type="tube">
+      <location y="0" x="0.14025" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube122">
+    <component type="tube">
+      <location y="0" x="0.14575" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube123">
+    <component type="tube">
+      <location y="0" x="0.15125" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube124">
+    <component type="tube">
+      <location y="0" x="0.15675" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube125">
+    <component type="tube">
+      <location y="0" x="0.16225" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube126">
+    <component type="tube">
+      <location y="0" x="0.16775" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube127">
+    <component type="tube">
+      <location y="0" x="0.17325" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube128">
+    <component type="tube">
+      <location y="0" x="0.17875" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube129">
+    <component type="tube">
+      <location y="0" x="0.18425" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube130">
+    <component type="tube">
+      <location y="0" x="0.18975" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube131">
+    <component type="tube">
+      <location y="0" x="0.19525" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube132">
+    <component type="tube">
+      <location y="0" x="0.20075" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube133">
+    <component type="tube">
+      <location y="0" x="0.20625" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube134">
+    <component type="tube">
+      <location y="0" x="0.21175" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube135">
+    <component type="tube">
+      <location y="0" x="0.21725" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube136">
+    <component type="tube">
+      <location y="0" x="0.22275" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube137">
+    <component type="tube">
+      <location y="0" x="0.22825" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube138">
+    <component type="tube">
+      <location y="0" x="0.23375" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube139">
+    <component type="tube">
+      <location y="0" x="0.23925" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube140">
+    <component type="tube">
+      <location y="0" x="0.24475" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube141">
+    <component type="tube">
+      <location y="0" x="0.25025" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube142">
+    <component type="tube">
+      <location y="0" x="0.25575" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube143">
+    <component type="tube">
+      <location y="0" x="0.26125" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube144">
+    <component type="tube">
+      <location y="0" x="0.26675" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube145">
+    <component type="tube">
+      <location y="0" x="0.27225" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube146">
+    <component type="tube">
+      <location y="0" x="0.27775" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube147">
+    <component type="tube">
+      <location y="0" x="0.28325" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube148">
+    <component type="tube">
+      <location y="0" x="0.28875" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube149">
+    <component type="tube">
+      <location y="0" x="0.29425" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube150">
+    <component type="tube">
+      <location y="0" x="0.29975" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube151">
+    <component type="tube">
+      <location y="0" x="0.30525" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube152">
+    <component type="tube">
+      <location y="0" x="0.31075" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube153">
+    <component type="tube">
+      <location y="0" x="0.31625" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube154">
+    <component type="tube">
+      <location y="0" x="0.32175" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube155">
+    <component type="tube">
+      <location y="0" x="0.32725" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube156">
+    <component type="tube">
+      <location y="0" x="0.33275" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube157">
+    <component type="tube">
+      <location y="0" x="0.33825" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube158">
+    <component type="tube">
+      <location y="0" x="0.34375" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube159">
+    <component type="tube">
+      <location y="0" x="0.34925" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube160">
+    <component type="tube">
+      <location y="0" x="0.35475" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube161">
+    <component type="tube">
+      <location y="0" x="0.36025" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube162">
+    <component type="tube">
+      <location y="0" x="0.36575" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube163">
+    <component type="tube">
+      <location y="0" x="0.37125" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube164">
+    <component type="tube">
+      <location y="0" x="0.37675" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube165">
+    <component type="tube">
+      <location y="0" x="0.38225" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube166">
+    <component type="tube">
+      <location y="0" x="0.38775" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube167">
+    <component type="tube">
+      <location y="0" x="0.39325" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube168">
+    <component type="tube">
+      <location y="0" x="0.39875" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube169">
+    <component type="tube">
+      <location y="0" x="0.40425" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube170">
+    <component type="tube">
+      <location y="0" x="0.40975" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube171">
+    <component type="tube">
+      <location y="0" x="0.41525" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube172">
+    <component type="tube">
+      <location y="0" x="0.42075" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube173">
+    <component type="tube">
+      <location y="0" x="0.42625" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube174">
+    <component type="tube">
+      <location y="0" x="0.43175" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube175">
+    <component type="tube">
+      <location y="0" x="0.43725" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube176">
+    <component type="tube">
+      <location y="0" x="0.44275" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube177">
+    <component type="tube">
+      <location y="0" x="0.44825" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube178">
+    <component type="tube">
+      <location y="0" x="0.45375" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube179">
+    <component type="tube">
+      <location y="0" x="0.45925" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube180">
+    <component type="tube">
+      <location y="0" x="0.46475" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube181">
+    <component type="tube">
+      <location y="0" x="0.47025" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube182">
+    <component type="tube">
+      <location y="0" x="0.47575" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube183">
+    <component type="tube">
+      <location y="0" x="0.48125" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube184">
+    <component type="tube">
+      <location y="0" x="0.48675" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube185">
+    <component type="tube">
+      <location y="0" x="0.49225" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube186">
+    <component type="tube">
+      <location y="0" x="0.49775" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube187">
+    <component type="tube">
+      <location y="0" x="0.50325" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube188">
+    <component type="tube">
+      <location y="0" x="0.50875" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube189">
+    <component type="tube">
+      <location y="0" x="0.51425" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube190">
+    <component type="tube">
+      <location y="0" x="0.51975" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  <type name="tube191">
+    <component type="tube">
+      <location y="0" x="0.52525" z="0">
+        <rot axis-z="0" axis-x="0" axis-y="1" val="0">
+          <rot axis-z="0" axis-x="1" axis-y="0" val="0">
+            <rot axis-z="1" axis-x="0" axis-y="0" val="0"/>
+          </rot>
+        </rot>
+      </location>
+    </component>
+  </type>
+  
+  <idlist idname="detector1">
+        <id start="1000000" step="1000" end="1255000" />
+    <id start="1000001" step="1000" end="1255001" />
+    <id start="1000002" step="1000" end="1255002" />
+    <id start="1000003" step="1000" end="1255003" />
+    <id start="1000004" step="1000" end="1255004" />
+    <id start="1000005" step="1000" end="1255005" />
+    <id start="1000006" step="1000" end="1255006" />
+    <id start="1000007" step="1000" end="1255007" />
+    <id start="1000008" step="1000" end="1255008" />
+    <id start="1000009" step="1000" end="1255009" />
+    <id start="1000010" step="1000" end="1255010" />
+    <id start="1000011" step="1000" end="1255011" />
+    <id start="1000012" step="1000" end="1255012" />
+    <id start="1000013" step="1000" end="1255013" />
+    <id start="1000014" step="1000" end="1255014" />
+    <id start="1000015" step="1000" end="1255015" />
+    <id start="1000016" step="1000" end="1255016" />
+    <id start="1000017" step="1000" end="1255017" />
+    <id start="1000018" step="1000" end="1255018" />
+    <id start="1000019" step="1000" end="1255019" />
+    <id start="1000020" step="1000" end="1255020" />
+    <id start="1000021" step="1000" end="1255021" />
+    <id start="1000022" step="1000" end="1255022" />
+    <id start="1000023" step="1000" end="1255023" />
+    <id start="1000024" step="1000" end="1255024" />
+    <id start="1000025" step="1000" end="1255025" />
+    <id start="1000026" step="1000" end="1255026" />
+    <id start="1000027" step="1000" end="1255027" />
+    <id start="1000028" step="1000" end="1255028" />
+    <id start="1000029" step="1000" end="1255029" />
+    <id start="1000030" step="1000" end="1255030" />
+    <id start="1000031" step="1000" end="1255031" />
+    <id start="1000032" step="1000" end="1255032" />
+    <id start="1000033" step="1000" end="1255033" />
+    <id start="1000034" step="1000" end="1255034" />
+    <id start="1000035" step="1000" end="1255035" />
+    <id start="1000036" step="1000" end="1255036" />
+    <id start="1000037" step="1000" end="1255037" />
+    <id start="1000038" step="1000" end="1255038" />
+    <id start="1000039" step="1000" end="1255039" />
+    <id start="1000040" step="1000" end="1255040" />
+    <id start="1000041" step="1000" end="1255041" />
+    <id start="1000042" step="1000" end="1255042" />
+    <id start="1000043" step="1000" end="1255043" />
+    <id start="1000044" step="1000" end="1255044" />
+    <id start="1000045" step="1000" end="1255045" />
+    <id start="1000046" step="1000" end="1255046" />
+    <id start="1000047" step="1000" end="1255047" />
+    <id start="1000048" step="1000" end="1255048" />
+    <id start="1000049" step="1000" end="1255049" />
+    <id start="1000050" step="1000" end="1255050" />
+    <id start="1000051" step="1000" end="1255051" />
+    <id start="1000052" step="1000" end="1255052" />
+    <id start="1000053" step="1000" end="1255053" />
+    <id start="1000054" step="1000" end="1255054" />
+    <id start="1000055" step="1000" end="1255055" />
+    <id start="1000056" step="1000" end="1255056" />
+    <id start="1000057" step="1000" end="1255057" />
+    <id start="1000058" step="1000" end="1255058" />
+    <id start="1000059" step="1000" end="1255059" />
+    <id start="1000060" step="1000" end="1255060" />
+    <id start="1000061" step="1000" end="1255061" />
+    <id start="1000062" step="1000" end="1255062" />
+    <id start="1000063" step="1000" end="1255063" />
+    <id start="1000064" step="1000" end="1255064" />
+    <id start="1000065" step="1000" end="1255065" />
+    <id start="1000066" step="1000" end="1255066" />
+    <id start="1000067" step="1000" end="1255067" />
+    <id start="1000068" step="1000" end="1255068" />
+    <id start="1000069" step="1000" end="1255069" />
+    <id start="1000070" step="1000" end="1255070" />
+    <id start="1000071" step="1000" end="1255071" />
+    <id start="1000072" step="1000" end="1255072" />
+    <id start="1000073" step="1000" end="1255073" />
+    <id start="1000074" step="1000" end="1255074" />
+    <id start="1000075" step="1000" end="1255075" />
+    <id start="1000076" step="1000" end="1255076" />
+    <id start="1000077" step="1000" end="1255077" />
+    <id start="1000078" step="1000" end="1255078" />
+    <id start="1000079" step="1000" end="1255079" />
+    <id start="1000080" step="1000" end="1255080" />
+    <id start="1000081" step="1000" end="1255081" />
+    <id start="1000082" step="1000" end="1255082" />
+    <id start="1000083" step="1000" end="1255083" />
+    <id start="1000084" step="1000" end="1255084" />
+    <id start="1000085" step="1000" end="1255085" />
+    <id start="1000086" step="1000" end="1255086" />
+    <id start="1000087" step="1000" end="1255087" />
+    <id start="1000088" step="1000" end="1255088" />
+    <id start="1000089" step="1000" end="1255089" />
+    <id start="1000090" step="1000" end="1255090" />
+    <id start="1000091" step="1000" end="1255091" />
+    <id start="1000092" step="1000" end="1255092" />
+    <id start="1000093" step="1000" end="1255093" />
+    <id start="1000094" step="1000" end="1255094" />
+    <id start="1000095" step="1000" end="1255095" />
+    <id start="1000096" step="1000" end="1255096" />
+    <id start="1000097" step="1000" end="1255097" />
+    <id start="1000098" step="1000" end="1255098" />
+    <id start="1000099" step="1000" end="1255099" />
+    <id start="1000100" step="1000" end="1255100" />
+    <id start="1000101" step="1000" end="1255101" />
+    <id start="1000102" step="1000" end="1255102" />
+    <id start="1000103" step="1000" end="1255103" />
+    <id start="1000104" step="1000" end="1255104" />
+    <id start="1000105" step="1000" end="1255105" />
+    <id start="1000106" step="1000" end="1255106" />
+    <id start="1000107" step="1000" end="1255107" />
+    <id start="1000108" step="1000" end="1255108" />
+    <id start="1000109" step="1000" end="1255109" />
+    <id start="1000110" step="1000" end="1255110" />
+    <id start="1000111" step="1000" end="1255111" />
+    <id start="1000112" step="1000" end="1255112" />
+    <id start="1000113" step="1000" end="1255113" />
+    <id start="1000114" step="1000" end="1255114" />
+    <id start="1000115" step="1000" end="1255115" />
+    <id start="1000116" step="1000" end="1255116" />
+    <id start="1000117" step="1000" end="1255117" />
+    <id start="1000118" step="1000" end="1255118" />
+    <id start="1000119" step="1000" end="1255119" />
+    <id start="1000120" step="1000" end="1255120" />
+    <id start="1000121" step="1000" end="1255121" />
+    <id start="1000122" step="1000" end="1255122" />
+    <id start="1000123" step="1000" end="1255123" />
+    <id start="1000124" step="1000" end="1255124" />
+    <id start="1000125" step="1000" end="1255125" />
+    <id start="1000126" step="1000" end="1255126" />
+    <id start="1000127" step="1000" end="1255127" />
+    <id start="1000128" step="1000" end="1255128" />
+    <id start="1000129" step="1000" end="1255129" />
+    <id start="1000130" step="1000" end="1255130" />
+    <id start="1000131" step="1000" end="1255131" />
+    <id start="1000132" step="1000" end="1255132" />
+    <id start="1000133" step="1000" end="1255133" />
+    <id start="1000134" step="1000" end="1255134" />
+    <id start="1000135" step="1000" end="1255135" />
+    <id start="1000136" step="1000" end="1255136" />
+    <id start="1000137" step="1000" end="1255137" />
+    <id start="1000138" step="1000" end="1255138" />
+    <id start="1000139" step="1000" end="1255139" />
+    <id start="1000140" step="1000" end="1255140" />
+    <id start="1000141" step="1000" end="1255141" />
+    <id start="1000142" step="1000" end="1255142" />
+    <id start="1000143" step="1000" end="1255143" />
+    <id start="1000144" step="1000" end="1255144" />
+    <id start="1000145" step="1000" end="1255145" />
+    <id start="1000146" step="1000" end="1255146" />
+    <id start="1000147" step="1000" end="1255147" />
+    <id start="1000148" step="1000" end="1255148" />
+    <id start="1000149" step="1000" end="1255149" />
+    <id start="1000150" step="1000" end="1255150" />
+    <id start="1000151" step="1000" end="1255151" />
+    <id start="1000152" step="1000" end="1255152" />
+    <id start="1000153" step="1000" end="1255153" />
+    <id start="1000154" step="1000" end="1255154" />
+    <id start="1000155" step="1000" end="1255155" />
+    <id start="1000156" step="1000" end="1255156" />
+    <id start="1000157" step="1000" end="1255157" />
+    <id start="1000158" step="1000" end="1255158" />
+    <id start="1000159" step="1000" end="1255159" />
+    <id start="1000160" step="1000" end="1255160" />
+    <id start="1000161" step="1000" end="1255161" />
+    <id start="1000162" step="1000" end="1255162" />
+    <id start="1000163" step="1000" end="1255163" />
+    <id start="1000164" step="1000" end="1255164" />
+    <id start="1000165" step="1000" end="1255165" />
+    <id start="1000166" step="1000" end="1255166" />
+    <id start="1000167" step="1000" end="1255167" />
+    <id start="1000168" step="1000" end="1255168" />
+    <id start="1000169" step="1000" end="1255169" />
+    <id start="1000170" step="1000" end="1255170" />
+    <id start="1000171" step="1000" end="1255171" />
+    <id start="1000172" step="1000" end="1255172" />
+    <id start="1000173" step="1000" end="1255173" />
+    <id start="1000174" step="1000" end="1255174" />
+    <id start="1000175" step="1000" end="1255175" />
+    <id start="1000176" step="1000" end="1255176" />
+    <id start="1000177" step="1000" end="1255177" />
+    <id start="1000178" step="1000" end="1255178" />
+    <id start="1000179" step="1000" end="1255179" />
+    <id start="1000180" step="1000" end="1255180" />
+    <id start="1000181" step="1000" end="1255181" />
+    <id start="1000182" step="1000" end="1255182" />
+    <id start="1000183" step="1000" end="1255183" />
+    <id start="1000184" step="1000" end="1255184" />
+    <id start="1000185" step="1000" end="1255185" />
+    <id start="1000186" step="1000" end="1255186" />
+    <id start="1000187" step="1000" end="1255187" />
+    <id start="1000188" step="1000" end="1255188" />
+    <id start="1000189" step="1000" end="1255189" />
+    <id start="1000190" step="1000" end="1255190" />
+    <id start="1000191" step="1000" end="1255191" />
+  </idlist>   
+  
+  <idlist idname="monitor1">
+    <id val="1" />  
+  </idlist>
+  <idlist idname="timer1">
+    <id val="2" />  
+  </idlist>
+</instrument>
diff --git a/instrument/CG2_Parameters.xml b/instrument/CG2_Parameters.xml
new file mode 100644
index 0000000000000000000000000000000000000000..c8e8c63b594c573cbbca8d88d0a2c6622519ca41
--- /dev/null
+++ b/instrument/CG2_Parameters.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<parameter-file instrument = "CG2" valid-from = "2011-08-18 11:50:59">
+
+<component-link name = "CG2">
+
+<parameter name="detector-name" type="string">
+  <value val="detector1"/>
+</parameter>
+
+<parameter name="default-incident-timer-spectrum">
+  <value val="2"/>
+</parameter>
+
+<parameter name="default-incident-monitor-spectrum">
+  <value val="1"/>
+</parameter>
+
+<parameter name="number-of-x-pixels">
+  <value val="192"/>
+</parameter>
+
+<parameter name="number-of-y-pixels">
+  <value val="256"/>
+</parameter>
+
+<parameter name="number-of-monitors">
+  <value val="2"/>
+</parameter>
+
+<parameter name="x-pixel-size">
+  <value val="5.500000"/>
+</parameter>
+
+<parameter name="y-pixel-size">
+  <value val="4.3000000"/>
+</parameter>
+
+<parameter name="detector-distance-offset">
+  <value val="711.0"/>
+</parameter>
+
+<!-- Aperture distances for 8 guides to 0 guides -->
+<parameter name="aperture-distances" type="string">
+  <value val="1919.1, 3329.3, 5323.7, 7377.5, 9399.0, 11433.8, 13454.4, 15473.2, 17495.2" />
+</parameter>
+
+</component-link>
+
+</parameter-file>
diff --git a/instrument/CRISP_Parameters.xml b/instrument/CRISP_Parameters.xml
index 785baa525ded9c506a2a3605dc44ec81e9679138..8b05b80de69896755efe9bc24b968966faaae67d 100644
--- a/instrument/CRISP_Parameters.xml
+++ b/instrument/CRISP_Parameters.xml
@@ -36,14 +36,10 @@
     <value val="1"/>
   </parameter>
 
-  <!-- In the old Reflectometry UI, LambdaMin's value has 1 added to it.
-       In the new Reflectometry UI, this adjustment is NOT made. -->
   <parameter name="LambdaMin">
     <value val="0.6"/>
   </parameter>
 
-  <!-- In the old Reflectometry UI, LambdaMax's value has 2 subtracted from it.
-       In the new Reflectometry UI, this adjustment is NOT made. -->
   <parameter name="LambdaMax">
     <value val="6.5"/>
   </parameter>
diff --git a/instrument/Facilities.xml b/instrument/Facilities.xml
index 33026c4dbfb04ef403f3ac4980f50e5b5a6ee4cb..a428dcc438400384e0cb33b72edf489338594f50 100644
--- a/instrument/Facilities.xml
+++ b/instrument/Facilities.xml
@@ -324,6 +324,10 @@
       <technique>Small Angle Scattering</technique>
    </instrument>
 
+   <instrument name="CG2">
+      <technique>Small Angle Scattering</technique>
+   </instrument>
+
    <instrument name="BIOSANS">
       <technique>Small Angle Scattering</technique>
    </instrument>
diff --git a/instrument/INTER_Parameters.xml b/instrument/INTER_Parameters.xml
index 43671c19f03c3307ac6d04afc7f0ac9d652f1226..96216d6a8c2ab6320e46a750911e61135e6d6311 100644
--- a/instrument/INTER_Parameters.xml
+++ b/instrument/INTER_Parameters.xml
@@ -33,14 +33,10 @@
     <value val="2"/>
   </parameter>
 
-  <!-- In the old Reflectometry UI, LambdaMin's value has 1 added to it.
-       In the new Reflectometry UI, this adjustment is NOT made. -->
   <parameter name="LambdaMin">
     <value val="1.0"/>
   </parameter>
 
-  <!-- In the old Reflectometry UI, LambdaMax's value has 2 subtracted from it.
-       In the new Reflectometry UI, this adjustment is NOT made. -->
   <parameter name="LambdaMax">
     <value val="17.0"/>
   </parameter>
diff --git a/instrument/MANDI_Definition_2015_08_01.xml b/instrument/MANDI_Definition_2015_08_01.xml
index 613f3d49b3cb29549ee3f4b0147c318e48e38ca8..921e943092b43e97e55cad822e925380483a1a68 100644
--- a/instrument/MANDI_Definition_2015_08_01.xml
+++ b/instrument/MANDI_Definition_2015_08_01.xml
@@ -1,11 +1,11 @@
 <?xml version='1.0' encoding='UTF-8'?>
-<!-- For help on the notation used to specify an Instrument Definition File 
+<!-- For help on the notation used to specify an Instrument Definition File
      see http://www.mantidproject.org/IDF -->
-<instrument xmlns="http://www.mantidproject.org/IDF/1.0" 
+<instrument xmlns="http://www.mantidproject.org/IDF/1.0"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://www.mantidproject.org/IDF/1.0 http://schema.mantidproject.org/IDF/1.0/IDFSchema.xsd"
  name="MANDI" valid-from   ="2015-08-01 00:00:00"
-              valid-to     ="2100-12-31 23:59:59"
+              valid-to     ="2016-01-31 23:59:59"
                       last-modified="2015-09-24 17:31:16.384625">
   <!--DEFAULTS-->
   <defaults>
@@ -53,490 +53,490 @@
     <rot val="89.714809" axis-x="0" axis-y="1" axis-z="0" />
   </rot>
 </location>
-</component> 
+</component>
 
 <!-- Rectangular Detector Panel optimized size for each bank -->
 <type name="panel1" is="rectangular_detector" type="pixel"
     xpixels="256" xstart="-0.079144" xstep="0.000621"
     ypixels="256" ystart="-0.078851" ystep="0.000618" >
   <properties/>
-</type> 
+</type>
 <component type="panel2" idstart="131072" idfillbyfirst="y" idstepbyrow="256">
 <location r="0.439200" t="67.109805" p="-65.487837" name="bank2" rot="85.095578" axis-x="0" axis-y="1" axis-z="0">
   <rot val="66.586787">
     <rot val="113.537009" axis-x="0" axis-y="1" axis-z="0" />
   </rot>
 </location>
-</component> 
+</component>
 
 <!-- Rectangular Detector Panel optimized size for each bank -->
 <type name="panel2" is="rectangular_detector" type="pixel"
     xpixels="256" xstart="-0.079327" xstep="0.000622"
     ypixels="256" ystart="-0.078769" ystep="0.000618" >
   <properties/>
-</type> 
+</type>
 <component type="panel5" idstart="327680" idfillbyfirst="y" idstepbyrow="256">
 <location r="0.409200" t="114.611689" p="-90.961550" name="bank5" rot="-90.419015" axis-x="0" axis-y="1" axis-z="0">
   <rot val="66.019813">
     <rot val="90.326087" axis-x="0" axis-y="1" axis-z="0" />
   </rot>
 </location>
-</component> 
+</component>
 
 <!-- Rectangular Detector Panel optimized size for each bank -->
 <type name="panel5" is="rectangular_detector" type="pixel"
     xpixels="256" xstart="-0.078467" xstep="0.000615"
     ypixels="256" ystart="-0.078511" ystep="0.000616" >
   <properties/>
-</type> 
+</type>
 <component type="panel7" idstart="458752" idfillbyfirst="y" idstepbyrow="256">
 <location r="0.409200" t="90.613855" p="-115.104965" name="bank7" rot="0.044432" axis-x="0" axis-y="1" axis-z="0">
   <rot val="64.169598">
     <rot val="90.001910" axis-x="0" axis-y="1" axis-z="0" />
   </rot>
 </location>
-</component> 
+</component>
 
 <!-- Rectangular Detector Panel optimized size for each bank -->
 <type name="panel7" is="rectangular_detector" type="pixel"
     xpixels="256" xstart="-0.078579" xstep="0.000616"
     ypixels="256" ystart="-0.078633" ystep="0.000617" >
   <properties/>
-</type> 
+</type>
 <component type="panel8" idstart="524288" idfillbyfirst="y" idstepbyrow="256">
 <location r="0.439200" t="67.200120" p="-116.583341" name="bank8" rot="-5.044368" axis-x="0" axis-y="1" axis-z="0">
   <rot val="66.111678">
     <rot val="115.718111" axis-x="0" axis-y="1" axis-z="0" />
   </rot>
 </location>
-</component> 
+</component>
 
 <!-- Rectangular Detector Panel optimized size for each bank -->
 <type name="panel8" is="rectangular_detector" type="pixel"
     xpixels="256" xstart="-0.078695" xstep="0.000617"
     ypixels="256" ystart="-0.079044" ystep="0.000620" >
   <properties/>
-</type> 
+</type>
 <component type="panel11" idstart="720896" idfillbyfirst="y" idstepbyrow="256">
 <location r="0.455000" t="46.974211" p="-47.697668" name="bank11" rot="-170.401757" axis-x="0" axis-y="1" axis-z="0">
   <rot val="52.884816">
     <rot val="41.099924" axis-x="0" axis-y="1" axis-z="0" />
   </rot>
 </location>
-</component> 
+</component>
 
 <!-- Rectangular Detector Panel optimized size for each bank -->
 <type name="panel11" is="rectangular_detector" type="pixel"
     xpixels="256" xstart="-0.078492" xstep="0.000616"
     ypixels="256" ystart="-0.078476" ystep="0.000615" >
   <properties/>
-</type> 
+</type>
 <component type="panel12" idstart="786432" idfillbyfirst="y" idstepbyrow="256">
 <location r="0.455000" t="75.257017" p="-34.182564" name="bank12" rot="-136.701453" axis-x="0" axis-y="1" axis-z="0">
   <rot val="54.071800">
     <rot val="43.620552" axis-x="0" axis-y="1" axis-z="0" />
   </rot>
 </location>
-</component> 
+</component>
 
 <!-- Rectangular Detector Panel optimized size for each bank -->
 <type name="panel12" is="rectangular_detector" type="pixel"
     xpixels="256" xstart="-0.077823" xstep="0.000610"
     ypixels="256" ystart="-0.078259" ystep="0.000614" >
   <properties/>
-</type> 
+</type>
 <component type="panel13" idstart="851968" idfillbyfirst="y" idstepbyrow="256">
 <location r="0.455000" t="105.694087" p="-34.142346" name="bank13" rot="-100.334201" axis-x="0" axis-y="1" axis-z="0">
   <rot val="53.235950">
     <rot val="41.446364" axis-x="0" axis-y="1" axis-z="0" />
   </rot>
 </location>
-</component> 
+</component>
 
 <!-- Rectangular Detector Panel optimized size for each bank -->
 <type name="panel13" is="rectangular_detector" type="pixel"
     xpixels="256" xstart="-0.078025" xstep="0.000612"
     ypixels="256" ystart="-0.077866" ystep="0.000611" >
   <properties/>
-</type> 
+</type>
 <component type="panel17" idstart="1114112" idfillbyfirst="y" idstepbyrow="256">
 <location r="0.455000" t="105.676561" p="-147.861331" name="bank17" rot="45.389838" axis-x="0" axis-y="1" axis-z="0">
   <rot val="52.113605">
     <rot val="40.311416" axis-x="0" axis-y="1" axis-z="0" />
   </rot>
 </location>
-</component> 
+</component>
 
 <!-- Rectangular Detector Panel optimized size for each bank -->
 <type name="panel17" is="rectangular_detector" type="pixel"
     xpixels="256" xstart="-0.077910" xstep="0.000611"
     ypixels="256" ystart="-0.077937" ystep="0.000611" >
   <properties/>
-</type> 
+</type>
 <component type="panel18" idstart="1179648" idfillbyfirst="y" idstepbyrow="256">
 <location r="0.455000" t="75.292431" p="-147.839737" name="bank18" rot="79.719694" axis-x="0" axis-y="1" axis-z="0">
   <rot val="53.840508">
     <rot val="40.420670" axis-x="0" axis-y="1" axis-z="0" />
   </rot>
 </location>
-</component> 
+</component>
 
 <!-- Rectangular Detector Panel optimized size for each bank -->
 <type name="panel18" is="rectangular_detector" type="pixel"
     xpixels="256" xstart="-0.078146" xstep="0.000613"
     ypixels="256" ystart="-0.078181" ystep="0.000613" >
   <properties/>
-</type> 
+</type>
 <component type="panel19" idstart="1245184" idfillbyfirst="y" idstepbyrow="256">
 <location r="0.455000" t="47.004176" p="-134.304836" name="bank19" rot="115.906660" axis-x="0" axis-y="1" axis-z="0">
   <rot val="54.047911">
     <rot val="40.364891" axis-x="0" axis-y="1" axis-z="0" />
   </rot>
 </location>
-</component> 
+</component>
 
 <!-- Rectangular Detector Panel optimized size for each bank -->
 <type name="panel19" is="rectangular_detector" type="pixel"
     xpixels="256" xstart="-0.078441" xstep="0.000615"
     ypixels="256" ystart="-0.078564" ystep="0.000616" >
   <properties/>
-</type> 
+</type>
 <component type="panel20" idstart="1310720" idfillbyfirst="y" idstepbyrow="256">
 <location r="0.425000" t="24.070112" p="-43.813263" name="bank20" rot="-176.489865" axis-x="0" axis-y="1" axis-z="0">
   <rot val="47.429933">
     <rot val="22.126098" axis-x="0" axis-y="1" axis-z="0" />
   </rot>
 </location>
-</component> 
+</component>
 
 <!-- Rectangular Detector Panel optimized size for each bank -->
 <type name="panel20" is="rectangular_detector" type="pixel"
     xpixels="256" xstart="-0.078143" xstep="0.000613"
     ypixels="256" ystart="-0.078883" ystep="0.000619" >
   <properties/>
-</type> 
+</type>
 <component type="panel21" idstart="1376256" idfillbyfirst="y" idstepbyrow="256">
 <location r="0.425000" t="55.982433" p="-20.384355" name="bank21" rot="-142.844804" axis-x="0" axis-y="1" axis-z="0">
   <rot val="48.161657">
     <rot val="22.277621" axis-x="0" axis-y="1" axis-z="0" />
   </rot>
 </location>
-</component> 
+</component>
 
 <!-- Rectangular Detector Panel optimized size for each bank -->
 <type name="panel21" is="rectangular_detector" type="pixel"
     xpixels="256" xstart="-0.077993" xstep="0.000612"
     ypixels="256" ystart="-0.078052" ystep="0.000612" >
   <properties/>
-</type> 
+</type>
 <component type="panel22" idstart="1441792" idfillbyfirst="y" idstepbyrow="256">
 <location r="0.425000" t="90.524163" p="-16.850395" name="bank22" rot="-108.460614" axis-x="0" axis-y="1" axis-z="0">
   <rot val="48.067945">
     <rot val="23.229455" axis-x="0" axis-y="1" axis-z="0" />
   </rot>
 </location>
-</component> 
+</component>
 
 <!-- Rectangular Detector Panel optimized size for each bank -->
 <type name="panel22" is="rectangular_detector" type="pixel"
     xpixels="256" xstart="-0.077913" xstep="0.000611"
     ypixels="256" ystart="-0.078061" ystep="0.000612" >
   <properties/>
-</type> 
+</type>
 <component type="panel27" idstart="1769472" idfillbyfirst="y" idstepbyrow="256">
 <location r="0.425000" t="90.505423" p="-165.138258" name="bank27" rot="75.213160" axis-x="0" axis-y="1" axis-z="0">
   <rot val="47.092431">
     <rot val="21.143081" axis-x="0" axis-y="1" axis-z="0" />
   </rot>
 </location>
-</component> 
+</component>
 
 <!-- Rectangular Detector Panel optimized size for each bank -->
 <type name="panel27" is="rectangular_detector" type="pixel"
     xpixels="256" xstart="-0.077833" xstep="0.000610"
     ypixels="256" ystart="-0.077879" ystep="0.000611" >
   <properties/>
-</type> 
+</type>
 <component type="panel28" idstart="1835008" idfillbyfirst="y" idstepbyrow="256">
 <location r="0.425000" t="56.005364" p="-161.608758" name="bank28" rot="109.131571" axis-x="0" axis-y="1" axis-z="0">
   <rot val="48.038294">
     <rot val="22.301736" axis-x="0" axis-y="1" axis-z="0" />
   </rot>
 </location>
-</component> 
+</component>
 
 <!-- Rectangular Detector Panel optimized size for each bank -->
 <type name="panel28" is="rectangular_detector" type="pixel"
     xpixels="256" xstart="-0.078133" xstep="0.000613"
     ypixels="256" ystart="-0.078306" ystep="0.000614" >
   <properties/>
-</type> 
+</type>
 <component type="panel29" idstart="1900544" idfillbyfirst="y" idstepbyrow="256">
 <location r="0.425000" t="24.128551" p="-138.318615" name="bank29" rot="148.822523" axis-x="0" axis-y="1" axis-z="0">
   <rot val="47.547214">
     <rot val="20.390660" axis-x="0" axis-y="1" axis-z="0" />
   </rot>
 </location>
-</component> 
+</component>
 
 <!-- Rectangular Detector Panel optimized size for each bank -->
 <type name="panel29" is="rectangular_detector" type="pixel"
     xpixels="256" xstart="-0.079024" xstep="0.000620"
     ypixels="256" ystart="-0.078148" ystep="0.000613" >
   <properties/>
-</type> 
+</type>
 <component type="panel31" idstart="2031616" idfillbyfirst="y" idstepbyrow="256">
 <location r="0.395000" t="36.229786" p="-0.812142" name="bank31" rot="-141.426537" axis-x="0" axis-y="1" axis-z="0">
   <rot val="45.732332">
     <rot val="0.467861" axis-x="0" axis-y="1" axis-z="0" />
   </rot>
 </location>
-</component> 
+</component>
 
 <!-- Rectangular Detector Panel optimized size for each bank -->
 <type name="panel31" is="rectangular_detector" type="pixel"
     xpixels="256" xstart="-0.078761" xstep="0.000618"
     ypixels="256" ystart="-0.078411" ystep="0.000615" >
   <properties/>
-</type> 
+</type>
 <component type="panel32" idstart="2097152" idfillbyfirst="y" idstepbyrow="256">
 <location r="0.395000" t="72.459964" p="-0.849651" name="bank32" rot="-107.314383" axis-x="0" axis-y="1" axis-z="0">
   <rot val="45.131912">
     <rot val="-1.094101" axis-x="0" axis-y="1" axis-z="0" />
   </rot>
 </location>
-</component> 
+</component>
 
 <!-- Rectangular Detector Panel optimized size for each bank -->
 <type name="panel32" is="rectangular_detector" type="pixel"
     xpixels="256" xstart="-0.077955" xstep="0.000611"
     ypixels="256" ystart="-0.078249" ystep="0.000614" >
   <properties/>
-</type> 
+</type>
 <component type="panel33" idstart="2162688" idfillbyfirst="y" idstepbyrow="256">
 <location r="0.395000" t="108.473489" p="-0.757347" name="bank33" rot="-72.475171" axis-x="0" axis-y="1" axis-z="0">
   <rot val="44.586341">
     <rot val="1.692678" axis-x="0" axis-y="1" axis-z="0" />
   </rot>
 </location>
-</component> 
+</component>
 
 <!-- Rectangular Detector Panel optimized size for each bank -->
 <type name="panel33" is="rectangular_detector" type="pixel"
     xpixels="256" xstart="-0.077662" xstep="0.000609"
     ypixels="256" ystart="-0.077804" ystep="0.000610" >
   <properties/>
-</type> 
+</type>
 <component type="panel37" idstart="2424832" idfillbyfirst="y" idstepbyrow="256">
 <location r="0.395000" t="108.449939" p="178.800472" name="bank37" rot="72.758615" axis-x="0" axis-y="1" axis-z="0">
   <rot val="44.671684">
     <rot val="-1.313473" axis-x="0" axis-y="1" axis-z="0" />
   </rot>
 </location>
-</component> 
+</component>
 
 <!-- Rectangular Detector Panel optimized size for each bank -->
 <type name="panel37" is="rectangular_detector" type="pixel"
     xpixels="256" xstart="-0.077570" xstep="0.000608"
     ypixels="256" ystart="-0.077658" ystep="0.000609" >
   <properties/>
-</type> 
+</type>
 <component type="panel39" idstart="2555904" idfillbyfirst="y" idstepbyrow="256">
 <location r="0.395000" t="36.377518" p="178.884469" name="bank39" rot="143.645356" axis-x="0" axis-y="1" axis-z="0">
   <rot val="45.846105">
     <rot val="-0.124236" axis-x="0" axis-y="1" axis-z="0" />
   </rot>
 </location>
-</component> 
+</component>
 
 <!-- Rectangular Detector Panel optimized size for each bank -->
 <type name="panel39" is="rectangular_detector" type="pixel"
     xpixels="256" xstart="-0.078147" xstep="0.000613"
     ypixels="256" ystart="-0.077946" ystep="0.000611" >
   <properties/>
-</type> 
+</type>
 <component type="panel40" idstart="2621440" idfillbyfirst="y" idstepbyrow="256">
 <location r="0.425000" t="24.106776" p="42.071242" name="bank40" rot="-146.790634" axis-x="0" axis-y="1" axis-z="0">
   <rot val="48.046881">
     <rot val="-21.275223" axis-x="0" axis-y="1" axis-z="0" />
   </rot>
 </location>
-</component> 
+</component>
 
 <!-- Rectangular Detector Panel optimized size for each bank -->
 <type name="panel40" is="rectangular_detector" type="pixel"
     xpixels="256" xstart="-0.078421" xstep="0.000615"
     ypixels="256" ystart="-0.078067" ystep="0.000612" >
   <properties/>
-</type> 
+</type>
 <component type="panel41" idstart="2686976" idfillbyfirst="y" idstepbyrow="256">
 <location r="0.425000" t="55.965353" p="18.662590" name="bank41" rot="-111.965993" axis-x="0" axis-y="1" axis-z="0">
   <rot val="47.283734">
     <rot val="-21.473589" axis-x="0" axis-y="1" axis-z="0" />
   </rot>
 </location>
-</component> 
+</component>
 
 <!-- Rectangular Detector Panel optimized size for each bank -->
 <type name="panel41" is="rectangular_detector" type="pixel"
     xpixels="256" xstart="-0.078418" xstep="0.000615"
     ypixels="256" ystart="-0.078249" ystep="0.000614" >
   <properties/>
-</type> 
+</type>
 <component type="panel42" idstart="2752512" idfillbyfirst="y" idstepbyrow="256">
 <location r="0.425000" t="90.446642" p="15.205705" name="bank42" rot="-77.365624" axis-x="0" axis-y="1" axis-z="0">
   <rot val="46.309839">
     <rot val="-19.787640" axis-x="0" axis-y="1" axis-z="0" />
   </rot>
 </location>
-</component> 
+</component>
 
 <!-- Rectangular Detector Panel optimized size for each bank -->
 <type name="panel42" is="rectangular_detector" type="pixel"
     xpixels="256" xstart="-0.078081" xstep="0.000612"
     ypixels="256" ystart="-0.077967" ystep="0.000612" >
   <properties/>
-</type> 
+</type>
 <component type="panel47" idstart="3080192" idfillbyfirst="y" idstepbyrow="256">
 <location r="0.425000" t="90.429116" p="162.871738" name="bank47" rot="106.524237" axis-x="0" axis-y="1" axis-z="0">
   <rot val="47.515657">
     <rot val="-23.678193" axis-x="0" axis-y="1" axis-z="0" />
   </rot>
 </location>
-</component> 
+</component>
 
 <!-- Rectangular Detector Panel optimized size for each bank -->
 <type name="panel47" is="rectangular_detector" type="pixel"
     xpixels="256" xstart="-0.077779" xstep="0.000610"
     ypixels="256" ystart="-0.077835" ystep="0.000610" >
   <properties/>
-</type> 
+</type>
 <component type="panel48" idstart="3145728" idfillbyfirst="y" idstepbyrow="256">
 <location r="0.425000" t="56.026825" p="159.404874" name="bank48" rot="142.178239" axis-x="0" axis-y="1" axis-z="0">
   <rot val="48.204588">
     <rot val="-22.850473" axis-x="0" axis-y="1" axis-z="0" />
   </rot>
 </location>
-</component> 
+</component>
 
 <!-- Rectangular Detector Panel optimized size for each bank -->
 <type name="panel48" is="rectangular_detector" type="pixel"
     xpixels="256" xstart="-0.078213" xstep="0.000613"
     ypixels="256" ystart="-0.078172" ystep="0.000613" >
   <properties/>
-</type> 
+</type>
 <component type="panel49" idstart="3211264" idfillbyfirst="y" idstepbyrow="256">
 <location r="0.425000" t="24.166778" p="136.064654" name="bank49" rot="175.961275" axis-x="0" axis-y="1" axis-z="0">
   <rot val="47.476752">
     <rot val="-22.971310" axis-x="0" axis-y="1" axis-z="0" />
   </rot>
 </location>
-</component> 
+</component>
 
 <!-- Rectangular Detector Panel optimized size for each bank -->
 <type name="panel49" is="rectangular_detector" type="pixel"
     xpixels="256" xstart="-0.078784" xstep="0.000618"
     ypixels="256" ystart="-0.079112" ystep="0.000620" >
   <properties/>
-</type> 
+</type>
 <component type="panel50" idstart="3276800" idfillbyfirst="y" idstepbyrow="256">
 <location r="0.455000" t="32.280231" p="89.160326" name="bank50" rot="-153.289807" axis-x="0" axis-y="1" axis-z="0">
   <rot val="53.042181">
     <rot val="-41.461672" axis-x="0" axis-y="1" axis-z="0" />
   </rot>
 </location>
-</component> 
+</component>
 
 <!-- Rectangular Detector Panel optimized size for each bank -->
 <type name="panel50" is="rectangular_detector" type="pixel"
     xpixels="256" xstart="-0.077948" xstep="0.000611"
     ypixels="256" ystart="-0.078405" ystep="0.000615" >
   <properties/>
-</type> 
+</type>
 <component type="panel51" idstart="3342336" idfillbyfirst="y" idstepbyrow="256">
 <location r="0.455000" t="46.988507" p="45.880209" name="bank51" rot="-116.151786" axis-x="0" axis-y="1" axis-z="0">
   <rot val="53.673939">
     <rot val="-40.817428" axis-x="0" axis-y="1" axis-z="0" />
   </rot>
 </location>
-</component> 
+</component>
 
 <!-- Rectangular Detector Panel optimized size for each bank -->
 <type name="panel51" is="rectangular_detector" type="pixel"
     xpixels="256" xstart="-0.077699" xstep="0.000609"
     ypixels="256" ystart="-0.078357" ystep="0.000615" >
   <properties/>
-</type> 
+</type>
 <component type="panel52" idstart="3407872" idfillbyfirst="y" idstepbyrow="256">
 <location r="0.455000" t="75.177052" p="32.490474" name="bank52" rot="-80.365326" axis-x="0" axis-y="1" axis-z="0">
   <rot val="53.002018">
     <rot val="-40.464882" axis-x="0" axis-y="1" axis-z="0" />
   </rot>
 </location>
-</component> 
+</component>
 
 <!-- Rectangular Detector Panel optimized size for each bank -->
 <type name="panel52" is="rectangular_detector" type="pixel"
     xpixels="256" xstart="-0.078308" xstep="0.000614"
     ypixels="256" ystart="-0.078307" ystep="0.000614" >
   <properties/>
-</type> 
+</type>
 <component type="panel53" idstart="3473408" idfillbyfirst="y" idstepbyrow="256">
 <location r="0.455000" t="105.546335" p="32.543501" name="bank53" rot="-43.475977" axis-x="0" axis-y="1" axis-z="0">
   <rot val="53.236925">
     <rot val="-42.875181" axis-x="0" axis-y="1" axis-z="0" />
   </rot>
 </location>
-</component> 
+</component>
 
 <!-- Rectangular Detector Panel optimized size for each bank -->
 <type name="panel53" is="rectangular_detector" type="pixel"
     xpixels="256" xstart="-0.077710" xstep="0.000609"
     ypixels="256" ystart="-0.077747" ystep="0.000610" >
   <properties/>
-</type> 
+</type>
 <component type="panel57" idstart="3735552" idfillbyfirst="y" idstepbyrow="256">
 <location r="0.455000" t="105.503076" p="145.552811" name="bank57" rot="100.343121" axis-x="0" axis-y="1" axis-z="0">
   <rot val="53.209371">
     <rot val="-41.781867" axis-x="0" axis-y="1" axis-z="0" />
   </rot>
 </location>
-</component> 
+</component>
 
 <!-- Rectangular Detector Panel optimized size for each bank -->
 <type name="panel57" is="rectangular_detector" type="pixel"
     xpixels="256" xstart="-0.077526" xstep="0.000608"
     ypixels="256" ystart="-0.077525" ystep="0.000608" >
   <properties/>
-</type> 
+</type>
 <component type="panel58" idstart="3801088" idfillbyfirst="y" idstepbyrow="256">
 <location r="0.455000" t="75.265741" p="145.621245" name="bank58" rot="137.190245" axis-x="0" axis-y="1" axis-z="0">
   <rot val="54.674558">
     <rot val="-42.039674" axis-x="0" axis-y="1" axis-z="0" />
   </rot>
 </location>
-</component> 
+</component>
 
 <!-- Rectangular Detector Panel optimized size for each bank -->
 <type name="panel58" is="rectangular_detector" type="pixel"
     xpixels="256" xstart="-0.078004" xstep="0.000612"
     ypixels="256" ystart="-0.077815" ystep="0.000610" >
   <properties/>
-</type> 
+</type>
 <component type="panel59" idstart="3866624" idfillbyfirst="y" idstepbyrow="256">
 <location r="0.455000" t="47.057353" p="132.226096" name="bank59" rot="171.535377" axis-x="0" axis-y="1" axis-z="0">
   <rot val="54.031579">
     <rot val="-41.510666" axis-x="0" axis-y="1" axis-z="0" />
   </rot>
 </location>
-</component> 
+</component>
 
 <!-- Rectangular Detector Panel optimized size for each bank -->
 <type name="panel59" is="rectangular_detector" type="pixel"
     xpixels="256" xstart="-0.078340" xstep="0.000614"
     ypixels="256" ystart="-0.078330" ystep="0.000614" >
   <properties/>
-</type> 
+</type>
 <!-- List of all the bank names:
 bank1,bank2,bank5,bank7,bank8,bank11,bank12,bank13,bank17,bank18,bank19,bank20,bank21,bank22,bank27,bank28,bank29,bank31,bank32,bank33,bank37,bank39,bank40,bank41,bank42,bank47,bank48,bank49,bank50,bank51,bank52,bank53,bank57,bank58,bank59
 -->
diff --git a/instrument/MANDI_Definition_2016_02_01.xml b/instrument/MANDI_Definition_2016_02_01.xml
new file mode 100644
index 0000000000000000000000000000000000000000..caf90f6ae4db0885a4c70933728cfaf89f1e239b
--- /dev/null
+++ b/instrument/MANDI_Definition_2016_02_01.xml
@@ -0,0 +1,617 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- For help on the notation used to specify an Instrument Definition File
+     see http://www.mantidproject.org/IDF -->
+<instrument xmlns="http://www.mantidproject.org/IDF/1.0"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="http://www.mantidproject.org/IDF/1.0 http://schema.mantidproject.org/IDF/1.0/IDFSchema.xsd"
+ name="MANDI" valid-from   ="2016-02-01 00:00:00"
+              valid-to     ="2100-12-31 23:59:59"
+                      last-modified="2015-09-24 17:31:16.384625">
+  <!--DEFAULTS-->
+  <defaults>
+    <length unit="metre"/>
+    <angle unit="degree"/>
+    <reference-frame>
+      <along-beam axis="z"/>
+      <pointing-up axis="y"/>
+      <handedness val="right"/>
+    </reference-frame>
+    <default-view view="spherical_y"/>
+  </defaults>
+
+  <!--SOURCE-->
+  <component type="moderator">
+    <location z="-30.052984"/>
+  </component>
+  <type name="moderator" is="Source"/>
+
+  <!--SAMPLE-->
+  <component type="sample-position">
+    <location y="0.0" x="0.0" z="0.0"/>
+  </component>
+  <type name="sample-position" is="SamplePos"/>
+
+  <!--MONITORS-->
+  <component type="monitors" idlist="monitors">
+    <location/>
+  </component>
+  <type name="monitors">
+    <component type="monitor">
+      <location z="-2.935" name="monitor1"/>
+    </component>
+    <component type="monitor">
+      <location z="-0.898" name="monitor2"/>
+    </component>
+    <component type="monitor">
+      <location z="1.042" name="monitor3"/>
+    </component>
+  </type>
+  <!-- some XML Code automatically generated on 2015-09-24 17:31:16.450029 for the Mantid instrument definition file from MaNDi_2015-09-24.DetCal - individual panel sizes-->
+  <!-- some XML Code automatically generated on 2016-02-15 11:42:18.107060 for the Mantid instrument definition file - common panel sizes -->
+<component type="panel1" idstart="65536" idfillbyfirst="y" idstepbyrow="256">
+<location r="0.409200" t="66.451303" p="-91.083002" name="bank1" rot="90.570136" axis-x="0" axis-y="1" axis-z="0">
+  <rot val="65.797717">
+    <rot val="89.714809" axis-x="0" axis-y="1" axis-z="0" />
+  </rot>
+</location>
+</component>
+
+<!-- Rectangular Detector Panel optimized size for each bank -->
+<type name="panel1" is="rectangular_detector" type="pixel"
+    xpixels="256" xstart="-0.079144" xstep="0.000621"
+    ypixels="256" ystart="-0.078851" ystep="0.000618" >
+  <properties/>
+</type>
+<component type="panel2" idstart="131072" idfillbyfirst="y" idstepbyrow="256">
+<location r="0.439200" t="67.109805" p="-65.487837" name="bank2" rot="85.095578" axis-x="0" axis-y="1" axis-z="0">
+  <rot val="66.586787">
+    <rot val="113.537009" axis-x="0" axis-y="1" axis-z="0" />
+  </rot>
+</location>
+</component>
+
+<!-- Rectangular Detector Panel optimized size for each bank -->
+<type name="panel2" is="rectangular_detector" type="pixel"
+    xpixels="256" xstart="-0.079327" xstep="0.000622"
+    ypixels="256" ystart="-0.078769" ystep="0.000618" >
+  <properties/>
+</type>
+  <component type="panel" idstart="196608" idfillbyfirst="y" idstepbyrow="256">
+    <location r="0.409194" t="90.000086" p="-66.000154" name="bank3" rot="-179.999790" axis-x="0" axis-y="1" axis-z="0">
+      <rot val="66.000154">
+        <rot val="90.000000" axis-x="0" axis-y="1" axis-z="0" />
+      </rot>
+    </location>
+  </component>
+<component type="panel5" idstart="327680" idfillbyfirst="y" idstepbyrow="256">
+<location r="0.409200" t="114.611689" p="-90.961550" name="bank5" rot="-90.419015" axis-x="0" axis-y="1" axis-z="0">
+  <rot val="66.019813">
+    <rot val="90.326087" axis-x="0" axis-y="1" axis-z="0" />
+  </rot>
+</location>
+</component>
+
+<!-- Rectangular Detector Panel optimized size for each bank -->
+<type name="panel5" is="rectangular_detector" type="pixel"
+    xpixels="256" xstart="-0.078467" xstep="0.000615"
+    ypixels="256" ystart="-0.078511" ystep="0.000616" >
+  <properties/>
+</type>
+<component type="panel7" idstart="458752" idfillbyfirst="y" idstepbyrow="256">
+<location r="0.409200" t="90.613855" p="-115.104965" name="bank7" rot="0.044432" axis-x="0" axis-y="1" axis-z="0">
+  <rot val="64.169598">
+    <rot val="90.001910" axis-x="0" axis-y="1" axis-z="0" />
+  </rot>
+</location>
+</component>
+
+<!-- Rectangular Detector Panel optimized size for each bank -->
+<type name="panel7" is="rectangular_detector" type="pixel"
+    xpixels="256" xstart="-0.078579" xstep="0.000616"
+    ypixels="256" ystart="-0.078633" ystep="0.000617" >
+  <properties/>
+</type>
+<component type="panel8" idstart="524288" idfillbyfirst="y" idstepbyrow="256">
+<location r="0.439200" t="67.200120" p="-116.583341" name="bank8" rot="-5.044368" axis-x="0" axis-y="1" axis-z="0">
+  <rot val="66.111678">
+    <rot val="115.718111" axis-x="0" axis-y="1" axis-z="0" />
+  </rot>
+</location>
+</component>
+
+<!-- Rectangular Detector Panel optimized size for each bank -->
+<type name="panel8" is="rectangular_detector" type="pixel"
+    xpixels="256" xstart="-0.078695" xstep="0.000617"
+    ypixels="256" ystart="-0.079044" ystep="0.000620" >
+  <properties/>
+</type>
+<component type="panel11" idstart="720896" idfillbyfirst="y" idstepbyrow="256">
+<location r="0.455000" t="46.974211" p="-47.697668" name="bank11" rot="-170.401757" axis-x="0" axis-y="1" axis-z="0">
+  <rot val="52.884816">
+    <rot val="41.099924" axis-x="0" axis-y="1" axis-z="0" />
+  </rot>
+</location>
+</component>
+
+<!-- Rectangular Detector Panel optimized size for each bank -->
+<type name="panel11" is="rectangular_detector" type="pixel"
+    xpixels="256" xstart="-0.078492" xstep="0.000616"
+    ypixels="256" ystart="-0.078476" ystep="0.000615" >
+  <properties/>
+</type>
+<component type="panel12" idstart="786432" idfillbyfirst="y" idstepbyrow="256">
+<location r="0.455000" t="75.257017" p="-34.182564" name="bank12" rot="-136.701453" axis-x="0" axis-y="1" axis-z="0">
+  <rot val="54.071800">
+    <rot val="43.620552" axis-x="0" axis-y="1" axis-z="0" />
+  </rot>
+</location>
+</component>
+
+<!-- Rectangular Detector Panel optimized size for each bank -->
+<type name="panel12" is="rectangular_detector" type="pixel"
+    xpixels="256" xstart="-0.077823" xstep="0.000610"
+    ypixels="256" ystart="-0.078259" ystep="0.000614" >
+  <properties/>
+</type>
+<component type="panel13" idstart="851968" idfillbyfirst="y" idstepbyrow="256">
+<location r="0.455000" t="105.694087" p="-34.142346" name="bank13" rot="-100.334201" axis-x="0" axis-y="1" axis-z="0">
+  <rot val="53.235950">
+    <rot val="41.446364" axis-x="0" axis-y="1" axis-z="0" />
+  </rot>
+</location>
+</component>
+
+<!-- Rectangular Detector Panel optimized size for each bank -->
+<type name="panel13" is="rectangular_detector" type="pixel"
+    xpixels="256" xstart="-0.078025" xstep="0.000612"
+    ypixels="256" ystart="-0.077866" ystep="0.000611" >
+  <properties/>
+</type>
+<component type="panel17" idstart="1114112" idfillbyfirst="y" idstepbyrow="256">
+<location r="0.455000" t="105.676561" p="-147.861331" name="bank17" rot="45.389838" axis-x="0" axis-y="1" axis-z="0">
+  <rot val="52.113605">
+    <rot val="40.311416" axis-x="0" axis-y="1" axis-z="0" />
+  </rot>
+</location>
+</component>
+
+<!-- Rectangular Detector Panel optimized size for each bank -->
+<type name="panel17" is="rectangular_detector" type="pixel"
+    xpixels="256" xstart="-0.077910" xstep="0.000611"
+    ypixels="256" ystart="-0.077937" ystep="0.000611" >
+  <properties/>
+</type>
+<component type="panel18" idstart="1179648" idfillbyfirst="y" idstepbyrow="256">
+<location r="0.455000" t="75.292431" p="-147.839737" name="bank18" rot="79.719694" axis-x="0" axis-y="1" axis-z="0">
+  <rot val="53.840508">
+    <rot val="40.420670" axis-x="0" axis-y="1" axis-z="0" />
+  </rot>
+</location>
+</component>
+
+<!-- Rectangular Detector Panel optimized size for each bank -->
+<type name="panel18" is="rectangular_detector" type="pixel"
+    xpixels="256" xstart="-0.078146" xstep="0.000613"
+    ypixels="256" ystart="-0.078181" ystep="0.000613" >
+  <properties/>
+</type>
+<component type="panel19" idstart="1245184" idfillbyfirst="y" idstepbyrow="256">
+<location r="0.455000" t="47.004176" p="-134.304836" name="bank19" rot="115.906660" axis-x="0" axis-y="1" axis-z="0">
+  <rot val="54.047911">
+    <rot val="40.364891" axis-x="0" axis-y="1" axis-z="0" />
+  </rot>
+</location>
+</component>
+
+<!-- Rectangular Detector Panel optimized size for each bank -->
+<type name="panel19" is="rectangular_detector" type="pixel"
+    xpixels="256" xstart="-0.078441" xstep="0.000615"
+    ypixels="256" ystart="-0.078564" ystep="0.000616" >
+  <properties/>
+</type>
+<component type="panel20" idstart="1310720" idfillbyfirst="y" idstepbyrow="256">
+<location r="0.425000" t="24.070112" p="-43.813263" name="bank20" rot="-176.489865" axis-x="0" axis-y="1" axis-z="0">
+  <rot val="47.429933">
+    <rot val="22.126098" axis-x="0" axis-y="1" axis-z="0" />
+  </rot>
+</location>
+</component>
+
+<!-- Rectangular Detector Panel optimized size for each bank -->
+<type name="panel20" is="rectangular_detector" type="pixel"
+    xpixels="256" xstart="-0.078143" xstep="0.000613"
+    ypixels="256" ystart="-0.078883" ystep="0.000619" >
+  <properties/>
+</type>
+<component type="panel21" idstart="1376256" idfillbyfirst="y" idstepbyrow="256">
+<location r="0.425000" t="55.982433" p="-20.384355" name="bank21" rot="-142.844804" axis-x="0" axis-y="1" axis-z="0">
+  <rot val="48.161657">
+    <rot val="22.277621" axis-x="0" axis-y="1" axis-z="0" />
+  </rot>
+</location>
+</component>
+
+<!-- Rectangular Detector Panel optimized size for each bank -->
+<type name="panel21" is="rectangular_detector" type="pixel"
+    xpixels="256" xstart="-0.077993" xstep="0.000612"
+    ypixels="256" ystart="-0.078052" ystep="0.000612" >
+  <properties/>
+</type>
+<component type="panel22" idstart="1441792" idfillbyfirst="y" idstepbyrow="256">
+<location r="0.425000" t="90.524163" p="-16.850395" name="bank22" rot="-108.460614" axis-x="0" axis-y="1" axis-z="0">
+  <rot val="48.067945">
+    <rot val="23.229455" axis-x="0" axis-y="1" axis-z="0" />
+  </rot>
+</location>
+</component>
+
+<!-- Rectangular Detector Panel optimized size for each bank -->
+<type name="panel22" is="rectangular_detector" type="pixel"
+    xpixels="256" xstart="-0.077913" xstep="0.000611"
+    ypixels="256" ystart="-0.078061" ystep="0.000612" >
+  <properties/>
+</type>
+  <component type="panel" idstart="1507328" idfillbyfirst="y" idstepbyrow="256">
+    <location r="0.425000" t="124.403098" p="-19.516157" name="bank23" rot="-69.410491" axis-x="0" axis-y="1" axis-z="0">
+      <rot val="47.178655">
+        <rot val="22.073524" axis-x="0" axis-y="1" axis-z="0" />
+      </rot>
+    </location>
+  </component>
+  <component type="panel" idstart="1703936" idfillbyfirst="y" idstepbyrow="256">
+    <location r="0.425000" t="124.403098" p="-160.483843" name="bank26" rot="38.590066" axis-x="0" axis-y="1" axis-z="0">
+      <rot val="47.178655">
+        <rot val="22.073524" axis-x="0" axis-y="1" axis-z="0" />
+      </rot>
+    </location>
+  </component>
+<component type="panel27" idstart="1769472" idfillbyfirst="y" idstepbyrow="256">
+<location r="0.425000" t="90.505423" p="-165.138258" name="bank27" rot="75.213160" axis-x="0" axis-y="1" axis-z="0">
+  <rot val="47.092431">
+    <rot val="21.143081" axis-x="0" axis-y="1" axis-z="0" />
+  </rot>
+</location>
+</component>
+
+<!-- Rectangular Detector Panel optimized size for each bank -->
+<type name="panel27" is="rectangular_detector" type="pixel"
+    xpixels="256" xstart="-0.077833" xstep="0.000610"
+    ypixels="256" ystart="-0.077879" ystep="0.000611" >
+  <properties/>
+</type>
+<component type="panel28" idstart="1835008" idfillbyfirst="y" idstepbyrow="256">
+<location r="0.425000" t="56.005364" p="-161.608758" name="bank28" rot="109.131571" axis-x="0" axis-y="1" axis-z="0">
+  <rot val="48.038294">
+    <rot val="22.301736" axis-x="0" axis-y="1" axis-z="0" />
+  </rot>
+</location>
+</component>
+
+<!-- Rectangular Detector Panel optimized size for each bank -->
+<type name="panel28" is="rectangular_detector" type="pixel"
+    xpixels="256" xstart="-0.078133" xstep="0.000613"
+    ypixels="256" ystart="-0.078306" ystep="0.000614" >
+  <properties/>
+</type>
+<component type="panel29" idstart="1900544" idfillbyfirst="y" idstepbyrow="256">
+<location r="0.425000" t="24.128551" p="-138.318615" name="bank29" rot="148.822523" axis-x="0" axis-y="1" axis-z="0">
+  <rot val="47.547214">
+    <rot val="20.390660" axis-x="0" axis-y="1" axis-z="0" />
+  </rot>
+</location>
+</component>
+
+<!-- Rectangular Detector Panel optimized size for each bank -->
+<type name="panel29" is="rectangular_detector" type="pixel"
+    xpixels="256" xstart="-0.079024" xstep="0.000620"
+    ypixels="256" ystart="-0.078148" ystep="0.000613" >
+  <properties/>
+</type>
+<component type="panel31" idstart="2031616" idfillbyfirst="y" idstepbyrow="256">
+<location r="0.395000" t="36.229786" p="-0.812142" name="bank31" rot="-141.426537" axis-x="0" axis-y="1" axis-z="0">
+  <rot val="45.732332">
+    <rot val="0.467861" axis-x="0" axis-y="1" axis-z="0" />
+  </rot>
+</location>
+</component>
+
+<!-- Rectangular Detector Panel optimized size for each bank -->
+<type name="panel31" is="rectangular_detector" type="pixel"
+    xpixels="256" xstart="-0.078761" xstep="0.000618"
+    ypixels="256" ystart="-0.078411" ystep="0.000615" >
+  <properties/>
+</type>
+<component type="panel32" idstart="2097152" idfillbyfirst="y" idstepbyrow="256">
+<location r="0.395000" t="72.459964" p="-0.849651" name="bank32" rot="-107.314383" axis-x="0" axis-y="1" axis-z="0">
+  <rot val="45.131912">
+    <rot val="-1.094101" axis-x="0" axis-y="1" axis-z="0" />
+  </rot>
+</location>
+</component>
+
+<!-- Rectangular Detector Panel optimized size for each bank -->
+<type name="panel32" is="rectangular_detector" type="pixel"
+    xpixels="256" xstart="-0.077955" xstep="0.000611"
+    ypixels="256" ystart="-0.078249" ystep="0.000614" >
+  <properties/>
+</type>
+<component type="panel33" idstart="2162688" idfillbyfirst="y" idstepbyrow="256">
+<location r="0.395000" t="108.473489" p="-0.757347" name="bank33" rot="-72.475171" axis-x="0" axis-y="1" axis-z="0">
+  <rot val="44.586341">
+    <rot val="1.692678" axis-x="0" axis-y="1" axis-z="0" />
+  </rot>
+</location>
+</component>
+
+<!-- Rectangular Detector Panel optimized size for each bank -->
+<type name="panel33" is="rectangular_detector" type="pixel"
+    xpixels="256" xstart="-0.077662" xstep="0.000609"
+    ypixels="256" ystart="-0.077804" ystep="0.000610" >
+  <properties/>
+</type>
+<component type="panel37" idstart="2424832" idfillbyfirst="y" idstepbyrow="256">
+<location r="0.395000" t="108.449939" p="178.800472" name="bank37" rot="72.758615" axis-x="0" axis-y="1" axis-z="0">
+  <rot val="44.671684">
+    <rot val="-1.313473" axis-x="0" axis-y="1" axis-z="0" />
+  </rot>
+</location>
+</component>
+
+<!-- Rectangular Detector Panel optimized size for each bank -->
+<type name="panel37" is="rectangular_detector" type="pixel"
+    xpixels="256" xstart="-0.077570" xstep="0.000608"
+    ypixels="256" ystart="-0.077658" ystep="0.000609" >
+  <properties/>
+</type>
+<component type="panel39" idstart="2555904" idfillbyfirst="y" idstepbyrow="256">
+<location r="0.395000" t="36.377518" p="178.884469" name="bank39" rot="143.645356" axis-x="0" axis-y="1" axis-z="0">
+  <rot val="45.846105">
+    <rot val="-0.124236" axis-x="0" axis-y="1" axis-z="0" />
+  </rot>
+</location>
+</component>
+
+<!-- Rectangular Detector Panel optimized size for each bank -->
+<type name="panel39" is="rectangular_detector" type="pixel"
+    xpixels="256" xstart="-0.078147" xstep="0.000613"
+    ypixels="256" ystart="-0.077946" ystep="0.000611" >
+  <properties/>
+</type>
+<component type="panel40" idstart="2621440" idfillbyfirst="y" idstepbyrow="256">
+<location r="0.425000" t="24.106776" p="42.071242" name="bank40" rot="-146.790634" axis-x="0" axis-y="1" axis-z="0">
+  <rot val="48.046881">
+    <rot val="-21.275223" axis-x="0" axis-y="1" axis-z="0" />
+  </rot>
+</location>
+</component>
+
+<!-- Rectangular Detector Panel optimized size for each bank -->
+<type name="panel40" is="rectangular_detector" type="pixel"
+    xpixels="256" xstart="-0.078421" xstep="0.000615"
+    ypixels="256" ystart="-0.078067" ystep="0.000612" >
+  <properties/>
+</type>
+<component type="panel41" idstart="2686976" idfillbyfirst="y" idstepbyrow="256">
+<location r="0.425000" t="55.965353" p="18.662590" name="bank41" rot="-111.965993" axis-x="0" axis-y="1" axis-z="0">
+  <rot val="47.283734">
+    <rot val="-21.473589" axis-x="0" axis-y="1" axis-z="0" />
+  </rot>
+</location>
+</component>
+
+<!-- Rectangular Detector Panel optimized size for each bank -->
+<type name="panel41" is="rectangular_detector" type="pixel"
+    xpixels="256" xstart="-0.078418" xstep="0.000615"
+    ypixels="256" ystart="-0.078249" ystep="0.000614" >
+  <properties/>
+</type>
+<component type="panel42" idstart="2752512" idfillbyfirst="y" idstepbyrow="256">
+<location r="0.425000" t="90.446642" p="15.205705" name="bank42" rot="-77.365624" axis-x="0" axis-y="1" axis-z="0">
+  <rot val="46.309839">
+    <rot val="-19.787640" axis-x="0" axis-y="1" axis-z="0" />
+  </rot>
+</location>
+</component>
+
+<!-- Rectangular Detector Panel optimized size for each bank -->
+<type name="panel42" is="rectangular_detector" type="pixel"
+    xpixels="256" xstart="-0.078081" xstep="0.000612"
+    ypixels="256" ystart="-0.077967" ystep="0.000612" >
+  <properties/>
+</type>
+  <component type="panel" idstart="2818048" idfillbyfirst="y" idstepbyrow="256">
+    <location r="0.425000" t="124.403098" p="19.516157" name="bank43" rot="-38.590066" axis-x="0" axis-y="1" axis-z="0">
+      <rot val="47.178655">
+        <rot val="-22.073524" axis-x="0" axis-y="1" axis-z="0" />
+      </rot>
+    </location>
+  </component>
+  <component type="panel" idstart="3014656" idfillbyfirst="y" idstepbyrow="256">
+    <location r="0.425000" t="124.403098" p="160.483843" name="bank46" rot="69.410491" axis-x="0" axis-y="1" axis-z="0">
+      <rot val="47.178655">
+        <rot val="-22.073524" axis-x="0" axis-y="1" axis-z="0" />
+      </rot>
+    </location>
+  </component>
+<component type="panel47" idstart="3080192" idfillbyfirst="y" idstepbyrow="256">
+<location r="0.425000" t="90.429116" p="162.871738" name="bank47" rot="106.524237" axis-x="0" axis-y="1" axis-z="0">
+  <rot val="47.515657">
+    <rot val="-23.678193" axis-x="0" axis-y="1" axis-z="0" />
+  </rot>
+</location>
+</component>
+
+<!-- Rectangular Detector Panel optimized size for each bank -->
+<type name="panel47" is="rectangular_detector" type="pixel"
+    xpixels="256" xstart="-0.077779" xstep="0.000610"
+    ypixels="256" ystart="-0.077835" ystep="0.000610" >
+  <properties/>
+</type>
+<component type="panel48" idstart="3145728" idfillbyfirst="y" idstepbyrow="256">
+<location r="0.425000" t="56.026825" p="159.404874" name="bank48" rot="142.178239" axis-x="0" axis-y="1" axis-z="0">
+  <rot val="48.204588">
+    <rot val="-22.850473" axis-x="0" axis-y="1" axis-z="0" />
+  </rot>
+</location>
+</component>
+
+<!-- Rectangular Detector Panel optimized size for each bank -->
+<type name="panel48" is="rectangular_detector" type="pixel"
+    xpixels="256" xstart="-0.078213" xstep="0.000613"
+    ypixels="256" ystart="-0.078172" ystep="0.000613" >
+  <properties/>
+</type>
+<component type="panel49" idstart="3211264" idfillbyfirst="y" idstepbyrow="256">
+<location r="0.425000" t="24.166778" p="136.064654" name="bank49" rot="175.961275" axis-x="0" axis-y="1" axis-z="0">
+  <rot val="47.476752">
+    <rot val="-22.971310" axis-x="0" axis-y="1" axis-z="0" />
+  </rot>
+</location>
+</component>
+
+<!-- Rectangular Detector Panel optimized size for each bank -->
+<type name="panel49" is="rectangular_detector" type="pixel"
+    xpixels="256" xstart="-0.078784" xstep="0.000618"
+    ypixels="256" ystart="-0.079112" ystep="0.000620" >
+  <properties/>
+</type>
+<component type="panel50" idstart="3276800" idfillbyfirst="y" idstepbyrow="256">
+<location r="0.455000" t="32.280231" p="89.160326" name="bank50" rot="-153.289807" axis-x="0" axis-y="1" axis-z="0">
+  <rot val="53.042181">
+    <rot val="-41.461672" axis-x="0" axis-y="1" axis-z="0" />
+  </rot>
+</location>
+</component>
+
+<!-- Rectangular Detector Panel optimized size for each bank -->
+<type name="panel50" is="rectangular_detector" type="pixel"
+    xpixels="256" xstart="-0.077948" xstep="0.000611"
+    ypixels="256" ystart="-0.078405" ystep="0.000615" >
+  <properties/>
+</type>
+<component type="panel51" idstart="3342336" idfillbyfirst="y" idstepbyrow="256">
+<location r="0.455000" t="46.988507" p="45.880209" name="bank51" rot="-116.151786" axis-x="0" axis-y="1" axis-z="0">
+  <rot val="53.673939">
+    <rot val="-40.817428" axis-x="0" axis-y="1" axis-z="0" />
+  </rot>
+</location>
+</component>
+
+<!-- Rectangular Detector Panel optimized size for each bank -->
+<type name="panel51" is="rectangular_detector" type="pixel"
+    xpixels="256" xstart="-0.077699" xstep="0.000609"
+    ypixels="256" ystart="-0.078357" ystep="0.000615" >
+  <properties/>
+</type>
+<component type="panel52" idstart="3407872" idfillbyfirst="y" idstepbyrow="256">
+<location r="0.455000" t="75.177052" p="32.490474" name="bank52" rot="-80.365326" axis-x="0" axis-y="1" axis-z="0">
+  <rot val="53.002018">
+    <rot val="-40.464882" axis-x="0" axis-y="1" axis-z="0" />
+  </rot>
+</location>
+</component>
+
+<!-- Rectangular Detector Panel optimized size for each bank -->
+<type name="panel52" is="rectangular_detector" type="pixel"
+    xpixels="256" xstart="-0.078308" xstep="0.000614"
+    ypixels="256" ystart="-0.078307" ystep="0.000614" >
+  <properties/>
+</type>
+<component type="panel53" idstart="3473408" idfillbyfirst="y" idstepbyrow="256">
+<location r="0.455000" t="105.546335" p="32.543501" name="bank53" rot="-43.475977" axis-x="0" axis-y="1" axis-z="0">
+  <rot val="53.236925">
+    <rot val="-42.875181" axis-x="0" axis-y="1" axis-z="0" />
+  </rot>
+</location>
+</component>
+
+<!-- Rectangular Detector Panel optimized size for each bank -->
+<type name="panel53" is="rectangular_detector" type="pixel"
+    xpixels="256" xstart="-0.077710" xstep="0.000609"
+    ypixels="256" ystart="-0.077747" ystep="0.000610" >
+  <properties/>
+</type>
+<component type="panel57" idstart="3735552" idfillbyfirst="y" idstepbyrow="256">
+<location r="0.455000" t="105.503076" p="145.552811" name="bank57" rot="100.343121" axis-x="0" axis-y="1" axis-z="0">
+  <rot val="53.209371">
+    <rot val="-41.781867" axis-x="0" axis-y="1" axis-z="0" />
+  </rot>
+</location>
+</component>
+
+<!-- Rectangular Detector Panel optimized size for each bank -->
+<type name="panel57" is="rectangular_detector" type="pixel"
+    xpixels="256" xstart="-0.077526" xstep="0.000608"
+    ypixels="256" ystart="-0.077525" ystep="0.000608" >
+  <properties/>
+</type>
+<component type="panel58" idstart="3801088" idfillbyfirst="y" idstepbyrow="256">
+<location r="0.455000" t="75.265741" p="145.621245" name="bank58" rot="137.190245" axis-x="0" axis-y="1" axis-z="0">
+  <rot val="54.674558">
+    <rot val="-42.039674" axis-x="0" axis-y="1" axis-z="0" />
+  </rot>
+</location>
+</component>
+
+<!-- Rectangular Detector Panel optimized size for each bank -->
+<type name="panel58" is="rectangular_detector" type="pixel"
+    xpixels="256" xstart="-0.078004" xstep="0.000612"
+    ypixels="256" ystart="-0.077815" ystep="0.000610" >
+  <properties/>
+</type>
+<component type="panel59" idstart="3866624" idfillbyfirst="y" idstepbyrow="256">
+<location r="0.455000" t="47.057353" p="132.226096" name="bank59" rot="171.535377" axis-x="0" axis-y="1" axis-z="0">
+  <rot val="54.031579">
+    <rot val="-41.510666" axis-x="0" axis-y="1" axis-z="0" />
+  </rot>
+</location>
+</component>
+
+<!-- Rectangular Detector Panel optimized size for each bank -->
+<type name="panel59" is="rectangular_detector" type="pixel"
+    xpixels="256" xstart="-0.078340" xstep="0.000614"
+    ypixels="256" ystart="-0.078330" ystep="0.000614" >
+  <properties/>
+</type>
+  <!-- List of all the banks:
+       1,2,3,5,7,8,11,12,13,17,18,19,20,21,22,23,26,27,28,29,31,32,33,37,39,40,41,42,43,46,47,48,49,50,51,52,53,57,58,59
+       -->
+
+<!-- NOTE: This detector is the same as the SNAP detector -->
+<!-- Rectangular Detector Panel -->
+<type name="panel" is="rectangular_detector" type="pixel"
+    xpixels="256" xstart="-0.078795" xstep="+0.000618"
+    ypixels="256" ystart="-0.078795" ystep="+0.000618" >
+  <properties/>
+</type>
+
+  <!-- Pixel for Detectors-->
+  <type is="detector" name="pixel">
+    <cuboid id="pixel-shape">
+      <left-front-bottom-point y="-0.000309" x="-0.000309" z="0.0"/>
+      <left-front-top-point y="0.000309" x="-0.000309" z="0.0"/>
+      <left-back-bottom-point y="-0.000309" x="-0.000309" z="-0.0001"/>
+      <right-front-bottom-point y="-0.000309" x="0.000309" z="0.0"/>
+    </cuboid>
+    <algebra val="pixel-shape"/>
+  </type>
+
+  <!-- Shape for Monitors-->
+  <!-- TODO: Update to real shape -->
+  <type is="monitor" name="monitor">
+    <cylinder id="some-shape">
+      <centre-of-bottom-base p="0.0" r="0.0" t="0.0"/>
+      <axis y="0.0" x="0.0" z="1.0"/>
+      <radius val="0.01"/>
+      <height val="0.03"/>
+    </cylinder>
+    <algebra val="some-shape"/>
+  </type>
+
+  <!--MONITOR IDs-->
+  <idlist idname="monitors">
+    <id val="-1"/>
+    <id val="-2"/>
+    <id val="-3"/>
+  </idlist>
+</instrument>
diff --git a/instrument/MANDI_Parameters_2015_08_01.xml b/instrument/MANDI_Parameters_2015_08_01.xml
index cd88e3a098604fbfbb87bf0191378797e6385414..52ba77f6fdbe47c82b3dc7d2b3fc290aec796878 100644
--- a/instrument/MANDI_Parameters_2015_08_01.xml
+++ b/instrument/MANDI_Parameters_2015_08_01.xml
@@ -1,5 +1,5 @@
 <?xml version='1.0' encoding='UTF-8'?>
-<parameter-file instrument = "MANDI" valid-from="2015-08-01 00:00:00" valid-to="2100-12-31 23:59:59">
+<parameter-file instrument = "MANDI" valid-from="2015-08-01 00:00:00" valid-to="2016-01-31 23:59:59">
 
 <component-link name = "MANDI">
 <!-- Specify that any banks not in NeXus file are to be removed -->
@@ -8,4 +8,4 @@
 </parameter>
 </component-link>
 
-</parameter-file> 
+</parameter-file>
diff --git a/instrument/MANDI_Parameters_2016_02_01.xml b/instrument/MANDI_Parameters_2016_02_01.xml
new file mode 100644
index 0000000000000000000000000000000000000000..32e06803e75bbdf0c3b5b1c914d9bdae66428b1a
--- /dev/null
+++ b/instrument/MANDI_Parameters_2016_02_01.xml
@@ -0,0 +1,11 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<parameter-file instrument = "MANDI" valid-from="2016-02-01 00:00:00" valid-to="2100-12-31 23:59:59">
+
+<component-link name = "MANDI">
+<!-- Specify that any banks not in NeXus file are to be removed -->
+<parameter name="T0">
+ <value val="-0.904000"/>
+</parameter>
+</component-link>
+
+</parameter-file>
diff --git a/instrument/OFFSPEC_Parameters.xml b/instrument/OFFSPEC_Parameters.xml
index f9f7fc634b103aeea4f6ded1dc55f9688f769475..6ec19c3f5b6d7e4b00f1f9a6d285cb3aa80cf189 100644
--- a/instrument/OFFSPEC_Parameters.xml
+++ b/instrument/OFFSPEC_Parameters.xml
@@ -42,14 +42,10 @@
     <value val="1"/>
   </parameter>
 
-  <!-- In the old Reflectometry UI, LambdaMin's value has 1 added to it.
-       In the new Reflectometry UI, this adjustment is NOT made. -->
   <parameter name="LambdaMin">
     <value val="2.0"/>
   </parameter>
 
-  <!-- In the old Reflectometry UI, LambdaMax's value has 2 subtracted from it.
-       In the new Reflectometry UI, this adjustment is NOT made. -->
   <parameter name="LambdaMax">
     <value val="14.0"/>
   </parameter>
diff --git a/instrument/POLREF_Parameters.xml b/instrument/POLREF_Parameters.xml
index 537b14c666c84408a4a37dbcf9c67edad60ecc35..fa461e5f257bd510e7caeda35b462008235e8f76 100644
--- a/instrument/POLREF_Parameters.xml
+++ b/instrument/POLREF_Parameters.xml
@@ -39,14 +39,10 @@
     <value val="2"/>
   </parameter>
 
-  <!-- In the old Reflectometry UI, LambdaMin's value has 1 added to it.
-       In the new Reflectometry UI, this adjustment is NOT made. -->
   <parameter name="LambdaMin">
     <value val="1.0"/>
   </parameter>
 
-  <!-- In the old Reflectometry UI, LambdaMax's value has 2 subtracted from it.
-       In the new Reflectometry UI, this adjustment is NOT made. -->
   <parameter name="LambdaMax">
     <value val="15.0"/>
   </parameter>
diff --git a/instrument/SURF_Parameters.xml b/instrument/SURF_Parameters.xml
index 6c443dcccd977ecb9d68e8f55e082863f5af51a1..7b90a98646dc0b53c0f506f91810512e7c3b41be 100644
--- a/instrument/SURF_Parameters.xml
+++ b/instrument/SURF_Parameters.xml
@@ -33,14 +33,10 @@
     <value val="1"/>
   </parameter>
 
-  <!-- In the old Reflectometry UI, LambdaMin's value has 1 added to it.
-       In the new Reflectometry UI, this adjustment is NOT made. -->
   <parameter name="LambdaMin">
     <value val="0.5"/>
   </parameter>
 
-  <!-- In the old Reflectometry UI, LambdaMax's value has 2 subtracted from it.
-       In the new Reflectometry UI, this adjustment is NOT made. -->
   <parameter name="LambdaMax">
     <value val="7.0"/>
   </parameter>
diff --git a/instrument/embedded_instrument_corrections/TEST1_Parameter_Corrections.xml b/instrument/embedded_instrument_corrections/TEST1_Parameter_Corrections.xml
deleted file mode 100644
index bdf08de0f3095da5030fecd9bafc0b00c1aced7c..0000000000000000000000000000000000000000
--- a/instrument/embedded_instrument_corrections/TEST1_Parameter_Corrections.xml
+++ /dev/null
@@ -1 +0,0 @@
-test file
\ No newline at end of file
diff --git a/scripts/Inelastic/Direct/ISISDirecInelasticConfig.py b/scripts/Inelastic/Direct/ISISDirecInelasticConfig.py
index b0abb9049998a16fde36aa45931d01e97cc937dc..cdcb86a2a24a31a8901d9011d199a21d63784a19 100644
--- a/scripts/Inelastic/Direct/ISISDirecInelasticConfig.py
+++ b/scripts/Inelastic/Direct/ISISDirecInelasticConfig.py
@@ -10,27 +10,29 @@ import time
 from xml.dom import minidom
 
 # the list of instruments this configuration is applicable to
-INELASTIC_INSTRUMENTS = ['MAPS','LET','MERLIN','MARI','HET']
+INELASTIC_INSTRUMENTS = ['MAPS', 'LET', 'MERLIN', 'MARI', 'HET']
 # the list of the parameters, which can be replaced if found in user files
-USER_PROPERTIES=['instrument','userID', 'cycleID', 'start_date', 'rb_folder']
+USER_PROPERTIES = ['instrument', 'userID', 'cycleID', 'start_date', 'rb_folder']
+
 
 class UserProperties(object):
     """Helper class to define & retrieve user properties
        as retrieved from file provided by user office
     """
-    def __init__(self,*args):
+
+    def __init__(self, *args):
         """ Build user properties from space separated string in the form:
             "userId instr_name rb_num cycle_mu start_date"
             or list of five elements with the same meaning
         """
-        self._instrument={}
+        self._instrument = {}
         self._rb_dirs = {}
-        self._cycle_IDs={}
+        self._cycle_IDs = {}
         self._start_dates = {}
-        self._rb_exist={}
-        # 
+        self._rb_exist = {}
+
         self._user_id = None
-        self._recent_dateID=None
+        self._recent_dateID = None
         if args[0] is None:
             return
         if len(args) == 1:
@@ -38,27 +40,28 @@ class UserProperties(object):
             param = input.split()
             self._user_id = param[0]
             if len(param) == 5:
-                self.set_user_properties(param[1],param[2],param[3],param[4])
-            else: # only userID was provided, nothing else is defined
+                self.set_user_properties(param[1], param[2], param[3], param[4])
+            else:  # only userID was provided, nothing else is defined
                 return
         elif len(args) == 5:
             self._user_id = str(args[0])
-            self.set_user_properties(args[1],args[2],args[3],args[4])
+            self.set_user_properties(args[1], args[2], args[3], args[4])
         else:
-            raise RuntimeError("User has to be defined by the list of 5 components in the form:\n{0}".\
-                format("[userId,instr_name,rb_num,cycle_mu,start_date]"))
+            raise RuntimeError("User has to be defined by the list of 5 components in the form:\n{0}". \
+                               format("[userId,instr_name,rb_num,cycle_mu,start_date]"))
 
     def __str__(self):
         """Convert class to string. Only last cycle settings are returned"""
         if self._user_id:
-            return "{0} {1} {2} {3} {4}".format(self._user_id,self.instrument,\
-                    self.rb_folder,self.cycleID,str(self.start_date))
+            return "{0} {1} {2} {3} {4}".format(self._user_id, self.instrument, \
+                                                self.rb_folder, self.cycleID, str(self.start_date))
         else:
             return "None"
 
-       
-#
-    def set_user_properties(self,instrument,rb_folder_or_id,cycle,start_date):
+
+            #
+
+    def set_user_properties(self, instrument, rb_folder_or_id, cycle, start_date):
         """Define the information, user office provides about user.
 
            The info has the form:
@@ -69,28 +72,29 @@ class UserProperties(object):
            rb_folder  -- string containing the full path to working folder available
                         for all users and IS participating in the experiment.
         """
-        instrument,start_date,cycle,rb_folder_or_id,rb_exist =self.check_input(instrument,start_date,cycle,rb_folder_or_id)
-        #when user starts
-        recent_date = date(int(start_date[0:4]),int(start_date[4:6]),int(start_date[6:8]))
+        instrument, start_date, cycle, rb_folder_or_id, rb_exist = self.check_input(instrument, start_date, cycle,
+                                                                                    rb_folder_or_id)
+        # when user starts
+        recent_date = date(int(start_date[0:4]), int(start_date[4:6]), int(start_date[6:8]))
         recent_date_id = str(recent_date)
-        self._start_dates[recent_date_id]=recent_date
-        self._rb_exist[recent_date_id]  = rb_exist
+        self._start_dates[recent_date_id] = recent_date
+        self._rb_exist[recent_date_id] = rb_exist
 
 
         # a data which define the cycle ID e.g 2014_3 or something
-        self._cycle_IDs[recent_date_id]  = (str(cycle[5:9]),str(cycle[9:10]))
+        self._cycle_IDs[recent_date_id] = (str(cycle[5:9]), str(cycle[9:10]))
         self._instrument[recent_date_id] = str(instrument).upper()
-        self._rb_dirs[recent_date_id]    = rb_folder_or_id
+        self._rb_dirs[recent_date_id] = rb_folder_or_id
         if self._recent_dateID:
             max_date = self._start_dates[self._recent_dateID]
-            for date_key,a_date in self._start_dates.iteritems():
-                if a_date>max_date:
+            for date_key, a_date in self._start_dates.iteritems():
+                if a_date > max_date:
                     self._recent_dateID = date_key
                     max_date = a_date
         else:
             self._recent_dateID = recent_date_id
 
-    def replace_variables(self,data_string):
+    def replace_variables(self, data_string):
         """Replace variables defined in USER_PROPERTIES
             and enclosed in $ sign with their values
             defined for a user
@@ -102,10 +106,11 @@ class UserProperties(object):
             except Exception:
                 ind = None
             if not ind is None:
-                str_parts[ind] = str(getattr(self,prop))
+                str_parts[ind] = str(getattr(self, prop))
         data_string = "".join(str_parts)
         return data_string
-#
+
+    #
     @property
     def GID(self):
         """Returns user's group ID which coincide with
@@ -116,7 +121,8 @@ class UserProperties(object):
             return RBfolder[2:]
         else:
             return None
-#
+            #
+
     @property
     def rb_folder(self):
         """Returns short name of user's RB folder
@@ -128,6 +134,7 @@ class UserProperties(object):
             return RBfolder
         else:
             return None
+
     @property
     def rb_id(self):
         """the same as rb_folder:
@@ -136,84 +143,91 @@ class UserProperties(object):
         """
         return self.rb_folder
 
-
-#
+    #
     @property
     def start_date(self):
         """Last start date"""
         if self._recent_dateID:
-            return  self._start_dates[self._recent_dateID]
+            return self._start_dates[self._recent_dateID]
         else:
             raise RuntimeError("User's experiment date is not defined. User undefined")
- #
+            #
+
     @property
     def instrument(self):
         """return instrument used in last actual experiment"""
         if self._recent_dateID:
-            return  self._instrument[self._recent_dateID]
+            return self._instrument[self._recent_dateID]
         else:
             raise RuntimeError("User's experiment date is not defined. User undefined")
-#
+            #
+
     @property
     def rb_dir(self):
         """return rb folder used in last actual instrument"""
         if self._recent_dateID:
-            return  self._rb_dirs[self._recent_dateID]
+            return self._rb_dirs[self._recent_dateID]
         else:
             raise RuntimeError("User's experiment date is not defined. User undefined")
+
     @rb_dir.setter
-    def rb_dir(self,user_home_path):
+    def rb_dir(self, user_home_path):
         """Set user's rb-folder path"""
         rb_path = self.rb_folder
-        full_path = os.path.join(user_home_path,rb_path)
+        full_path = os.path.join(user_home_path, rb_path)
         if os.path.exists(full_path) and os.path.isdir(full_path):
             self._rb_dirs[self._recent_dateID] = full_path
             self._rb_exist[self._recent_dateID] = True
         else:
             pass
+
     #
     @property
     def rb_dir_exist(self):
         """return true if user's rb dir exist and false otherwise"""
         if self._recent_dateID:
-            return  self._rb_exist[self._recent_dateID]
+            return self._rb_exist[self._recent_dateID]
         else:
             raise RuntimeError("User's experiment date is not defined. User undefined")
 
-#
+            #
+
     @property
     def cycleID(self):
         """return last cycleID the user is participating"""
         if self._recent_dateID:
-            year,num =self._cycle_IDs[self._recent_dateID]
-            return  "{0}_{1}".format(year,num)
+            year, num = self._cycle_IDs[self._recent_dateID]
+            return "{0}_{1}".format(year, num)
         else:
             raise RuntimeError("User's experiment date is not defined. User undefined")
+
     @property
     def cycle(self):
         """return last cycle the user is participating"""
         if self._recent_dateID:
-            return  self._cycle_IDs[self._recent_dateID]
+            return self._cycle_IDs[self._recent_dateID]
         else:
             raise RuntimeError("User's experiment date is not defined. User undefined")
-#
+            #
+
     @property
     def userID(self):
         return self._user_id
+
     @userID.setter
-    def userID(self,val):
+    def userID(self, val):
         self._user_id = str(val)
 
-#
-    def check_input(self,instrument,start_date,cycle,rb_folder_or_id):
+    #
+    def check_input(self, instrument, start_date, cycle, rb_folder_or_id):
         """Verify that input is correct"""
         if not instrument in INELASTIC_INSTRUMENTS:
-            raise RuntimeError("Instrument {0} has to be one of "\
-                  "ISIS inelastic instruments".format(instrument))
-        if isinstance(start_date,str):
-            start_date = start_date.replace('-','')
+            raise RuntimeError("Instrument {0} has to be one of " \
+                               "ISIS inelastic instruments".format(instrument))
+        if isinstance(start_date, str):
+            start_date = start_date.replace('-', '')
             if len(start_date) != 8:
-                start_date = '20'+start_date
+                start_date = '20' + start_date
             if len(start_date) == 8:
                 error = False
             else:
@@ -221,54 +235,57 @@ class UserProperties(object):
         else:
             error = True
         if error:
-            raise RuntimeError("Experiment start date should be defined as"\
-            " a sting in the form YYYYMMDD or YYMMDD but it is: {0}".format(start_date))
+            raise RuntimeError("Experiment start date should be defined as" \
+                               " a sting in the form YYYYMMDD or YYMMDD but it is: {0}".format(start_date))
         #
         def convert_cycle_int(cycle_int):
-            if cycle_int > 999: # Full cycle format 20151
-               cycle = "CYCLE{0:05}".format(cycle_int)
+            if cycle_int > 999:  # Full cycle format 20151
+                cycle = "CYCLE{0:05}".format(cycle_int)
             else:
-               cycle = "CYCLE20{0:03}".format(cycle_int)
+                cycle = "CYCLE20{0:03}".format(cycle_int)
             return cycle
 
-        if isinstance(cycle,int):
+        if isinstance(cycle, int):
             cycle = convert_cycle_int(cycle)
-        if isinstance(cycle,str):
-            if not(len(cycle) == 10):
-                cycle = cycle.replace('_','')
+        if isinstance(cycle, str):
+            if len(cycle) != 10:
+                cycle = cycle.replace('_', '')
                 try:
                     cycle = int(cycle)
                 except ValueError:
-                    raise RuntimeError("Cycle should be a string in the form CYCLEYYYYN "\
-                    "N-- the cycle's number in a year or integer in the form: YYYYN or YYN "\
-                    "but it is {0}".format(cycle))
+                    raise RuntimeError("Cycle should be a string in the form CYCLEYYYYN " \
+                                       "N-- the cycle's number in a year or integer in the form: YYYYN or YYN " \
+                                       "but it is {0}".format(cycle))
                 cycle = convert_cycle_int(cycle)
-                if not(len(cycle) == 10 and re.match('^CYCLE',cycle)):
-                    raise RuntimeError("Cycle should be a string in form CYCLEYYYYN "\
-                    "N-- the cycle's number in a year or integer in the form: YYYYN or YYN "\
-                    "but it is {0}".format(cycle))
-        if isinstance(rb_folder_or_id,int):
-           rb_folder_or_id = "RB{0:07}".format(rb_folder_or_id)
-        if not isinstance(rb_folder_or_id,str):
+                if not (len(cycle) == 10 and re.match('^CYCLE', cycle)):
+                    raise RuntimeError("Cycle should be a string in form CYCLEYYYYN " \
+                                       "N-- the cycle's number in a year or integer in the form: YYYYN or YYN " \
+                                       "but it is {0}".format(cycle))
+        if isinstance(rb_folder_or_id, int):
+            rb_folder_or_id = "RB{0:07}".format(rb_folder_or_id)
+        if not isinstance(rb_folder_or_id, str):
             raise RuntimeError("RB Folder {0} should be a string".format(rb_folder_or_id))
         else:
-            base,rbf = os.path.split(rb_folder_or_id)
-            if(len(rbf) != 9):
+            base, rbf = os.path.split(rb_folder_or_id)
+            if len(rbf) != 9:
                 try:
                     rbf = int(rbf)
                     rbf = "RB{0:07}".format(rbf)
-                    rb_folder_or_id = os.path.join(base,rbf)
+                    rb_folder_or_id = os.path.join(base, rbf)
                 except ValueError:
-                    raise RuntimeError("RB Folder {0} should be a string containing RB number at the end".format(rb_folder_or_id))
-        #end
+                    raise RuntimeError(
+                        "RB Folder {0} should be a string containing RB number at the end".format(rb_folder_or_id))
+        # end
         if os.path.exists(rb_folder_or_id) and os.path.isdir(rb_folder_or_id):
             rb_exist = True
         else:
             rb_exist = False
 
-        return instrument,start_date,cycle,rb_folder_or_id,rb_exist
+        return instrument, start_date, cycle, rb_folder_or_id, rb_exist
+
+
 #
-#--------------------------------------------------------------------#
+# --------------------------------------------------------------------#
 #
 class MantidConfigDirectInelastic(object):
     """Class describes Mantid server specific user's configuration,
@@ -295,29 +312,29 @@ class MantidConfigDirectInelastic(object):
     """
     # pylint: disable=too-many-instance-attributes
     # It has as many as parameters describing ISIS configuration.
-    def __init__(self,mantid='/opt/Mantid/',home='/home/',\
-                 script_repo='/opt/UserScripts/',\
+    def __init__(self, mantid='/opt/Mantid/', home='/home/', \
+                 script_repo='/opt/UserScripts/', \
                  map_mask_folder='/usr/local/mprogs/InstrumentFiles/'):
         """Initialize generic config variables and variables specific to a server"""
 
         self._mantid_path = str(mantid)
-        self._home_path  = str(home)
+        self._home_path = str(home)
         self._script_repo = str(script_repo)
         self._map_mask_folder = str(map_mask_folder)
         # check if all necessary server folders specified as class parameters are present
         self._check_server_folders_present()
         #
         # Static Parts of dynamic contents of Mantid configuration file
-        self._root_data_folder='/archive' # root folder for all experimental results -- particular one will depend on
-                                          # instrument and cycle number.
+        self._root_data_folder = '/archive'  # root folder for all experimental results -- particular one will depend on
+        # instrument and cycle number.
         # the common part of all strings, generated dynamically as function of input class parameters.
         self._dynamic_options_base = ['default.facility=ISIS']
         # Path to python scripts, defined and used by mantid wrt to Mantid Root (this path may be version specific)
-        self._python_mantid_path = ['scripts/Calibration/','scripts/Examples/','scripts/Interface/','scripts/Vates/']
+        self._python_mantid_path = ['scripts/Calibration/', 'scripts/Examples/', 'scripts/Interface/', 'scripts/Vates/']
         # Static paths to user scripts, defined wrt script repository root
         self._python_user_scripts = set(['direct_inelastic/ISIS/qtiGenie/'])
         # Relative to a particular user path to place links, important to user
-        self._user_specific_link_path='Desktop'
+        self._user_specific_link_path = 'Desktop'
         # Relative to a particular user name of folders with link to instrument files
         self._map_mask_link_name = 'instrument_files'
         # the name of the file, which describes python files to copy to user. The file has to be placed in
@@ -327,10 +344,10 @@ class MantidConfigDirectInelastic(object):
         # fall back files defined to use if USER_Files_description is for some reason not available or wrong
         # pylint: disable=W0108
         # it will not work without lambda as intended
-        self._sample_reduction_file = lambda InstrName : '{0}Reduction_Sample.py'.format(InstrName)
+        self._sample_reduction_file = lambda InstrName: '{0}Reduction_Sample.py'.format(InstrName)
         # File name, used as target for copying to user folder for user to deploy as the base for his reduction script
         # it will not work without lambda as intended
-        self._target_reduction_file = lambda InstrName,cycleID : '{0}Reduction_{1}.py'.format(InstrName,cycleID)
+        self._target_reduction_file = lambda InstrName, cycleID: '{0}Reduction_{1}.py'.format(InstrName, cycleID)
 
 
         # Static contents of the Mantid Config file
@@ -372,11 +389,12 @@ class MantidConfigDirectInelastic(object):
 
         # Methods, which build & verify various parts of Mantid configuration
         self._dynamic_options = [self._set_default_inst,
-                                 self._set_script_repo, # necessary to have on an Instrument scientist account, disabled on generic setup
+                                 self._set_script_repo,
+                                 # necessary to have on an Instrument scientist account, disabled on generic setup
                                  self._def_python_search_path,
-                                 self._set_datasearch_directory,self._set_rb_directory]
+                                 self._set_datasearch_directory, self._set_rb_directory]
         self._user = None
-        self._cycle_data_folder=set()
+        self._cycle_data_folder = set()
         # this is the list, containing configuration strings
         # generated by the class. No configuration is present initially.
         # Its contents is generated by _init_config method from server and user specific
@@ -386,8 +404,9 @@ class MantidConfigDirectInelastic(object):
         self._force_change_config = False
         # Unconditionally rewrite copy of sample reduction script
         self._force_change_script = False
-#
-    def config_need_replacing(self,config_file_name):
+
+    #
+    def config_need_replacing(self, config_file_name):
         """Method specifies conditions when existing configuration file should be replaced"""
         if self._force_change_config:
             return True
@@ -397,26 +416,28 @@ class MantidConfigDirectInelastic(object):
 
         start_date = self._user.start_date
         unmodified_creation_time = time.mktime(start_date.timetuple())
-        targ_config_time  = os.path.getmtime(config_file_name)
+        targ_config_time = os.path.getmtime(config_file_name)
 
         # Only rewrite configuration if nobody have touched it
-        if unmodified_creation_time  == targ_config_time:
+        if unmodified_creation_time == targ_config_time:
             return True
         else:
             return False
-#
+            #
+
     @property
     def user_file_description(self):
         """defines full file name (with path) for an xml file which describes
            files, which should be copied to a user
         """
         if self._user:
-            return os.path.join(self._script_repo,'direct_inelastic',self._user.instrument,
+            return os.path.join(self._script_repo, 'direct_inelastic', self._user.instrument,
                                 self._user_files_descr)
         else:
-            return  self._user_files_descr
-#
-    def script_need_replacing(self,target_script_name):
+            return self._user_files_descr
+            #
+
+    def script_need_replacing(self, target_script_name):
         """Method specifies conditions when existing reduction file should be replaced
            by a sample file.
         """
@@ -425,17 +446,18 @@ class MantidConfigDirectInelastic(object):
         # non-existing file should always be replaced
         if not os.path.isfile(target_script_name):
             return True
-        #Always replace sample file if it has not been touched
+        # Always replace sample file if it has not been touched
         start_date = self._user.start_date
         # this time is set up to the file, copied from the repository
         unmodified_file_time = time.mktime(start_date.timetuple())
-        targ_file_time  = os.path.getmtime(target_script_name)
-        if unmodified_file_time ==  targ_file_time:
+        targ_file_time = os.path.getmtime(target_script_name)
+        if unmodified_file_time == targ_file_time:
             return True
-        else: # somebody have modified the target file. Leave it alone
+        else:  # somebody have modified the target file. Leave it alone
             return False
-#
-    def _fullpath_to_copy(self,short_source_file=None,short_target_file=None):
+            #
+
+    def _fullpath_to_copy(self, short_source_file=None, short_target_file=None):
         """Append full path to source and target files """
 
         InstrName = self._user.instrument
@@ -444,15 +466,15 @@ class MantidConfigDirectInelastic(object):
             short_source_file = self._sample_reduction_file(InstrName)
         if short_target_file is None:
             CycleID = self._user.cycleID
-            short_target_file = self._target_reduction_file(InstrName,CycleID)
+            short_target_file = self._target_reduction_file(InstrName, CycleID)
 
+        source_path = os.path.join(self._script_repo, 'direct_inelastic', InstrName.upper())
+        full_source = os.path.join(source_path, short_source_file)
 
-        source_path = os.path.join(self._script_repo,'direct_inelastic',InstrName.upper())
-        full_source = os.path.join(source_path,short_source_file)
+        full_target = os.path.join(rb_folder, short_target_file)
+        return full_source, full_target
 
-        full_target = os.path.join(rb_folder,short_target_file)
-        return full_source,full_target
-#
+    #
     def copy_reduction_sample(self, users_file_description=None):
         """copy sample reduction scripts from Mantid script repository
            to user folder.
@@ -461,15 +483,14 @@ class MantidConfigDirectInelastic(object):
             users_file_description = self._user_files_descr
         info_to_copy = self._parse_user_files_description(users_file_description)
         for info in info_to_copy:
-            self._copy_user_file_job(info[0],info[1],info[2])
-
+            self._copy_user_file_job(info[0], info[1], info[2])
 
-    def _copy_and_parse_user_file(self,input_file,output_file,replacemets_list):
+    def _copy_and_parse_user_file(self, input_file, output_file, replacemets_list):
         """Method processes file provided for user and replaces list of keywords, describing user
            and experiment (See comments in User_files_description.xml) with their values
         """
-        fh_targ    = open(output_file,'w')
-        if not fh_targ :
+        fh_targ = open(output_file, 'w')
+        if not fh_targ:
             return
         var_to_replace = replacemets_list.keys()
         with open(input_file) as fh_source:
@@ -480,8 +501,9 @@ class MantidConfigDirectInelastic(object):
                         rez = rez.replace(var, replacemets_list[var])
                 fh_targ.write(rez)
         fh_targ.close()
-#
-    def _copy_user_file_job(self,input_file,output_file,replacement_list=None):
+
+    #
+    def _copy_user_file_job(self, input_file, output_file, replacement_list=None):
         """Method copies file provided into the requested destination
            and replaces keys specified in replacement list dictionary with their
            values if replacement_list is provided.
@@ -495,24 +517,24 @@ class MantidConfigDirectInelastic(object):
         if os.path.isfile(output_file):
             os.remove(output_file)
         if replacement_list is None:
-            shutil.copyfile(input_file,output_file)
+            shutil.copyfile(input_file, output_file)
         else:
-            self._copy_and_parse_user_file(input_file,output_file,replacement_list)
-        os.chmod(output_file,0777)
+            self._copy_and_parse_user_file(input_file, output_file, replacement_list)
+        os.chmod(output_file, 0777)
 
         if platform.system() != 'Windows':
-            os.system("chown {0}:{1} {2}".format(self._user.userID,self._user.rb_id,output_file))
+            os.system("chown {0}:{1} {2}".format(self._user.userID, self._user.rb_id, output_file))
         # Set up the file creation and modification dates to the users start date
         start_date = self._user.start_date
         file_time = time.mktime(start_date.timetuple())
-        os.utime(output_file,(file_time,file_time))
+        os.utime(output_file, (file_time, file_time))
 
-    def _get_file_attributes(self,file_node):
+    def _get_file_attributes(self, file_node):
         """processes xml file_node to retrieve file attributes to copy """
 
         source_file = file_node.getAttribute("file_name")
         if source_file is None:
-            return (None,None)
+            return (None, None)
         target_file = file_node.getAttribute("copy_as")
 
         if target_file is None:
@@ -520,11 +542,12 @@ class MantidConfigDirectInelastic(object):
         else:
             if "$" in target_file:
                 target_file = self._user.replace_variables(target_file)
-        full_source,full_target  = self._fullpath_to_copy(source_file,target_file)
+        full_source, full_target = self._fullpath_to_copy(source_file, target_file)
 
-        return (full_source,full_target)
-#
-    def _parse_replacement_info(self,repl_info):
+        return (full_source, full_target)
+
+    #
+    def _parse_replacement_info(self, repl_info):
         """process dom element 'replacement' and
            returns the  variables with its correspondent value
            to replace variable by their value.
@@ -535,26 +558,28 @@ class MantidConfigDirectInelastic(object):
            and their values are taken from current self._user class
         """
         # what should be replaced in the file
-        source  = repl_info.getAttribute("var")
+        source = repl_info.getAttribute("var")
         if len(source) == 0:
-            raise InvalidArgument('"replace" field of {0} file for instrument {1} has to contain attribute "var" and its value'\
-                                   .format(self._user_files_descr,self._user.instrument))
+            raise InvalidArgument(
+                '"replace" field of {0} file for instrument {1} has to contain attribute "var" and its value' \
+                    .format(self._user_files_descr, self._user.instrument))
         # what should be placed instead of the replacement
-        dest    = repl_info.getAttribute("by_var")
+        dest = repl_info.getAttribute("by_var")
         if len(dest) == 0:
-            raise InvalidArgument('"replace" field of {0} file for instrument {1} has to contain attribute "by_var" and its value'\
-                                   .format(self._user_files_descr,self._user.instrument))
+            raise InvalidArgument(
+                '"replace" field of {0} file for instrument {1} has to contain attribute "by_var" and its value' \
+                    .format(self._user_files_descr, self._user.instrument))
 
         # replace use-specific variables by their values
         if '$' in dest:
             dest = self._user.replace_variables(dest)
-        return (source,dest)
+        return (source, dest)
 
-    def _parse_user_files_description(self,job_description_file):
+    def _parse_user_files_description(self, job_description_file):
         """ Method parses xml file used to describe files to provide to user"""
 
         # mainly for debugging purposes
-        filenames_to_copy=[]
+        filenames_to_copy = []
 
         # does not work if user is not defined
         if self._user is None:
@@ -562,18 +587,18 @@ class MantidConfigDirectInelastic(object):
         # parse job description file, fail down on default behavior if
         # user files description is not there
         try:
-            domObj=minidom.parse(job_description_file)
+            domObj = minidom.parse(job_description_file)
         except Exception:
-            input_file,output_file = self._fullpath_to_copy()
-            filenames_to_copy.append((input_file,output_file,None))
+            input_file, output_file = self._fullpath_to_copy()
+            filenames_to_copy.append((input_file, output_file, None))
             return filenames_to_copy
 
         files_to_copy = domObj.getElementsByTagName("file_to_copy")
 
         # go through all files in the description and define file copying operations
-        for file_node in files_to_copy :
+        for file_node in files_to_copy:
             # retrieve file attributes or its default values if the attributes are missing
-            input_file,output_file =self._get_file_attributes(file_node)
+            input_file, output_file = self._get_file_attributes(file_node)
             if input_file is None:
                 continue
 
@@ -584,32 +609,34 @@ class MantidConfigDirectInelastic(object):
             else:
                 replacement_list = {}
                 for replacement in replacements_info:
-                    source,dest = self._parse_replacement_info(replacement)
-                    replacement_list[source]=dest
-            filenames_to_copy.append((input_file,output_file,replacement_list))
+                    source, dest = self._parse_replacement_info(replacement)
+                    replacement_list[source] = dest
+            filenames_to_copy.append((input_file, output_file, replacement_list))
 
         return filenames_to_copy
-#
-    def get_data_folder_name(self,instr,cycle_ID):
+
+    #
+    def get_data_folder_name(self, instr, cycle_ID):
         """Method to generate a data folder from instrument name and the cycle start date
            (cycle ID)
            The agreement on the naming as currently in ISIS:
            e.g: /archive/NDXMERLIN/Instrument/data/cycle_08_1
         """
         # cycle folder have short form without leading numbers
-        cycle_fold_n =int(cycle_ID[0])-2000
-        folder = os.path.join(self._root_data_folder,'NDX'+instr.upper(),\
-                              "Instrument/data/cycle_{0:02}_{1}".format(cycle_fold_n,str(cycle_ID[1])))
+        cycle_fold_n = int(cycle_ID[0]) - 2000
+        folder = os.path.join(self._root_data_folder, 'NDX' + instr.upper(), \
+                              "Instrument/data/cycle_{0:02}_{1}".format(cycle_fold_n, str(cycle_ID[1])))
         return folder
 
-    def is_inelastic(self,instr_name):
+    def is_inelastic(self, instr_name):
         """Check if the instrument is inelastic"""
         if instr_name in INELASTIC_INSTRUMENTS:
             return True
         else:
             return False
+
     #
-    def init_user(self,fedIDorUser,theUser=None):
+    def init_user(self, fedIDorUser, theUser=None):
         """Define settings, specific to a user
            Supports two interfaces -- old and the new one
            where
@@ -620,7 +647,7 @@ class MantidConfigDirectInelastic(object):
            theUser -- class defining all user's properties including fedID
         """
         if not theUser:
-            if isinstance(fedIDorUser,UserProperties):
+            if isinstance(fedIDorUser, UserProperties):
                 theUser = fedIDorUser
             else:
                 raise RuntimeError("self.init_user(val) has to have val of UserProperty type only and got")
@@ -632,30 +659,32 @@ class MantidConfigDirectInelastic(object):
         for instr in theUser._instrument.values():
             if not self.is_inelastic(instr):
                 raise RuntimeError('Instrument {0} is not among acceptable instruments'.format(instrument))
-        self._user=theUser
+        self._user = theUser
 
         # pylint: disable=W0201
         # its init method so the change is reasonable
-        self._fedid =  theUser.userID
-        user_folder = os.path.join(self._home_path,self._fedid)
+        self._fedid = theUser.userID
+        user_folder = os.path.join(self._home_path, self._fedid)
         if not os.path.exists(user_folder):
             raise RuntimeError("User with fedID {0} does not exist. Create such user folder first".format(self._fedid))
         # pylint: disable=W0212
         # bad practice but I need all rb_dires, not the current one
         for rb_folder in theUser._rb_dirs.values():
             if not os.path.exists(str(rb_folder)):
-                raise RuntimeError("Experiment folder with {0} does not exist. Create such folder first".format(rb_folder))
+                raise RuntimeError(
+                    "Experiment folder with {0} does not exist. Create such folder first".format(rb_folder))
         #
         # how to check cycle folders, they may not be available
-        self._cycle_data_folder=set()
+        self._cycle_data_folder = set()
         # pylint: disable=W0212
-        for date_key,folder_id in theUser._cycle_IDs.items():
-            self._cycle_data_folder.add(self.get_data_folder_name(theUser._instrument[date_key],folder_id))
+        for date_key, folder_id in theUser._cycle_IDs.items():
+            self._cycle_data_folder.add(self.get_data_folder_name(theUser._instrument[date_key], folder_id))
         # Initialize configuration settings
         self._dynamic_configuration = copy.deepcopy(self._dynamic_options_base)
         self._init_config()
+
     #
-    def  _check_server_folders_present(self):
+    def _check_server_folders_present(self):
         """Routine checks all necessary server folder are present"""
         if not os.path.exists(self._mantid_path):
             raise RuntimeError("SERVER ERROR: no correct Mantid path defined at {0}".format(self._mantid_path))
@@ -663,16 +692,18 @@ class MantidConfigDirectInelastic(object):
             raise RuntimeError("SERVER ERROR: no correct home path defined at {0}".format(self._home_path))
         if not os.path.exists(self._script_repo):
             raise RuntimeError(("SERVER ERROR: no correct user script repository defined at {0}\n"
-                                "Check out Mantid script repository from account, which have admin rights").format(self._script_repo))
+                                "Check out Mantid script repository from account, "
+                                "which have admin rights").format(self._script_repo))
         if not os.path.exists(self._map_mask_folder):
             raise RuntimeError(("SERVER ERROR: no correct map/mask folder defined at {0}\n"
-                                "Check out Mantid map/mask files from svn at https://svn.isis.rl.ac.uk/InstrumentFiles/trunk")\
-                                .format(self._map_mask_folder))
+                                "Check out Mantid map/mask files from svn at"
+                                " https://svn.isis.rl.ac.uk/InstrumentFiles/trunk").format(self._map_mask_folder))
 
     def _init_config(self):
         """Execute Mantid properties setup methods"""
         for fun in self._dynamic_options:
             fun()
+
     #
     def _set_default_inst(self):
         """Set up last instrument, deployed by user"""
@@ -681,10 +712,12 @@ class MantidConfigDirectInelastic(object):
             self._dynamic_configuration.append('default.instrument={0}'.format(InstrName))
         else:
             self._dynamic_configuration.append('default.instrument={0}'.format('MARI'))
+
     #
     def _set_script_repo(self):
         """ defines script repository location. By default its option is commented"""
         self._dynamic_configuration.append('#ScriptLocalRepository={0}'.format(self._script_repo))
+
     #
     def _def_python_search_path(self):
         """Define path for Mantid Inelastic python scripts"""
@@ -693,19 +726,20 @@ class MantidConfigDirectInelastic(object):
             raise RuntimeError("Can not define python search path without defined user")
 
         # define main Mantid scripts search path
-        path = os.path.join(self._mantid_path,'scripts/')
+        path = os.path.join(self._mantid_path, 'scripts/')
         for part in self._python_mantid_path:
-            path +=';'+os.path.join(self._mantid_path,part)
+            path += ';' + os.path.join(self._mantid_path, part)
 
         # define and append user scripts search path
         user_path_part = copy.deepcopy(self._python_user_scripts)
         # pylint: disable=W0212
         for instr in self._user._instrument.values():
-            user_path_part.add(os.path.join('direct_inelastic',instr.upper()))
+            user_path_part.add(os.path.join('direct_inelastic', instr.upper()))
         for part in user_path_part:
-            path +=';'+os.path.join(self._script_repo,part)+'/'
+            path += ';' + os.path.join(self._script_repo, part) + '/'
 
         self._dynamic_configuration.append('pythonscripts.directories=' + path)
+
     #
     def _set_rb_directory(self):
         """Set up default save directory, the one where data are saved by default"""
@@ -715,6 +749,7 @@ class MantidConfigDirectInelastic(object):
             self._dynamic_configuration.append('defaultsave.directory={0}'.format(rb_folder))
         else:
             raise RuntimeError("Can not define RB folder without user being defined")
+
     #
     def _set_datasearch_directory(self):
         """Note, map/mask instrument folder is lower case as if loaded from SVN.
@@ -723,75 +758,77 @@ class MantidConfigDirectInelastic(object):
             raise RuntimeError("Can not define Data search path without user being defined")
 
         instr_name = self._user.instrument
-        map_mask_dir  = os.path.abspath(os.path.join('{0}'.format(self._map_mask_folder),\
-                                                     '{0}'.format(str.lower(instr_name))))
+        map_mask_dir = os.path.abspath(os.path.join('{0}'.format(self._map_mask_folder), \
+                                                    '{0}'.format(str.lower(instr_name))))
         # set up all data folders
-        all_data_folders=list(self._cycle_data_folder)
+        all_data_folders = list(self._cycle_data_folder)
         data_dir = os.path.abspath('{0}'.format(all_data_folders[0]))
         for folder in all_data_folders[1:]:
-            data_dir +=';'+os.path.abspath('{0}'.format(folder))
+            data_dir += ';' + os.path.abspath('{0}'.format(folder))
 
         # pylint: disable=W0212
         all_rb_folders = self._user._rb_dirs
         for folder in all_rb_folders.values():
-            data_dir+=';'+os.path.abspath('{0}'.format(folder))
+            data_dir += ';' + os.path.abspath('{0}'.format(folder))
+
+        self._dynamic_configuration.append('datasearch.directories=' + map_mask_dir + ';' + data_dir)
 
-        self._dynamic_configuration.append('datasearch.directories='+map_mask_dir+';'+data_dir)
     #
     def generate_config(self):
         """Save generated Mantid configuration file into user's home folder
            and copy other files, necessary for Mantid to work properly
         """
-        user_path = os.path.join(self._home_path,self._fedid)
-        config_path = os.path.join(user_path,'.mantid')
+        user_path = os.path.join(self._home_path, self._fedid)
+        config_path = os.path.join(user_path, '.mantid')
         if not os.path.exists(config_path):
             err = os.makedirs(config_path)
             if err:
                 raise RuntimeError('can not find or create Mantid configuration path {0}'.format(config_path))
 
-        config_file = os.path.join(config_path,'Mantid.user.properties')
+        config_file = os.path.join(config_path, 'Mantid.user.properties')
         if self.config_need_replacing(config_file):
             self._write_user_config_file(config_file)
         else:
             pass
         if platform.system() != 'Windows':
-            os.system('chown -R {0}:{0} {1}'.format(self._fedid,config_path))
+            os.system('chown -R {0}:{0} {1}'.format(self._fedid, config_path))
 
         self.copy_reduction_sample(self.user_file_description)
         #
         self.make_map_mask_links(user_path)
+
     #
-    def make_map_mask_links(self,user_path):
+    def make_map_mask_links(self, user_path):
         """The method generates references to map files and places these references
            to the user's desktop.
         """
         # the path where to set up links, important to user
-        links_path = os.path.join(user_path,self._user_specific_link_path)
+        links_path = os.path.join(user_path, self._user_specific_link_path)
         if not os.path.exists(links_path):
             os.makedirs(links_path)
             # the path have to belong to user
             if platform.system() != 'Windows':
-                os.system('chown -R {0}:{0} {1}'.format(self._fedid,links_path))
+                os.system('chown -R {0}:{0} {1}'.format(self._fedid, links_path))
 
-        map_mask_folder_link = os.path.join(links_path,self._map_mask_link_name)
+        map_mask_folder_link = os.path.join(links_path, self._map_mask_link_name)
         if os.path.exists(map_mask_folder_link):
             return
         # create link to map mask folder
         if platform.system() == 'Windows':
             # the script is not intended to run on Windows, so this is just for testing
-            mmfl = map_mask_folder_link.replace('/','\\')
-            mmf  = self._map_mask_folder.replace('/','\\')
-            os.system("mklink /J {0} {1}".format(mmfl,mmf))
+            mmfl = map_mask_folder_link.replace('/', '\\')
+            mmf = self._map_mask_folder.replace('/', '\\')
+            os.system("mklink /J {0} {1}".format(mmfl, mmf))
         else:
-            os.system('ln -s {0} {1}'.format(self._map_mask_folder,map_mask_folder_link))
+            os.system('ln -s {0} {1}'.format(self._map_mask_folder, map_mask_folder_link))
 
-    def _write_user_config_file(self,config_file_name):
+    def _write_user_config_file(self, config_file_name):
         """Write existing dynamic configuration from memory to
            user defined configuration file
         """
         # pylint: disable=C0103
         # What is wrong with fp variable name here?
-        fp = open(config_file_name,'w')
+        fp = open(config_file_name, 'w')
         fp.write(self._header)
         fp.write('## -----   Generated user properties ------------ \n')
         fp.write('##\n')
@@ -801,13 +838,14 @@ class MantidConfigDirectInelastic(object):
         fp.write(self._footer)
         fp.close()
         if platform.system() != 'Windows':
-            os.system('chown -R {0}:{0} {1}'.format(self._fedid,config_file_name))
-        # Set up configuration for the specific time, which should change only if user 
+            os.system('chown -R {0}:{0} {1}'.format(self._fedid, config_file_name))
+        # Set up configuration for the specific time, which should change only if user
         # modified this configuration
         start_date = self._user.start_date
         file_time = time.mktime(start_date.timetuple())
-        os.utime(config_file_name,(file_time,file_time))
+        os.utime(config_file_name, (file_time, file_time))
 
+# pylint: disable = invalid-name
 
 if __name__ == "__main__":
 
@@ -815,24 +853,23 @@ if __name__ == "__main__":
         print "usage: Config.py userID instrument RBNumber cycleID start_date"
         exit()
 
-    argi  = sys.argv[1:]
+    argi = sys.argv[1:]
     user = UserProperties(*argi)
 
-
     if platform.system() == 'Windows':
-        sys.path.insert(0,'c:/Mantid/scripts/Inelastic/Direct')
+        sys.path.insert(0, 'c:/Mantid/scripts/Inelastic/Direct')
 
         base = 'd:/Data/Mantid_Testing/config_script_test_folder'
-        analysisDir= base
+        analysisDir = base
 
         MantidDir = r"c:\Mantid\_builds\br_master\bin\Release"
-        UserScriptRepoDir = os.path.join(analysisDir,"UserScripts")
-        MapMaskDir =  os.path.join(analysisDir,"InstrumentFiles")
+        UserScriptRepoDir = os.path.join(analysisDir, "UserScripts")
+        MapMaskDir = os.path.join(analysisDir, "InstrumentFiles")
 
-        rootDir = os.path.join(base,'users')
+        rootDir = os.path.join(base, 'users')
     else:
-        sys.path.insert(0,'/opt/Mantid/scripts/Inelastic/Direct/')
-        #sys.path.insert(0,'/opt/mantidnightly/scripts/Inelastic/Direct/')
+        sys.path.insert(0, '/opt/Mantid/scripts/Inelastic/Direct/')
+        # sys.path.insert(0,'/opt/mantidnightly/scripts/Inelastic/Direct/')
 
 
         MantidDir = '/opt/Mantid'
@@ -845,21 +882,19 @@ if __name__ == "__main__":
 
     # initialize Mantid configuration
 
-    from ISISDirecInelasticConfig import MantidConfigDirectInelastic,UserProperties
+    from ISISDirecInelasticConfig import MantidConfigDirectInelastic, UserProperties
 
-    mcf = MantidConfigDirectInelastic(MantidDir,rootDir,UserScriptRepoDir,MapMaskDir)
+    mcf = MantidConfigDirectInelastic(MantidDir, rootDir, UserScriptRepoDir, MapMaskDir)
     print "Successfully initialized ISIS Inelastic Configuration script generator"
 
-
-
-    rb_user_folder = os.path.join(mcf._home_path,user.userID)
+    rb_user_folder = os.path.join(mcf._home_path, user.userID)
     user.rb_dir = rb_user_folder
     if not user.rb_dir_exist:
-        print "RB folder {0} for user {1} should exist and be accessible to configure this user".format(user.rb_dir,user.userID)
+        print "RB folder {0} for user {1} should exist and be accessible to configure this user".format(user.rb_dir,
+                                                                                                        user.userID)
         exit()
     # Configure user
-    mcf.init_user(user.userID,user)
+    mcf.init_user(user.userID, user)
     mcf.generate_config()
-    print "Successfully Configured user: {0} for instrument {1} and RBNum: {2}"\
-           .format(user.userID,user.instrument,user.rb_folder)
-
+    print "Successfully Configured user: {0} for instrument {1} and RBNum: {2}" \
+        .format(user.userID, user.instrument, user.rb_folder)
diff --git a/scripts/Inelastic/IndirectDataAnalysis.py b/scripts/Inelastic/IndirectDataAnalysis.py
index 305ee471a801e6b2b5f1abc7a0ba4375ab50b93b..05c9ada0551b66abb4c27659b71d78ad3e5f57da 100644
--- a/scripts/Inelastic/IndirectDataAnalysis.py
+++ b/scripts/Inelastic/IndirectDataAnalysis.py
@@ -97,89 +97,6 @@ def furyfitSeq(inputWS, func, ftype, startx, endx,
     return result_workspace
 
 
-def furyfitMult(inputWS, function, ftype, startx, endx,
-                spec_min=0, spec_max=None, intensities_constrained=False,
-                minimizer='Levenberg-Marquardt', max_iterations=500,
-                Save=False, Plot='None'):
-    StartTime('FuryFit Multi')
-
-    nHist = mtd[inputWS].getNumberHistograms()
-    output_workspace = getWSprefix(inputWS) + 'fury_1Smult_s0_to_' + str(nHist-1)
-
-    option = ftype[:-2]
-    logger.information('Option: '+option)
-    logger.information('Function: '+function)
-
-    #prepare input workspace for fitting
-    tmp_fit_workspace = "__furyfit_fit_ws"
-    if spec_max is None:
-        CropWorkspace(InputWorkspace=inputWS, OutputWorkspace=tmp_fit_workspace,
-                      XMin=startx, XMax=endx,
-                      StartWorkspaceIndex=spec_min)
-    else:
-        CropWorkspace(InputWorkspace=inputWS, OutputWorkspace=tmp_fit_workspace,
-                      XMin=startx, XMax=endx,
-                      StartWorkspaceIndex=spec_min, EndWorkspaceIndex=spec_max)
-
-    ConvertToHistogram(tmp_fit_workspace, OutputWorkspace=tmp_fit_workspace)
-    convertToElasticQ(tmp_fit_workspace)
-
-    #fit multi-domian functino to workspace
-    multi_domain_func, kwargs = createFuryMultiDomainFunction(function, tmp_fit_workspace)
-    Fit(Function=multi_domain_func,
-        InputWorkspace=tmp_fit_workspace,
-        WorkspaceIndex=0,
-        Output=output_workspace,
-        CreateOutput=True,
-        Minimizer=minimizer,
-        MaxIterations=max_iterations,
-        **kwargs)
-
-    params_table = output_workspace + '_Parameters'
-    transposeFitParametersTable(params_table)
-
-    #set first column of parameter table to be axis values
-    x_axis = mtd[tmp_fit_workspace].getAxis(1)
-    axis_values = x_axis.extractValues()
-    for i, value in enumerate(axis_values):
-        mtd[params_table].setCell('axis-1', i, value)
-
-    #convert parameters to matrix workspace
-    result_workspace = output_workspace + "_Result"
-    parameter_names = ['A0', 'Intensity', 'Tau', 'Beta']
-    convertParametersToWorkspace(params_table, "axis-1", parameter_names, result_workspace)
-
-    #set x units to be momentum transfer
-    axis = mtd[result_workspace].getAxis(0)
-    axis.setUnit("MomentumTransfer")
-
-    result_workspace = output_workspace + '_Result'
-    fit_group = output_workspace + '_Workspaces'
-
-    sample_logs  = {'start_x': startx, 'end_x': endx, 'fit_type': ftype,
-                    'intensities_constrained': intensities_constrained, 'beta_constrained': True}
-
-    CopyLogs(InputWorkspace=inputWS, OutputWorkspace=result_workspace)
-    CopyLogs(InputWorkspace=inputWS, OutputWorkspace=fit_group)
-
-    log_names = [item[0] for item in sample_logs]
-    log_values = [item[1] for item in sample_logs]
-    AddSampleLogMultiple(Workspace=result_workspace, LogNames=log_names, LogValues=log_values)
-    AddSampleLogMultiple(Workspace=fit_group, LogNames=log_names, LogValues=log_values)
-
-    DeleteWorkspace(tmp_fit_workspace)
-
-    if Save:
-        save_workspaces = [result_workspace]
-        furyFitSaveWorkspaces(save_workspaces)
-
-    if Plot != 'None':
-        furyfitPlotSeq(result_workspace, Plot)
-
-    EndTime('TransformToIqtFit Multi')
-    return result_workspace
-
-
 def createFuryMultiDomainFunction(function, input_ws):
     multi= 'composite=MultiDomainFunction,NumDeriv=true;'
     comp = '(composite=CompositeFunction,NumDeriv=true,$domains=i;' + function + ');'
diff --git a/scripts/Inelastic/IndirectNeutron.py b/scripts/Inelastic/IndirectNeutron.py
index 400db9541563409f1ca03476540b4b14bc81777e..04059cebf31c7dad1738d0688fd796cd0a024e65 100644
--- a/scripts/Inelastic/IndirectNeutron.py
+++ b/scripts/Inelastic/IndirectNeutron.py
@@ -1,4 +1,4 @@
-#pylint: disable=invalid-name,too-many-arguments
+# pylint: disable=invalid-name,too-many-arguments, redefined-builtin, too-many-locals
 
 """
 Force for ILL backscattering raw
@@ -9,26 +9,28 @@ from mantid.simpleapi import *
 from mantid import config, logger, mtd, FileFinder
 import sys, math, os.path, numpy as np
 from IndirectCommon import StartTime, EndTime, ExtractFloat, ExtractInt, getEfixed
+
 MTD_PLOT = import_mantidplot()
 
+
 #  Routines for Ascii file of raw data
 
-def Iblock(a,first):                                 #read Ascii block of Integers
+def Iblock(a, first):  # read Ascii block of Integers
     line1 = a[first]
-    line2 = a[first+1]
+    line2 = a[first + 1]
     val = ExtractInt(line2)
     numb = val[0]
-    lines=numb/10
-    last = numb-10*lines
+    lines = numb / 10
+    last = numb - 10 * lines
     if line1.startswith('I'):
         error = ''
     else:
-        error = 'NOT an I block starting at line ' +str(first)
+        error = 'NOT an I block starting at line ' + str(first)
         logger.information('ERROR *** ' + error)
         sys.exit(error)
     ival = []
     for m in range(0, lines):
-        mm = first+2+m
+        mm = first + 2 + m
         val = ExtractInt(a[mm])
         for n in range(0, 10):
             ival.append(val[n])
@@ -37,24 +39,25 @@ def Iblock(a,first):                                 #read Ascii block of Intege
     for n in range(0, last):
         ival.append(val[n])
     mm += 1
-    return mm,ival                                       #values as list
+    return mm, ival  # values as list
+
 
-def Fblock(a,first):                                 #read Ascii block of Floats
+def Fblock(a, first):  # read Ascii block of Floats
     line1 = a[first]
-    line2 = a[first+1]
+    line2 = a[first + 1]
     val = ExtractInt(line2)
     numb = val[0]
-    lines=numb/5
-    last = numb-5*lines
+    lines = numb / 5
+    last = numb - 5 * lines
     if line1.startswith('F'):
-        error= ''
+        error = ''
     else:
-        error = 'NOT an F block starting at line ' +str(first)
+        error = 'NOT an F block starting at line ' + str(first)
         logger.information('ERROR *** ' + error)
         sys.exit(error)
     fval = []
     for m in range(0, lines):
-        mm = first+2+m
+        mm = first + 2 + m
         val = ExtractFloat(a[mm])
         for n in range(0, 5):
             fval.append(val[n])
@@ -63,46 +66,48 @@ def Fblock(a,first):                                 #read Ascii block of Floats
     for n in range(0, last):
         fval.append(val[n])
     mm += 1
-    return mm,fval                                       #values as list
+    return mm, fval  # values as list
+
 
-def ReadIbackGroup(a,first):                           #read Ascii block of spectrum values
+def ReadIbackGroup(a, first):  # read Ascii block of spectrum values
     x = []
     y = []
     e = []
     next = first
     line1 = a[next]
     next += 1
-    val = ExtractInt(a[next])
+    _val = ExtractInt(a[next])
     if line1.startswith('S'):
         error = ''
     else:
-        error = 'NOT an S block starting at line ' +str(first)
+        error = 'NOT an S block starting at line ' + str(first)
         logger.information('ERROR *** ' + error)
         sys.exit(error)
     next += 1
-    next,Ival = Iblock(a,next)
+    next, Ival = Iblock(a, next)
     for m in range(0, len(Ival)):
         x.append(float(m))
         yy = float(Ival[m])
         y.append(yy)
         ee = math.sqrt(yy)
         e.append(ee)
-    return next,x,y,e                                #values of x,y,e as lists
+    return next, x, y, e  # values of x,y,e as lists
+
 
 # Get the path to the file
 # checks if we already know the path, else
 # returns searches of the file based on run number and instrument
-def getFilePath(run,ext,instr):
+def getFilePath(run, ext, instr):
     path = None
     fname = None
     if os.path.isfile(run):
-        #using full file path
+        # using full file path
         path = run
-        #base name less extension
+        # base name less extension
         base = os.path.basename(path)
         fname = os.path.splitext(base)[0]
     else:
-        #using run number
+        # using run number
         path = FileFinder.getFullPath(instr + "_" + run + ext)
         fname = instr + "_" + run
 
@@ -112,6 +117,7 @@ def getFilePath(run,ext,instr):
         error = 'ERROR *** Could not find ' + ext + ' file: ' + fname
         sys.exit(error)
 
+
 # Load an ascii/inx file
 def loadFile(path):
     try:
@@ -127,158 +133,161 @@ def loadFile(path):
         error = 'ERROR *** Could not load ' + path
         sys.exit(error)
 
-def IbackStart(instr,run,ana,refl,rejectZ,useM,mapPath,Plot,Save):      #Ascii start routine
+
+def IbackStart(instr, run, ana, refl, rejectZ, useM, mapPath, Plot, Save):  # Ascii start routine
     StartTime('Iback')
     workdir = config['defaultsave.directory']
 
-    path, fname = getFilePath(run,'.asc',instr)
+    path, fname = getFilePath(run, '.asc', instr)
 
     logger.information('Reading file : ' + path)
 
     asc = loadFile(path)
-    lasc = len(asc)
+    _lasc = len(asc)
 
-# raw head
+    # raw head
     text = asc[1]
     run = text[:8]
     first = 5
-    next,Ival = Iblock(asc,first)
+    next, _Ival = Iblock(asc, first)
     next += 2
-    title = asc[next]    # title line
+    title = asc[next]  # title line
     next += 1
-    text = asc[next]   # user line
-    user = text[20:32]
-    time = text[40:50]
-    next += 6           # 5 lines of text
-# back head1
-    next,Fval = Fblock(asc,next)
+    text = asc[next]  # user line
+    _user = text[20:32]
+    _time = text[40:50]
+    next += 6  # 5 lines of text
+    # back head1
+    next, Fval = Fblock(asc, next)
     if instr == 'IN10':
         freq = Fval[89]
     if instr == 'IN16':
         freq = Fval[2]
         amp = Fval[3]
         wave = Fval[69]
-        Ef = 81.787/(4.0*wave*wave)
+        _Ef = 81.787 / (4.0 * wave * wave)
         npt = int(Fval[6])
         nsp = int(Fval[7])
-# back head2
-    next,Fval = Fblock(asc,next)
-    k0 = 4.0*math.pi/wave
-    d2r = math.pi/180.0
+    # back head2
+    next, Fval = Fblock(asc, next)
+    _k0 = 4.0 * math.pi / wave
+    _d2r = math.pi / 180.0
     theta = []
-    Q = []
+    _Q = []
     for m in range(0, nsp):
         theta.append(Fval[m])
-# raw spectra
-    val = ExtractInt(asc[next+3])
+    # raw spectra
+    val = ExtractInt(asc[next + 3])
     npt = val[0]
-    lgrp=5+npt/10
-    val = ExtractInt(asc[next+1])
+    lgrp = 5 + npt / 10
+    val = ExtractInt(asc[next + 1])
     if instr == 'IN10':
         nsp = int(val[2])
     logger.information('Number of spectra : ' + str(nsp))
-# read monitor
-    nmon = next+nsp*lgrp
-    nm,xm,ym,em = ReadIbackGroup(asc,nmon)
-# monitor calcs
+    # read monitor
+    nmon = next + nsp * lgrp
+    _nm, _xm, ym, em = ReadIbackGroup(asc, nmon)
+    # monitor calcs
     imin = 0
     ymax = 0
     for m in range(0, 20):
         if ym[m] > ymax:
-            imin=m
-            ymax=ym[m]
+            imin = m
+            ymax = ym[m]
     npt = len(ym)
     imax = npt
     ymax = 0
-    for m in range(npt-1, npt-20, -1):
+    for m in range(npt - 1, npt - 20, -1):
         if ym[m] > ymax:
-            imax=m
-            ymax=ym[m]
-    new=imax-imin
-    imid=new/2+1
+            imax = m
+            ymax = ym[m]
+    new = imax - imin
+    imid = new / 2 + 1
     if instr == 'IN10':
-        DRV=18.706                            # fast drive
-        vmax=freq*DRV
+        DRV = 18.706  # fast drive
+        vmax = freq * DRV
     if instr == 'IN16':
-        vmax=1.2992581918414711e-4*freq*amp*2.0/wave     #max energy
-    dele=2.0*vmax/new
+        vmax = 1.2992581918414711e-4 * freq * amp * 2.0 / wave  # max energy
+    dele = 2.0 * vmax / new
     xMon = []
     yOut = []
     eOut = []
-    for m in range(0, new+1):
-        xe = (m-imid)*dele
-        mm = m+imin
+    for m in range(0, new + 1):
+        xe = (m - imid) * dele
+        mm = m + imin
         xMon.append(xe)
-        yOut.append(ym[mm]/100.0)
-        eOut.append(em[mm]/10.0)
-    xMon.append(2*xMon[new-1]-xMon[new-2])
+        yOut.append(ym[mm] / 100.0)
+        eOut.append(em[mm] / 10.0)
+    xMon.append(2 * xMon[new - 1] - xMon[new - 2])
     monWS = '__Mon'
-    CreateWorkspace(OutputWorkspace=monWS, DataX=xMon, DataY=yOut, DataE=eOut,\
-        Nspec=1, UnitX='DeltaE')
-#
-    Qaxis = ''
+    CreateWorkspace(OutputWorkspace=monWS, DataX=xMon, DataY=yOut, DataE=eOut, \
+                    Nspec=1, UnitX='DeltaE')
+    #
+    _Qaxis = ''
     xDat = []
     yDat = []
     eDat = []
     tot = []
     for n in range(0, nsp):
-        next,xd,yd,ed = ReadIbackGroup(asc,next)
+        next, _xd, yd, ed = ReadIbackGroup(asc, next)
         tot.append(sum(yd))
-        logger.information('Spectrum ' + str(n+1) +' at angle '+ str(theta[n])+\
-                      ' ; Total counts = '+str(sum(yd)))
-        for m in range(0, new+1):
-            mm = m+imin
+        logger.information('Spectrum ' + str(n + 1) + ' at angle ' + str(theta[n]) + \
+                           ' ; Total counts = ' + str(sum(yd)))
+        for m in range(0, new + 1):
+            mm = m + imin
             xDat.append(xMon[m])
             yDat.append(yd[mm])
             eDat.append(ed[mm])
         if n != 0:
-            Qaxis += ','
-        xDat.append(2*xDat[new-1]-xDat[new-2])
-        Qaxis += str(theta[n])
-    ascWS = fname +'_' +ana+refl +'_asc'
-    outWS = fname +'_' +ana+refl +'_red'
-    CreateWorkspace(OutputWorkspace=ascWS, DataX=xDat, DataY=yDat, DataE=eDat,\
-        Nspec=nsp, UnitX='DeltaE')
-    Divide(LHSWorkspace=ascWS, RHSWorkspace=monWS, OutputWorkspace=ascWS,\
-        AllowDifferentNumberSpectra=True)
-    DeleteWorkspace(monWS)                                # delete monitor WS
-    InstrParas(ascWS,instr,ana,refl)
-    efixed = RunParas(ascWS,instr,run,title)
-    ChangeAngles(ascWS,instr,theta)
+            _Qaxis += ','
+        xDat.append(2 * xDat[new - 1] - xDat[new - 2])
+        _Qaxis += str(theta[n])
+    ascWS = fname + '_' + ana + refl + '_asc'
+    outWS = fname + '_' + ana + refl + '_red'
+    CreateWorkspace(OutputWorkspace=ascWS, DataX=xDat, DataY=yDat, DataE=eDat, \
+                    Nspec=nsp, UnitX='DeltaE')
+    Divide(LHSWorkspace=ascWS, RHSWorkspace=monWS, OutputWorkspace=ascWS, \
+           AllowDifferentNumberSpectra=True)
+    DeleteWorkspace(monWS)  # delete monitor WS
+    InstrParas(ascWS, instr, ana, refl)
+    _efixed = RunParas(ascWS, instr, run, title)
+    ChangeAngles(ascWS, instr, theta)
     if useM:
         map = ReadMap(mapPath)
-        UseMap(ascWS,map)
+        UseMap(ascWS, map)
     if rejectZ:
-        RejectZero(ascWS,tot)
+        RejectZero(ascWS, tot)
     if useM == False and rejectZ == False:
         CloneWorkspace(InputWorkspace=ascWS, OutputWorkspace=outWS)
     if Save:
-        opath = os.path.join(workdir,outWS+'.nxs')
+        opath = os.path.join(workdir, outWS + '.nxs')
         SaveNexusProcessed(InputWorkspace=outWS, Filename=opath)
         logger.information('Output file : ' + opath)
     if Plot:
-        plotForce(outWS,Plot)
+        plotForce(outWS, Plot)
     EndTime('Iback')
 
+
 # Routines for Inx ascii file
 
-def ReadInxGroup(asc,n,lgrp):                  # read ascii x,y,e
+def ReadInxGroup(asc, n, lgrp):  # read ascii x,y,e
     x = []
     y = []
     e = []
-    first = n*lgrp
-    last = (n+1)*lgrp
-    val = ExtractFloat(asc[first+2])
+    first = n * lgrp
+    last = (n + 1) * lgrp
+    val = ExtractFloat(asc[first + 2])
     Q = val[0]
-    for m in range(first+4, last):
+    for m in range(first + 4, last):
         val = ExtractFloat(asc[m])
-        x.append(val[0]/1000.0)
+        x.append(val[0] / 1000.0)
         y.append(val[1])
         e.append(val[2])
     npt = len(x)
-    return Q,npt,x,y,e                                 #values of x,y,e as lists
+    return Q, npt, x, y, e  # values of x,y,e as lists
+
 
-def InxStart(instr,run,ana,refl,rejectZ,useM,mapPath,Plot,Save):
+def InxStart(instr, run, ana, refl, rejectZ, useM, mapPath, Plot, Save):
     StartTime('Inx')
     workdir = config['defaultsave.directory']
 
@@ -292,76 +301,77 @@ def InxStart(instr,run,ana,refl,rejectZ,useM,mapPath,Plot,Save):
     val = ExtractInt(asc[0])
     lgrp = int(val[0])
     ngrp = int(val[2])
-    npt = int(val[7])
+    _npt = int(val[7])
     title = asc[1]
-    ltot = ngrp*lgrp
+    ltot = ngrp * lgrp
     logger.information('Number of spectra : ' + str(ngrp))
     if ltot == lasc:
         error = ''
     else:
-        error = 'file ' +filext+ ' should be ' +str(ltot)+ ' lines'
+        error = 'file ' + filext + ' should be ' + str(ltot) + ' lines'
         logger.information('ERROR *** ' + error)
         sys.exit(error)
-    Qaxis = ''
+    _Qaxis = ''
     xDat = []
     yDat = []
     eDat = []
     ns = 0
     Q = []
     tot = []
-    for m in range(0,ngrp):
-        Qq,nd,xd,yd,ed = ReadInxGroup(asc,m,lgrp)
+    for m in range(0, ngrp):
+        Qq, nd, xd, yd, ed = ReadInxGroup(asc, m, lgrp)
         tot.append(sum(yd))
-        logger.information('Spectrum ' + str(m+1) +' at Q= '+ str(Qq)+' ; Total counts = '+str(tot))
+        logger.information('Spectrum ' + str(m + 1) + ' at Q= ' + str(Qq) + ' ; Total counts = ' + str(tot))
         if ns != 0:
-            Qaxis += ','
-        Qaxis += str(Qq)
+            _Qaxis += ','
+        _Qaxis += str(Qq)
         Q.append(Qq)
-        for n in range(0,nd):
+        for n in range(0, nd):
             xDat.append(xd[n])
             yDat.append(yd[n])
             eDat.append(ed[n])
-        xDat.append(2*xd[nd-1]-xd[nd-2])
+        xDat.append(2 * xd[nd - 1] - xd[nd - 2])
         ns += 1
-    ascWS = fname +'_' +ana+refl +'_inx'
-    outWS = fname +'_' +ana+refl +'_red'
-    CreateWorkspace(OutputWorkspace=ascWS, DataX=xDat, DataY=yDat, DataE=eDat,\
-        Nspec=ns, UnitX='DeltaE')
-    InstrParas(ascWS,instr,ana,refl)
-    efixed = RunParas(ascWS,instr,0,title)
-    pi4 = 4.0*math.pi
-    wave=1.8*math.sqrt(25.2429/efixed)
+    ascWS = fname + '_' + ana + refl + '_inx'
+    outWS = fname + '_' + ana + refl + '_red'
+    CreateWorkspace(OutputWorkspace=ascWS, DataX=xDat, DataY=yDat, DataE=eDat, \
+                    Nspec=ns, UnitX='DeltaE')
+    InstrParas(ascWS, instr, ana, refl)
+    efixed = RunParas(ascWS, instr, 0, title)
+    pi4 = 4.0 * math.pi
+    wave = 1.8 * math.sqrt(25.2429 / efixed)
     theta = []
-    for n in range(0,ngrp):
-        qw = wave*Q[n]/pi4
-        ang = 2.0*math.degrees(math.asin(qw))
+    for n in range(0, ngrp):
+        qw = wave * Q[n] / pi4
+        ang = 2.0 * math.degrees(math.asin(qw))
         theta.append(ang)
-    ChangeAngles(ascWS,instr,theta)
+    ChangeAngles(ascWS, instr, theta)
     if useM:
         map = ReadMap(mapPath)
-        UseMap(ascWS,map)
+        UseMap(ascWS, map)
     if rejectZ:
-        RejectZero(ascWS,tot)
+        RejectZero(ascWS, tot)
     if useM == False and rejectZ == False:
         CloneWorkspace(InputWorkspace=ascWS, OutputWorkspace=outWS)
     if Save:
-        opath = os.path.join(workdir,outWS+'.nxs')
+        opath = os.path.join(workdir, outWS + '.nxs')
         SaveNexusProcessed(InputWorkspace=outWS, Filename=opath)
         logger.information('Output file : ' + opath)
     if Plot:
-        plotForce(outWS,Plot)
+        plotForce(outWS, Plot)
     EndTime('Inx')
 
+
 # General routines
 
-def RejectZero(inWS,tot):
-    nin = mtd[inWS].getNumberHistograms()                      # no. of hist/groups in sam
+def RejectZero(inWS, tot):
+    nin = mtd[inWS].getNumberHistograms()  # no. of hist/groups in sam
     nout = 0
-    outWS = inWS[:-3]+'red'
+    outWS = inWS[:-3] + 'red'
     for n in range(0, nin):
         if tot[n] > 0:
-            ExtractSingleSpectrum(InputWorkspace=inWS, OutputWorkspace='__tmp',\
-                WorkspaceIndex=n)
+            ExtractSingleSpectrum(InputWorkspace=inWS, OutputWorkspace='__tmp', \
+                                  WorkspaceIndex=n)
             if nout == 0:
                 RenameWorkspace(InputWorkspace='__tmp', OutputWorkspace=outWS)
             else:
@@ -369,80 +379,86 @@ def RejectZero(inWS,tot):
                                   CheckOverlapping=False)
             nout += 1
         else:
-            logger.information('** spectrum '+str(n+1)+' rejected')
+            logger.information('** spectrum ' + str(n + 1) + ' rejected')
+
 
 def ReadMap(path):
-    workdir = config['defaultsave.directory']
+    _workdir = config['defaultsave.directory']
 
     asc = loadFile(path)
 
     lasc = len(asc)
-    logger.information('Map file : ' + path +' ; spectra = ' +str(lasc-1))
+    logger.information('Map file : ' + path + ' ; spectra = ' + str(lasc - 1))
     val = ExtractInt(asc[0])
     numb = val[0]
-    if numb != (lasc-1):
+    if numb != (lasc - 1):
         error = 'Number of lines  not equal to number of spectra'
         logger.error(error)
         sys.exit(error)
     map = []
-    for n in range(1,lasc):
+    for n in range(1, lasc):
         val = ExtractInt(asc[n])
         map.append(val[1])
     return map
 
+
 def UseMap(inWS, map):
-    nin = mtd[inWS].getNumberHistograms()                      # no. of hist/groups in sam
+    nin = mtd[inWS].getNumberHistograms()  # no. of hist/groups in sam
     nout = 0
-    outWS = inWS[:-3]+'red'
+    outWS = inWS[:-3] + 'red'
     for n in range(0, nin):
         if map[n] == 1:
-            ExtractSingleSpectrum(InputWorkspace=inWS, OutputWorkspace='__tmp',\
-                WorkspaceIndex=n)
+            ExtractSingleSpectrum(InputWorkspace=inWS, OutputWorkspace='__tmp', \
+                                  WorkspaceIndex=n)
             if nout == 0:
                 RenameWorkspace(InputWorkspace='__tmp', OutputWorkspace=outWS)
             else:
                 ConjoinWorkspaces(InputWorkspace1=outWS, InputWorkspace2='__tmp',
                                   CheckOverlapping=False)
             nout += 1
-            logger.information('** spectrum '+str(n+1)+' mapped')
+            logger.information('** spectrum ' + str(n + 1) + ' mapped')
         else:
-            logger.information('** spectrum '+str(n+1)+' skipped')
+            logger.information('** spectrum ' + str(n + 1) + ' skipped')
+
 
-def plotForce(inWS,Plot):
+def plotForce(inWS, Plot):
     if Plot == 'Spectrum' or Plot == 'Both':
         nHist = mtd[inWS].getNumberHistograms()
-        if nHist > 10 :
+        if nHist > 10:
             nHist = 10
         plot_list = []
         for i in range(0, nHist):
             plot_list.append(i)
-        MTD_PLOT.plotSpectrum(inWS,plot_list)
+        MTD_PLOT.plotSpectrum(inWS, plot_list)
     if Plot == 'Contour' or Plot == 'Both':
         MTD_PLOT.importMatrixWorkspace(inWS).plotGraph2D()
 
-def ChangeAngles(inWS,instr,theta):
+
+def ChangeAngles(inWS, instr, theta):
     workdir = config['defaultsave.directory']
-    filename = instr+'_angles.txt'
+    filename = instr + '_angles.txt'
     path = os.path.join(workdir, filename)
     logger.information('Creating angles file : ' + path)
     handle = open(path, 'w')
     head = 'spectrum,theta'
-    handle.write(head +" \n" )
-    for n in range(0,len(theta)):
-        handle.write(str(n+1) +'   '+ str(theta[n]) +"\n" )
-        logger.information('Spectrum ' +str(n+1)+ ' = '+str(theta[n]))
+    handle.write(head + " \n")
+    for n in range(0, len(theta)):
+        handle.write(str(n + 1) + '   ' + str(theta[n]) + "\n")
+        logger.information('Spectrum ' + str(n + 1) + ' = ' + str(theta[n]))
     handle.close()
-    UpdateInstrumentFromFile(Workspace=inWS, Filename=path, MoveMonitors=False, IgnorePhi=False,\
-        AsciiHeader=head)
+    UpdateInstrumentFromFile(Workspace=inWS, Filename=path, MoveMonitors=False, IgnorePhi=False, \
+                             AsciiHeader=head)
 
-def InstrParas(ws,instr,ana,refl):
+
+def InstrParas(ws, instr, ana, refl):
     idf_dir = config['instrumentDefinition.directory']
     idf = idf_dir + instr + '_Definition.xml'
     LoadInstrument(Workspace=ws, Filename=idf, RewriteSpectraMap=False)
     ipf = idf_dir + instr + '_' + ana + '_' + refl + '_Parameters.xml'
     LoadParameterFile(Workspace=ws, Filename=ipf)
 
-def RunParas(ascWS,instr,run,title):
+
+def RunParas(ascWS, _instr, run, title):
     ws = mtd[ascWS]
     inst = ws.getInstrument()
     AddSampleLog(Workspace=ascWS, LogName="facility", LogType="String", LogText="ILL")
@@ -451,122 +467,124 @@ def RunParas(ascWS,instr,run,title):
     efixed = getEfixed(ascWS)
 
     facility = ws.getRun().getLogData('facility').value
-    logger.information('Facility is ' +facility)
+    logger.information('Facility is ' + facility)
     runNo = ws.getRun()['run_number'].value
     runTitle = ws.getRun()['run_title'].value.strip()
     logger.information('Run : ' + str(runNo) + ' ; Title : ' + runTitle)
     an = inst.getStringParameter('analyser')[0]
     ref = inst.getStringParameter('reflection')[0]
-    logger.information('Analyser : ' +an+ref +' with energy = ' + str(efixed))
+    logger.information('Analyser : ' + an + ref + ' with energy = ' + str(efixed))
 
     return efixed
 
+
 # IN13 routines
 # These routines are specific to loading data for the ILL IN13 instrument
 
-def IN13Start(instr,run,ana,refl,rejectZ,useM,mapPath,Plot,Save):      #Ascii start routine
+def IN13Start(instr, run, ana, refl, _rejectZ, _useM, _mapPath, Plot, Save):  # Ascii start routine
     StartTime('IN13')
-    samWS = IN13Read(instr,run,ana,refl,Plot,Save)
+    _samWS = IN13Read(instr, run, ana, refl, Plot, Save)
     EndTime('IN13')
 
-def IN13Read(instr,run,ana,refl,Plot,Save):      #Ascii start routine
+
+def IN13Read(instr, run, ana, refl, Plot, Save):  # Ascii start routine
     workdir = config['defaultsave.directory']
 
-    path, fname = getFilePath(run,'.asc', instr)
+    path, fname = getFilePath(run, '.asc', instr)
 
     logger.information('Reading file : ' + path)
 
     asc = loadFile(path)
-    lasc = len(asc)
+    _lasc = len(asc)
 
-# header block
+    # header block
     text = asc[1]
     run = text[:8]
-    text = asc[4]    # run line
+    text = asc[4]  # run line
     instr = text[:4]
-    time = text[14:33]   # user line
-    next,Ival = Iblock(asc,5)
+    _time = text[14:33]  # user line
+    next, Ival = Iblock(asc, 5)
     nsubsp = Ival[0]
-    nspec = Ival[153]-2
-# text block
+    nspec = Ival[153] - 2
+    # text block
     text = asc[25]
     title = text[:20]
-# para1 block
-    next,Fval = Fblock(asc,32)
+    # para1 block
+    next, Fval = Fblock(asc, 32)
     ntemp = int(Fval[6])
-    f1 = ntemp/10
+    f1 = ntemp / 10
     ltemp = int(f1)
-    f2 = f1 -10*ltemp
+    f2 = f1 - 10 * ltemp
     if f2 >= 0.:
-        ltemp = ltemp +1
-    wave = 2.0*Fval[81]
+        ltemp = ltemp + 1
+    wave = 2.0 * Fval[81]
 
     logger.information('No. sub-spectra : ' + str(nsubsp))
     logger.information('No. spectra : ' + str(nspec))
-    logger.information('Scan type : ' + str(int(Fval[8]))+\
-        ' ; Average energy : ' + str(Fval[9]))
-    logger.information('CaF2 lattice : ' + str(Fval[81])+\
-        ' ; Graphite lattice : ' + str(Fval[82]))
+    logger.information('Scan type : ' + str(int(Fval[8])) + \
+                       ' ; Average energy : ' + str(Fval[9]))
+    logger.information('CaF2 lattice : ' + str(Fval[81]) + \
+                       ' ; Graphite lattice : ' + str(Fval[82]))
     logger.information('Wavelength : ' + str(wave))
     logger.information('No. temperatures : ' + str(ntemp))
     logger.information('No. temperature lines : ' + str(ltemp))
 
-# para2 block
-    next,Fval = Fblock(asc,next)
+    # para2 block
+    next, Fval = Fblock(asc, next)
     angles = Fval[:nspec]
     logger.information('Angles : ' + str(angles))
-    lspec = 4 +ltemp
-# monitors
-    psd = next + (nspec+2048)*lspec
+    lspec = 4 + ltemp
+    # monitors
+    psd = next + (nspec + 2048) * lspec
     l1m1 = psd + 1
-    txt = asc[l1m1]
-    l2m1 = l1m1 +3
+    _txt = asc[l1m1]
+    l2m1 = l1m1 + 3
     mon1 = ExtractFloat(asc[l2m1])
-    logger.information('Mon1 : Line '+str(l2m1)+' : ' + asc[l2m1])
-# raw spectra
+    logger.information('Mon1 : Line ' + str(l2m1) + ' : ' + asc[l2m1])
+    # raw spectra
     first = next
     xDat = angles
     y2D = []
     e2D = []
-    for n in range(0,nspec):
+    for n in range(0, nspec):
         ylist = []
         elist = []
-        l1 = first + lspec*n + 1
-        logger.information('Line '+str(l1)+' : ' + asc[l1])
-        for l in range(0,ltemp):
+        l1 = first + lspec * n + 1
+        logger.information('Line ' + str(l1) + ' : ' + asc[l1])
+        for l in range(0, ltemp):
             l2 = l1 + 3 + l
             val = ExtractFloat(asc[l2])
             nval = len(val)
-            for m in range(0,nval):
-                ylist.append(val[m]/mon1[m])
-                elist.append(math.sqrt(val[m])/mon1[m])
+            for m in range(0, nval):
+                ylist.append(val[m] / mon1[m])
+                elist.append(math.sqrt(val[m]) / mon1[m])
         y2D.append(ylist)
         e2D.append(elist)
-# create WS
+    # create WS
     npt = len(xDat)
-    xDat.append(2*xDat[npt-1]-xDat[npt-2])
+    xDat.append(2 * xDat[npt - 1] - xDat[npt - 2])
     ascWS = fname + '_' + ana + refl + '_ang'
     outWS = fname + '_' + ana + refl + '_q'
     xD = np.array(xDat)
-    k0 = 4*math.pi/wave
+    k0 = 4 * math.pi / wave
     Q = []
-    for n in range(0,nspec):
+    for n in range(0, nspec):
         if angles[n] >= 180.0:
             angles[n] = 360.0 - angles[n]
-        theta = math.radians(angles[n]/2.)
-        qq = k0*math.sin(theta)
+        theta = math.radians(angles[n] / 2.)
+        qq = k0 * math.sin(theta)
         Q.append(qq)
     Qa = np.array(Q)
-    sorted_indices=Qa.argsort()
-    sorted_Q=Qa[sorted_indices]
+    sorted_indices = Qa.argsort()
+    sorted_Q = Qa[sorted_indices]
     lxdq = len(sorted_Q)
-    xlast = 2*sorted_Q[lxdq-1]-sorted_Q[lxdq-2]
-    sorted_Q = np.append(sorted_Q,xlast)
+    xlast = 2 * sorted_Q[lxdq - 1] - sorted_Q[lxdq - 2]
+    sorted_Q = np.append(sorted_Q, xlast)
     xDq = sorted_Q
-    for m in range(0,nval):
+    for m in range(0, nval):
         ylist = []
         elist = []
-        for n in range(0,nspec):
+        for n in range(0, nspec):
             ylist.append(y2D[n][m])
             elist.append(e2D[n][m])
         y1D = np.array(ylist)
@@ -581,35 +599,36 @@ def IN13Read(instr,run,ana,refl,Plot,Save):      #Ascii start routine
             yDq = y1Dq
             eDq = e1Dq
         else:
-            xData = np.append(xData,xD)
-            yData = np.append(yData,y1D)
-            eData = np.append(eData,e1D)
-            xDq = np.append(xDq,sorted_Q)
-            yDq = np.append(yDq,y1Dq)
-            eDq = np.append(eDq,e1Dq)
-    CreateWorkspace(OutputWorkspace=ascWS, DataX=xData, DataY=yData, DataE=eData,\
-        Nspec=3, UnitX='MomentumTransfer')
-    IN13Paras(ascWS,run,title,wave)
-    CreateWorkspace(OutputWorkspace=outWS, DataX=xDq, DataY=yDq, DataE=eDq,\
-        Nspec=3, UnitX='MomentumTransfer')
-    IN13Paras(outWS,run,title,wave)
+            xData = np.append(xData, xD)
+            yData = np.append(yData, y1D)
+            eData = np.append(eData, e1D)
+            xDq = np.append(xDq, sorted_Q)
+            yDq = np.append(yDq, y1Dq)
+            eDq = np.append(eDq, e1Dq)
+    CreateWorkspace(OutputWorkspace=ascWS, DataX=xData, DataY=yData, DataE=eData, \
+                    Nspec=3, UnitX='MomentumTransfer')
+    IN13Paras(ascWS, run, title, wave)
+    CreateWorkspace(OutputWorkspace=outWS, DataX=xDq, DataY=yDq, DataE=eDq, \
+                    Nspec=3, UnitX='MomentumTransfer')
+    IN13Paras(outWS, run, title, wave)
     if Save:
-        opath = os.path.join(workdir,outWS+'.nxs')
+        opath = os.path.join(workdir, outWS + '.nxs')
         SaveNexusProcessed(InputWorkspace=outWS, Filename=opath)
         logger.information('Output file : ' + opath)
     if Plot != 'None':
-        plotForce(outWS,Plot)
+        plotForce(outWS, Plot)
     return outWS
 
-def IN13Paras(ascWS,run,title,wave):
+
+def IN13Paras(ascWS, run, title, wave):
     ws = mtd[ascWS]
     AddSampleLog(Workspace=ascWS, LogName="facility", LogType="String", LogText="ILL")
     ws.getRun()['run_number'] = run
     ws.getRun()['run_title'] = title
 
     facility = ws.getRun().getLogData('facility').value
-    logger.information('Facility is ' +facility)
+    logger.information('Facility is ' + facility)
     runNo = ws.getRun()['run_number'].value
     runTitle = ws.getRun()['run_title'].value.strip()
-    logger.information('Run : ' +runNo + ' ; Title : ' + runTitle)
+    logger.information('Run : ' + runNo + ' ; Title : ' + runTitle)
     logger.information('Wavelength : ' + str(wave))
diff --git a/scripts/Interface/ui/reflectometer/refl_gui.py b/scripts/Interface/ui/reflectometer/refl_gui.py
index db30e4ab3a689379a6b64bb3a56fe5ebd9e74eda..6fdad80c55a8246eaa33b525ab3243a91ba016cb 100644
--- a/scripts/Interface/ui/reflectometer/refl_gui.py
+++ b/scripts/Interface/ui/reflectometer/refl_gui.py
@@ -788,9 +788,6 @@ class ReflGui(QtGui.QMainWindow, ui_refl_window.Ui_windowRefl):
                                 overlapLow.append(qmin)
                             if self.tableMain.item(row, i * 5 + 4).text() == '':
                                 item = QtGui.QTableWidgetItem()
-                                if i == len(runno) - 1:
-                                # allow full high q-range for last angle
-                                    qmax = 4 * math.pi / ((4 * math.pi / qmax * math.sin(theta * math.pi / 180)) - 0.5) * math.sin(theta * math.pi / 180)
                                 item.setText(str(qmax))
                                 self.tableMain.setItem(row, i * 5 + 4, item)
                                 overlapHigh.append(qmax)
@@ -921,7 +918,7 @@ class ReflGui(QtGui.QMainWindow, ui_refl_window.Ui_windowRefl):
                 outputwksp = runno[0] + '_' + runno[2][3:]
             if not getWorkspace(outputwksp, report_error=False):
                 # Stitching has not been done as part of processing, so we need to do it here.
-                wcomb = combineDataMulti(wkspBinned, outputwksp, overlapLow, overlapHigh, Qmin, Qmax, -dqq, 1,
+                _wcomb = combineDataMulti(wkspBinned, outputwksp, overlapLow, overlapHigh, Qmin, Qmax, -dqq, 1,
                                          keep=True, scale_right=self.__scale_right)
 
             Qmin = min(getWorkspace(outputwksp).readX(0))
@@ -1052,12 +1049,12 @@ class ReflGui(QtGui.QMainWindow, ui_refl_window.Ui_windowRefl):
             inst = wq[0].getInstrument()
         else:
             inst = wq.getInstrument()
-        #NOTE: In the new Refl UI, these adjustments to lmin/lmax are NOT made. This has been
-        #noted in the parameter files for INTER/CRIST/POLREF/SURF.
-        lmin = inst.getNumberParameter('LambdaMin')[0] + 1
-        lmax = inst.getNumberParameter('LambdaMax')[0] - 2
+
+        lmin = inst.getNumberParameter('LambdaMin')[0]
+        lmax = inst.getNumberParameter('LambdaMax')[0]
         qmin = 4 * math.pi / lmax * math.sin(th * math.pi / 180)
         qmax = 4 * math.pi / lmin * math.sin(th * math.pi / 180)
+
         return th, qmin, qmax, wlam, wq
 
     def _save_table_contents(self, filename):
diff --git a/scripts/Interface/ui/sans/hfir_instrument.ui b/scripts/Interface/ui/sans/hfir_instrument.ui
index 01144fa19e01e135b0122c3ad57290170225cf6a..bdfb473f0adbd4d2b848e656886fc612e5de7bdc 100644
--- a/scripts/Interface/ui/sans/hfir_instrument.ui
+++ b/scripts/Interface/ui/sans/hfir_instrument.ui
@@ -123,7 +123,7 @@
 &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
 p, li { white-space: pre-wrap; }
 &lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Bitstream Charter'; font-size:10pt; font-weight:400; font-style:italic;&quot;&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;For more information, go to &lt;a style=&quot;text-decoration: none&quot; href=&quot;http://www.mantidproject.org/Reduction_for_HFIR_SANS&quot;&gt;&lt;span style=&quot; color:#5555ff;&quot;&gt;http://www.mantidproject.org/Reduction_for_HFIR_SANS&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;For more information, go to &lt;a style=&quot;text-decoration: none&quot; href=&quot;http://docs.mantidproject.org/nightly/concepts/ORNL_SANS_Reduction.html&quot;&gt;&lt;span style=&quot; color:#5555ff;&quot;&gt;http://docs.mantidproject.org/nightly/concepts/ORNL_SANS_Reduction.html&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
               </property>
               <property name="openExternalLinks">
                <bool>true</bool>
diff --git a/scripts/MantidIPython/__init__.py b/scripts/MantidIPython/__init__.py
index f4a39903614873bc2d32d5a18c396dd14d8a0675..4ede76d88d070c30442eb2eeda0ed3d9098acbde 100644
--- a/scripts/MantidIPython/__init__.py
+++ b/scripts/MantidIPython/__init__.py
@@ -22,4 +22,9 @@ Some tools for use in ipython notebooks generated by Mantid.
 """
 
 from MantidIPython.plot_functions import *
+import warnings
+import mantid.kernel
 
+# Check if the version of Mantid being used matches the version which created the notebook.
+if "3.5.20160108.1509" != mantid.kernel.version_str():
+    warnings.warn("Version of Mantid being used does not match version which created the notebook.")
diff --git a/scripts/MantidIPython/plot_functions.py b/scripts/MantidIPython/plot_functions.py
index 7b5a8d1697824d784704263a335b2a390c4bf828..5cf53680e10ccc9dfbe1935f3e9a352835741500 100644
--- a/scripts/MantidIPython/plot_functions.py
+++ b/scripts/MantidIPython/plot_functions.py
@@ -4,18 +4,8 @@ Plotting functions for use in IPython notebooks that are generated by MantidPlot
 
 import matplotlib.pyplot as plt
 
-# This code block should be removed once an ipython launch script exists
-# on all platforms (issue #13728)
-import sys
-import os
-CURRENT_DIR = os.getcwd()
-LIB_PATH = os.path.join(CURRENT_DIR.split('Code')[0], 'Code/debug/bin')
-if os.path.exists(LIB_PATH) is False:
-    LIB_PATH = os.path.join(CURRENT_DIR.split('Code')[0], 'Code/release/bin')
-sys.path.append(LIB_PATH)
-
 # Import Mantid
-import mantid.simpleapi as api
+from mantid.simpleapi import *
 import mantid.api as mapi
 
 
@@ -25,7 +15,7 @@ def _plot_with_options(axes_option, workspace, options_list, plot_number):
     options (ops) for the given axes (ax).
     Plot with or without errorbars.
     """
-    ws_plot = api.ConvertToPointData(workspace)
+    ws_plot = ConvertToPointData(workspace)
     if options_list['errorbars']:
         axes_option.errorbar(ws_plot.readX(0), ws_plot.readY(0),
                              yerr=ws_plot.readE(0), label=workspace.name())
diff --git a/tools/scripts/CorrectConceptLinksinAlgPages.py b/tools/scripts/CorrectConceptLinksinAlgPages.py
index 7dcd787a465a2a84151c64ec152e6b0f2ba720c7..3731c1d8474dceb24960bdd5f559cd2e6982dcf6 100644
--- a/tools/scripts/CorrectConceptLinksinAlgPages.py
+++ b/tools/scripts/CorrectConceptLinksinAlgPages.py
@@ -38,7 +38,6 @@ concepts = ['Algorithm',
             'Shared_Pointer',
             'Table_Workspaces',
             'Unit_Factory',
-            'UserAlgorithms',
             'Workflow_Algorithm',
             'Workspace',
             'Workspace2D',