diff --git a/.gitignore b/.gitignore
index 8f718aea18f8228889f4966d3e05d98422a63c57..5a12c9f6778a0f6d3d7e41243a29ccdc903a43d4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -166,7 +166,7 @@ Desktop.ini
 .tags
 .tags_sorted_by_file
 
-Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/inc/MantidVatesSimpleGuiViewWidgets/LibHelper.h
+Vates/VatesSimpleGui/ViewWidgets/inc/MantidVatesSimpleGuiViewWidgets/LibHelper.h
 
 
 # Make sure Third_Party doesn't get checked into the main repository
diff --git a/Framework/API/inc/MantidAPI/AlgorithmProxy.h b/Framework/API/inc/MantidAPI/AlgorithmProxy.h
index ef45cafbbf59b8bce4303063b7ae87fb6a73fa05..cc2c06272044a8d3aee5889ffdb1da9975de73aa 100644
--- a/Framework/API/inc/MantidAPI/AlgorithmProxy.h
+++ b/Framework/API/inc/MantidAPI/AlgorithmProxy.h
@@ -116,6 +116,8 @@ public:
   void setPropertyValue(const std::string &name, const std::string &value);
   /// Do something after a property was set
   void afterPropertySet(const std::string &);
+  /// Make m_properties point to the same PropertyManager as po.
+  void copyPropertiesFrom(const PropertyManagerOwner &po);
   //@}
 
   void cancel();
diff --git a/Framework/API/inc/MantidAPI/DeprecatedAlgorithm.h b/Framework/API/inc/MantidAPI/DeprecatedAlgorithm.h
index 68c8250521e5bb0c2d476a682a009ac44c851898..f48837d236cb6925ef562a70ff597d62b28fc7db 100644
--- a/Framework/API/inc/MantidAPI/DeprecatedAlgorithm.h
+++ b/Framework/API/inc/MantidAPI/DeprecatedAlgorithm.h
@@ -52,7 +52,7 @@ private:
   /// Replacement version, -1 indicates latest
   int m_replacementVersion;
   /// The date that the algorithm was first deprecated.
-  std::string m_deprecatdDate;
+  std::string m_deprecatedDate;
 };
 
 } // namespace API
diff --git a/Framework/API/src/Algorithm.cpp b/Framework/API/src/Algorithm.cpp
index e95b083c084a4db9beba993a20643fbb9c1f1d85..860a17a3d66cb681fd368d2f87a4f69347f5af71 100644
--- a/Framework/API/src/Algorithm.cpp
+++ b/Framework/API/src/Algorithm.cpp
@@ -1278,11 +1278,13 @@ bool Algorithm::processGroups() {
   // ---------- Create all the output workspaces ----------------------------
   for (size_t owp = 0; owp < m_pureOutputWorkspaceProps.size(); owp++) {
     Property *prop = dynamic_cast<Property *>(m_pureOutputWorkspaceProps[owp]);
-    WorkspaceGroup_sptr outWSGrp = WorkspaceGroup_sptr(new WorkspaceGroup());
-    outGroups.push_back(outWSGrp);
-    // Put the GROUP in the ADS
-    AnalysisDataService::Instance().addOrReplace(prop->value(), outWSGrp);
-    outWSGrp->observeADSNotifications(false);
+    if (prop) {
+      WorkspaceGroup_sptr outWSGrp = WorkspaceGroup_sptr(new WorkspaceGroup());
+      outGroups.push_back(outWSGrp);
+      // Put the GROUP in the ADS
+      AnalysisDataService::Instance().addOrReplace(prop->value(), outWSGrp);
+      outWSGrp->observeADSNotifications(false);
+    }
   }
 
   // Go through each entry in the input group(s)
diff --git a/Framework/API/src/AlgorithmProxy.cpp b/Framework/API/src/AlgorithmProxy.cpp
index a400d76b3943ccaab4a31a82474c523b4be6f1b9..c1a77746b23d389a16f10c89c606aaa192430d24 100644
--- a/Framework/API/src/AlgorithmProxy.cpp
+++ b/Framework/API/src/AlgorithmProxy.cpp
@@ -218,6 +218,17 @@ void AlgorithmProxy::afterPropertySet(const std::string &name) {
   copyPropertiesFrom(*m_alg);
 }
 
+/**
+ * Copy properties from another property manager
+ * Making sure that the concrete alg is kept in sync
+ * @param po :: The property manager to copy
+ */
+void AlgorithmProxy::copyPropertiesFrom(const PropertyManagerOwner &po) {
+  PropertyManagerOwner::copyPropertiesFrom(po);
+  createConcreteAlg(true);
+  m_alg->copyPropertiesFrom(*this);
+}
+
 //----------------------------------------------------------------------
 // Private methods
 //----------------------------------------------------------------------
diff --git a/Framework/API/src/DeprecatedAlgorithm.cpp b/Framework/API/src/DeprecatedAlgorithm.cpp
index 095b870de6dce2c5493b60e1b42277f86d52a730..804e2e0ca5c0caa89d57d3944d32415fcfd7f188 100644
--- a/Framework/API/src/DeprecatedAlgorithm.cpp
+++ b/Framework/API/src/DeprecatedAlgorithm.cpp
@@ -13,7 +13,7 @@ Kernel::Logger g_log("DeprecatedAlgorithm");
 
 /// Does nothing other than make the compiler happy.
 DeprecatedAlgorithm::DeprecatedAlgorithm()
-    : m_replacementAlgorithm(), m_replacementVersion(-1), m_deprecatdDate() {}
+    : m_replacementAlgorithm(), m_replacementVersion(-1), m_deprecatedDate() {}
 
 /// Does nothing other than make the compiler happy.
 DeprecatedAlgorithm::~DeprecatedAlgorithm() {}
@@ -37,7 +37,7 @@ void DeprecatedAlgorithm::useAlgorithm(const std::string &replacement,
 
 /// The date the algorithm was deprecated on
 void DeprecatedAlgorithm::deprecatedDate(const std::string &date) {
-  this->m_deprecatdDate = "";
+  this->m_deprecatedDate = "";
   if (date.empty()) {
     // TODO warn people that it wasn't set
     return;
@@ -46,7 +46,7 @@ void DeprecatedAlgorithm::deprecatedDate(const std::string &date) {
     // TODO warn people that it wasn't set
     return;
   }
-  this->m_deprecatdDate = date;
+  this->m_deprecatedDate = date;
 }
 
 /// This merely prints the deprecation error for people to see.
@@ -57,8 +57,8 @@ const std::string DeprecatedAlgorithm::deprecationMsg(const IAlgorithm *algo) {
 
   msg << "deprecated";
 
-  if (!this->m_deprecatdDate.empty())
-    msg << " (on " << this->m_deprecatdDate << ")";
+  if (!this->m_deprecatedDate.empty())
+    msg << " (on " << this->m_deprecatedDate << ")";
 
   if (this->m_replacementAlgorithm.empty()) {
     msg << " and has no replacement.";
diff --git a/Framework/API/src/ExperimentInfo.cpp b/Framework/API/src/ExperimentInfo.cpp
index 26a61864f6b9927aad85b761c5e985a894de8ce7..3ddd52bfdf0bbefe09fb0864bbf10fd4f1ba0e93 100644
--- a/Framework/API/src/ExperimentInfo.cpp
+++ b/Framework/API/src/ExperimentInfo.cpp
@@ -1149,7 +1149,7 @@ void ExperimentInfo::readParameterMap(const std::string &parameterStr) {
     // if( comp_name == prev_name ) continue; this blocks reading in different
     // parameters of the same component. RNT
     // prev_name = comp_name;
-    const Geometry::IComponent *comp = 0;
+    const Geometry::IComponent *comp = NULL;
     if (comp_name.find("detID:") != std::string::npos) {
       int detID = atoi(comp_name.substr(6).c_str());
       comp = instr->getDetector(detID).get();
@@ -1164,8 +1164,7 @@ void ExperimentInfo::readParameterMap(const std::string &parameterStr) {
         continue;
       }
     }
-    if (!comp)
-      continue;
+
     // create parameter's value as a sum of all tokens with index 3 or larger
     // this allow a parameter's value to contain ";"
     std::string paramValue = tokens[3];
diff --git a/Framework/API/src/FunctionFactory.cpp b/Framework/API/src/FunctionFactory.cpp
index 5d2a0a1aad401f3cebf7326d1219a3edf99798c1..29a5ec54767c1b593c9cf2e3c028f262707968d6 100644
--- a/Framework/API/src/FunctionFactory.cpp
+++ b/Framework/API/src/FunctionFactory.cpp
@@ -192,6 +192,9 @@ CompositeFunction_sptr FunctionFactoryImpl::createComposite(
     inputError(expr.str());
   }
 
+  if (!cfun)
+    inputError(expr.str());
+
   for (; it != terms.end(); ++it) {
     const Expression &term = it->bracketsRemoved();
     IFunction_sptr fun;
diff --git a/Framework/API/src/NumericAxis.cpp b/Framework/API/src/NumericAxis.cpp
index 819ad1a5445b13c0a0415db954d2b2650bfe0d60..d609325a2397082f50219cfd5610807e58ae826c 100644
--- a/Framework/API/src/NumericAxis.cpp
+++ b/Framework/API/src/NumericAxis.cpp
@@ -191,9 +191,9 @@ std::string NumericAxis::label(const std::size_t &index) const {
   auto it = numberLabel.end() - 1;
   for (; it != numberLabel.begin(); --it) {
     if (*it == '0') {
-      numberLabel.erase(it);
+      it = numberLabel.erase(it);
     } else if (*it == '.') {
-      numberLabel.erase(it);
+      it = numberLabel.erase(it);
       break;
     } else {
       break;
diff --git a/Framework/API/src/WorkspaceOpOverloads.cpp b/Framework/API/src/WorkspaceOpOverloads.cpp
index cfd3595724a9d60b327e5565606e1b504442491d..f29bca1ca5fe27a3bd029a203c5169e2eb8c3897 100644
--- a/Framework/API/src/WorkspaceOpOverloads.cpp
+++ b/Framework/API/src/WorkspaceOpOverloads.cpp
@@ -5,11 +5,11 @@
 #include "MantidAPI/Algorithm.h"
 #include "MantidAPI/AlgorithmManager.h"
 #include "MantidKernel/Property.h"
-#include "MantidKernel/Exception.h"
+//#include "MantidKernel/Exception.h"
 #include "MantidAPI/MatrixWorkspace.h"
 #include "MantidAPI/IWorkspaceProperty.h"
 #include "MantidAPI/WorkspaceFactory.h"
-#include "MantidAPI/SpectraAxis.h"
+//#include "MantidAPI/SpectraAxis.h"
 #include "MantidAPI/IMDWorkspace.h"
 #include "MantidAPI/IMDHistoWorkspace.h"
 #include "MantidAPI/WorkspaceGroup_fwd.h"
@@ -67,30 +67,20 @@ ResultType executeBinaryOperation(const std::string &algorithmName,
 
   alg->execute();
 
-  if (alg->isExecuted()) {
-    // Get the output workspace property
-    if (child) {
-      return alg->getProperty("OutputWorkspace");
-    } else {
-      API::Workspace_sptr result =
-          API::AnalysisDataService::Instance().retrieve(
-              alg->getPropertyValue("OutputWorkspace"));
-      return boost::dynamic_pointer_cast<typename ResultType::element_type>(
-          result);
-    }
-  } else {
+  if (!alg->isExecuted()) {
     std::string message = "Error while executing operation: " + algorithmName;
     throw std::runtime_error(message);
   }
 
-  throw Kernel::Exception::NotFoundError(
-      "Required output workspace property not found on Child Algorithm",
-      "OutputWorkspace");
-
-  // Horendous code inclusion to satisfy compilers that all code paths return a
-  // value
-  // in reality the above code should either throw or return successfully.
-  return ResultType();
+  // Get the output workspace property
+  if (child) {
+    return alg->getProperty("OutputWorkspace");
+  } else {
+    API::Workspace_sptr result = API::AnalysisDataService::Instance().retrieve(
+        alg->getPropertyValue("OutputWorkspace"));
+    return boost::dynamic_pointer_cast<typename ResultType::element_type>(
+        result);
+  }
 }
 
 template DLLExport MatrixWorkspace_sptr
@@ -169,14 +159,12 @@ bool equals(const MatrixWorkspace_sptr lhs, const MatrixWorkspace_sptr rhs,
   // Rest: use default
 
   alg->execute();
-  if (alg->isExecuted()) {
-    return (alg->getPropertyValue("Result") == "Success!");
-  } else {
+  if (!alg->isExecuted()) {
     std::string message =
         "Error while executing operation: CheckWorkspacesMatch";
     throw std::runtime_error(message);
   }
-  return false;
+  return (alg->getPropertyValue("Result") == "Success!");
 }
 
 /** Creates a temporary single value workspace the error is set to zero
@@ -512,17 +500,18 @@ bool WorkspaceHelpers::matchingBins(const MatrixWorkspace_const_sptr ws1,
   if (!step)
     step = 1;
   for (size_t i = step; i < numHist; i += step) {
-    const double firstWS =
+    const double firstWSLoop =
         std::accumulate(ws1->readX(i).begin(), ws1->readX(i).end(), 0.);
-    const double secondWS =
+    const double secondWSLoop =
         std::accumulate(ws2->readX(i).begin(), ws2->readX(i).end(), 0.);
-    if (std::abs(firstWS) < 1.0E-7 && std::abs(secondWS) < 1.0E-7) {
+    if (std::abs(firstWSLoop) < 1.0E-7 && std::abs(secondWSLoop) < 1.0E-7) {
       for (size_t j = 0; j < ws1->readX(i).size(); j++) {
         if (std::abs(ws1->readX(i)[j] - ws2->readX(i)[j]) > 1.0E-7)
           return false;
       }
-    } else if (std::abs(firstWS - secondWS) /
-                   std::max<double>(std::abs(firstWS), std::abs(secondWS)) >
+    } else if (std::abs(firstWSLoop - secondWSLoop) /
+                   std::max<double>(std::abs(firstWSLoop),
+                                    std::abs(secondWSLoop)) >
                1.0E-7)
       return false;
   }
diff --git a/Framework/API/test/AlgorithmProxyTest.h b/Framework/API/test/AlgorithmProxyTest.h
index 8c50e2e0dcd53e09f3d9ce26df5d78dd7f952dd2..6e8cafd780007d1caedf0087baf6c4936736b8c6 100644
--- a/Framework/API/test/AlgorithmProxyTest.h
+++ b/Framework/API/test/AlgorithmProxyTest.h
@@ -212,6 +212,30 @@ public:
     }
     TS_ASSERT_EQUALS("InputWorkspace", alg->workspaceMethodInputProperty());
   }
+
+  void test_copyPropertiesFrom() {
+    IAlgorithm_sptr alg =
+        AlgorithmManager::Instance().create("ToyAlgorithmProxy");
+    alg->initialize();
+    alg->setPropertyValue("prop1", "string");
+    alg->setPropertyValue("prop2", "1");
+    IAlgorithm_sptr algCopy =
+        AlgorithmManager::Instance().create("ToyAlgorithmProxy");
+
+    auto algProxy = boost::dynamic_pointer_cast<AlgorithmProxy>(alg);
+    auto algCopyProxy = boost::dynamic_pointer_cast<AlgorithmProxy>(algCopy);
+    algCopyProxy->copyPropertiesFrom(*algProxy);
+
+    int val = boost::lexical_cast<int>(algCopy->getPropertyValue("prop2"));
+
+    TS_ASSERT_EQUALS(val, 1);
+
+    // set another value and check the other value is unaffected
+    algCopy->setPropertyValue("prop1", "A difference");
+    int val2 = boost::lexical_cast<int>(algCopy->getPropertyValue("prop2"));
+
+    TS_ASSERT_EQUALS(val, val2);
+  }
 };
 
 #endif /*ALGORITHMPROXYTEST_H_*/
diff --git a/Framework/Algorithms/src/AlignDetectors.cpp b/Framework/Algorithms/src/AlignDetectors.cpp
index fc3442fd1720e1054631093998b53a4860dc95c8..742f56343e698b4fae2c524d7927248922e68e0c 100644
--- a/Framework/Algorithms/src/AlignDetectors.cpp
+++ b/Framework/Algorithms/src/AlignDetectors.cpp
@@ -153,7 +153,9 @@ const std::string AlignDetectors::summary() const {
 }
 
 /// (Empty) Constructor
-AlignDetectors::AlignDetectors() { this->tofToDmap = NULL; }
+AlignDetectors::AlignDetectors() : m_numberOfSpectra(0) {
+  this->tofToDmap = NULL;
+}
 
 /// Destructor
 AlignDetectors::~AlignDetectors() { delete this->tofToDmap; }
diff --git a/Framework/Algorithms/src/CorelliCrossCorrelate.cpp b/Framework/Algorithms/src/CorelliCrossCorrelate.cpp
index cc44de1f5a4eddfc2a540b31dc094a8fb5f022b9..75bfd01219154690408f807d50bf75f27aa7cc33 100644
--- a/Framework/Algorithms/src/CorelliCrossCorrelate.cpp
+++ b/Framework/Algorithms/src/CorelliCrossCorrelate.cpp
@@ -170,6 +170,11 @@ void CorelliCrossCorrelate::exec() {
   // Determine period from chopper frequency.
   auto motorSpeed = dynamic_cast<TimeSeriesProperty<double> *>(
       inputWS->run().getProperty("BL9:Chop:Skf4:MotorSpeed"));
+  if (!motorSpeed) {
+    throw Exception::NotFoundError(
+        "Could not find a log value for the motor speed",
+        "BL9:Chop:Skf4:MotorSpeed");
+  }
   double period = 1e9 / static_cast<double>(motorSpeed->timeAverageValue());
   g_log.information() << "Frequency = " << 1e9 / period
                       << "Hz Period = " << period << "ns\n";
diff --git a/Framework/Algorithms/src/CreateDummyCalFile.cpp b/Framework/Algorithms/src/CreateDummyCalFile.cpp
index d7c9020aaf9ecfded65339768e765ff11d20f89b..a13e9ba5626e143f39053f6c44d5f3dea6f87ca6 100644
--- a/Framework/Algorithms/src/CreateDummyCalFile.cpp
+++ b/Framework/Algorithms/src/CreateDummyCalFile.cpp
@@ -111,7 +111,7 @@ void CreateDummyCalFile::exec() {
   std::string filename = getProperty("CalFilename");
 
   // Plan to overwrite file, so do not check if it exists
-  bool overwrite = false;
+  const bool overwrite = false;
 
   int number = 0;
   Progress prog(this, 0.0, 0.8, assemblies.size());
diff --git a/Framework/Algorithms/src/FFT.cpp b/Framework/Algorithms/src/FFT.cpp
index f8e6db3c74314b67a7c712256543b0733b55e805..1d6f94e2bf38fe60405370cd002df6453f65d240 100644
--- a/Framework/Algorithms/src/FFT.cpp
+++ b/Framework/Algorithms/src/FFT.cpp
@@ -172,7 +172,7 @@ void FFT::exec() {
   // centerShift == true means that the zero on the x axis is assumed to be in
   // the data centre
   // at point with index i = ySize/2. If shift == false the zero is at i = 0
-  bool centerShift = true;
+  const bool centerShift = true;
 
   API::TextAxis *tAxis = new API::TextAxis(nOut);
   int iRe = 0;
diff --git a/Framework/Algorithms/src/FindPeakBackground.cpp b/Framework/Algorithms/src/FindPeakBackground.cpp
index f5de226028bff2fb6f34e25ccc26c37f68d85f66..047bb0748a29536e74291b11089fd189ca149331 100644
--- a/Framework/Algorithms/src/FindPeakBackground.cpp
+++ b/Framework/Algorithms/src/FindPeakBackground.cpp
@@ -157,7 +157,7 @@ void FindPeakBackground::exec() {
     Statistics stats = getStatistics(maskedY);
     Ymean = stats.mean;
     Yvariance = stats.standard_deviation * stats.standard_deviation;
-    Ysigma = std::sqrt((moment4(maskedY, n - l0, Ymean) -
+    Ysigma = std::sqrt((moment4(maskedY, static_cast<size_t>(xn), Ymean) -
                         (xn - 3.0) / (xn - 1.0) * Yvariance) /
                        xn);
     MantidVec::const_iterator it =
diff --git a/Framework/Algorithms/src/MonitorEfficiencyCorUser.cpp b/Framework/Algorithms/src/MonitorEfficiencyCorUser.cpp
index 726ecc5d1e00e1cfc1727f220325f93c0b7294e0..5278427de9e61d573a00f6cdee0ed2b5462857e7 100644
--- a/Framework/Algorithms/src/MonitorEfficiencyCorUser.cpp
+++ b/Framework/Algorithms/src/MonitorEfficiencyCorUser.cpp
@@ -16,7 +16,8 @@ DECLARE_ALGORITHM(MonitorEfficiencyCorUser)
 //----------------------------------------------------------------------------------------------
 /** Constructor
  */
-MonitorEfficiencyCorUser::MonitorEfficiencyCorUser() {}
+MonitorEfficiencyCorUser::MonitorEfficiencyCorUser()
+    : m_inputWS(), m_outputWS(), m_Ei(.0), m_monitorCounts(0) {}
 
 //----------------------------------------------------------------------------------------------
 /** Destructor
diff --git a/Framework/Algorithms/src/RemovePromptPulse.cpp b/Framework/Algorithms/src/RemovePromptPulse.cpp
index 55e9260057b2c6c08fc1d9eb733e2af0a9ffdfe4..ae43e1db8dbe835485aa5c68b3b806afb63fd5b4 100644
--- a/Framework/Algorithms/src/RemovePromptPulse.cpp
+++ b/Framework/Algorithms/src/RemovePromptPulse.cpp
@@ -71,7 +71,7 @@ void getTofRange(MatrixWorkspace_const_sptr wksp, double &tmin, double &tmax) {
   DataObjects::EventWorkspace_const_sptr eventWksp =
       boost::dynamic_pointer_cast<const DataObjects::EventWorkspace>(wksp);
 
-  bool isEvent = false;
+  const bool isEvent = false;
   if (isEvent) {
     eventWksp->getEventXMinMax(tmin, tmax);
   } else {
diff --git a/Framework/Crystal/src/FilterPeaks.cpp b/Framework/Crystal/src/FilterPeaks.cpp
index 8e398c2b0de67a54cfba1205285caa2be5a0808c..f60acecea9586ca7449801c11b174ecdbefd7e16 100644
--- a/Framework/Crystal/src/FilterPeaks.cpp
+++ b/Framework/Crystal/src/FilterPeaks.cpp
@@ -98,6 +98,8 @@ void FilterPeaks::exec() {
     filterFunction = &intensity;
   else if (FilterVariable == "Signal/Noise")
     filterFunction = &SN;
+  else
+    throw std::invalid_argument("Unknown FilterVariable: " + FilterVariable);
 
   const double FilterValue = getProperty("FilterValue");
   const std::string Operator = getProperty("Operator");
diff --git a/Framework/Crystal/src/LoadIsawSpectrum.cpp b/Framework/Crystal/src/LoadIsawSpectrum.cpp
index cf96079cac60faa533d647dc7ecfc0ede0417c67..2c5a6da66ba1706e9aa415a2cdbd27c3755d84ad 100644
--- a/Framework/Crystal/src/LoadIsawSpectrum.cpp
+++ b/Framework/Crystal/src/LoadIsawSpectrum.cpp
@@ -68,38 +68,24 @@ void LoadIsawSpectrum::exec() {
   std::vector<std::vector<double>> spectra;
   std::vector<std::vector<double>> time;
   int iSpec = 0;
-  if (iSpec == 1) {
-    while (!infile.eof()) // To get you all the lines.
-    {
-      // Set up sizes. (HEIGHT x WIDTH)
-      spectra.resize(a + 1);
-      getline(infile, STRING); // Saves the line in STRING.
-      infile >> spec[0] >> spec[1] >> spec[2] >> spec[3] >> spec[4] >>
-          spec[5] >> spec[6] >> spec[7] >> spec[8] >> spec[9] >> spec[10];
-      for (int i = 0; i < 11; i++)
-        spectra[a].push_back(spec[i]);
-      a++;
-    }
-  } else {
-    for (int wi = 0; wi < 8; wi++)
-      getline(infile, STRING); // Saves the line in STRING.
-    while (!infile.eof())      // To get you all the lines.
-    {
-      time.resize(a + 1);
-      spectra.resize(a + 1);
-      getline(infile, STRING); // Saves the line in STRING.
-      if (infile.eof())
-        break;
-      std::stringstream ss(STRING);
-      if (STRING.find("Bank") == std::string::npos) {
-        double time0, spectra0;
-        ss >> time0 >> spectra0;
-        time[a].push_back(time0);
-        spectra[a].push_back(spectra0);
+  for (int wi = 0; wi < 8; wi++)
+    getline(infile, STRING); // Saves the line in STRING.
+  while (!infile.eof())      // To get you all the lines.
+  {
+    time.resize(a + 1);
+    spectra.resize(a + 1);
+    getline(infile, STRING); // Saves the line in STRING.
+    if (infile.eof())
+      break;
+    std::stringstream ss(STRING);
+    if (STRING.find("Bank") == std::string::npos) {
+      double time0, spectra0;
+      ss >> time0 >> spectra0;
+      time[a].push_back(time0);
+      spectra[a].push_back(spectra0);
 
-      } else {
-        a++;
-      }
+    } else {
+      a++;
     }
   }
   infile.close();
diff --git a/Framework/Crystal/src/SaveHKL.cpp b/Framework/Crystal/src/SaveHKL.cpp
index 2194a1227cd89ff3516e957cba2536031597af5a..0892660f75417fbe9b98815157a12693a1a32eba 100644
--- a/Framework/Crystal/src/SaveHKL.cpp
+++ b/Framework/Crystal/src/SaveHKL.cpp
@@ -229,37 +229,23 @@ void SaveHKL::exec() {
     infile.open(spectraFile.c_str());
     if (infile.is_open()) {
       size_t a = 0;
-      if (iSpec == 1) {
-        while (!infile.eof()) // To get you all the lines.
-        {
-          // Set up sizes. (HEIGHT x WIDTH)
-          spectra.resize(a + 1);
-          getline(infile, STRING); // Saves the line in STRING.
-          infile >> spec[0] >> spec[1] >> spec[2] >> spec[3] >> spec[4] >>
-              spec[5] >> spec[6] >> spec[7] >> spec[8] >> spec[9] >> spec[10];
-          for (int i = 0; i < 11; i++)
-            spectra[a].push_back(spec[i]);
+      for (int wi = 0; wi < 8; wi++)
+        getline(infile, STRING); // Saves the line in STRING.
+      while (!infile.eof())      // To get you all the lines.
+      {
+        time.resize(a + 1);
+        spectra.resize(a + 1);
+        getline(infile, STRING); // Saves the line in STRING.
+        std::stringstream ss(STRING);
+        if (STRING.find("Bank") == std::string::npos) {
+          double time0, spectra0;
+          ss >> time0 >> spectra0;
+          time[a].push_back(time0);
+          spectra[a].push_back(spectra0);
+
+        } else {
           a++;
         }
-      } else {
-        for (int wi = 0; wi < 8; wi++)
-          getline(infile, STRING); // Saves the line in STRING.
-        while (!infile.eof())      // To get you all the lines.
-        {
-          time.resize(a + 1);
-          spectra.resize(a + 1);
-          getline(infile, STRING); // Saves the line in STRING.
-          std::stringstream ss(STRING);
-          if (STRING.find("Bank") == std::string::npos) {
-            double time0, spectra0;
-            ss >> time0 >> spectra0;
-            time[a].push_back(time0);
-            spectra[a].push_back(spectra0);
-
-          } else {
-            a++;
-          }
-        }
       }
       infile.close();
     }
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters.h
index ae51ee6bc546147d19ee3d365b728512e0bf0641..9d3eeba57a4f02f257190c767a07f51f4f6f6df0 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters.h
@@ -152,43 +152,43 @@ private:
 
   //--------------- Class Variables -------------------
   /// Output Workspace containing the dspacing ~ TOF peak positions
-  DataObjects::Workspace2D_sptr dataWS;
+  DataObjects::Workspace2D_sptr m_dataWS;
 
   /// Map for all peaks to fit individually
-  std::map<std::vector<int>, Functions::BackToBackExponential_sptr> mPeaks;
+  std::map<std::vector<int>, Functions::BackToBackExponential_sptr> m_Peaks;
 
   /// Map for all peaks' error (fitted vs. experimental): [HKL]: Chi^2
-  std::map<std::vector<int>, double> mPeakErrors;
+  std::map<std::vector<int>, double> m_PeakErrors;
 
   /// Map for function (instrument parameter)
-  std::map<std::string, double> mFuncParameters;
+  std::map<std::string, double> m_FuncParameters;
   /// Map to store the original (input) parameters
-  std::map<std::string, double> mOrigParameters;
+  std::map<std::string, double> m_OrigParameters;
 
   /// Peak function parameter names
-  std::vector<std::string> mPeakFunctionParameterNames;
+  std::vector<std::string> m_PeakFunctionParameterNames;
   /// N sets of the peak parameter values for the best N chi2 for MC.  It is
   /// paired with mPeakFunctionParameterNames
-  std::vector<std::pair<double, std::vector<double>>> mBestMCParameters;
+  std::vector<std::pair<double, std::vector<double>>> m_BestMCParameters;
   /// N sets of the peak parameter values for the best N chi2 for MC.  It is
   /// paired with mPeakFunctionParameterNames
-  std::vector<std::pair<double, std::vector<double>>> mBestFitParameters;
+  std::vector<std::pair<double, std::vector<double>>> m_BestFitParameters;
   /// N sets of the homemade chi2 and gsl chi2
-  std::vector<std::pair<double, double>> mBestFitChi2s;
+  std::vector<std::pair<double, double>> m_BestFitChi2s;
   /// Best Chi2 ever
-  double mBestGSLChi2;
+  double m_BestGSLChi2;
 
   /// Minimum allowed sigma of a peak
-  double mMinSigma;
+  double m_MinSigma;
 
   /// Minimum number of fitted peaks for refinement
-  size_t mMinNumFittedPeaks;
+  size_t m_MinNumFittedPeaks;
 
   /// Maximum number of data stored
-  size_t mMaxNumberStoredParameters;
+  size_t m_MaxNumberStoredParameters;
 
   /// Modelling function
-  Functions::ThermalNeutronDtoTOFFunction_sptr mFunction;
+  Functions::ThermalNeutronDtoTOFFunction_sptr m_Function;
 };
 
 /** Formular for linear iterpolation: X = [(xf-x0)*Y - (xf*y0-x0*yf)]/(yf-y0)
diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/GSLMatrix.h b/Framework/CurveFitting/inc/MantidCurveFitting/GSLMatrix.h
index e9e35f7ac6e9d915984bba1aa8a17d91f7c10955..9add0ff7f666e5946222020673c31a24eb6c58d6 100644
--- a/Framework/CurveFitting/inc/MantidCurveFitting/GSLMatrix.h
+++ b/Framework/CurveFitting/inc/MantidCurveFitting/GSLMatrix.h
@@ -241,6 +241,7 @@ inline GSLMatrixMult3 operator*(const GSLMatrixMult2 &mm, const Tr &m) {
 
 /// The << operator. Prints a matrix in rows.
 inline std::ostream &operator<<(std::ostream &ostr, const GSLMatrix &m) {
+  std::ios::fmtflags fflags(ostr.flags());
   ostr << std::scientific << std::setprecision(6);
   for (size_t i = 0; i < m.size1(); ++i) {
     for (size_t j = 0; j < m.size2(); ++j) {
@@ -248,6 +249,7 @@ inline std::ostream &operator<<(std::ostream &ostr, const GSLMatrix &m) {
     }
     ostr << std::endl;
   }
+  ostr.flags(fflags);
   return ostr;
 }
 
diff --git a/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp b/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp
index b69b92fdba2ae6bc11c07eaadbd5e5c46d75924d..87801460543315e7aaccd4501e43e74facf27e8f 100644
--- a/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp
+++ b/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp
@@ -2021,7 +2021,6 @@ bool FitPowderDiffPeaks::doFitMultiplePeaks(
   // 1. Fit peaks intensities first
   const size_t numpeaks = peakfuncs.size();
   map<string, double> peaksfuncparams;
-  bool evergood = true;
 
   // a) Set up fit/fix
   vector<string> peakparnames = peakfuncs[0]->getParameterNames();
@@ -2045,7 +2044,7 @@ bool FitPowderDiffPeaks::doFitMultiplePeaks(
   double chi2;
   bool fitgood = doFitNPeaksSimple(dataws, wsindex, peaksfunc, peakfuncs,
                                    "Levenberg-MarquardtMD", 1000, chi2);
-  evergood = evergood || fitgood;
+  bool evergood = fitgood;
 
   // c) Process result
   if (!fitgood) {
diff --git a/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp b/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp
index 60e3d731b21978a1bb9b3ed92ab4deb36575ab06..21d6e9af3d6c32ae3b6a07aa2cd14487ad0aac60 100644
--- a/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp
+++ b/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp
@@ -341,7 +341,7 @@ void LeBailFit::exec() {
   case FIT:
     // LeBail Fit
     g_log.notice() << "Function: Do LeBail Fit ==> Monte Carlo.\n";
-
+  // fall through
   case MONTECARLO:
     // Monte carlo Le Bail refinement
     g_log.notice("Function: Do LeBail Fit By Monte Carlo Random Walk.");
diff --git a/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters.cpp b/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters.cpp
index 98a64f0b76769673b79f16fcf1fab4ce31aea6d1..80d4fdec61c340ed49b564399931f1824e76dc26 100644
--- a/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters.cpp
+++ b/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters.cpp
@@ -48,7 +48,9 @@ DECLARE_ALGORITHM(RefinePowderInstrumentParameters)
 //----------------------------------------------------------------------------------------------
 /** Constructor
  */
-RefinePowderInstrumentParameters::RefinePowderInstrumentParameters() {}
+RefinePowderInstrumentParameters::RefinePowderInstrumentParameters()
+    : m_BestGSLChi2(0.0), m_MinSigma(0.0), m_MinNumFittedPeaks(0),
+      m_MaxNumberStoredParameters(0) {}
 
 //----------------------------------------------------------------------------------------------
 /** Destructor
@@ -145,7 +147,7 @@ void RefinePowderInstrumentParameters::exec() {
   DataObjects::TableWorkspace_sptr parameterWS =
       this->getProperty("InstrumentParameterWorkspace");
 
-  mMinSigma = getProperty("MinSigma");
+  m_MinSigma = getProperty("MinSigma");
 
   int tempint = getProperty("MinNumberFittedPeaks");
   if (tempint <= 1) {
@@ -153,13 +155,13 @@ void RefinePowderInstrumentParameters::exec() {
                   << " is too small. " << endl;
     throw std::invalid_argument("Input MinNumberFittedPeaks is too small.");
   }
-  mMinNumFittedPeaks = static_cast<size_t>(tempint);
+  m_MinNumFittedPeaks = static_cast<size_t>(tempint);
 
   tempint = getProperty("NumberBestFitRecorded");
   if (tempint <= 0)
     throw runtime_error(
         "Input NumberBestFitRecorded cannot be less and equal to 0. ");
-  mMaxNumberStoredParameters = static_cast<size_t>(tempint);
+  m_MaxNumberStoredParameters = static_cast<size_t>(tempint);
 
   string algoption = getProperty("RefinementAlgorithm");
   if (algoption.compare("DirectFit") == 0)
@@ -172,14 +174,14 @@ void RefinePowderInstrumentParameters::exec() {
 
   // 2. Parse input table workspace
   genPeaksFromTable(peakWS);
-  importParametersFromTable(parameterWS, mFuncParameters);
-  mOrigParameters = mFuncParameters;
+  importParametersFromTable(parameterWS, m_FuncParameters);
+  m_OrigParameters = m_FuncParameters;
 
   // 3. Generate a cener workspace as function of d-spacing.
   bool usemc = false;
   if (refinealgorithm == MonteCarlo)
     usemc = true;
-  genPeakCentersWorkspace(usemc, mMaxNumberStoredParameters);
+  genPeakCentersWorkspace(usemc, m_MaxNumberStoredParameters);
 
   // 4. Fit instrument geometry function
   stringstream errss;
@@ -208,7 +210,7 @@ void RefinePowderInstrumentParameters::exec() {
   }
 
   // 5. Set output workspace
-  this->setProperty("OutputWorkspace", dataWS);
+  this->setProperty("OutputWorkspace", m_dataWS);
 
   // 6. Output new instrument parameters
   DataObjects::TableWorkspace_sptr fitparamws =
@@ -228,16 +230,16 @@ void RefinePowderInstrumentParameters::fitInstrumentParameters() {
 
   // 1. Initialize the fitting function
   ThermalNeutronDtoTOFFunction rawfunc;
-  mFunction = boost::make_shared<ThermalNeutronDtoTOFFunction>(rawfunc);
-  mFunction->initialize();
+  m_Function = boost::make_shared<ThermalNeutronDtoTOFFunction>(rawfunc);
+  m_Function->initialize();
 
-  API::FunctionDomain1DVector domain(dataWS->readX(1));
+  API::FunctionDomain1DVector domain(m_dataWS->readX(1));
   API::FunctionValues values(domain);
-  const MantidVec &rawY = dataWS->readY(0);
-  const MantidVec &rawE = dataWS->readE(0);
+  const MantidVec &rawY = m_dataWS->readY(0);
+  const MantidVec &rawE = m_dataWS->readE(0);
 
   // 2. Set up parameters values
-  std::vector<std::string> funparamnames = mFunction->getParameterNames();
+  std::vector<std::string> funparamnames = m_Function->getParameterNames();
 
   std::vector<std::string> paramtofit = getProperty("ParametersToFit");
   std::sort(paramtofit.begin(), paramtofit.end());
@@ -247,22 +249,22 @@ void RefinePowderInstrumentParameters::fitInstrumentParameters() {
   std::map<std::string, double>::iterator paramiter;
   for (size_t i = 0; i < funparamnames.size(); ++i) {
     string parname = funparamnames[i];
-    paramiter = mFuncParameters.find(parname);
-    if (paramiter == mFuncParameters.end()) {
+    paramiter = m_FuncParameters.find(parname);
+    if (paramiter == m_FuncParameters.end()) {
       // Not found and thus skip
       continue;
     }
 
     double parvalue = paramiter->second;
-    mFunction->setParameter(parname, parvalue);
+    m_Function->setParameter(parname, parvalue);
     msgss << setw(10) << parname << " = " << parvalue << endl;
   }
   cout << msgss.str();
 
   // 2b. Calculate the statistic of the starting values
-  double gslchi2 = calculateFunctionStatistic(mFunction, dataWS, 0);
+  double gslchi2 = calculateFunctionStatistic(m_Function, m_dataWS, 0);
   double homchi2 =
-      calculateD2TOFFunction(mFunction, domain, values, rawY, rawE);
+      calculateD2TOFFunction(m_Function, domain, values, rawY, rawE);
   cout << "Fit Starting Value:  Chi^2 (GSL) = " << gslchi2
        << ",  Chi2^2 (Home) = " << homchi2 << endl;
 
@@ -274,9 +276,9 @@ void RefinePowderInstrumentParameters::fitInstrumentParameters() {
     vsiter = std::find(paramtofit.begin(), paramtofit.end(), parname);
 
     if (vsiter == paramtofit.end())
-      mFunction->fix(i);
+      m_Function->fix(i);
     else
-      mFunction->unfix(i);
+      m_Function->unfix(i);
   }
 
   // 4. Select minimizer.  Use Simplex for more than 1 parameters to fit.
@@ -288,13 +290,13 @@ void RefinePowderInstrumentParameters::fitInstrumentParameters() {
   g_log.information() << "Fit use minizer: " << minimizer << endl;
 
   // 5. Create and setup fit algorithm
-  g_log.information() << "Fit instrument geometry: " << mFunction->asString()
+  g_log.information() << "Fit instrument geometry: " << m_Function->asString()
                       << std::endl;
 
   stringstream outss;
-  for (size_t i = 0; i < dataWS->readX(0).size(); ++i)
-    outss << dataWS->readX(0)[i] << "\t\t" << dataWS->readY(0)[i] << "\t\t"
-          << dataWS->readE(0)[i] << endl;
+  for (size_t i = 0; i < m_dataWS->readX(0).size(); ++i)
+    outss << m_dataWS->readX(0)[i] << "\t\t" << m_dataWS->readY(0)[i] << "\t\t"
+          << m_dataWS->readE(0)[i] << endl;
   cout << "Input Peak Position Workspace To Fit: " << endl
        << outss.str() << endl;
 
@@ -302,8 +304,8 @@ void RefinePowderInstrumentParameters::fitInstrumentParameters() {
   fitalg->initialize();
 
   fitalg->setProperty("Function",
-                      boost::dynamic_pointer_cast<API::IFunction>(mFunction));
-  fitalg->setProperty("InputWorkspace", dataWS);
+                      boost::dynamic_pointer_cast<API::IFunction>(m_Function));
+  fitalg->setProperty("InputWorkspace", m_dataWS);
   fitalg->setProperty("WorkspaceIndex", 0);
   fitalg->setProperty("Minimizer", minimizer);
   fitalg->setProperty("CostFunction", "Least squares");
@@ -326,31 +328,31 @@ void RefinePowderInstrumentParameters::fitInstrumentParameters() {
   API::IFunction_sptr fitfunc = fitalg->getProperty("Function");
 
   // 4. Set the output data (model and diff)
-  mFunction->function(domain, values);
+  m_Function->function(domain, values);
 
   for (size_t i = 0; i < domain.size(); ++i) {
-    dataWS->dataY(1)[i] = values[i];
-    dataWS->dataY(2)[i] = dataWS->readY(0)[i] - values[i];
+    m_dataWS->dataY(1)[i] = values[i];
+    m_dataWS->dataY(2)[i] = m_dataWS->readY(0)[i] - values[i];
   }
 
   double selfchi2 =
-      calculateD2TOFFunction(mFunction, domain, values, rawY, rawE);
+      calculateD2TOFFunction(m_Function, domain, values, rawY, rawE);
   cout << "Homemade Chi^2 = " << selfchi2 << endl;
 
   // 5. Update fitted parameters
   for (size_t i = 0; i < funparamnames.size(); ++i) {
     std::string parname = funparamnames[i];
     double parvalue = fitfunc->getParameter(parname);
-    mFuncParameters[parname] = parvalue;
+    m_FuncParameters[parname] = parvalue;
   }
 
   // 6. Pretty screen output
   stringstream dbss;
   dbss << "************ Fit Parameter Result *************" << std::endl;
-  for (paramiter = mFuncParameters.begin(); paramiter != mFuncParameters.end();
-       ++paramiter) {
+  for (paramiter = m_FuncParameters.begin();
+       paramiter != m_FuncParameters.end(); ++paramiter) {
     std::string parname = paramiter->first;
-    double inpparvalue = mOrigParameters[parname];
+    double inpparvalue = m_OrigParameters[parname];
     double parvalue = paramiter->second;
     dbss << setw(20) << parname << " = " << setw(15) << setprecision(6)
          << parvalue << "\t\tFrom " << setw(15) << setprecision(6)
@@ -362,18 +364,18 @@ void RefinePowderInstrumentParameters::fitInstrumentParameters() {
   // 7. Play with Zscore:     template<typename TYPE>
   //    std::vector<double> getZscore(const std::vector<TYPE>& data, const bool
   //    sorted=false);
-  vector<double> z0 = Kernel::getZscore(dataWS->readY(0));
-  vector<double> z1 = Kernel::getZscore(dataWS->readY(1));
-  vector<double> z2 = Kernel::getZscore(dataWS->readY(2));
+  vector<double> z0 = Kernel::getZscore(m_dataWS->readY(0));
+  vector<double> z1 = Kernel::getZscore(m_dataWS->readY(1));
+  vector<double> z2 = Kernel::getZscore(m_dataWS->readY(2));
   stringstream zss;
   zss << setw(20) << "d_h" << setw(20) << "Z DataY" << setw(20) << "Z ModelY"
       << setw(20) << "Z DiffY" << setw(20) << "DiffY" << endl;
   for (size_t i = 0; i < z0.size(); ++i) {
-    double d_h = dataWS->readX(0)[i];
+    double d_h = m_dataWS->readX(0)[i];
     double zdatay = z0[i];
     double zmodely = z1[i];
     double zdiffy = z2[i];
-    double diffy = dataWS->readY(2)[i];
+    double diffy = m_dataWS->readY(2)[i];
     zss << setw(20) << d_h << setw(20) << zdatay << setw(20) << zmodely
         << setw(20) << zdiffy << setw(20) << diffy << endl;
   }
@@ -392,7 +394,7 @@ bool RefinePowderInstrumentParameters::fitFunction(IFunction_sptr func,
 
   fitalg->setProperty("Function",
                       boost::dynamic_pointer_cast<API::IFunction>(func));
-  fitalg->setProperty("InputWorkspace", dataWS);
+  fitalg->setProperty("InputWorkspace", m_dataWS);
   fitalg->setProperty("WorkspaceIndex", 0);
   fitalg->setProperty("Minimizer", "Simplex");
   fitalg->setProperty("CostFunction", "Least squares");
@@ -462,19 +464,20 @@ double RefinePowderInstrumentParameters::calculateFunctionStatistic(
 void RefinePowderInstrumentParameters::refineInstrumentParametersMC(
     TableWorkspace_sptr parameterWS, bool fit2) {
   // 1. Get function's parameter names
-  getD2TOFFuncParamNames(mPeakFunctionParameterNames);
+  getD2TOFFuncParamNames(m_PeakFunctionParameterNames);
 
   // 2. Parse parameter (table) workspace
   vector<double> stepsizes, lowerbounds, upperbounds;
-  importMonteCarloParametersFromTable(parameterWS, mPeakFunctionParameterNames,
+  importMonteCarloParametersFromTable(parameterWS, m_PeakFunctionParameterNames,
                                       stepsizes, lowerbounds, upperbounds);
 
   stringstream dbss;
-  for (size_t i = 0; i < mPeakFunctionParameterNames.size(); ++i) {
-    dbss << setw(20) << mPeakFunctionParameterNames[i] << ": Min = " << setw(15)
-         << setprecision(6) << lowerbounds[i] << ", Max = " << setw(15)
-         << setprecision(6) << upperbounds[i] << ", Step Size = " << setw(15)
-         << setprecision(6) << stepsizes[i] << endl;
+  for (size_t i = 0; i < m_PeakFunctionParameterNames.size(); ++i) {
+    dbss << setw(20) << m_PeakFunctionParameterNames[i]
+         << ": Min = " << setw(15) << setprecision(6) << lowerbounds[i]
+         << ", Max = " << setw(15) << setprecision(6) << upperbounds[i]
+         << ", Step Size = " << setw(15) << setprecision(6) << stepsizes[i]
+         << endl;
   }
   g_log.notice() << "Monte Carlo Parameters: " << endl
                  << dbss.str();
@@ -494,33 +497,33 @@ void RefinePowderInstrumentParameters::refineInstrumentParametersMC(
   double stepsizescalefactor = 1.1;
 
   // 5. Monte Carlo simulation
-  doParameterSpaceRandomWalk(mPeakFunctionParameterNames, lowerbounds,
+  doParameterSpaceRandomWalk(m_PeakFunctionParameterNames, lowerbounds,
                              upperbounds, stepsizes, maxsteps,
                              stepsizescalefactor, fit2);
 
   // 6. Record the result
-  const MantidVec &X = dataWS->readX(0);
-  const MantidVec &Y = dataWS->readY(0);
-  const MantidVec &E = dataWS->readE(0);
+  const MantidVec &X = m_dataWS->readX(0);
+  const MantidVec &Y = m_dataWS->readY(0);
+  const MantidVec &E = m_dataWS->readE(0);
   FunctionDomain1DVector domain(X);
   FunctionValues values(domain);
-  for (size_t i = 0; i < mBestFitParameters.size(); ++i) {
+  for (size_t i = 0; i < m_BestFitParameters.size(); ++i) {
     // a. Set the function with the
-    for (size_t j = 0; j < mPeakFunctionParameterNames.size(); ++j) {
-      mFunction->setParameter(mPeakFunctionParameterNames[j],
-                              mBestFitParameters[i].second[j]);
+    for (size_t j = 0; j < m_PeakFunctionParameterNames.size(); ++j) {
+      m_Function->setParameter(m_PeakFunctionParameterNames[j],
+                               m_BestFitParameters[i].second[j]);
     }
 
     // b. Calculate
-    calculateD2TOFFunction(mFunction, domain, values, Y, E);
+    calculateD2TOFFunction(m_Function, domain, values, Y, E);
 
     vector<double> vec_n;
-    calculateThermalNeutronSpecial(mFunction, X, vec_n);
+    calculateThermalNeutronSpecial(m_Function, X, vec_n);
 
     // c. Put the data to output workspace
-    MantidVec &newY = dataWS->dataY(3 * i + 1);
-    MantidVec &newD = dataWS->dataY(3 * i + 2);
-    MantidVec &newN = dataWS->dataY(3 * i + 3);
+    MantidVec &newY = m_dataWS->dataY(3 * i + 1);
+    MantidVec &newD = m_dataWS->dataY(3 * i + 2);
+    MantidVec &newN = m_dataWS->dataY(3 * i + 3);
     for (size_t j = 0; j < newY.size(); ++j) {
       newY[j] = values[j];
       newD[j] = Y[j] - values[j];
@@ -548,30 +551,30 @@ void RefinePowderInstrumentParameters::doParameterSpaceRandomWalk(
           << setw(20) << "Upper Boundary" << setw(20) << "Step Size" << endl;
   for (size_t i = 0; i < parnames.size(); ++i)
     inpinfo << setw(20) << parnames[i] << setw(20) <<
-  mFuncParameters[parnames[i]]
+  m_FuncParameters[parnames[i]]
             << setw(20) << lowerbounds[i]
             << setw(20) << upperbounds[i] << setw(20) <<  stepsizes[i] << endl;
   cout << inpinfo.str();
   ------------*/
 
-  // 1. Set up starting values, esp. to mFunction
+  // 1. Set up starting values, esp. to m_Function
   size_t numparameters = parnames.size();
   vector<double> paramvalues;
   for (size_t i = 0; i < numparameters; ++i) {
     string parname = parnames[i];
-    double parvalue = mFuncParameters[parname];
+    double parvalue = m_FuncParameters[parname];
     paramvalues.push_back(parvalue);
-    mFunction->setParameter(parname, parvalue);
+    m_Function->setParameter(parname, parvalue);
   }
 
   // Calcualte the function's initial statistic
-  mBestGSLChi2 = calculateFunctionStatistic(mFunction, dataWS, 0);
-  cout << "Function with starting values has Chi2 = " << mBestGSLChi2
+  m_BestGSLChi2 = calculateFunctionStatistic(m_Function, m_dataWS, 0);
+  cout << "Function with starting values has Chi2 = " << m_BestGSLChi2
        << " (GSL L.M) " << endl;
 
-  const MantidVec &X = dataWS->readX(0);
-  const MantidVec &rawY = dataWS->readY(0);
-  const MantidVec &rawE = dataWS->readE(0);
+  const MantidVec &X = m_dataWS->readX(0);
+  const MantidVec &rawY = m_dataWS->readY(0);
+  const MantidVec &rawE = m_dataWS->readE(0);
   FunctionDomain1DVector domain(X);
   FunctionValues values(domain);
 
@@ -623,7 +626,7 @@ void RefinePowderInstrumentParameters::doParameterSpaceRandomWalk(
 
   // 4. Do MC loops
   double curchi2 =
-      calculateD2TOFFunction(mFunction, domain, values, rawY, rawE);
+      calculateD2TOFFunction(m_Function, domain, values, rawY, rawE);
 
   g_log.notice() << "Monte Carlo Random Walk Starting Chi^2 = " << curchi2
                  << endl;
@@ -656,7 +659,7 @@ void RefinePowderInstrumentParameters::doParameterSpaceRandomWalk(
     }
 
     try {
-      mFunction->setParameter(parnames[paramindex], newvalue);
+      m_Function->setParameter(parnames[paramindex], newvalue);
     } catch (runtime_error &) {
       stringstream errss;
       errss << "New Value = " << newvalue
@@ -669,13 +672,13 @@ void RefinePowderInstrumentParameters::doParameterSpaceRandomWalk(
 
     // b. Calcualte the new
     double newchi2 =
-        calculateD2TOFFunction(mFunction, domain, values, rawY, rawE);
+        calculateD2TOFFunction(m_Function, domain, values, rawY, rawE);
 
     // Optionally fit
     if (fit2) {
       // i.   Copy the parameters
       for (size_t i = 0; i < numparameters; ++i) {
-        double parvalue = mFunction->getParameter(i);
+        double parvalue = m_Function->getParameter(i);
         func4fit->setParameter(i, parvalue);
       }
 
@@ -688,8 +691,8 @@ void RefinePowderInstrumentParameters::doParameterSpaceRandomWalk(
         double homchi2 =
             calculateD2TOFFunction(func4fit, domain, values, rawY, rawE);
 
-        if (gslchi2 < mBestGSLChi2)
-          mBestGSLChi2 = gslchi2;
+        if (gslchi2 < m_BestGSLChi2)
+          m_BestGSLChi2 = gslchi2;
 
         // iv.  Archive
         vector<double> newparvalues;
@@ -697,15 +700,15 @@ void RefinePowderInstrumentParameters::doParameterSpaceRandomWalk(
           double parvalue = func4fit->getParameter(i);
           newparvalues.push_back(parvalue);
         }
-        mBestFitParameters.push_back(make_pair(homchi2, newparvalues));
-        mBestFitChi2s.push_back(make_pair(homchi2, gslchi2));
+        m_BestFitParameters.push_back(make_pair(homchi2, newparvalues));
+        m_BestFitChi2s.push_back(make_pair(homchi2, gslchi2));
 
         // v.  Sort and keep in size
-        sort(mBestFitParameters.begin(), mBestFitParameters.end());
-        sort(mBestFitChi2s.begin(), mBestFitChi2s.end());
-        if (mBestFitParameters.size() > mMaxNumberStoredParameters) {
-          mBestFitParameters.pop_back();
-          mBestFitChi2s.pop_back();
+        sort(m_BestFitParameters.begin(), m_BestFitParameters.end());
+        sort(m_BestFitChi2s.begin(), m_BestFitChi2s.end());
+        if (m_BestFitParameters.size() > m_MaxNumberStoredParameters) {
+          m_BestFitParameters.pop_back();
+          m_BestFitChi2s.pop_back();
         }
 
         // cout << "\tHomemade Chi^2 = " << homchi2 << endl;
@@ -752,12 +755,12 @@ void RefinePowderInstrumentParameters::doParameterSpaceRandomWalk(
 
       // ii.  Add the new values to vector
       vector<double> parametervalues = paramvalues;
-      mBestMCParameters.push_back(make_pair(newchi2, parametervalues));
+      m_BestMCParameters.push_back(make_pair(newchi2, parametervalues));
 
       // iii. Sort and delete the last if necessary
-      sort(mBestMCParameters.begin(), mBestMCParameters.end());
-      if (mBestMCParameters.size() > mMaxNumberStoredParameters)
-        mBestMCParameters.pop_back();
+      sort(m_BestMCParameters.begin(), m_BestMCParameters.end());
+      if (m_BestMCParameters.size() > m_MaxNumberStoredParameters)
+        m_BestMCParameters.pop_back();
 
       // iv.  Update chi2 and ...
       curchi2 = newchi2;
@@ -773,24 +776,24 @@ void RefinePowderInstrumentParameters::doParameterSpaceRandomWalk(
 
   // 3. Debug output
   stringstream mcresult;
-  mcresult << "Monte Carlo Result for " << mBestMCParameters.size()
+  mcresult << "Monte Carlo Result for " << m_BestMCParameters.size()
            << " Best Results" << endl;
   mcresult << "Number of acceptance = " << numacceptance << ", out of "
            << maxsteps << " MC steps."
            << "Accept ratio = "
            << static_cast<double>(numacceptance) / static_cast<double>(maxsteps)
            << endl;
-  mcresult << "Best " << mBestMCParameters.size()
+  mcresult << "Best " << m_BestMCParameters.size()
            << " Monte Carlo (no fit) results: " << endl;
-  for (size_t i = 0; i < mBestMCParameters.size(); ++i) {
-    mcresult << setw(3) << i << ":  Chi^2 = " << mBestMCParameters[i].first
+  for (size_t i = 0; i < m_BestMCParameters.size(); ++i) {
+    mcresult << setw(3) << i << ":  Chi^2 = " << m_BestMCParameters[i].first
              << endl;
   }
-  mcresult << "Best " << mBestMCParameters.size()
-           << " fitting results.  Best Chi^2 =  " << mBestGSLChi2 << endl;
-  for (size_t i = 0; i < mBestFitParameters.size(); ++i) {
-    mcresult << setw(3) << i << ":  Chi^2 = " << mBestFitParameters[i].first
-             << ", GSL Chi^2 = " << mBestFitChi2s[i].second << endl;
+  mcresult << "Best " << m_BestMCParameters.size()
+           << " fitting results.  Best Chi^2 =  " << m_BestGSLChi2 << endl;
+  for (size_t i = 0; i < m_BestFitParameters.size(); ++i) {
+    mcresult << setw(3) << i << ":  Chi^2 = " << m_BestFitParameters[i].first
+             << ", GSL Chi^2 = " << m_BestFitChi2s[i].second << endl;
   }
   g_log.notice() << mcresult.str();
 
@@ -809,7 +812,7 @@ void RefinePowderInstrumentParameters::getD2TOFFuncParamNames(
   d2toffunc.initialize();
   std::vector<std::string> funparamnames = d2toffunc.getParameterNames();
 
-  mFunction = boost::make_shared<ThermalNeutronDtoTOFFunction>(d2toffunc);
+  m_Function = boost::make_shared<ThermalNeutronDtoTOFFunction>(d2toffunc);
 
   // 3. Copy
   parnames = funparamnames;
@@ -824,14 +827,14 @@ double RefinePowderInstrumentParameters::calculateD2TOFFunction(
     const MantidVec &rawY, const MantidVec &rawE) {
   // 1. Check validity
   if (!func) {
-    throw std::runtime_error("mFunction has not been initialized!");
+    throw std::runtime_error("m_Function has not been initialized!");
   } else {
     /*
-    vector<string> parnames = mFunction->getParameterNames();
+    vector<string> parnames = m_Function->getParameterNames();
     for (size_t i = 0; i < parnames.size(); ++i)
     {
       cout << "DBx1125  " << parnames[i] << " = " <<
-    mFunction->getParameter(parnames[i]) << endl;
+    m_Function->getParameter(parnames[i]) << endl;
     }
     */
     ;
@@ -861,7 +864,7 @@ double RefinePowderInstrumentParameters::calculateD2TOFFunction(
 //------------------------------- Processing Inputs
 //----------------------------------------
 /** Genearte peaks from input workspace
-  * Peaks are stored in a map.  (HKL) is the key
+  * m_Peaks are stored in a map.  (HKL) is the key
   */
 void RefinePowderInstrumentParameters::genPeaksFromTable(
     DataObjects::TableWorkspace_sptr peakparamws) {
@@ -873,7 +876,7 @@ void RefinePowderInstrumentParameters::genPeaksFromTable(
         "Invalid input table workspace for peak parameters");
   }
 
-  mPeaks.clear();
+  m_Peaks.clear();
 
   // 2. Parse table workspace rows to generate peaks
   vector<string> colnames = peakparamws->getColumnNames();
@@ -940,12 +943,12 @@ void RefinePowderInstrumentParameters::genPeaksFromTable(
     hkl.push_back(k);
     hkl.push_back(l);
 
-    mPeaks.insert(std::make_pair(hkl, newpeakptr));
+    m_Peaks.insert(std::make_pair(hkl, newpeakptr));
 
-    mPeakErrors.insert(make_pair(hkl, chi2));
+    m_PeakErrors.insert(make_pair(hkl, chi2));
 
-    g_log.information() << "[GeneratePeaks] Peak " << ir << " HKL = [" << hkl[0]
-                        << ", " << hkl[1] << ", " << hkl[2]
+    g_log.information() << "[Generatem_Peaks] Peak " << ir << " HKL = ["
+                        << hkl[0] << ", " << hkl[1] << ", " << hkl[2]
                         << "], Input Center = " << setw(10) << setprecision(6)
                         << newpeak.centre() << endl;
 
@@ -1118,17 +1121,17 @@ hkl, double lattice)
 /** Calcualte value n for thermal neutron peak profile
   */
 void RefinePowderInstrumentParameters::calculateThermalNeutronSpecial(
-    IFunction_sptr mFunction, vector<double> vec_d, vector<double> &vec_n) {
-  if (mFunction->name().compare("ThermalNeutronDtoTOFFunction") != 0) {
-    g_log.warning() << "Function (" << mFunction->name()
+    IFunction_sptr m_Function, vector<double> vec_d, vector<double> &vec_n) {
+  if (m_Function->name().compare("ThermalNeutronDtoTOFFunction") != 0) {
+    g_log.warning() << "Function (" << m_Function->name()
                     << " is not ThermalNeutronDtoTOFFunction.  And it is not "
                        "required to calculate n." << endl;
     for (size_t i = 0; i < vec_d.size(); ++i)
       vec_n.push_back(0);
   }
 
-  double width = mFunction->getParameter("Width");
-  double tcross = mFunction->getParameter("Tcross");
+  double width = m_Function->getParameter("Width");
+  double tcross = m_Function->getParameter("Tcross");
 
   for (size_t i = 0; i < vec_d.size(); ++i) {
     double dh = vec_d[i];
@@ -1149,7 +1152,7 @@ void RefinePowderInstrumentParameters::calculateThermalNeutronSpecial(
 void RefinePowderInstrumentParameters::genPeakCentersWorkspace(
     bool montecarlo, size_t numbestfit) {
   // 1. Collect values in a vector for sorting
-  double lattice = mFuncParameters["LatticeConstant"];
+  double lattice = m_FuncParameters["LatticeConstant"];
   if (lattice < 1.0E-5) {
     std::stringstream errmsg;
     errmsg << "Input Lattice constant = " << lattice
@@ -1176,12 +1179,12 @@ void RefinePowderInstrumentParameters::genPeakCentersWorkspace(
 
   Geometry::UnitCell unitcell(lattice, lattice, lattice, 90.0, 90.0, 90.0);
 
-  for (peakiter = mPeaks.begin(); peakiter != mPeaks.end(); ++peakiter) {
+  for (peakiter = m_Peaks.begin(); peakiter != m_Peaks.end(); ++peakiter) {
     vector<int> hkl = peakiter->first;
     BackToBackExponential_sptr peak = peakiter->second;
 
     double sigma = peak->getParameter("S");
-    if (sigma < mMinSigma) {
+    if (sigma < m_MinSigma) {
       g_log.information() << "Peak (" << hkl[0] << ", " << hkl[1] << ", "
                           << hkl[2]
                           << ") has unphysically small Sigma = " << sigma
@@ -1222,18 +1225,18 @@ void RefinePowderInstrumentParameters::genPeakCentersWorkspace(
     nspec = 1 + 3;
   }
 
-  dataWS = boost::dynamic_pointer_cast<DataObjects::Workspace2D>(
+  m_dataWS = boost::dynamic_pointer_cast<DataObjects::Workspace2D>(
       API::WorkspaceFactory::Instance().create("Workspace2D", nspec, size,
                                                size));
-  dataWS->getAxis(0)->setUnit("dSpacing");
+  m_dataWS->getAxis(0)->setUnit("dSpacing");
 
   // 4. Put data to output workspace
   for (size_t i = 0; i < peakcenters.size(); ++i) {
     for (size_t j = 0; j < nspec; ++j) {
-      dataWS->dataX(j)[i] = peakcenters[i].first;
+      m_dataWS->dataX(j)[i] = peakcenters[i].first;
     }
-    dataWS->dataY(0)[i] = peakcenters[i].second.first;
-    dataWS->dataE(0)[i] = peakcenters[i].second.second;
+    m_dataWS->dataY(0)[i] = peakcenters[i].second.first;
+    m_dataWS->dataE(0)[i] = peakcenters[i].second.second;
   }
 
   return;
@@ -1250,18 +1253,18 @@ RefinePowderInstrumentParameters::genMCResultTable() {
 
   tablews->addColumn("double", "Chi2");
   tablews->addColumn("double", "GSLChi2");
-  for (size_t i = 0; i < mPeakFunctionParameterNames.size(); ++i) {
-    tablews->addColumn("double", mPeakFunctionParameterNames[i]);
+  for (size_t i = 0; i < m_PeakFunctionParameterNames.size(); ++i) {
+    tablews->addColumn("double", m_PeakFunctionParameterNames[i]);
   }
 
   // 2. Put values in
-  for (size_t ib = 0; ib < mBestFitParameters.size(); ++ib) {
+  for (size_t ib = 0; ib < m_BestFitParameters.size(); ++ib) {
     TableRow newrow = tablews->appendRow();
-    double chi2 = mBestFitParameters[ib].first;
-    double gslchi2 = mBestFitChi2s[ib].second;
+    double chi2 = m_BestFitParameters[ib].first;
+    double gslchi2 = m_BestFitChi2s[ib].second;
     newrow << chi2 << gslchi2;
-    for (size_t ip = 0; ip < mPeakFunctionParameterNames.size(); ++ip) {
-      double tempdbl = mBestFitParameters[ib].second[ip];
+    for (size_t ip = 0; ip < m_PeakFunctionParameterNames.size(); ++ip) {
+      double tempdbl = m_BestFitParameters[ib].second[ip];
       newrow << tempdbl;
     }
   } // ENDFOR 1 Best Answer
@@ -1290,7 +1293,7 @@ RefinePowderInstrumentParameters::genOutputInstrumentParameterTable() {
 
   std::map<std::string, double>::iterator pariter;
 
-  for (pariter = mFuncParameters.begin(); pariter != mFuncParameters.end();
+  for (pariter = m_FuncParameters.begin(); pariter != m_FuncParameters.end();
        ++pariter) {
     API::TableRow newrow = newtablews->appendRow();
     std::string parname = pariter->first;
diff --git a/Framework/CurveFitting/src/Algorithms/SplineBackground.cpp b/Framework/CurveFitting/src/Algorithms/SplineBackground.cpp
index 93b2e86016a7320e17d3ae657789ec49ad86da6f..a19fa51061060d39206dd760f8a1d8db453d9fb0 100644
--- a/Framework/CurveFitting/src/Algorithms/SplineBackground.cpp
+++ b/Framework/CurveFitting/src/Algorithms/SplineBackground.cpp
@@ -66,8 +66,7 @@ void SplineBackground::exec() {
   bool isMasked = inWS->hasMaskedBins(spec);
   std::vector<int> masked(Y.size());
   if (isMasked) {
-    for (API::MatrixWorkspace::MaskList::const_iterator it =
-             inWS->maskedBins(spec).begin();
+    for (auto it = inWS->maskedBins(spec).begin();
          it != inWS->maskedBins(spec).end(); ++it)
       masked[it->first] = 1;
     n -= static_cast<int>(inWS->maskedBins(spec).size());
diff --git a/Framework/CurveFitting/src/GSLVector.cpp b/Framework/CurveFitting/src/GSLVector.cpp
index 6c7c341cf7d4f0f9f158ba91e7ebffe771a3cce0..cdbc2a12db0e7f571b5a8703754af69f1805cfd1 100644
--- a/Framework/CurveFitting/src/GSLVector.cpp
+++ b/Framework/CurveFitting/src/GSLVector.cpp
@@ -157,10 +157,12 @@ double GSLVector::dot(const GSLVector &v) const {
 
 /// The << operator.
 std::ostream &operator<<(std::ostream &ostr, const GSLVector &v) {
+  std::ios::fmtflags fflags(ostr.flags());
   ostr << std::scientific << std::setprecision(6);
   for (size_t j = 0; j < v.size(); ++j) {
     ostr << std::setw(13) << v[j] << ' ';
   }
+  ostr.flags(fflags);
   return ostr;
 }
 
diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadAscii.h b/Framework/DataHandling/inc/MantidDataHandling/LoadAscii.h
index 44e695b5bcd1d3a08be0c73641950774822fbbb9..cf495c009be312933a224018d34b0deb1079edab 100644
--- a/Framework/DataHandling/inc/MantidDataHandling/LoadAscii.h
+++ b/Framework/DataHandling/inc/MantidDataHandling/LoadAscii.h
@@ -5,6 +5,7 @@
 // Includes
 //----------------------------------------------------------------------
 #include "MantidAPI/IFileLoader.h"
+#include "MantidAPI/DeprecatedAlgorithm.h"
 
 namespace Mantid {
 namespace DataHandling {
@@ -45,7 +46,8 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 File change history is stored at: <https://github.com/mantidproject/mantid>.
 Code Documentation is available at: <http://doxygen.mantidproject.org>
 */
-class DLLExport LoadAscii : public API::IFileLoader<Kernel::FileDescriptor> {
+class DLLExport LoadAscii : public API::IFileLoader<Kernel::FileDescriptor>,
+                            public API::DeprecatedAlgorithm {
 public:
   /// Default constructor
   LoadAscii();
diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadEventPreNexus.h b/Framework/DataHandling/inc/MantidDataHandling/LoadEventPreNexus.h
index c3f14b233810c5a14e3082ea5bc88725df2ef0ed..328be8a18896d921be8e0a25bd1c6ff8f0185c86 100644
--- a/Framework/DataHandling/inc/MantidDataHandling/LoadEventPreNexus.h
+++ b/Framework/DataHandling/inc/MantidDataHandling/LoadEventPreNexus.h
@@ -5,6 +5,7 @@
 #include <string>
 #include <vector>
 #include "MantidAPI/IFileLoader.h"
+#include "MantidAPI/DeprecatedAlgorithm.h"
 #include "MantidKernel/BinaryFile.h"
 #include "MantidDataObjects/EventWorkspace.h"
 #include "MantidDataObjects/Events.h"
@@ -88,7 +89,8 @@ struct Pulse {
 #pragma pack(pop)
 
 class DLLExport LoadEventPreNexus
-    : public API::IFileLoader<Kernel::FileDescriptor> {
+    : public API::IFileLoader<Kernel::FileDescriptor>,
+      public API::DeprecatedAlgorithm {
 public:
   /// Constructor
   LoadEventPreNexus();
diff --git a/Framework/DataHandling/src/GroupDetectors2.cpp b/Framework/DataHandling/src/GroupDetectors2.cpp
index 11d123fea37ff96dd5ce556327b8bf7cf8434ad9..86e1c36329a0a24520a4ec31a435f4d0352a6a8c 100644
--- a/Framework/DataHandling/src/GroupDetectors2.cpp
+++ b/Framework/DataHandling/src/GroupDetectors2.cpp
@@ -353,7 +353,7 @@ void GroupDetectors2::getGroups(API::MatrixWorkspace_const_sptr workspace,
     }
     // check we don't have an index that is too high for the workspace
     size_t maxIn = static_cast<size_t>(workspace->getNumberHistograms() - 1);
-    std::vector<size_t>::const_iterator it = m_GroupSpecInds[0].begin();
+    auto it = m_GroupSpecInds[0].begin();
     for (; it != m_GroupSpecInds[0].end(); ++it) {
       if (*it > maxIn) {
         g_log.error() << "Spectra index " << *it
@@ -375,7 +375,7 @@ void GroupDetectors2::getGroups(API::MatrixWorkspace_const_sptr workspace,
 
   // up date unUsedSpec, this is used to find duplicates and when the user has
   // set KeepUngroupedSpectra
-  std::vector<size_t>::const_iterator index = m_GroupSpecInds[0].begin();
+  auto index = m_GroupSpecInds[0].begin();
   for (; index != m_GroupSpecInds[0].end();
        ++index) { // the vector<int> m_GroupSpecInds[0] must not index contain
                   // numbers that don't exist in the workspaace
diff --git a/Framework/DataHandling/src/LoadAscii.cpp b/Framework/DataHandling/src/LoadAscii.cpp
index 747bd5422b98555db8ceb6e6bff37a5245f66abe..74dda663af566b72c71ca5209a90493ddff03af7 100644
--- a/Framework/DataHandling/src/LoadAscii.cpp
+++ b/Framework/DataHandling/src/LoadAscii.cpp
@@ -24,7 +24,9 @@ using namespace Kernel;
 using namespace API;
 
 /// Empty constructor
-LoadAscii::LoadAscii() : m_columnSep(), m_separatorIndex() {}
+LoadAscii::LoadAscii() : m_columnSep(), m_separatorIndex() {
+  this->useAlgorithm("LoadAscii", 2);
+}
 
 /**
  * Return the confidence with with this algorithm can load the file
diff --git a/Framework/DataHandling/src/LoadEventPreNexus.cpp b/Framework/DataHandling/src/LoadEventPreNexus.cpp
index 43f73c8f10abe5c91fba36406380bfab82c5570c..e6687146f3fab3f327e3d18c3213dddf8b786999 100644
--- a/Framework/DataHandling/src/LoadEventPreNexus.cpp
+++ b/Framework/DataHandling/src/LoadEventPreNexus.cpp
@@ -84,7 +84,9 @@ LoadEventPreNexus::LoadEventPreNexus()
       num_good_events(0), num_error_events(0), num_ignored_events(0),
       first_event(0), max_events(0), using_mapping_file(false),
       loadOnlySomeSpectra(false), spectraLoadMap(), longest_tof(0),
-      shortest_tof(0), parallelProcessing(false) {}
+      shortest_tof(0), parallelProcessing(false) {
+  this->useAlgorithm("LoadEventPreNexus", 2);
+}
 
 LoadEventPreNexus::~LoadEventPreNexus() { delete this->eventfile; }
 
diff --git a/Framework/DataHandling/src/SaveDiffCal.cpp b/Framework/DataHandling/src/SaveDiffCal.cpp
index 66259ba0ad274d6856f16180cc48240a99e183ca..96c2cbe07747c32a9b817a67505126fa137752eb 100644
--- a/Framework/DataHandling/src/SaveDiffCal.cpp
+++ b/Framework/DataHandling/src/SaveDiffCal.cpp
@@ -30,7 +30,8 @@ DECLARE_ALGORITHM(SaveDiffCal)
 //----------------------------------------------------------------------------------------------
 /** Constructor
  */
-SaveDiffCal::SaveDiffCal() {}
+SaveDiffCal::SaveDiffCal()
+    : m_numValues(0), m_calibrationWS(), m_detidToIndex() {}
 
 //----------------------------------------------------------------------------------------------
 /** Destructor
diff --git a/Framework/DataHandling/src/SaveGSS.cpp b/Framework/DataHandling/src/SaveGSS.cpp
index fb34a2b4616fa638b0db93ba4036b5b18a1290c8..af536d1977a0afa2330f7b899b36a42d6e2c2031 100644
--- a/Framework/DataHandling/src/SaveGSS.cpp
+++ b/Framework/DataHandling/src/SaveGSS.cpp
@@ -413,6 +413,7 @@ void writeLogValue(std::ostream &os, const Run &runinfo,
 void SaveGSS::writeHeaders(const std::string &format, std::stringstream &os,
                            double primaryflightpath) const {
   const Run &runinfo = inputWS->run();
+  std::ios::fmtflags fflags(os.flags());
 
   // Run number
   if (format.compare(SLOG) == 0) {
@@ -486,6 +487,8 @@ void SaveGSS::writeHeaders(const std::string &format, std::stringstream &os,
     os << "\n";
   }
 
+  os.flags(fflags);
+
   return;
 }
 
@@ -494,10 +497,12 @@ void SaveGSS::writeHeaders(const std::string &format, std::stringstream &os,
   */
 inline void writeBankLine(std::stringstream &out, const std::string &bintype,
                           const int banknum, const size_t datasize) {
+  std::ios::fmtflags fflags(out.flags());
   out << "BANK " << std::fixed << std::setprecision(0)
       << banknum // First bank should be 1 for GSAS; this can be changed
       << std::fixed << " " << datasize << std::fixed << " " << datasize
       << std::fixed << " " << bintype;
+  out.flags(fflags);
 }
 
 //----------------------------------------------------------------------------------------------
diff --git a/Framework/DataObjects/inc/MantidDataObjects/CalculateReflectometryQxQz.h b/Framework/DataObjects/inc/MantidDataObjects/CalculateReflectometryQxQz.h
index 2656b0085f6924d57618e626b151cacf0d9d1508..7256f47e3bbb7c5b3a8a1936b742f8c057749b9f 100644
--- a/Framework/DataObjects/inc/MantidDataObjects/CalculateReflectometryQxQz.h
+++ b/Framework/DataObjects/inc/MantidDataObjects/CalculateReflectometryQxQz.h
@@ -22,7 +22,8 @@ public:
   /**
    Constructor
    */
-  CalculateReflectometryQxQz() : m_dirQx(0.0), m_dirQz(0.0) {}
+  CalculateReflectometryQxQz()
+      : m_cos_theta_i(0.0), m_sin_theta_i(0.0), m_dirQx(0.0), m_dirQz(0.0) {}
 
   /**
    Setter for the incident theta value require for the calculation. Internally
diff --git a/Framework/DataObjects/inc/MantidDataObjects/MDGridBox.tcc b/Framework/DataObjects/inc/MantidDataObjects/MDGridBox.tcc
index d03eb54542a77ee0bdd2b9cd5f04adcf3020215a..4de121711232aa6c6a24fd477c7118097ca62778 100644
--- a/Framework/DataObjects/inc/MantidDataObjects/MDGridBox.tcc
+++ b/Framework/DataObjects/inc/MantidDataObjects/MDGridBox.tcc
@@ -40,10 +40,10 @@ namespace DataObjects {
  */
 TMDE(MDGridBox)::MDGridBox(
     BoxController *const bc, const uint32_t depth,
-    const std::vector<
-        Mantid::Geometry::MDDimensionExtents<coord_t>> &extentsVector)
-    : MDBoxBase<MDE, nd>(bc, depth, UNDEF_SIZET, extentsVector),
-      numBoxes(0), m_Children(), diagonalSquared(0.f), nPoints(0) {
+    const std::vector<Mantid::Geometry::MDDimensionExtents<coord_t>> &
+        extentsVector)
+    : MDBoxBase<MDE, nd>(bc, depth, UNDEF_SIZET, extentsVector), numBoxes(0),
+      m_Children(), diagonalSquared(0.f), nPoints(0) {
   initGridBox();
 }
 
@@ -55,8 +55,8 @@ TMDE(MDGridBox)::MDGridBox(
 */
 TMDE(MDGridBox)::MDGridBox(
     boost::shared_ptr<API::BoxController> &bc, const uint32_t depth,
-    const std::vector<
-        Mantid::Geometry::MDDimensionExtents<coord_t>> &extentsVector)
+    const std::vector<Mantid::Geometry::MDDimensionExtents<coord_t>> &
+        extentsVector)
     : MDBoxBase<MDE, nd>(bc.get(), depth, UNDEF_SIZET, extentsVector),
       numBoxes(0), m_Children(), diagonalSquared(0.f), nPoints(0) {
   initGridBox();
@@ -68,17 +68,16 @@ template <typename MDE, size_t nd> size_t MDGridBox<MDE, nd>::initGridBox() {
         "MDGridBox::ctor(): No BoxController specified in box.");
 
   // How many is it split?
-  // If we are at the top level and we have a specific top level split, then set it.
-  boost::optional<std::vector<size_t>> splitTopInto = this->m_BoxController->getSplitTopInto();
-  if (this->getDepth() == 0 && splitTopInto)
-  {
+  // If we are at the top level and we have a specific top level split, then set
+  // it.
+  boost::optional<std::vector<size_t>> splitTopInto =
+      this->m_BoxController->getSplitTopInto();
+  if (this->getDepth() == 0 && splitTopInto) {
     for (size_t d = 0; d < nd; d++)
       split[d] = splitTopInto.get()[d];
-  }
-  else
-  {
-   for (size_t d = 0; d < nd; d++)
-    split[d] = this->m_BoxController->getSplitInto(d);
+  } else {
+    for (size_t d = 0; d < nd; d++)
+      split[d] = this->m_BoxController->getSplitInto(d);
   }
 
   // Compute sizes etc.
@@ -94,10 +93,9 @@ template <typename MDE, size_t nd> size_t MDGridBox<MDE, nd>::initGridBox() {
  * @param box :: MDBox containing the events to split
  */
 TMDE(MDGridBox)::MDGridBox(MDBox<MDE, nd> *box)
-    : MDBoxBase<MDE, nd>(*box, box->getBoxController()), split(),
-      splitCumul(), m_SubBoxSize(), numBoxes(0), m_Children(),
-      diagonalSquared(0.f), nPoints(0)
-{
+    : MDBoxBase<MDE, nd>(*box, box->getBoxController()), split(), splitCumul(),
+      m_SubBoxSize(), numBoxes(0), m_Children(), diagonalSquared(0.f),
+      nPoints(0) {
   size_t totalSize = initGridBox();
 
   double ChildVol(1);
@@ -188,10 +186,10 @@ void MDGridBox<MDE, nd>::fillBoxShell(const size_t tot,
  */
 TMDE(MDGridBox)::MDGridBox(const MDGridBox<MDE, nd> &other,
                            Mantid::API::BoxController *const otherBC)
-    : MDBoxBase<MDE, nd>(other, otherBC), numBoxes(other.numBoxes), m_Children(),
-      diagonalSquared(other.diagonalSquared), nPoints(other.nPoints) {
-  for (size_t d = 0; d < nd; d++) 
-  {
+    : MDBoxBase<MDE, nd>(other, otherBC), numBoxes(other.numBoxes),
+      m_Children(), diagonalSquared(other.diagonalSquared),
+      nPoints(other.nPoints) {
+  for (size_t d = 0; d < nd; d++) {
     split[d] = other.split[d];
     splitCumul[d] = other.splitCumul[d];
     m_SubBoxSize[d] = other.m_SubBoxSize[d];
@@ -415,7 +413,7 @@ TMDE(std::vector<MDE> *MDGridBox)::getEventsCopy() {
  */
 TMDE(void MDGridBox)::getBoxes(std::vector<API::IMDNode *> &outBoxes,
                                size_t maxDepth, bool leafOnly) {
- //Add this box, unless we only want the leaves
+  // Add this box, unless we only want the leaves
   if (!leafOnly)
     outBoxes.push_back(this);
 
@@ -1465,8 +1463,9 @@ TMDE(void MDGridBox)::integrateCylinder(
       coord_t out[nd];
       radiusTransform.apply(boxCenter, out);
       if (out[0] < std::sqrt(diagonalSquared * 0.72 + radius * radius) &&
-          std::fabs(out[1]) <
-              std::sqrt(diagonalSquared * 0.72 + 0.25 * length * length)) {
+          (nd >= 1 &&
+           std::fabs(out[1]) <
+               std::sqrt(diagonalSquared * 0.72 + 0.25 * length * length))) {
         // If the center is closer than the size of the box, then it MIGHT be
         // touching.
         // (We multiply by 0.72 (about sqrt(2)) to look for half the diagonal).
diff --git a/Framework/DataObjects/src/EventList.cpp b/Framework/DataObjects/src/EventList.cpp
index efb6e74c71354d9c2d6207883c39d49a6e1e95f2..8dfbd6d9421904169c2016b3f5f11279c626469a 100644
--- a/Framework/DataObjects/src/EventList.cpp
+++ b/Framework/DataObjects/src/EventList.cpp
@@ -548,6 +548,7 @@ EventList &EventList::operator-=(const EventList &more_events) {
       minusHelper(this->weightedEvents, more_events.weightedEventsNoTime);
       break;
     }
+    break;
 
   case WEIGHTED_NOTIME:
     switch (more_events.getEventType()) {
@@ -561,6 +562,7 @@ EventList &EventList::operator-=(const EventList &more_events) {
       minusHelper(this->weightedEventsNoTime, more_events.weightedEventsNoTime);
       break;
     }
+    break;
   }
 
   // No guaranteed order
diff --git a/Framework/DataObjects/src/PeakColumn.cpp b/Framework/DataObjects/src/PeakColumn.cpp
index b3d7e129cc927636043721605c3517a80c4892a8..f8ffb4af0964c3be9a10fbfb6884363a31dc4dd4 100644
--- a/Framework/DataObjects/src/PeakColumn.cpp
+++ b/Framework/DataObjects/src/PeakColumn.cpp
@@ -134,6 +134,7 @@ const std::type_info &PeakColumn::get_pointer_type_info() const {
 void PeakColumn::print(size_t index, std::ostream &s) const {
   Peak &peak = m_peaks[index];
 
+  std::ios::fmtflags fflags(s.flags());
   if (m_name == "RunNumber")
     s << peak.getRunNumber();
   else if (m_name == "DetID")
@@ -152,6 +153,7 @@ void PeakColumn::print(size_t index, std::ostream &s) const {
     s << std::fixed << std::setprecision(m_hklPrec) << peak.getL();
   } else
     s << peak.getValueByColName(m_name);
+  s.flags(fflags);
 }
 
 //-------------------------------------------------------------------------------------
diff --git a/Framework/Geometry/src/Crystal/ScalarUtils.cpp b/Framework/Geometry/src/Crystal/ScalarUtils.cpp
index 096cbabf474a832b4b82a10cd92da237707671aa..e92b977edef531ba35d5a1092e8df1dc1ffe07e4 100644
--- a/Framework/Geometry/src/Crystal/ScalarUtils.cpp
+++ b/Framework/Geometry/src/Crystal/ScalarUtils.cpp
@@ -229,7 +229,7 @@ ConventionalCell ScalarUtils::GetCellForForm(const DblMatrix &UB,
   if (allowPermutations) {
     double angle_tolerance = 2.0;
     double length_factor = 1.05;
-    UB_list = GetRelatedUBs(UB, angle_tolerance, length_factor);
+    UB_list = GetRelatedUBs(UB, length_factor, angle_tolerance);
   } else {
     // Get exact form requested and not permutations
     UB_list.push_back(UB);
diff --git a/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp b/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp
index cdc50169d55ad5ab98597068d3a5a4ced1b04ddb..f4c9afef815111745fea386715ae9a79b4d531ea 100644
--- a/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp
+++ b/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp
@@ -1554,7 +1554,15 @@ void InstrumentDefinitionParser::populateIdList(Poco::XML::Element *pE,
             increment = atoi((pIDElem->getAttribute("step")).c_str());
 
           // check the start end and increment values are sensible
-          if (((endID - startID) / increment) < 0) {
+          if (0 == increment) {
+            std::stringstream ss;
+            ss << "The step element cannot be zero, found step: " << increment;
+
+            throw Kernel::Exception::InstrumentDefinitionError(ss.str(),
+                                                               filename);
+          }
+          int numSteps = (endID - startID) / increment;
+          if (numSteps < 0) {
             std::stringstream ss;
             ss << "The start, end, and step elements do not allow a single id "
                   "in the idlist entry - ";
@@ -1565,7 +1573,7 @@ void InstrumentDefinitionParser::populateIdList(Poco::XML::Element *pE,
                                                                filename);
           }
 
-          idList.vec.reserve((endID - startID) / increment);
+          idList.vec.reserve(numSteps);
           for (int i = startID; i != endID + increment; i += increment) {
             idList.vec.push_back(i);
           }
@@ -2301,7 +2309,9 @@ void InstrumentDefinitionParser::createNeutronicInstrument() {
             mapTypeNameToShape.find(shapeName);
         if (shapeIt != mapTypeNameToShape.end()) {
           // Change the shape on the current component to the one requested
-          dynamic_cast<ObjComponent *>(it->first)->setShape(shapeIt->second);
+          auto objCmpt = dynamic_cast<ObjComponent *>(it->first);
+          if (objCmpt)
+            objCmpt->setShape(shapeIt->second);
         } else {
           throw Exception::InstrumentDefinitionError(
               "Requested type " + shapeName + " not defined in IDF");
diff --git a/Framework/Geometry/src/Math/Acomp.cpp b/Framework/Geometry/src/Math/Acomp.cpp
index 0788103182bd08ed8d4202180f43ed171f722ee3..75c5fb5fe2be6d8d76bc081899ffbf8b4e10774a 100644
--- a/Framework/Geometry/src/Math/Acomp.cpp
+++ b/Framework/Geometry/src/Math/Acomp.cpp
@@ -366,7 +366,8 @@ Assumes that the component is sorted and inserts appropiately.
     for (acp = AX.Comp.begin(); acp != AX.Comp.end(); ++acp) {
       std::vector<Acomp>::iterator cpt;
       cpt = std::lower_bound(Comp.begin(), Comp.end(), *acp);
-      if (cpt == Comp.end() || *cpt != *aup) // Only insert if new
+      if (cpt == Comp.end() ||
+          (AX.Units.end() != aup && *cpt != *aup)) // Only insert if new
         Comp.insert(cpt, *acp);
     }
     return;
@@ -981,6 +982,9 @@ It is set on exit (to the EPI)
           break;
       }
 
+      if (PIactive.end() == px)
+        continue;
+
       EPI.push_back(PIform[*px]);
       // remove all minterm that the EPI covered
       for (ddx = DNFactive.begin(); ddx != DNFactive.end(); ++ddx)
diff --git a/Framework/ICat/src/GSoap/stdsoap2.cpp b/Framework/ICat/src/GSoap/stdsoap2.cpp
index ec26daa1e2e5e4ba9c1137565e6c2f1d5d763e28..7a966fb7a437dd7c1b35655b223446dc0506e1f8 100644
--- a/Framework/ICat/src/GSoap/stdsoap2.cpp
+++ b/Framework/ICat/src/GSoap/stdsoap2.cpp
@@ -2386,7 +2386,7 @@ int SOAP_FMAC2 soap_resolve(struct soap *soap) {
                                         "location=%p level=%u,%u id='%s'\n",
                                 ip->type, p, ip->level, fp->level, ip->id));
             while (ip->level < k) {
-              void **q = (void **)soap_malloc(soap, sizeof(q));
+              void **q = (void **)soap_malloc(soap, sizeof(*q));
               if (!q)
                 return soap->error;
               *q = p;
@@ -8188,9 +8188,11 @@ void *SOAP_FMAC2 soap_id_lookup(struct soap *soap, const char *id, void **p,
       void *s, **r = &ip->link;
       q = (void **)ip->link;
       while (q) {
-        *r = (void *)soap_malloc(soap, sizeof(void *));
-        if (!*r)
+        void **tmp = (void **)soap_malloc(soap, sizeof(void *));
+        if (!tmp)
           return NULL;
+        *r = (void *)tmp;
+
         s = *q;
         *q = *r;
         r = (void **)*r;
@@ -10040,7 +10042,7 @@ int SOAP_FMAC2 soap_element_start_end_out(struct soap *soap, const char *tag) {
   if (soap->mode & SOAP_XML_CANONICAL) {
     struct soap_nlist *np;
     for (tp = soap->attributes; tp; tp = tp->next) {
-      if (tp->visible && tp->name)
+      if (tp->visible && tp->name[0])
         soap_utilize_ns(soap, tp->name);
     }
     for (np = soap->nlist; np; np = np->next) {
@@ -11048,7 +11050,7 @@ int SOAP_FMAC2 soap_peek_element(struct soap *soap) {
           soap->arraySize[sizeof(soap->arrayType) - 1] = '\0';
           soap->arrayType[sizeof(soap->arrayType) - 1] = '\0';
         } else if (!soap_match_tag(soap, tp->name, "SOAP-ENC:offset"))
-          strncpy(soap->arrayOffset, tp->value, sizeof(soap->arrayOffset));
+          strncpy(soap->arrayOffset, tp->value, sizeof(soap->arrayOffset) - 1);
         else if (!soap_match_tag(soap, tp->name, "SOAP-ENC:position"))
           soap->position = soap_getposition(tp->value, soap->positions);
         else if (!soap_match_tag(soap, tp->name, "SOAP-ENC:root"))
diff --git a/Framework/Kernel/inc/MantidKernel/PropertyManagerOwner.h b/Framework/Kernel/inc/MantidKernel/PropertyManagerOwner.h
index 7a095862e9ce2aad426bcb01da21b7910b545aa2..ada32918cb12d35a2b41a9359cce28e8c18ca112 100644
--- a/Framework/Kernel/inc/MantidKernel/PropertyManagerOwner.h
+++ b/Framework/Kernel/inc/MantidKernel/PropertyManagerOwner.h
@@ -65,7 +65,9 @@ public:
   void setPropertyOrdinal(const int &index, const std::string &value);
 
   /// Make m_properties point to the same PropertyManager as po.
-  void copyPropertiesFrom(const PropertyManagerOwner &po) { *this = po; }
+  virtual void copyPropertiesFrom(const PropertyManagerOwner &po) {
+    *this = po;
+  }
 
   bool existsProperty(const std::string &name) const;
   bool validateProperties() const;
diff --git a/Framework/Kernel/src/DateValidator.cpp b/Framework/Kernel/src/DateValidator.cpp
index 2ff99628903731dcf38e75d971c67852a1f8c550..5362fb247e217211a577736781841c1057ccacfe 100644
--- a/Framework/Kernel/src/DateValidator.cpp
+++ b/Framework/Kernel/src/DateValidator.cpp
@@ -28,6 +28,9 @@ struct tm getTimeValue(const std::string &sDate, std::string &error) {
   timeinfo.tm_wday = 0;
   timeinfo.tm_yday = 0;
   timeinfo.tm_isdst = -1;
+#ifndef _WIN32
+  timeinfo.tm_gmtoff = 0;
+#endif
 
   std::basic_string<char>::size_type index, off = 0;
   int day, month, year;
diff --git a/Framework/Kernel/src/Matrix.cpp b/Framework/Kernel/src/Matrix.cpp
index f4e1adc13197297776e06c33da66c50614498298..014284f04c4da6b769c33f2d1157cb0390e3f336 100644
--- a/Framework/Kernel/src/Matrix.cpp
+++ b/Framework/Kernel/src/Matrix.cpp
@@ -158,17 +158,20 @@ Matrix<T>::Matrix(const Matrix<T> &A, const size_t nrow, const size_t ncol)
     throw Kernel::Exception::IndexError(ncol, A.ny,
                                         "Matrix::Constructor without col");
   setMem(nx, ny);
-  size_t iR(0);
-  for (size_t i = 0; i <= nx; i++) {
-    if (i != nrow) {
-      size_t jR(0);
-      for (size_t j = 0; j <= ny; j++) {
-        if (j != ncol) {
-          V[iR][jR] = A.V[i][j];
-          jR++;
+  if (V) {
+    size_t iR(0);
+    for (size_t i = 0; i <= nx; i++) {
+      if (i != nrow) {
+        size_t jR(0);
+        for (size_t j = 0; j <= ny; j++) {
+          if (j != ncol) {
+
+            V[iR][jR] = A.V[i][j];
+            jR++;
+          }
         }
+        iR++;
       }
-      iR++;
     }
   }
 }
diff --git a/Framework/LiveData/src/ADARA/ADARAParser.cpp b/Framework/LiveData/src/ADARA/ADARAParser.cpp
index 8fe1652ecb61c1985e1538b85869fc1c8d029b3f..1fe48e4b00b4755d3c0e3a73e5c25c8caf289e86 100644
--- a/Framework/LiveData/src/ADARA/ADARAParser.cpp
+++ b/Framework/LiveData/src/ADARA/ADARAParser.cpp
@@ -9,7 +9,7 @@ using namespace ADARA;
 
 Parser::Parser(unsigned int initial_buffer_size, unsigned int max_pkt_size)
     : m_size(initial_buffer_size), m_max_size(max_pkt_size), m_len(0),
-      m_restart_offset(0), m_oversize_len(0) {
+      m_restart_offset(0), m_oversize_len(0), m_oversize_offset(0) {
   m_buffer = new uint8_t[initial_buffer_size];
   m_discarded_packets.clear();
 }
diff --git a/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Integrate3DEvents.h b/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Integrate3DEvents.h
index 2d2b6398fcbc13ef8930008df57da0b01eb015e7..d5a3c71fc66da3866275f0cd6a87bf0c4b5050e5 100644
--- a/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Integrate3DEvents.h
+++ b/Framework/MDAlgorithms/inc/MantidMDAlgorithms/Integrate3DEvents.h
@@ -127,10 +127,10 @@ private:
   double detectorQ(std::vector<Kernel::V3D> E1Vec,
                    const Mantid::Kernel::V3D QLabFrame, std::vector<double> &r);
   // Private data members
-  PeakQMap peak_qs;         // hashtable with peak Q-vectors
-  EventListMap event_lists; // hashtable with lists of events for each peak
-  Kernel::DblMatrix UBinv;  // matrix mapping from Q to h,k,l
-  double radius;            // size of sphere to use for events around a peak
+  PeakQMap m_peak_qs;         // hashtable with peak Q-vectors
+  EventListMap m_event_lists; // hashtable with lists of events for each peak
+  Kernel::DblMatrix m_UBinv;  // matrix mapping from Q to h,k,l
+  double m_radius;            // size of sphere to use for events around a peak
 };
 
 } // namespace MDAlgorithms
diff --git a/Framework/MDAlgorithms/src/ConvertCWSDExpToMomentum.cpp b/Framework/MDAlgorithms/src/ConvertCWSDExpToMomentum.cpp
index 67c0bd24fdb7f2e62820baa3acc1a485a48fe3c2..5bb6cc662e53abe742bfb355143983a89573ce5d 100644
--- a/Framework/MDAlgorithms/src/ConvertCWSDExpToMomentum.cpp
+++ b/Framework/MDAlgorithms/src/ConvertCWSDExpToMomentum.cpp
@@ -24,7 +24,8 @@ DECLARE_ALGORITHM(ConvertCWSDExpToMomentum)
 /** Constructor
  */
 ConvertCWSDExpToMomentum::ConvertCWSDExpToMomentum()
-    : m_iColFilename(2), m_iColStartDetID(3), m_setQRange(true) {}
+    : m_iColFilename(2), m_iColStartDetID(3), m_setQRange(true),
+      m_isBaseName(false) {}
 
 //----------------------------------------------------------------------------------------------
 /** Destructor
@@ -201,13 +202,15 @@ void ConvertCWSDExpToMomentum::addMDEvents(bool usevirtual) {
   // Check whether to add / or \ to m_dataDir
   std::string sep("");
   if (m_dataDir.size() > 0) {
-    // Determine system
-    bool isWindows(false);
+// Determine system
 #if _WIN64
-    isWindows = true;
-#elif _WIND32
-    isWindows = true;
+    const bool isWindows = true;
+#elif _WIN32
+    const bool isWindows = true;
+#else
+    const bool isWindows = false;
 #endif
+
     if (isWindows && *m_dataDir.rbegin() != '\\') {
       sep = "\\";
     } else if (!isWindows && *m_dataDir.rbegin() != '/')
diff --git a/Framework/MDAlgorithms/src/FindPeaksMD.cpp b/Framework/MDAlgorithms/src/FindPeaksMD.cpp
index 1e94707a155f447cab458f8d4b2e3528fef25294..ba70dd4bedd2239fcf40c699cdac43d92045abe3 100644
--- a/Framework/MDAlgorithms/src/FindPeaksMD.cpp
+++ b/Framework/MDAlgorithms/src/FindPeaksMD.cpp
@@ -215,12 +215,15 @@ FindPeaksMD::createPeak(const Mantid::Kernel::V3D &Q, const double binCount) {
   boost::shared_ptr<DataObjects::Peak> p;
   if (dimType == QLAB) {
     // Build using the Q-lab-frame constructor
-    p = boost::shared_ptr<DataObjects::Peak>(new Peak(inst, Q));
+    p = boost::make_shared<Peak>(inst, Q);
     // Save gonio matrix for later
     p->setGoniometerMatrix(m_goniometer);
   } else if (dimType == QSAMPLE) {
     // Build using the Q-sample-frame constructor
-    p = boost::shared_ptr<DataObjects::Peak>(new Peak(inst, Q, m_goniometer));
+    p = boost::make_shared<Peak>(inst, Q, m_goniometer);
+  } else {
+    throw std::invalid_argument(
+        "Cannot Integrate peaks unless the dimension is QLAB or QSAMPLE");
   }
 
   try { // Look for a detector
diff --git a/Framework/MDAlgorithms/src/ImportMDEventWorkspace.cpp b/Framework/MDAlgorithms/src/ImportMDEventWorkspace.cpp
index 9bb7c6d1a1723019e115ccda352ef3039a6dccee..8aab04ee8dbf02e05f695e30c90b2100fb472a3a 100644
--- a/Framework/MDAlgorithms/src/ImportMDEventWorkspace.cpp
+++ b/Framework/MDAlgorithms/src/ImportMDEventWorkspace.cpp
@@ -266,7 +266,13 @@ void ImportMDEventWorkspace::exec() {
       m_nDimensions + 4; // signal, error, run_no, detector_no
   m_IsFullDataObjects = (nActualColumns == columnsForFullEvents);
 
-  m_nDataObjects = posDiffMDEvent / nActualColumns;
+  if (0 == nActualColumns) {
+    m_nDataObjects = 0;
+    g_log.warning() << "The number of actual columns found in the file "
+                       "(exlcuding comments) is zero" << std::endl;
+  } else {
+    m_nDataObjects = posDiffMDEvent / nActualColumns;
+  }
 
   // Get the min and max extents in each dimension.
   std::vector<double> extentMins(m_nDimensions);
diff --git a/Framework/MDAlgorithms/src/Integrate3DEvents.cpp b/Framework/MDAlgorithms/src/Integrate3DEvents.cpp
index f3db57b5fd7b3652e27e4bf5187cbf8311c872e5..372e9b1ad95a59e2852b7522d4b4e3602fc6a41b 100644
--- a/Framework/MDAlgorithms/src/Integrate3DEvents.cpp
+++ b/Framework/MDAlgorithms/src/Integrate3DEvents.cpp
@@ -35,14 +35,14 @@ using Mantid::Kernel::V3D;
 Integrate3DEvents::Integrate3DEvents(
     std::vector<std::pair<double, V3D>> const &peak_q_list,
     DblMatrix const &UBinv, double radius) {
-  this->UBinv = UBinv;
-  this->radius = radius;
+  m_UBinv = UBinv;
+  m_radius = radius;
 
   int64_t hkl_key;
   for (size_t it = 0; it != peak_q_list.size(); ++it) {
     hkl_key = getHklKey(peak_q_list[it].second);
     if (hkl_key != 0) // only save if hkl != (0,0,0)
-      peak_qs[hkl_key] = peak_q_list[it].second;
+      m_peak_qs[hkl_key] = peak_q_list[it].second;
   }
 }
 
@@ -124,7 +124,12 @@ Integrate3DEvents::ellipseIntegrateEvents(
     return boost::make_shared<NoShape>();
   }
 
-  std::vector<std::pair<double, V3D>> &some_events = event_lists[hkl_key];
+  auto pos = m_event_lists.find(hkl_key);
+  if (m_event_lists.end() == pos)
+    return boost::make_shared<NoShape>();
+  ;
+
+  std::vector<std::pair<double, V3D>> &some_events = pos->second;
 
   if (some_events.size() < 3) // if there are not enough events to
   {                           // find covariance matrix, return
@@ -132,14 +137,14 @@ Integrate3DEvents::ellipseIntegrateEvents(
   }
 
   DblMatrix cov_matrix(3, 3);
-  makeCovarianceMatrix(some_events, cov_matrix, radius);
+  makeCovarianceMatrix(some_events, cov_matrix, m_radius);
 
   std::vector<V3D> eigen_vectors;
   getEigenVectors(cov_matrix, eigen_vectors);
 
   std::vector<double> sigmas;
   for (int i = 0; i < 3; i++) {
-    sigmas.push_back(stdDev(some_events, eigen_vectors[i], radius));
+    sigmas.push_back(stdDev(some_events, eigen_vectors[i], m_radius));
   }
 
   bool invalid_peak = false;
@@ -392,7 +397,7 @@ int64_t Integrate3DEvents::getHklKey2(V3D const &hkl) {
  *  @param q_vector  The q_vector to be mapped to h,k,l
  */
 int64_t Integrate3DEvents::getHklKey(V3D const &q_vector) {
-  V3D hkl = UBinv * q_vector;
+  V3D hkl = m_UBinv * q_vector;
   int h = boost::math::iround<double>(hkl[0]);
   int k = boost::math::iround<double>(hkl[1]);
   int l = boost::math::iround<double>(hkl[2]);
@@ -424,15 +429,15 @@ void Integrate3DEvents::addEvent(std::pair<double, V3D> event_Q,
   if (hkl_key == 0) // don't keep events associated with 0,0,0
     return;
 
-  auto peak_it = peak_qs.find(hkl_key);
-  if (peak_it != peak_qs.end()) {
+  auto peak_it = m_peak_qs.find(hkl_key);
+  if (peak_it != m_peak_qs.end()) {
     if (!peak_it->second.nullVector()) {
       if (hkl_integ)
-        event_Q.second = event_Q.second - UBinv * peak_it->second;
+        event_Q.second = event_Q.second - m_UBinv * peak_it->second;
       else
         event_Q.second = event_Q.second - peak_it->second;
-      if (event_Q.second.norm() < radius) {
-        event_lists[hkl_key].push_back(event_Q);
+      if (event_Q.second.norm() < m_radius) {
+        m_event_lists[hkl_key].push_back(event_Q);
       }
     }
   }
@@ -511,8 +516,8 @@ PeakShapeEllipsoid_const_sptr Integrate3DEvents::ellipseIntegrateEvents(
     // if necessary restrict the background ellipsoid
     // to lie within the specified sphere, and adjust
     // the other sizes, proportionally
-    if (r3 * max_sigma > radius) {
-      r3 = radius / max_sigma;
+    if (r3 * max_sigma > m_radius) {
+      r3 = m_radius / max_sigma;
       r1 = r3 * 0.79370053f; // This value for r1 and r2 makes the background
       r2 = r1;               // shell volume equal to the peak region volume.
     }
diff --git a/Framework/MDAlgorithms/src/IntegrateMDHistoWorkspace.cpp b/Framework/MDAlgorithms/src/IntegrateMDHistoWorkspace.cpp
index 711de48f4bf03d29ae298d0aaebf6c47f0f01693..1468a6001c3194cd40433439827f19207efa27ae 100644
--- a/Framework/MDAlgorithms/src/IntegrateMDHistoWorkspace.cpp
+++ b/Framework/MDAlgorithms/src/IntegrateMDHistoWorkspace.cpp
@@ -386,6 +386,10 @@ void IntegrateMDHistoWorkspace::exec() {
         // Create a thread-local input iterator.
         boost::scoped_ptr<MDHistoWorkspaceIterator> inIterator(
             dynamic_cast<MDHistoWorkspaceIterator *>(inWS->createIterator()));
+        if (!inIterator) {
+          throw std::runtime_error(
+              "Could not convert IMDIterator to a MDHistoWorkspaceIterator");
+        }
 
         /*
         We jump to the iterator position which is closest in the model
diff --git a/Framework/PythonInterface/plugins/algorithms/LoadVesuvio.py b/Framework/PythonInterface/plugins/algorithms/LoadVesuvio.py
index e587a1bfdef0c883ffd6d29d8e7955c34d6b0dfe..477cf69705777a9ce74bfb877129a6023557327e 100644
--- a/Framework/PythonInterface/plugins/algorithms/LoadVesuvio.py
+++ b/Framework/PythonInterface/plugins/algorithms/LoadVesuvio.py
@@ -132,6 +132,20 @@ class LoadVesuvio(LoadEmptyVesuvio):
         else:
             self._exec_single_foil_state_mode()
 
+#----------------------------------------------------------------------------------------
+
+    def validateInputs(self):
+        issues = {}
+
+        # Validtae run number ranges
+        run_str = self.getProperty(RUN_PROP).value
+        if "-" in run_str:
+            lower, upper = run_str.split("-")
+            if upper < lower:
+                issues[RUN_PROP] = "Range must be in format lower-upper"
+
+        return issues
+
 #----------------------------------------------------------------------------------------
 
     def _exec_difference_mode(self):
@@ -346,24 +360,42 @@ class LoadVesuvio(LoadEmptyVesuvio):
             if index == 0:
                 out_name, out_mon = SUMMED_WS, SUMMED_MON
             else:
-                out_name, out_mon = SUMMED_WS+'tmp', SUMMED_MON + 'tmp'
+                out_name, out_mon = SUMMED_WS + 'tmp', SUMMED_MON + 'tmp'
+
             # Load data
-            ms.LoadRaw(Filename=run, SpectrumList=spectra,
-                       OutputWorkspace=out_name, LoadMonitors='Exclude',EnableLogging=_LOGGING_)
-            ms.LoadRaw(Filename=run,SpectrumList=self._mon_spectra,
-                       OutputWorkspace=out_mon,EnableLogging=_LOGGING_)
-            if index > 0: # sum
-                ms.Plus(LHSWorkspace=SUMMED_WS, RHSWorkspace=out_name,
-                        OutputWorkspace=SUMMED_WS,EnableLogging=_LOGGING_)
-                ms.Plus(LHSWorkspace=SUMMED_MON, RHSWorkspace=out_mon,
-                        OutputWorkspace=SUMMED_MON,EnableLogging=_LOGGING_)
-                ms.DeleteWorkspace(out_name,EnableLogging=_LOGGING_)
-                ms.DeleteWorkspace(out_mon,EnableLogging=_LOGGING_)
-
-        ms.CropWorkspace(Inputworkspace= SUMMED_WS, OutputWorkspace= SUMMED_WS,
-                         XMax=self._tof_max,EnableLogging=_LOGGING_)
-        ms.CropWorkspace(Inputworkspace= SUMMED_MON, OutputWorkspace= SUMMED_MON,
-                         XMax=self._mon_tof_max, EnableLogging=_LOGGING_)
+            ms.LoadRaw(Filename=run,
+                       SpectrumList=spectra,
+                       OutputWorkspace=out_name,
+                       LoadMonitors='Exclude',
+                       EnableLogging=_LOGGING_)
+            ms.LoadRaw(Filename=run,
+                       SpectrumList=self._mon_spectra,
+                       OutputWorkspace=out_mon,
+                       EnableLogging=_LOGGING_)
+
+            # Sum
+            if index > 0:
+                ms.Plus(LHSWorkspace=SUMMED_WS,
+                        RHSWorkspace=out_name,
+                        OutputWorkspace=SUMMED_WS,
+                        EnableLogging=_LOGGING_)
+                ms.Plus(LHSWorkspace=SUMMED_MON,
+                        RHSWorkspace=out_mon,
+                        OutputWorkspace=SUMMED_MON,
+                        EnableLogging=_LOGGING_)
+
+                ms.DeleteWorkspace(out_name, EnableLogging=_LOGGING_)
+                ms.DeleteWorkspace(out_mon, EnableLogging=_LOGGING_)
+
+        ms.CropWorkspace(Inputworkspace= SUMMED_WS,
+                         OutputWorkspace=SUMMED_WS,
+                         XMax=self._tof_max,
+                         EnableLogging=_LOGGING_)
+        ms.CropWorkspace(Inputworkspace= SUMMED_MON,
+                         OutputWorkspace=SUMMED_MON,
+                         XMax=self._mon_tof_max,
+                         EnableLogging=_LOGGING_)
+
         return mtd[SUMMED_WS], mtd[SUMMED_MON]
 
 #----------------------------------------------------------------------------------------
@@ -375,9 +407,9 @@ class LoadVesuvio(LoadEmptyVesuvio):
         run_str = self.getProperty(RUN_PROP).value
         # Load is not doing the right thing when summing. The numbers don't look correct
         if "-" in run_str:
-            lower,upper =  run_str.split("-")
+            lower, upper = run_str.split("-")
             # Range goes lower to up-1 but we want to include the last number
-            runs = range(int(lower),int(upper)+1)
+            runs = range(int(lower), int(upper)+1)
 
         elif "," in run_str:
             runs =  run_str.split(",")
diff --git a/Framework/PythonInterface/plugins/algorithms/SavePlot1DAsJson.py b/Framework/PythonInterface/plugins/algorithms/SavePlot1DAsJson.py
index f52fad8cdc115c57000329048628b138798af648..7bc6cc433707c03185ec1ec1402151f124a6de45 100644
--- a/Framework/PythonInterface/plugins/algorithms/SavePlot1DAsJson.py
+++ b/Framework/PythonInterface/plugins/algorithms/SavePlot1DAsJson.py
@@ -1,4 +1,4 @@
-#pylint: disable=no-init,unused-variable
+#pylint: disable=no-init,unused-variable,invalid-name,bare-except
 from mantid.api import *
 from mantid.kernel import *
 
@@ -76,30 +76,47 @@ class SavePlot1DAsJson(PythonAlgorithm):
         return
 
     def _serialize(self, workspace, plotname):
-        wname = plotname or workspace.getName()
+        pname = plotname or workspace.getName()
         # init dictionary
         ishist = workspace.isHistogramData()
         plottype = "histogram" if ishist else "point"
-        serialized = {"type": plottype}
-        # helper
-        label = lambda axis: "%s (%s)" % (
-            axis.getUnit().caption(),
-            axis.getUnit().symbol() or 1,
+        serialized = dict(
+            type = plottype,
+            data = dict(),
             )
         # loop over spectra
         for i in range(workspace.getNumberHistograms()):
-            k = "%s%s" % (wname, i)
-            value = dict(
-                x=list(workspace.readX(i)),
-                y=list(workspace.readY(i)),
-                e=list(workspace.readE(i)),
-                xlabel=label(workspace.getAxis(0)),
-                ylabel=label(workspace.getAxis(1)),
-                title="long title of %s" % k,
-                )
-            serialized[k] = value
+            spectrum_no = workspace.getSpectrum(i).getSpectrumNo()
+            # Why do we need label?
+            # label = "%s_spectrum_%d" % (pname, spectrum_no)
+            # labels.append(label)
+            # or title?
+            # title = "%s - spectrum %d" % (workspace.getTitle(), spectrum_no)
+            arr = [
+                list(workspace.readX(i)),
+                list(workspace.readY(i)),
+                list(workspace.readE(i)),
+                ]
+            serialized['data'][spectrum_no] = arr
             continue
-        return serialized
+        # axes
+        # .. helper
+        label = lambda axis: axis.getUnit().caption()
+        def unit(axis):
+            s = axis.getUnit().symbol()
+            try:
+                return s.latex()
+            except:
+                return '%s' % s
+        axes = dict(
+            xlabel=label(workspace.getAxis(0)),
+            ylabel=label(workspace.getAxis(1)),
+            xunit = unit(workspace.getAxis(0)),
+            # yunit = unit(workspace.getAxis(1)),
+            yunit = workspace.YUnitLabel(),
+            )
+        serialized['axes'] = axes
+        return {pname: serialized}
 
 
 # Register algorithm with Mantid
diff --git a/Framework/PythonInterface/plugins/algorithms/TOFTOFCropWorkspace.py b/Framework/PythonInterface/plugins/algorithms/TOFTOFCropWorkspace.py
new file mode 100644
index 0000000000000000000000000000000000000000..c7c6f387adb444ff9c0b0ded8ac87c33c0f3bd99
--- /dev/null
+++ b/Framework/PythonInterface/plugins/algorithms/TOFTOFCropWorkspace.py
@@ -0,0 +1,70 @@
+from mantid.api import PythonAlgorithm, AlgorithmFactory, WorkspaceProperty    # , WorkspaceUnitValidator
+from mantid.kernel import Direction
+import mantid.simpleapi as api
+
+
+class TOFTOFCropWorkspace(PythonAlgorithm):
+    """ Crop empty time channels
+    """
+    def __init__(self):
+        PythonAlgorithm.__init__(self)
+
+    def category(self):
+        """ Return category
+        """
+        return "PythonAlgorithms\\MLZ\\TOFTOF;Utility"
+
+    def name(self):
+        """ Return summary
+        """
+        return "TOFTOFCropWorkspace"
+
+    def summary(self):
+        return "Crop empty time channels."
+
+    def PyInit(self):
+        """ Declare properties
+        """
+        # better would be to use the validator, but it fails if WorkspaceGroup is given as an input
+        # self.declareProperty(WorkspaceProperty("InputWorkspace", "", direction=Direction.Input,
+        #                                       validator=WorkspaceUnitValidator('TOF')),
+        #                     doc="Input workspace.")
+        self.declareProperty(WorkspaceProperty("InputWorkspace", "", direction=Direction.Input),
+                             doc="Input workspace.")
+        self.declareProperty(WorkspaceProperty("OutputWorkspace", "", direction=Direction.Output),
+                             doc="Name of the workspace that will contain the results")
+        return
+
+    def validateInputs(self):
+        issues = dict()
+        input_workspace = self.getProperty("InputWorkspace").value
+
+        xunit = input_workspace.getAxis(0).getUnit().unitID()
+        if xunit != 'TOF':
+            issues['InputWorkspace'] = "X axis units must be TOF. "
+
+        # check for required properties
+        run = input_workspace.getRun()
+        if not run.hasProperty('channel_width'):
+            issues['InputWorkspace'] = "Input workpsace must have sample log channel_width."
+        if not run.hasProperty('full_channels'):
+            issues['InputWorkspace'] = "Input workpsace must have sample log full_channels."
+
+        return issues
+
+    def PyExec(self):
+        """ Main execution body
+        """
+        inputws = self.getProperty("InputWorkspace").value
+        outputws = self.getProperty("OutputWorkspace").value
+
+        run = inputws.getRun()
+        channel_width = float(run.getLogData('channel_width').value)
+        full_channels = float(run.getLogData('full_channels').value)
+
+        outputws = api.CropWorkspace(inputws, XMin=0., XMax=full_channels*channel_width, OutputWorkspace=outputws)
+        self.setProperty("OutputWorkspace", outputws)
+
+
+# Register algorithm with Mantid.
+AlgorithmFactory.subscribe(TOFTOFCropWorkspace)
diff --git a/Framework/PythonInterface/test/python/plugins/algorithms/CMakeLists.txt b/Framework/PythonInterface/test/python/plugins/algorithms/CMakeLists.txt
index c12c040cddbff6f851d86f23bfa144fc0bbeb73f..512bbcf54bb99005c226817590357887ddf922e3 100644
--- a/Framework/PythonInterface/test/python/plugins/algorithms/CMakeLists.txt
+++ b/Framework/PythonInterface/test/python/plugins/algorithms/CMakeLists.txt
@@ -75,6 +75,7 @@ set ( TEST_PY_FILES
   UpdatePeakParameterTableValueTest.py
   SANSSubtractTest.py
   TimeSliceTest.py
+  TOFTOFCropWorkspaceTest.py
   TOFTOFMergeRunsTest.py
   TOSCABankCorrectionTest.py
   TransformToIqtTest.py
diff --git a/Framework/PythonInterface/test/python/plugins/algorithms/SavePlot1DAsJsonTest.py b/Framework/PythonInterface/test/python/plugins/algorithms/SavePlot1DAsJsonTest.py
index 6e8c6100e3f2d764c4aa5a8b6c5bdb8961b02cbc..62f8c938fa13402e41580886bc0c61f632ad58d6 100644
--- a/Framework/PythonInterface/test/python/plugins/algorithms/SavePlot1DAsJsonTest.py
+++ b/Framework/PythonInterface/test/python/plugins/algorithms/SavePlot1DAsJsonTest.py
@@ -1,4 +1,4 @@
-#pylint: disable=invalid-name,too-many-public-methods
+#pylint: disable=invalid-name,too-many-public-methods,too-many-arguments
 import unittest
 import numpy as np
 import mantid.simpleapi as api
@@ -9,13 +9,13 @@ from mantid.api import AnalysisDataService
 
 import os, json
 
-class SaveVulcanGSSTest(unittest.TestCase):
+class SavePlot1DAsJsonTest(unittest.TestCase):
 
     def test_save_one_curve(self):
         """ Test to Save one curve
         """
-        datawsname = "TestOneCurve"
-        E, I, err = self._createOneCurve(datawsname)
+        datawsname = "constant energy cut"
+        E, I, err = self._createOneQCurve(datawsname)
 
         # Execute
         out_path = "tempout_curve.json"
@@ -26,11 +26,9 @@ class SaveVulcanGSSTest(unittest.TestCase):
         # executed?
         self.assertTrue(alg_test.isExecuted())
         # Verify ....
-        d = json.load(open(out_path))
-        d0 = d[datawsname+'0'] # plots are numbered
-        np.testing.assert_array_equal(d0['x'], E)
-        np.testing.assert_array_equal(d0['y'], I)
-        np.testing.assert_array_equal(d0['e'], err)
+        d = json.load(open(out_path))[datawsname]
+        self.assertEqual(d['type'], 'point')
+        self._checkData(d, E, I, err)
         # Delete the output file
         os.remove(out_path)
         return
@@ -51,11 +49,8 @@ class SaveVulcanGSSTest(unittest.TestCase):
         # Executed?
         self.assertTrue(alg_test.isExecuted())
         # Verify ....
-        d = json.load(open(out_path))
-        d0 = d[datawsname+'0'] # plots are numbered
-        np.testing.assert_array_equal(d0['x'], E)
-        np.testing.assert_array_equal(d0['y'], I)
-        np.testing.assert_array_equal(d0['e'], err)
+        d = json.load(open(out_path))[datawsname]
+        self._checkData(d, E, I, err)
         # test overwrite
         alg_test = run_algorithm(
             "SavePlot1DAsJson",
@@ -80,14 +75,9 @@ class SaveVulcanGSSTest(unittest.TestCase):
         # executed?
         self.assertTrue(alg_test.isExecuted())
         # Verify ....
-        d = json.load(open(out_path))
-        d0 = d[datawsname+'0'] # plots are numbered
-        np.testing.assert_array_equal(d0['x'], E)
-        np.testing.assert_array_equal(d0['y'], I)
-        np.testing.assert_array_equal(d0['e'], err)
-        d1 = d[datawsname+'1'] #
-        np.testing.assert_array_equal(d1['y'], I2)
-        np.testing.assert_array_equal(d1['e'], err2)
+        d = json.load(open(out_path))[datawsname]
+        self._checkData(d, E, I, err)
+        self._checkData(d, E, I2, err2, ID="2")
         # Delete the output file
         os.remove(out_path)
         return
@@ -97,6 +87,7 @@ class SaveVulcanGSSTest(unittest.TestCase):
         """ Test to Save one curve with a name specified by client
         """
         datawsname = "TestOneCurve"
+        plotname = "myplot"
         E, I, err = self._createOneCurve(datawsname)
         # Execute
         out_path = "tempout_curve_withname.json"
@@ -104,36 +95,55 @@ class SaveVulcanGSSTest(unittest.TestCase):
             "SavePlot1DAsJson",
             InputWorkspace = datawsname,
             JsonFilename = out_path,
-            PlotName = "myplot")
+            PlotName = plotname)
         # executed?
         self.assertTrue(alg_test.isExecuted())
         # Verify ....
-        d = json.load(open(out_path))
-        plotname = "myplot"
-        d0 = d[plotname+'0'] # plots are numbered
-        np.testing.assert_array_equal(d0['x'], E)
-        np.testing.assert_array_equal(d0['y'], I)
-        np.testing.assert_array_equal(d0['e'], err)
+        d = json.load(open(out_path))[plotname]
+        self._checkData(d, E, I, err)
         # Delete the output file
         os.remove(out_path)
         return
 
 
+    def _checkData(self, s, E, I, err, ID="1"):
+        d0 = s["data"][ID]
+        np.testing.assert_array_equal(d0[0], E)
+        np.testing.assert_array_equal(d0[1], I)
+        np.testing.assert_array_equal(d0[2], err)
+        return
+
+
     def _createOneCurve(self, datawsname):
         """ Create data workspace
         """
-        E = np.arange(-50, 50, 1.0)
+        E = np.arange(-50, 50, 10.0)
         I = 1000 * np.exp(-E**2/10**2)
         err = I ** .5
         # create workspace
         dataws = api.CreateWorkspace(
             DataX = E, DataY = I, DataE = err, NSpec = 1,
-            UnitX = "Energy(meV)")
+            UnitX = "Energy")
         # Add to data service
         AnalysisDataService.addOrReplace(datawsname, dataws)
         return E, I, err
 
 
+    def _createOneQCurve(self, datawsname):
+        """ Create data workspace
+        """
+        Q = np.arange(0, 13, 1.0)
+        I = 1000 * np.exp(-Q**2/10**2)
+        err = I ** .5
+        # create workspace
+        dataws = api.CreateWorkspace(
+            DataX = Q, DataY = I, DataE = err, NSpec = 1,
+            UnitX = "Momentum")
+        # Add to data service
+        AnalysisDataService.addOrReplace(datawsname, dataws)
+        return Q, I, err
+
+
     def _createOneHistogram(self, datawsname):
         """ Create data workspace
         """
diff --git a/Framework/PythonInterface/test/python/plugins/algorithms/TOFTOFCropWorkspaceTest.py b/Framework/PythonInterface/test/python/plugins/algorithms/TOFTOFCropWorkspaceTest.py
new file mode 100644
index 0000000000000000000000000000000000000000..14651813e297fe91d44d8e8006bfc41db7655bbb
--- /dev/null
+++ b/Framework/PythonInterface/test/python/plugins/algorithms/TOFTOFCropWorkspaceTest.py
@@ -0,0 +1,59 @@
+import unittest
+from mantid.simpleapi import Load, DeleteWorkspace, GroupWorkspaces, TOFTOFCropWorkspace
+from testhelpers import run_algorithm
+from mantid.api import AnalysisDataService
+
+
+class TOFTOFCropWorkspaceTest(unittest.TestCase):
+
+    _input_ws = None
+    _cropped_ws = None
+
+    def setUp(self):
+        input_ws = Load(Filename="TOFTOFTestdata.nxs")
+        self._input_ws = input_ws
+
+    def test_basicrun(self):
+        OutputWorkspaceName = "cropped_ws"
+        alg_test = run_algorithm("TOFTOFCropWorkspace",
+                                 InputWorkspace=self._input_ws,
+                                 OutputWorkspace=OutputWorkspaceName)
+        self.assertTrue(alg_test.isExecuted())
+        self._cropped_ws = AnalysisDataService.retrieve(OutputWorkspaceName)
+
+        run = self._cropped_ws.getRun()
+        # check existence of required entries in logs
+        self.assertTrue('full_channels' in run.keys())
+        self.assertTrue('channel_width' in run.keys())
+        # check their values
+        full_channels = float(run.getLogData('full_channels').value)
+        channel_width = float(run.getLogData('channel_width').value)
+        self.assertTrue(full_channels > 0.)
+        self.assertTrue(channel_width > 0.)
+        # check unit horizontal axis
+        self.assertEqual(self._cropped_ws.getAxis(0).getUnit().unitID(), 'TOF')
+        # check length of cropped ws
+        self.assertEqual(len(self._cropped_ws.readX(0)), int(full_channels))
+
+    def test_inputgroup(self):
+        group = GroupWorkspaces([self._input_ws])
+        OutputWorkspaceName = "cropped_ws"
+        alg_test = run_algorithm("TOFTOFCropWorkspace",
+                                 InputWorkspace=group,
+                                 OutputWorkspace=OutputWorkspaceName)
+        self.assertTrue(alg_test.isExecuted())
+
+    def test_invalid_xunits(self):
+        self._input_ws.getAxis(0).setUnit('Wavelength')
+        OutputWorkspaceName = "cropped_ws"
+        self.assertRaises(RuntimeError, TOFTOFCropWorkspace, InputWorkspace=self._input_ws,
+                          OutputWorkspace=OutputWorkspaceName)
+
+    def cleanUp(self):
+        if AnalysisDataService.doesExist(self._input_ws):
+            DeleteWorkspace(self._input_ws)
+        if AnalysisDataService.doesExist(self._cropped_ws):
+            DeleteWorkspace(self._cropped_ws)
+
+if __name__ == "__main__":
+    unittest.main()
diff --git a/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks2D.h b/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks2D.h
index 973c128b27ba685ec33b4abfe7b79f178da2f9a5..1a7c1005d68692eb07359cc90d0ad0731cadf8ed 100644
--- a/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks2D.h
+++ b/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks2D.h
@@ -6,6 +6,7 @@
 #include "MantidAPI/Algorithm.h"
 #include "MantidAPI/IFunction.h"
 #include "MantidAPI/IPeakFunction.h"
+#include "MantidGeometry/Crystal/PointGroup.h"
 
 #include "MantidKernel/Matrix.h"
 
@@ -104,6 +105,9 @@ protected:
   getFunctionPawley(std::string profileFunctionName,
                     const PoldiPeakCollection_sptr &peakCollection);
 
+  std::string getCrystalSystemFromPointGroup(
+      const Geometry::PointGroup_sptr &pointGroup) const;
+
   std::string
   getRefinedStartingCell(const std::string &initialCell,
                          const std::string &crystalSystem,
diff --git a/Framework/SINQ/src/PoldiFitPeaks2D.cpp b/Framework/SINQ/src/PoldiFitPeaks2D.cpp
index 5ace6536c53526aaddd76b1e7faec2a84e5e7b44..dc9755d28fbc0efb9ba8f4463e93b03d0c66e3dc 100644
--- a/Framework/SINQ/src/PoldiFitPeaks2D.cpp
+++ b/Framework/SINQ/src/PoldiFitPeaks2D.cpp
@@ -546,8 +546,7 @@ Poldi2DFunction_sptr PoldiFitPeaks2D::getFunctionPawley(
                                 "peaks do not have point group.");
   }
 
-  std::string crystalSystem =
-      getCrystalSystemAsString(pointGroup->crystalSystem());
+  std::string crystalSystem = getCrystalSystemFromPointGroup(pointGroup);
   pawleyFunction->setCrystalSystem(crystalSystem);
 
   UnitCell cell = peakCollection->unitCell();
@@ -575,6 +574,35 @@ Poldi2DFunction_sptr PoldiFitPeaks2D::getFunctionPawley(
   return mdFunction;
 }
 
+/**
+ * Returns the crystal system for the specified point group
+ *
+ * This function simply uses Geometry::getCrystalSystemAsString(), except when
+ * the crystal system is trigonal but the point group uses hexagonal axes. In
+ * that case this function returns the string for PointGroup::Hexagonal.
+ *
+ * @param pointGroup :: The point group for which to find the crystal system
+ * @return The crystal system for the point group
+ */
+std::string PoldiFitPeaks2D::getCrystalSystemFromPointGroup(
+    const PointGroup_sptr &pointGroup) const {
+  if (!pointGroup) {
+    throw std::invalid_argument(
+        "Cannot return crystal system for null PointGroup.");
+  }
+
+  PointGroup::CrystalSystem crystalSystem = pointGroup->crystalSystem();
+
+  if (crystalSystem == PointGroup::Trigonal) {
+    if (pointGroup->getCoordinateSystem() ==
+        Group::CoordinateSystem::Hexagonal) {
+      return getCrystalSystemAsString(PointGroup::Hexagonal);
+    }
+  }
+
+  return getCrystalSystemAsString(crystalSystem);
+}
+
 /**
  * Tries to refine the initial cell using the supplied peaks
  *
diff --git a/Framework/SINQ/src/PoldiUtilities/PoldiAutoCorrelationCore.cpp b/Framework/SINQ/src/PoldiUtilities/PoldiAutoCorrelationCore.cpp
index 4a3ec4167a2bcbb4b2ea8d71ff9529c35d134574..48b5317b0eacdd7fdf4cc32a6cb5af86b2223ca7 100644
--- a/Framework/SINQ/src/PoldiUtilities/PoldiAutoCorrelationCore.cpp
+++ b/Framework/SINQ/src/PoldiUtilities/PoldiAutoCorrelationCore.cpp
@@ -385,6 +385,18 @@ UncertainValue PoldiAutoCorrelationCore::getCMessAndCSigma(
   case 2: {
     int middleIndex = cleanIndex((locator.icmin + 1), m_timeBinCount);
 
+    if (middleIndex < 0) {
+      m_logger.warning() << "Inconsistency foun while calculating correlation "
+                            "intensity and error for d-value: "
+                         << boost::lexical_cast<std::string>(dValue)
+                         << ", with detector index: "
+                         << boost::lexical_cast<std::string>(index)
+                         << ", got middle index: "
+                         << boost::lexical_cast<std::string>(middleIndex)
+                         << ", ignoring it." << std::endl;
+      break;
+    }
+
     double counts = getCounts(locator.detectorElement, middleIndex);
     double normCounts = getNormCounts(locator.detectorElement, middleIndex);
 
diff --git a/Framework/SINQ/src/PoldiUtilities/PoldiResidualCorrelationCore.cpp b/Framework/SINQ/src/PoldiUtilities/PoldiResidualCorrelationCore.cpp
index 02f23178125755897c583659e66ec70e8ca6ed16..665b2f1eefa67af58661bb36d0e4c8d86b5c6904 100644
--- a/Framework/SINQ/src/PoldiUtilities/PoldiResidualCorrelationCore.cpp
+++ b/Framework/SINQ/src/PoldiUtilities/PoldiResidualCorrelationCore.cpp
@@ -99,6 +99,15 @@ void PoldiResidualCorrelationCore::distributeCorrelationCounts(
         case 2: {
           int middleIndex = cleanIndex((locator.icmin + 1), m_timeBinCount);
 
+          if (middleIndex < 0) {
+            m_logger.warning()
+                << "Inconsistency foun while calculating distribute "
+                   "correlation counts for d-value with index "
+                << boost::lexical_cast<std::string>(k) << ", got middle index: "
+                << boost::lexical_cast<std::string>(middleIndex)
+                << ", ignoring it." << std::endl;
+            break;
+          }
           addToCountData(locator.detectorElement, middleIndex, deltaForD);
         }
         case 1: {
diff --git a/Framework/SINQ/test/PoldiFitPeaks2DTest.h b/Framework/SINQ/test/PoldiFitPeaks2DTest.h
index da95dd9141476a4b1fdef8b7604b044ff0b0f45a..a9f11eb2d9af4e130098bdbf47729f9625cfc4e6 100644
--- a/Framework/SINQ/test/PoldiFitPeaks2DTest.h
+++ b/Framework/SINQ/test/PoldiFitPeaks2DTest.h
@@ -433,6 +433,40 @@ public:
     TS_ASSERT_EQUALS(refinedCell, "5 5 5 90 90 90");
   }
 
+  void testGetCrystalSystemFromPointGroup() {
+    TestablePoldiFitPeaks2D alg;
+
+    auto pgCubic = PointGroupFactory::Instance().createPointGroup("m-3m");
+    TS_ASSERT_EQUALS(alg.getCrystalSystemFromPointGroup(pgCubic), "Cubic");
+
+    auto pgTetra = PointGroupFactory::Instance().createPointGroup("4/mmm");
+    TS_ASSERT_EQUALS(alg.getCrystalSystemFromPointGroup(pgTetra), "Tetragonal");
+
+    auto pgOrtho = PointGroupFactory::Instance().createPointGroup("mmm");
+    TS_ASSERT_EQUALS(alg.getCrystalSystemFromPointGroup(pgOrtho),
+                     "Orthorhombic");
+
+    auto pgMono = PointGroupFactory::Instance().createPointGroup("2/m");
+    TS_ASSERT_EQUALS(alg.getCrystalSystemFromPointGroup(pgMono), "Monoclinic");
+
+    auto pgTric = PointGroupFactory::Instance().createPointGroup("-1");
+    TS_ASSERT_EQUALS(alg.getCrystalSystemFromPointGroup(pgTric), "Triclinic");
+
+    auto pgHex = PointGroupFactory::Instance().createPointGroup("6/mmm");
+    TS_ASSERT_EQUALS(alg.getCrystalSystemFromPointGroup(pgHex), "Hexagonal");
+
+    auto pgTrigRh = PointGroupFactory::Instance().createPointGroup("-3m r");
+    TS_ASSERT_EQUALS(alg.getCrystalSystemFromPointGroup(pgTrigRh), "Trigonal");
+
+    auto pgTrigHex = PointGroupFactory::Instance().createPointGroup("-3m");
+    TS_ASSERT_EQUALS(alg.getCrystalSystemFromPointGroup(pgTrigHex),
+                     "Hexagonal");
+
+    PointGroup_sptr invalid;
+    TS_ASSERT_THROWS(alg.getCrystalSystemFromPointGroup(invalid),
+                     std::invalid_argument);
+  }
+
 private:
   PoldiInstrumentAdapter_sptr m_instrument;
   PoldiTimeTransformer_sptr m_timeTransformer;
diff --git a/Framework/WorkflowAlgorithms/src/RefReduction.cpp b/Framework/WorkflowAlgorithms/src/RefReduction.cpp
index cbb14c3e25c92d85ca73c77548dabe91012c99ad..9cc5678a2d2df87113a607c4a9ac52bc0976f26b 100644
--- a/Framework/WorkflowAlgorithms/src/RefReduction.cpp
+++ b/Framework/WorkflowAlgorithms/src/RefReduction.cpp
@@ -628,6 +628,8 @@ double RefReduction::calculateAngleREFM(MatrixWorkspace_sptr workspace) {
   Mantid::Kernel::Property *prop = workspace->run().getProperty("SampleDetDis");
   Mantid::Kernel::TimeSeriesProperty<double> *dp =
       dynamic_cast<Mantid::Kernel::TimeSeriesProperty<double> *>(prop);
+  if (!dp)
+    throw std::runtime_error("SampleDetDis was not a TimeSeriesProperty");
   const double det_distance = dp->getStatistics().mean / 1000.0;
 
   double direct_beam_pix = getProperty("DirectPixel");
diff --git a/MantidPlot/pymantidplot/__init__.py b/MantidPlot/pymantidplot/__init__.py
index f77ce7c983d7da2f2fb6446947c212e40fcbedd5..3ea6a0189f54e0505309f7f71b712aba68fe14c9 100644
--- a/MantidPlot/pymantidplot/__init__.py
+++ b/MantidPlot/pymantidplot/__init__.py
@@ -300,7 +300,9 @@ def plotMD(source, plot_axis=-2, normalization=DEFAULT_MD_NORMALIZATION, error_b
     Args:
         source: Workspace(s) to plot
         plot_axis: Index of the plot axis (defaults to auto-select)
-        normalization: Type of normalization required (defaults to volume)
+        normalization: Type of normalization required (defaults to volume, options available:
+                       MDNormalization.NoNormalization, MDNormalization.NumEventsNormalization, and
+                       MDNormalization.VolumeNormalization).
         error_bars: Flag for error bar plotting.
         window: window used for plotting. If None a new one will be created
         clearWindow: if is True, the window specified will be cleared before adding new curve
diff --git a/MantidPlot/src/ApplicationWindow.cpp b/MantidPlot/src/ApplicationWindow.cpp
index d9455438c81ff03c2f0516cc79f00b0934b5c201..3fa69dd633f1932060d53fc279973fe2ed4731c0 100644
--- a/MantidPlot/src/ApplicationWindow.cpp
+++ b/MantidPlot/src/ApplicationWindow.cpp
@@ -10153,6 +10153,7 @@ void ApplicationWindow::showGraphContextMenu() {
   QMenu axes(this);
   QMenu colour(this);
   QMenu normalization(this);
+  QMenu normMD(this);
   QMenu exports(this);
   QMenu copy(this);
   QMenu prints(this);
@@ -10218,6 +10219,27 @@ void ApplicationWindow::showGraphContextMenu() {
     noNorm->setChecked(!ag->isDistribution());
     binNorm->setChecked(ag->isDistribution());
     cm.insertItem(tr("&Normalization"), &normalization);
+  } else if (ag->normalizableMD()) {
+    QAction *noNormMD = new QAction(tr("N&one"), &normMD);
+    noNormMD->setCheckable(true);
+    connect(noNormMD, SIGNAL(activated()), ag, SLOT(noNormalizationMD()));
+    normMD.addAction(noNormMD);
+
+    QAction *volNormMD = new QAction(tr("&Volume"), &normMD);
+    volNormMD->setCheckable(true);
+    connect(volNormMD, SIGNAL(activated()), ag, SLOT(volumeNormalizationMD()));
+    normMD.addAction(volNormMD);
+
+    QAction *eventsNormMD = new QAction(tr("&Events"), &normMD);
+    eventsNormMD->setCheckable(true);
+    connect(eventsNormMD, SIGNAL(activated()), ag, SLOT(numEventsNormalizationMD()));
+    normMD.addAction(eventsNormMD);
+
+    int normalization = ag->normalizationMD();
+    noNormMD->setChecked(0 == normalization);
+    volNormMD->setChecked(1 == normalization);
+    eventsNormMD->setChecked(2 == normalization);
+    cm.insertItem("MD &Normalization", &normMD);
   }
 
   QMenu plotType(this);
diff --git a/MantidPlot/src/ConfigDialog.cpp b/MantidPlot/src/ConfigDialog.cpp
index 6344d67d31cb6107058a72196d4b9b7feec1ac5a..87e74e4ea83cab6eb72537345019aeadb92dc4f3 100644
--- a/MantidPlot/src/ConfigDialog.cpp
+++ b/MantidPlot/src/ConfigDialog.cpp
@@ -2341,8 +2341,11 @@ void ConfigDialog::apply()
   QList<MdiSubWindow*> windows = app->windowsList();
   foreach(MdiSubWindow *w, windows){
     if (w->isA("MultiLayer")){
-      (dynamic_cast<MultiLayer*>(w))->setScaleLayersOnPrint(boxScaleLayersOnPrint->isChecked());
-      (dynamic_cast<MultiLayer*>(w))->printCropmarks(boxPrintCropmarks->isChecked());
+      MultiLayer* multiLayer = dynamic_cast<MultiLayer*>(w);
+      if (multiLayer) {
+        multiLayer->setScaleLayersOnPrint(boxScaleLayersOnPrint->isChecked());
+        multiLayer->printCropmarks(boxPrintCropmarks->isChecked());
+      }
     }
   }
   // general page: application tab
diff --git a/MantidPlot/src/ContourLinesEditor.cpp b/MantidPlot/src/ContourLinesEditor.cpp
index 19ff48b3bf2c9a39d2da9d592d99f953a1315e9b..144b2c7f245cd9c0bbb736cbee787ba77a733413 100644
--- a/MantidPlot/src/ContourLinesEditor.cpp
+++ b/MantidPlot/src/ContourLinesEditor.cpp
@@ -108,10 +108,14 @@ void ContourLinesEditor::updateContourLevels()
 
 	int rows = table->rowCount();
 	QwtValueList levels;
-	for (int i = 0; i < rows; i++)
-		levels << dynamic_cast<DoubleSpinBox*>(table->cellWidget(i, 0))->value();
+  for (int i = 0; i < rows; i++) {
+    DoubleSpinBox *spinBox =
+        dynamic_cast<DoubleSpinBox *>(table->cellWidget(i, 0));
+    if (spinBox)
+      levels << spinBox->value();
+  }
 
-	d_spectrogram->setContourLevels(levels);
+  d_spectrogram->setContourLevels(levels);
 }
 
 void ContourLinesEditor::updateContourPens()
diff --git a/MantidPlot/src/CustomActionDialog.cpp b/MantidPlot/src/CustomActionDialog.cpp
index 0ffe792247682d974fbf3c6af8338c200fa32c61..8b779deb8ec2a2fb4978b0b5a1439b5d8ba7b504 100644
--- a/MantidPlot/src/CustomActionDialog.cpp
+++ b/MantidPlot/src/CustomActionDialog.cpp
@@ -514,7 +514,10 @@ void CustomActionDialog::chooseFolder()
 QAction * CustomActionDialog::actionAt(int row)
 {
 	ApplicationWindow *app = dynamic_cast<ApplicationWindow *>(parent());
-	QList<QAction *>actions = app->customActionsList();
+  if (!app)
+    throw std::runtime_error(
+        "The parent of this dialog was not the Application Window");
+  QList<QAction *>actions = app->customActionsList();
 	if (actions.isEmpty() || row < 0 || row >= actions.count())
         return 0;
 
diff --git a/MantidPlot/src/Graph.cpp b/MantidPlot/src/Graph.cpp
index db3b3e6fcd290c43819c2df94f5f38d021aee8a4..b90d59c0c2ba39d003eb0589957f4663b3ab805e 100644
--- a/MantidPlot/src/Graph.cpp
+++ b/MantidPlot/src/Graph.cpp
@@ -60,6 +60,7 @@
 
 #include "MantidAPI/AnalysisDataService.h"
 #include "Mantid/MantidMatrixCurve.h"
+#include "Mantid/MantidMDCurve.h"
 #include "MantidQtAPI/PlotAxis.h"
 #include "MantidQtAPI/QwtRasterDataMD.h"
 #include "MantidQtAPI/QwtWorkspaceSpectrumData.h"
@@ -209,6 +210,9 @@ Graph::Graph(int x, int y, int width, int height, QWidget* parent, Qt::WFlags f)
 
   m_isDistribution = false;
   m_normalizable = false;
+
+  m_normalizableMD = false;
+  m_normalizationMD = 0;
 }
 
 void Graph::notifyChanges()
@@ -1436,7 +1440,8 @@ void Graph::setAxisScale(int axis, double start, double end, int type, double st
           QwtScaleWidget *rightAxis = d_plot->axisWidget(QwtPlot::yRight);
           if(rightAxis)
           {
-            if (type == ScaleTransformation::Log10 && (start <= 0 || start == DBL_MAX))
+            //if (type == ScaleTransformation::Log10 && (start <= 0 || start == DBL_MAX))
+            if (type == GraphOptions::Log10 && (start <= 0 || start == DBL_MAX))
             {
               start = sp->getMinPositiveValue();
             }
@@ -3411,12 +3416,15 @@ QString Graph::yAxisTitleFromFirstCurve()
     using namespace Mantid::API;
     QString wsName = firstCurve->workspaceName();
     auto ws = AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>(wsName.toStdString());
-    return MantidQt::API::PlotAxis(m_isDistribution, *ws).title();
-  }
-  else
-  {
-    return axisTitle(0);
+    if (ws)
+      return MantidQt::API::PlotAxis(m_isDistribution, *ws).title();
+  } else if (auto *firstCurve = dynamic_cast<MantidMDCurve*>(curve(0))) {
+    MantidQwtIMDWorkspaceData* data = firstCurve->mantidData();
+    if (data)
+      return data->getYAxisLabel();
   }
+
+  return axisTitle(0);
 }
 
 void Graph::contextMenuEvent(QContextMenuEvent *e)
@@ -5519,9 +5527,9 @@ void Graph::noNormalization()
   if(!m_isDistribution) return; // Nothing to do
 
   m_isDistribution = false;
-  updateDataCurves();
-  d_plot->updateAxes();
-  setYAxisTitle(yAxisTitleFromFirstCurve());
+
+  updateCurvesAndAxes();
+
   notifyChanges();
 }
 
@@ -5533,11 +5541,65 @@ void Graph::binWidthNormalization()
   if(m_isDistribution) return; // Nothing to do
 
   m_isDistribution = true;
+
+  updateCurvesAndAxes();
+
+  notifyChanges();
+}
+
+/**
+ * Set 'None' normalization for MD plots
+ */
+void Graph::noNormalizationMD()
+{
+  if (!normalizableMD())
+    return;
+
+  setNormalizationMD(0);
+
+  updateCurvesAndAxes();
+
+  notifyChanges();
+}
+
+/**
+ * Set volume normalization for MD plots
+ */
+void Graph::volumeNormalizationMD()
+{
+  if (!normalizableMD())
+    return;
+
+  setNormalizationMD(1);
+
+  updateCurvesAndAxes();
+
+  notifyChanges();
+}
+
+/**
+ * Set number of events normalization for MD plots
+ */
+void Graph::numEventsNormalizationMD()
+{
+  if (!normalizableMD())
+    return;
+
+  setNormalizationMD(2);
+
+  updateCurvesAndAxes();
+
+  notifyChanges();
+}
+
+/**
+ * Convenience method to use when updating the normalization types
+ * (whether Matrix or MD data normalizatio).
+ */
+void Graph::updateCurvesAndAxes() {
   updateDataCurves();
   d_plot->updateAxes();
   setYAxisTitle(yAxisTitleFromFirstCurve());
-
-  notifyChanges();
 }
 
 void Graph::setWaterfallXOffset(int offset)
@@ -5653,6 +5715,15 @@ void Graph::updateDataCurves()
       mc->invalidateBoundingRect();
       mc->loadData();
     }
+    else if (MantidMDCurve *mdc = dynamic_cast<MantidMDCurve*>(pc))
+    {
+      //mdc->setDrawAsDistribution(m_isDistribution);
+      // yes, using int in Graph and ApplicationWindow instead of the proper enum, just so that
+      // IMDWorkspace.h does not need to be included in more places in MantidPlot
+      mdc->mantidData()->setNormalization(static_cast<Mantid::API::MDNormalization>(m_normalizationMD));
+      mdc->invalidateBoundingRect();
+    }
+
   }
   QApplication::restoreOverrideCursor();
 }
diff --git a/MantidPlot/src/Graph.h b/MantidPlot/src/Graph.h
index 9512139404943318a36ffc5dc9fa343d9fc82d7d..34ae08f03ca7eacf89224cf0b37a0bffcc81b19d 100644
--- a/MantidPlot/src/Graph.h
+++ b/MantidPlot/src/Graph.h
@@ -209,6 +209,20 @@ public slots:
   bool isDistribution() const { return m_isDistribution; }
   void setDistribution(const bool on) { m_isDistribution = on; }
 
+  void noNormalizationMD();
+  void numEventsNormalizationMD();
+  void volumeNormalizationMD();
+
+  /// normalizable in the MD sense, don't confuse with (bin width) normalizable(),
+  /// True if this is a plot MD
+  bool normalizableMD() const { return m_normalizableMD; }
+  void setNormalizableMD(const bool on) { m_normalizableMD = on; }
+
+  /// when using MD curves (true == normalizbleMD()), what type of normalization
+  int normalizationMD() const { return m_normalizationMD; }
+  void setNormalizationMD(const int normalization) { m_normalizationMD = normalization; }
+
+
 
   //! Accessor method for #d_plot.
   Plot* plotWidget(){return d_plot;};
@@ -813,6 +827,8 @@ private:
 
   QString yAxisTitleFromFirstCurve();
   
+  void updateCurvesAndAxes();
+
   Plot *d_plot;
   QwtPlotZoomer *d_zoomer[2];
   TitlePicker *titlePicker;
@@ -877,6 +893,12 @@ private:
   bool m_isDistribution;
   // True, if the graph can be plotted as distribution
   bool m_normalizable;
+
+  // True if the graph is an MD plot and can be normalized (none, volume, events)
+  bool m_normalizableMD;
+  /// type of normalization for MD curves
+  int m_normalizationMD;
+
   // x and y units of MantidCurves
   boost::shared_ptr<Mantid::Kernel::Unit> m_xUnits;
   boost::shared_ptr<Mantid::Kernel::Unit> m_yUnits;
diff --git a/MantidPlot/src/ImportASCIIDialog.cpp b/MantidPlot/src/ImportASCIIDialog.cpp
index 44c2ff0105b2c0636fe4a8fcebce9f9dbdcb0dcd..075910ef35fb89d929af75626a20ae8a6845b781 100644
--- a/MantidPlot/src/ImportASCIIDialog.cpp
+++ b/MantidPlot/src/ImportASCIIDialog.cpp
@@ -450,62 +450,67 @@ void ImportASCIIDialog::preview()
 
 void ImportASCIIDialog::previewTable()
 {
-	if (!d_preview_table)
-		return;
+  if (!d_preview_table)
+    return;
 
-	if (!d_preview_table->isVisible())
-		d_preview_table->show();
+  if (!d_preview_table->isVisible())
+    d_preview_table->show();
 
-	if (d_current_path.trimmed().isEmpty()){
-		d_preview_table->clear();
-		d_preview_table->resetHeader();
-        return;
-    }
+  if (d_current_path.trimmed().isEmpty()){
+    d_preview_table->clear();
+    d_preview_table->resetHeader();
+    return;
+  }
 
-	int importMode = d_import_mode->currentIndex();
-	if (importMode == NewTables)
-		importMode = Table::Overwrite;
-	else
-		importMode -= 2;
-
-	d_preview_table->resetHeader();
-	d_preview_table->importASCII(d_current_path, columnSeparator(), d_ignored_lines->value(),
-							d_rename_columns->isChecked(), d_strip_spaces->isChecked(),
-							d_simplify_spaces->isChecked(), d_import_comments->isChecked(),
-                            d_comment_string->text(), (Table::ImportMode)importMode, 
-                            boxEndLine->currentIndex(), d_preview_lines_box->value());
-
-	if (d_import_dec_separators->isChecked())
-		d_preview_table->updateDecimalSeparators(decimalSeparators());
-    if (!d_preview_table->isVisible())
-        d_preview_table->show();
+  int importMode = d_import_mode->currentIndex();
+  if (importMode == NewTables) {
+    importMode = (ImportASCIIDialog::ImportMode)Table::Overwrite;
+  } else {
+    importMode -= 2;
+  }
+
+  d_preview_table->resetHeader();
+  d_preview_table->importASCII(d_current_path, columnSeparator(), d_ignored_lines->value(),
+                               d_rename_columns->isChecked(), d_strip_spaces->isChecked(),
+                               d_simplify_spaces->isChecked(), d_import_comments->isChecked(),
+                               d_comment_string->text(), (Table::ImportMode)importMode,
+                               boxEndLine->currentIndex(), d_preview_lines_box->value());
+
+  if (d_import_dec_separators->isChecked())
+    d_preview_table->updateDecimalSeparators(decimalSeparators());
+
+  if (!d_preview_table->isVisible())
+    d_preview_table->show();
 }
 
-void ImportASCIIDialog::previewMatrix()
-{
-	if (!d_preview_matrix)
-		return;
+void ImportASCIIDialog::previewMatrix() {
+  if (!d_preview_matrix)
+    return;
 
-	if (d_current_path.trimmed().isEmpty()){
-		d_preview_matrix->clear();
-        return;
-    }
+  if (d_current_path.trimmed().isEmpty()) {
+    d_preview_matrix->clear();
+    return;
+  }
 
-	int importMode = d_import_mode->currentIndex();
-	if (importMode == NewMatrices)
-		importMode = Matrix::Overwrite;
-	else
-		importMode -= 2;
+  int importMode = d_import_mode->currentIndex();
+  if (importMode == NewMatrices) {
+    importMode = (ImportASCIIDialog::ImportMode)Matrix::Overwrite;
+  } else {
+    // Overwrite-2 => NewColumns (in both Matrix::importMode and
+    // ImportASCIIDialog::importMode)
+    importMode -= 2;
+  }
 
-	QLocale locale = d_preview_matrix->locale();
-	if(d_import_dec_separators->isChecked())
-		locale = decimalSeparators();
+  QLocale locale = d_preview_matrix->locale();
+  if (d_import_dec_separators->isChecked())
+    locale = decimalSeparators();
 
-	d_preview_matrix->importASCII(d_current_path, columnSeparator(), d_ignored_lines->value(),
-							d_strip_spaces->isChecked(), d_simplify_spaces->isChecked(),
-                            d_comment_string->text(), importMode, locale,
-                            boxEndLine->currentIndex(), d_preview_lines_box->value());
-	d_preview_matrix->resizeColumnsToContents();
+  d_preview_matrix->importASCII(
+      d_current_path, columnSeparator(), d_ignored_lines->value(),
+      d_strip_spaces->isChecked(), d_simplify_spaces->isChecked(),
+      d_comment_string->text(), importMode, locale, boxEndLine->currentIndex(),
+      d_preview_lines_box->value());
+  d_preview_matrix->resizeColumnsToContents();
 }
 
 void ImportASCIIDialog::changePreviewFile(const QString& path)
@@ -542,8 +547,8 @@ void ImportASCIIDialog::setNewWindowsOnly(bool on)
     if (on){
         d_import_mode->clear();
         d_import_mode->addItem(tr("New Table"));
-        d_import_mode->addItem(tr("New Matrice"));
-		d_import_mode->addItem(tr("New Workspace"));
+        d_import_mode->addItem(tr("New Matrix"));
+        d_import_mode->addItem(tr("New Workspace"));
     }
 
     d_preview_button->setChecked(false);
diff --git a/MantidPlot/src/Mantid/InstrumentWidget/UnwrappedSurface.cpp b/MantidPlot/src/Mantid/InstrumentWidget/UnwrappedSurface.cpp
index d83662b41b3b486ee0e4da6bce7f7fb13c2a5f1c..77766f8eff2801fa872fa1d9c612ba5122370e61 100644
--- a/MantidPlot/src/Mantid/InstrumentWidget/UnwrappedSurface.cpp
+++ b/MantidPlot/src/Mantid/InstrumentWidget/UnwrappedSurface.cpp
@@ -581,8 +581,8 @@ void UnwrappedSurface::drawSimpleToImage(QImage* image,bool picking)const
     if ( iw < 4 ) iw = 4;
     if ( ih < 4 ) ih = 4;
     
-    double w = (iw == 0)?  dw : udet.width/2;
-    double h = (ih == 0)?  dh : udet.height/2;
+    double w = udet.width/2;
+    double h = udet.height/2;
 
     if (!(m_viewRect.contains(udet.u-w, udet.v-h) || m_viewRect.contains(udet.u+w, udet.v+h))) continue;
 
diff --git a/MantidPlot/src/Mantid/MantidUI.cpp b/MantidPlot/src/Mantid/MantidUI.cpp
index d076bdf157480feeeb4f10b4ff922a8c1a7c90e4..f6ddf9efda70d0a46db18176e62f79426ebffe43 100644
--- a/MantidPlot/src/Mantid/MantidUI.cpp
+++ b/MantidPlot/src/Mantid/MantidUI.cpp
@@ -617,6 +617,9 @@ MultiLayer* MantidUI::plotMDList(const QStringList& wsNames, const int plotAxis,
       data->setPlotAxisChoice(plotAxis);
       data->setNormalization(normalization);
 
+      g->setNormalizableMD(true);
+      g->setNormalizationMD(normalization);
+
       // Using information from the first graph
       if( i == 0 && isGraphNew )
         g->setAutoScale();
diff --git a/MantidPlot/src/ScaleDetails.cpp b/MantidPlot/src/ScaleDetails.cpp
index 71190376094ff0093f8972b303d2eba67214edcd..e6ef88b10316eb1eaf83abc126038653d8a710d5 100644
--- a/MantidPlot/src/ScaleDetails.cpp
+++ b/MantidPlot/src/ScaleDetails.cpp
@@ -272,6 +272,10 @@ void ScaleDetails::initWidgets()
     if (type == ScaleDraw::Date)
     {
       ScaleDraw *sclDraw = dynamic_cast<ScaleDraw *>(d_plot->axisScaleDraw(m_mappedaxis));
+      if (!sclDraw) {
+        throw std::runtime_error("Could not convert the axis Scale Draw object "
+                                 "to a ScaleDraw object");
+      }
       QDateTime origin = sclDraw->dateTimeOrigin();
 
       m_dspnStart->hide();
diff --git a/MantidPlot/src/importOPJ.cpp b/MantidPlot/src/importOPJ.cpp
index f5d393e96b4239a28a8c3f23f98e9eabfeca5a7d..458e67fe47debd7431cdd9268e58cb0edb4594b5 100644
--- a/MantidPlot/src/importOPJ.cpp
+++ b/MantidPlot/src/importOPJ.cpp
@@ -702,6 +702,8 @@ bool ImportOPJ::importGraphs(const OPJFile& opj)
 					break;
 				case 'F':
 					s=opj.functionIndex(data.right(data.length()-2).toStdString().c_str());
+                                        if (s<0)
+                                          break;
 					int type;
 					if(opj.functionType(s)==1)//Polar
 					{
diff --git a/MantidQt/CustomDialogs/inc/MantidQtCustomDialogs/GetNegMuMuonicXRDDialog.h b/MantidQt/CustomDialogs/inc/MantidQtCustomDialogs/GetNegMuMuonicXRDDialog.h
index 85fa109a4511bb3ef96de179827dc54d33baab32..4d375e8cdc124c9d04bf0274f849ee4f597b7a13 100644
--- a/MantidQt/CustomDialogs/inc/MantidQtCustomDialogs/GetNegMuMuonicXRDDialog.h
+++ b/MantidQt/CustomDialogs/inc/MantidQtCustomDialogs/GetNegMuMuonicXRDDialog.h
@@ -36,19 +36,20 @@ namespace CustomDialogs {
 class GetNegMuMuonicXRDDialog : public API::AlgorithmDialog {
   Q_OBJECT
 
-  public:
+public:
   /// Constructor
   GetNegMuMuonicXRDDialog(QWidget *parent = 0);
 
-  private:
+private:
   /// Periodic Table widget used for selection of elements property
-  PeriodicTableWidget *periodicTable;
+  PeriodicTableWidget *m_periodicTable;
   /// QLineEdit used for input of y-position property
-  QLineEdit *yPosition;
+  QLineEdit *m_yPosition;
   /// QLineEdit used for input of GroupWorkspaceSpace
-  QLineEdit *groupWorkspaceNameInput;
-  //Check box for showing or hiding the Legend for PeriodicTableWidget
-  QCheckBox *showLegendCheck;
+  QLineEdit *m_groupWorkspaceNameInput;
+  // Check box for showing or hiding the Legend for PeriodicTableWidget
+  QCheckBox *m_showLegendCheck;
+
   /// Validate that the input is not empty before running algorithm
   bool validateDialogInput(QString input);
   /** Enables a the buttons corresponding to the elements
@@ -56,15 +57,15 @@ class GetNegMuMuonicXRDDialog : public API::AlgorithmDialog {
   */
   void enableElementsForGetNegMuMuonicXRD();
 
-  private slots:
+private slots:
   /// When the "Run" button is clicked, the algorithm is executed with inputs
   void runClicked();
   void showLegend();
 
-  protected:
+protected:
   // create the initial layout
   void initLayout();
-  signals:
+signals:
   /// signal emitted when validateDialogInput passes
   void validInput();
 };
diff --git a/MantidQt/CustomDialogs/src/GetNegMuMuonicXRDDialog.cpp b/MantidQt/CustomDialogs/src/GetNegMuMuonicXRDDialog.cpp
index 963da0325e8764e67562bd8801154cbca51c2648..463fae15e31cc0b36834b70bb1dfbef1ecd0c5a8 100644
--- a/MantidQt/CustomDialogs/src/GetNegMuMuonicXRDDialog.cpp
+++ b/MantidQt/CustomDialogs/src/GetNegMuMuonicXRDDialog.cpp
@@ -7,7 +7,6 @@
 #include <QValidator>
 #include <QFormLayout>
 
-
 namespace MantidQt {
 namespace CustomDialogs {
 DECLARE_DIALOG(GetNegMuMuonicXRDDialog)
@@ -18,7 +17,8 @@ DECLARE_DIALOG(GetNegMuMuonicXRDDialog)
  */
 
 GetNegMuMuonicXRDDialog::GetNegMuMuonicXRDDialog(QWidget *parent)
-    : API::AlgorithmDialog(parent) {}
+    : API::AlgorithmDialog(parent), m_periodicTable(NULL), m_yPosition(NULL),
+      m_groupWorkspaceNameInput(NULL), m_showLegendCheck(NULL) {}
 
 /// Initialise the layout
 void GetNegMuMuonicXRDDialog::initLayout() {
@@ -26,18 +26,18 @@ void GetNegMuMuonicXRDDialog::initLayout() {
   this->setMaximumHeight(400);
   this->setMaximumWidth(675);
   // assign periodicTable member to a new periodicTable
-  periodicTable = new PeriodicTableWidget();
+  m_periodicTable = new PeriodicTableWidget();
 
-  // assign yPosition member to a new QLineEdit
-  yPosition = new QLineEdit();
-  //assign GroupWorkspaceName member to a new QLineEdit
-  groupWorkspaceNameInput = new QLineEdit();
+  // assign m_yPosition member to a new QLineEdit
+  m_yPosition = new QLineEdit();
+  // assign GroupWorkspaceName member to a new QLineEdit
+  m_groupWorkspaceNameInput = new QLineEdit();
   auto *groupWsInputLabel = new QLabel("OutputWorkspace");
-  groupWorkspaceNameInput->setMaximumWidth(250);
+  m_groupWorkspaceNameInput->setMaximumWidth(250);
   // Disable all buttons on the periodicTable
   // as we only have a select few that need to be
   // enabled.
-  periodicTable->disableAllElementButtons();
+  m_periodicTable->disableAllElementButtons();
 
   /*Elements Enabled Correspond to those for which we
   * have data for in the dictionary found in
@@ -51,44 +51,44 @@ void GetNegMuMuonicXRDDialog::initLayout() {
   // run button for executing the algorithm
   auto *runButton = new QPushButton("Run");
 
-  // label for the QLineEdit for yPosition property
-  auto *yPositionLabel = new QLabel("Y Position");
+  // label for the QLineEdit for m_yPosition property
+  auto *m_yPositionLabel = new QLabel("Y Position");
 
-  /*validator allows only numeric input for yPosition
+  /*validator allows only numeric input for m_yPosition
    *this helps with validating the input.
    *Does not detect empty string as invalid input.
    */
-  auto yPositionNumericValidator = new QDoubleValidator();
+  auto m_yPositionNumericValidator = new QDoubleValidator();
 
   // YPosition LineEdit Attributes
-  yPosition->setMaximumWidth(250);
-  yPosition->setPlaceholderText("-0.01");
-  yPosition->setValidator(yPositionNumericValidator);
+  m_yPosition->setMaximumWidth(250);
+  m_yPosition->setPlaceholderText("-0.01");
+  m_yPosition->setValidator(m_yPositionNumericValidator);
 
   // Run Button Attributes and signal/slot assignment
   runButton->setMaximumWidth(100);
   connect(runButton, SIGNAL(clicked()), this, SLOT(runClicked()));
   connect(this, SIGNAL(validInput()), this, SLOT(accept()));
 
-  //Show Legend button attributes and signal/slot asssignment
-  showLegendCheck = new QCheckBox("Show Legend");
-  connect(showLegendCheck, SIGNAL(clicked()), this, SLOT(showLegend()));
+  // Show Legend button attributes and signal/slot asssignment
+  m_showLegendCheck = new QCheckBox("Show Legend");
+  connect(m_showLegendCheck, SIGNAL(clicked()), this, SLOT(showLegend()));
   // Adding Widgets to Layout
-  main_layout->addWidget(periodicTable);
-  main_layout->addWidget(showLegendCheck);
-  main_layout->addWidget(yPositionLabel);
-  main_layout->addWidget(yPosition);
+  main_layout->addWidget(m_periodicTable);
+  main_layout->addWidget(m_showLegendCheck);
+  main_layout->addWidget(m_yPositionLabel);
+  main_layout->addWidget(m_yPosition);
   main_layout->addWidget(groupWsInputLabel);
-  main_layout->addWidget(groupWorkspaceNameInput);
+  main_layout->addWidget(m_groupWorkspaceNameInput);
   main_layout->addWidget(runButton);
 }
 
 /**
  *
  */
-void GetNegMuMuonicXRDDialog::showLegend(){
-    bool checked = showLegendCheck->isChecked();
-    periodicTable->showGroupLegend(checked);
+void GetNegMuMuonicXRDDialog::showLegend() {
+  bool checked = m_showLegendCheck->isChecked();
+  m_periodicTable->showGroupLegend(checked);
 }
 
 /**
@@ -102,13 +102,13 @@ void GetNegMuMuonicXRDDialog::enableElementsForGetNegMuMuonicXRD() {
    * for the algorithm, and the button for that element can be enabled
    * the same as the elements are below.
    */
-  periodicTable->enableButtonByName("Au");
-  periodicTable->enableButtonByName("Ag");
-  periodicTable->enableButtonByName("Cu");
-  periodicTable->enableButtonByName("Zn");
-  periodicTable->enableButtonByName("Pb");
-  periodicTable->enableButtonByName("As");
-  periodicTable->enableButtonByName("Sn");
+  m_periodicTable->enableButtonByName("Au");
+  m_periodicTable->enableButtonByName("Ag");
+  m_periodicTable->enableButtonByName("Cu");
+  m_periodicTable->enableButtonByName("Zn");
+  m_periodicTable->enableButtonByName("Pb");
+  m_periodicTable->enableButtonByName("As");
+  m_periodicTable->enableButtonByName("Sn");
 }
 
 /**
@@ -128,7 +128,7 @@ bool GetNegMuMuonicXRDDialog::validateDialogInput(QString input) {
 */
 void GetNegMuMuonicXRDDialog::runClicked() {
   // getting a list of strings of elements selected from periodicTableWidget
-  QString elementsSelectedStr = periodicTable->getAllCheckedElementsStr();
+  QString elementsSelectedStr = m_periodicTable->getAllCheckedElementsStr();
   // if no elements are selected from the PeriodicTableWidget, a pop-up appears
   // to the user.
   if (!validateDialogInput(elementsSelectedStr)) {
@@ -141,15 +141,16 @@ void GetNegMuMuonicXRDDialog::runClicked() {
   // signal.
   if (validateDialogInput(elementsSelectedStr)) {
     storePropertyValue("Elements", elementsSelectedStr);
-    if (validateDialogInput(yPosition->text())) {
-      storePropertyValue("YAxisPosition", yPosition->text());
+    if (validateDialogInput(m_yPosition->text())) {
+      storePropertyValue("YAxisPosition", m_yPosition->text());
     } else {
-      // used as default value for yPosition property if the user does not input
+      // used as default value for m_yPosition property if the user does not
+      // input
       // one.
-      storePropertyValue("YAxisPosition", yPosition->placeholderText());
+      storePropertyValue("YAxisPosition", m_yPosition->placeholderText());
     }
-    if (validateDialogInput(groupWorkspaceNameInput->text())){
-        storePropertyValue("OutputWorkspace", groupWorkspaceNameInput->text());
+    if (validateDialogInput(m_groupWorkspaceNameInput->text())) {
+      storePropertyValue("OutputWorkspace", m_groupWorkspaceNameInput->text());
     }
     emit validInput();
   }
diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ISISEnergyTransfer.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ISISEnergyTransfer.h
index d164fa8aa6aae3a65e4c873d541e6d5527df0039..49090162ee653bd896774ab56d46edfcee8606f6 100644
--- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ISISEnergyTransfer.h
+++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ISISEnergyTransfer.h
@@ -6,68 +6,66 @@
 #include "MantidKernel/System.h"
 #include "MantidQtCustomInterfaces/Background.h"
 
-namespace MantidQt
-{
-namespace CustomInterfaces
-{
-  /** ISISEnergyTransfer
-    Handles an energy transfer reduction for ISIS instruments.
-
-    @author Dan Nixon
-    @date 23/07/2014
-
-    Copyright &copy; 2013 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge National Laboratory & European Spallation Source
-
-    This file is part of Mantid.
-
-    Mantid is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 3 of the License, or
-    (at your option) any later version.
-
-    Mantid is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-    File change history is stored at: <https://github.com/mantidproject/mantid>
-    Code Documentation is available at: <http://doxygen.mantidproject.org>
-  */
-  class DLLExport ISISEnergyTransfer : public IndirectDataReductionTab
-  {
-    Q_OBJECT
-
-  public:
-    ISISEnergyTransfer(IndirectDataReduction * idrUI, QWidget * parent = 0);
-    virtual ~ISISEnergyTransfer();
-
-    virtual void setup();
-    virtual void run();
-
-  public slots:
-    virtual bool validate();
-
-  private slots:
-    void algorithmComplete(bool error);
-    void setInstrumentDefault(); ///< Sets default parameters for current instrument
-    void mappingOptionSelected(const QString& groupType); ///< change ui to display appropriate options
-    void plotRaw(); ///< plot raw data from instrument
-    void pbRunEditing();  //< Called when a user starts to type / edit the runs to load.
-    void pbRunFinding();  //< Called when the FileFinder starts finding the files.
-    void pbRunFinished(); //< Called when the FileFinder has finished finding the files.
-    void plotRawComplete(bool error); //< Called when the Plot Raw algorithmm chain completes
-
-  private:
-    Ui::ISISEnergyTransfer m_uiForm;
-
-    QPair<QString, QString> createMapFile(const QString& groupType); ///< create the mapping file with which to group results
-    std::vector<std::string> getSaveFormats(); ///< get a vector of save formats
-
-  };
+namespace MantidQt {
+namespace CustomInterfaces {
+/** ISISEnergyTransfer
+  Handles an energy transfer reduction for ISIS instruments.
+
+  @author Dan Nixon
+  @date 23/07/2014
+
+  Copyright &copy; 2013 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge
+  National Laboratory & European Spallation Source
+
+  This file is part of Mantid.
+
+  Mantid is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 3 of the License, or
+  (at your option) any later version.
+
+  Mantid is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+  File change history is stored at: <https://github.com/mantidproject/mantid>
+  Code Documentation is available at: <http://doxygen.mantidproject.org>
+*/
+class DLLExport ISISEnergyTransfer : public IndirectDataReductionTab {
+  Q_OBJECT
+
+public:
+  ISISEnergyTransfer(IndirectDataReduction *idrUI, QWidget *parent = 0);
+  virtual ~ISISEnergyTransfer();
+
+  virtual void setup();
+  virtual void run();
+
+public slots:
+  virtual bool validate();
+
+private slots:
+  void algorithmComplete(bool error);
+  void
+  setInstrumentDefault(); ///< Sets default parameters for current instrument
+  void mappingOptionSelected(const QString &groupType); ///< change ui to display appropriate options
+  void plotRaw();       ///< plot raw data from instrument
+  void pbRunEditing();  //< Called when a user starts to type / edit the runs to load.
+  void pbRunFinding();  //< Called when the FileFinder starts finding the files.
+  void pbRunFinished(); //< Called when the FileFinder has finished finding the files.
+  void plotRawComplete(bool error); //< Called when the Plot Raw algorithmm chain completes
+
+private:
+  Ui::ISISEnergyTransfer m_uiForm;
+
+  QPair<QString, QString> createMapFile(const QString &groupType); ///< create the mapping file with which to group results
+  std::vector<std::string> getSaveFormats(); ///< get a vector of save formats
+};
 } // namespace CustomInterfaces
 } // namespace Mantid
 
-#endif //MANTIDQTCUSTOMINTERFACES_ISISENERGYTRANSFER_H_
+#endif // MANTIDQTCUSTOMINTERFACES_ISISENERGYTRANSFER_H_
diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/QtReflMainView.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/QtReflMainView.h
index 5423d7311d73d879001d488f2bdcd02e9b6ef5dc..1306417ed5c84ffd9139390a259a08e08a250d6d 100644
--- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/QtReflMainView.h
+++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/QtReflMainView.h
@@ -62,6 +62,7 @@ namespace MantidQt
       virtual void giveUserWarning(std::string prompt, std::string title);
       virtual void giveUserCritical(std::string prompt, std::string title);
       virtual void showAlgorithmDialog(const std::string& algorithm);
+      virtual std::string requestNotebookPath();
 
       //Plotting
       virtual void plotWorkspaces(const std::set<std::string>& workspaces);
diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ReflMainView.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ReflMainView.h
index ba7cfe632c3682ec2472b1778fbfee8efb29998f..bfcca663b78dc95a9e99974146d2ec1d066007fb 100644
--- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ReflMainView.h
+++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ReflMainView.h
@@ -57,6 +57,7 @@ namespace MantidQt
       virtual void giveUserWarning(std::string prompt, std::string title) = 0;
       virtual void giveUserCritical(std::string prompt, std::string title) = 0;
       virtual void showAlgorithmDialog(const std::string& algorithm) = 0;
+      virtual std::string requestNotebookPath() = 0;
 
       //Plotting
       virtual void plotWorkspaces(const std::set<std::string>& workspaces) = 0;
diff --git a/MantidQt/CustomInterfaces/src/Indirect/ApplyPaalmanPings.cpp b/MantidQt/CustomInterfaces/src/Indirect/ApplyPaalmanPings.cpp
index 42270faab779a63de3226cd5b3b3cc4ebd2c2de6..e4e9d4484706608f74596258ca4846cf1bc906b7 100644
--- a/MantidQt/CustomInterfaces/src/Indirect/ApplyPaalmanPings.cpp
+++ b/MantidQt/CustomInterfaces/src/Indirect/ApplyPaalmanPings.cpp
@@ -145,6 +145,7 @@ void ApplyPaalmanPings::run() {
         switch (result) {
         case QMessageBox::YesToAll:
           interpolateAll = true;
+          //fall through
         case QMessageBox::Yes:
           addInterpolationStep(factorWs, absCorProps["SampleWorkspace"]);
           break;
@@ -175,9 +176,18 @@ void ApplyPaalmanPings::run() {
     correctionType = "cyl";
     break;
   }
-  const QString outputWsName =
+  QString outputWsName =
       sampleWsName.left(nameCutIndex) + +"_" + correctionType + "_Corrected";
 
+  if (useCan) {
+    auto containerWsName = m_uiForm.dsContainer->getCurrentDataName();
+    int cutIndex = containerWsName.indexOf("_");
+    if (cutIndex == -1) {
+      cutIndex = containerWsName.length();
+    }
+	outputWsName += "_Subtract_" + containerWsName.left(cutIndex);
+  }
+
   applyCorrAlg->setProperty("OutputWorkspace", outputWsName.toStdString());
 
   // Add corrections algorithm to queue
diff --git a/MantidQt/CustomInterfaces/src/Indirect/CalculatePaalmanPings.cpp b/MantidQt/CustomInterfaces/src/Indirect/CalculatePaalmanPings.cpp
index 81277fad6d9919ec6d2057026a52be6716bff9c2..49584757883539d7ef1a4332893875067f9017e1 100644
--- a/MantidQt/CustomInterfaces/src/Indirect/CalculatePaalmanPings.cpp
+++ b/MantidQt/CustomInterfaces/src/Indirect/CalculatePaalmanPings.cpp
@@ -122,8 +122,17 @@ void CalculatePaalmanPings::run() {
     break;
   }
 
-  const QString outputWsName =
+  QString outputWsName =
       sampleWsName.left(nameCutIndex) + "_" + correctionType + "_abs";
+  if (useCan) {
+    auto containerWsName = m_uiForm.dsContainer->getCurrentDataName();
+    int cutIndex = containerWsName.indexOf("_");
+    if (cutIndex == -1) {
+      cutIndex = containerWsName.length();
+    }
+    outputWsName += "_Subtract_" + containerWsName.left(cutIndex);
+  }
+
   absCorAlgo->setProperty("OutputWorkspace", outputWsName.toStdString());
 
   // Add corrections algorithm to queue
diff --git a/MantidQt/CustomInterfaces/src/Indirect/ISISEnergyTransfer.cpp b/MantidQt/CustomInterfaces/src/Indirect/ISISEnergyTransfer.cpp
index ae32ddc36c2e30d07b9ff6dd2d5de8769a48a24a..684a600758ee1da57dd55c4810ab16df27c780fe 100644
--- a/MantidQt/CustomInterfaces/src/Indirect/ISISEnergyTransfer.cpp
+++ b/MantidQt/CustomInterfaces/src/Indirect/ISISEnergyTransfer.cpp
@@ -69,19 +69,19 @@ bool ISISEnergyTransfer::validate() {
   UserInputValidator uiv;
 
   // Run files input
-  if (!m_uiForm.dsRunFiles->isValid()){
+  if (!m_uiForm.dsRunFiles->isValid()) {
     uiv.addErrorMessage("Run file range is invalid.");
   }
 
   // Calibration file input
   if (m_uiForm.ckUseCalib->isChecked() &&
-      !m_uiForm.dsCalibrationFile->isValid()){
+      !m_uiForm.dsCalibrationFile->isValid()) {
     uiv.addErrorMessage("Calibration file/workspace is invalid.");
   }
 
   // Mapping file
   if ((m_uiForm.cbGroupingOptions->currentText() == "File") &&
-      (!m_uiForm.dsMapFile->isValid())){
+      (!m_uiForm.dsMapFile->isValid())) {
     uiv.addErrorMessage("Mapping file is invalid.");
   }
 
@@ -115,17 +115,63 @@ bool ISISEnergyTransfer::validate() {
   // Spectra Number check
   const int specMin = m_uiForm.spSpectraMin->value();
   const int specMax = m_uiForm.spSpectraMax->value();
-  if(specMin > specMax){
-	uiv.addErrorMessage("Spectra Min must be less than Spectra Max");
+  if (specMin > specMax) {
+    uiv.addErrorMessage("Spectra Min must be less than Spectra Max");
   }
 
   // Background Removal (TOF)
-  if(m_uiForm.ckBackgroundRemoval->isChecked()){
-	  const int start = m_uiForm.spBackgroundStart->value();
-	  const int end = m_uiForm.spBackgroundEnd->value();
-	  if(start > end){
-		  uiv.addErrorMessage("Background Start must be less than Background End");
-	  }
+  if (m_uiForm.ckBackgroundRemoval->isChecked()) {
+    const int start = m_uiForm.spBackgroundStart->value();
+    const int end = m_uiForm.spBackgroundEnd->value();
+    if (start > end) {
+      uiv.addErrorMessage("Background Start must be less than Background End");
+    }
+  }
+
+  if (m_uiForm.dsRunFiles->isValid()) {
+    int detectorMin = m_uiForm.spPlotTimeSpecMin->value();
+    int detectorMax = m_uiForm.spPlotTimeSpecMax->value();
+
+    QString rawFile = m_uiForm.dsRunFiles->getFirstFilename();
+    auto pos = rawFile.lastIndexOf(".");
+    auto extension = rawFile.right(rawFile.length() - pos);
+    QFileInfo rawFileInfo(rawFile);
+    std::string name = rawFileInfo.baseName().toStdString();
+
+    IAlgorithm_sptr loadAlg = AlgorithmManager::Instance().create("Load");
+    loadAlg->initialize();
+    loadAlg->setProperty("Filename", rawFile.toStdString());
+    loadAlg->setProperty("OutputWorkspace", name);
+    if (extension.compare(".nxs") == 0) {
+      int64_t detectorMin =
+          static_cast<int64_t>(m_uiForm.spPlotTimeSpecMin->value());
+      int64_t detectorMax =
+          static_cast<int64_t>(m_uiForm.spPlotTimeSpecMax->value());
+      loadAlg->setProperty("SpectrumMin", detectorMin);
+      loadAlg->setProperty("SpectrumMax", detectorMax);
+    } else {
+      loadAlg->setProperty("SpectrumMin", detectorMin);
+      loadAlg->setProperty("SpectrumMax", detectorMax);
+    }
+
+    loadAlg->execute();
+
+    if (m_uiForm.ckBackgroundRemoval->isChecked()) {
+      MatrixWorkspace_sptr tempWs =
+          AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>(name);
+      const double minBack = tempWs->readX(0)[0];
+      const double maxBack = tempWs->readX(0)[tempWs->blocksize()];
+
+      if (m_uiForm.spBackgroundStart->value() < minBack) {
+        uiv.addErrorMessage("The Start of Background Removal is less than the "
+                            "minimum of the data range");
+      }
+
+      if (m_uiForm.spBackgroundEnd->value() > maxBack) {
+        uiv.addErrorMessage("The End of Background Removal is more than the "
+                            "maximum of the data range");
+      }
+    }
   }
 
   QString error = uiv.generateErrorMessage();
@@ -446,6 +492,15 @@ void ISISEnergyTransfer::plotRaw() {
         "Minimum spectra must be less than or equal to maximum spectra.");
     return;
   }
+  const int startBack = m_uiForm.spBackgroundStart->value();
+  const int endBack = m_uiForm.spBackgroundEnd->value();
+
+  if (m_uiForm.ckBackgroundRemoval->isChecked() == true) {
+    if (startBack > endBack) {
+      emit showMessageBox("Background Start must be less than Background End");
+      return;
+    }
+  }
 
   QString rawFile = m_uiForm.dsRunFiles->getFirstFilename();
   auto pos = rawFile.lastIndexOf(".");
@@ -453,7 +508,7 @@ void ISISEnergyTransfer::plotRaw() {
   QFileInfo rawFileInfo(rawFile);
   std::string name = rawFileInfo.baseName().toStdString();
 
-   IAlgorithm_sptr loadAlg = AlgorithmManager::Instance().create("Load");
+  IAlgorithm_sptr loadAlg = AlgorithmManager::Instance().create("Load");
   loadAlg->initialize();
   loadAlg->setProperty("Filename", rawFile.toStdString());
   loadAlg->setProperty("OutputWorkspace", name);
@@ -468,7 +523,27 @@ void ISISEnergyTransfer::plotRaw() {
     loadAlg->setProperty("SpectrumMin", detectorMin);
     loadAlg->setProperty("SpectrumMax", detectorMax);
   }
-  m_batchAlgoRunner->addAlgorithm(loadAlg);
+
+  loadAlg->execute();
+
+  if (m_uiForm.ckBackgroundRemoval->isChecked()) {
+    MatrixWorkspace_sptr tempWs =
+        AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>(name);
+    const double minBack = tempWs->readX(0)[0];
+    const double maxBack = tempWs->readX(0)[tempWs->blocksize()];
+
+    if (startBack < minBack) {
+      emit showMessageBox("The Start of Background Removal is less than the "
+                          "minimum of the data range");
+      return;
+    }
+
+    if (endBack > maxBack) {
+      emit showMessageBox("The End of Background Removal is more than the "
+                          "maximum of the data range");
+      return;
+    }
+  }
 
   // Rebin the workspace to its self to ensure constant binning
   BatchAlgorithmRunner::AlgorithmRuntimeProps inputToRebin;
diff --git a/MantidQt/CustomInterfaces/src/Muon/ALCInterface.cpp b/MantidQt/CustomInterfaces/src/Muon/ALCInterface.cpp
index a52e8a9ea46656ce5503523ea3af0e8a01bf2846..f70fe204e98fc0c6d7dd30b80c2caff417715d33 100644
--- a/MantidQt/CustomInterfaces/src/Muon/ALCInterface.cpp
+++ b/MantidQt/CustomInterfaces/src/Muon/ALCInterface.cpp
@@ -31,6 +31,7 @@ namespace CustomInterfaces
 
   ALCInterface::ALCInterface(QWidget* parent)
     : UserSubWindow(parent), m_ui(),
+      m_baselineModellingView(NULL), m_peakFittingView(NULL),
       m_dataLoading(NULL), m_baselineModelling(NULL), m_peakFitting(NULL),
       m_baselineModellingModel(new ALCBaselineModellingModel()),
       m_peakFittingModel(new ALCPeakFittingModel())
diff --git a/MantidQt/CustomInterfaces/src/QtReflMainView.cpp b/MantidQt/CustomInterfaces/src/QtReflMainView.cpp
index a2c94562df9b0f759051ea6d4a835b49f4ab67b0..6f599771e4f4ffc5b63452900b01485518c834b5 100644
--- a/MantidQt/CustomInterfaces/src/QtReflMainView.cpp
+++ b/MantidQt/CustomInterfaces/src/QtReflMainView.cpp
@@ -434,6 +434,17 @@ namespace MantidQt
       runPythonCode(QString::fromStdString(pythonSrc.str()));
     }
 
+    /**
+    Show the user file dialog to choose save location of notebook
+    */
+    std::string QtReflMainView::requestNotebookPath()
+    {
+      QString qfilename = QFileDialog::getSaveFileName(0, "Save notebook file", QDir::currentPath(),
+                                                       "IPython Notebook files (*.ipynb);;All files (*.*)",
+                                                       new QString("IPython Notebook files (*.ipynb)"));
+      return qfilename.toStdString();
+    }
+
     /**
     Plot a workspace
     */
diff --git a/MantidQt/CustomInterfaces/src/ReflMainViewPresenter.cpp b/MantidQt/CustomInterfaces/src/ReflMainViewPresenter.cpp
index 8b813d6392f361ddceaef1748a5cf1a5cec4e2eb..2aedd280cf80054880642b336291837ffc642aa8 100644
--- a/MantidQt/CustomInterfaces/src/ReflMainViewPresenter.cpp
+++ b/MantidQt/CustomInterfaces/src/ReflMainViewPresenter.cpp
@@ -295,16 +295,15 @@ namespace MantidQt
     */
     void ReflMainViewPresenter::saveNotebook(std::map<int,std::set<int>> groups, std::set<int> rows)
     {
-      std::unique_ptr<ReflGenerateNotebook> notebook(new ReflGenerateNotebook(
-        m_wsName, m_model, m_view->getProcessInstrument(), COL_RUNS, COL_TRANSMISSION, COL_OPTIONS, COL_ANGLE,
-        COL_QMIN, COL_QMAX, COL_DQQ, COL_SCALE, COL_GROUP));
-      QString qfilename = QFileDialog::getSaveFileName(0, "Save notebook file", QDir::currentPath(),
-                                                       "IPython Notebook files (*.ipynb);;All files (*.*)",
-                                                       new QString("IPython Notebook files (*.ipynb)"));
-      std::string filename = qfilename.toStdString();
+
+      std::string filename = m_view->requestNotebookPath();
       if (filename == "") {
         return;
       }
+
+      std::unique_ptr<ReflGenerateNotebook> notebook(new ReflGenerateNotebook(
+        m_wsName, m_model, m_view->getProcessInstrument(), COL_RUNS, COL_TRANSMISSION, COL_OPTIONS, COL_ANGLE,
+        COL_QMIN, COL_QMAX, COL_DQQ, COL_SCALE, COL_GROUP));
       std::string generatedNotebook = notebook->generateNotebook(groups, rows);
 
       std::ofstream file(filename.c_str(), std::ofstream::trunc);
diff --git a/MantidQt/CustomInterfaces/src/Tomography/ImageStackPreParams.cpp b/MantidQt/CustomInterfaces/src/Tomography/ImageStackPreParams.cpp
index 60d8a1e2bd0dbc8a26e01cb9dcae0898e0a27395..b343d7c20876fa95bda014ff49ed75407ab2daaf 100644
--- a/MantidQt/CustomInterfaces/src/Tomography/ImageStackPreParams.cpp
+++ b/MantidQt/CustomInterfaces/src/Tomography/ImageStackPreParams.cpp
@@ -5,9 +5,7 @@ using namespace MantidQt::CustomInterfaces;
 namespace MantidQt {
 namespace CustomInterfaces {
 
-ImageStackPreParams::ImageStackPreParams()
-{
+ImageStackPreParams::ImageStackPreParams() : medianFilter(false) {}
 
-}
 } // namespace CustomInterfaces
 } // namespace MantidQt
diff --git a/MantidQt/CustomInterfaces/src/Tomography/TomographyIfaceModel.cpp b/MantidQt/CustomInterfaces/src/Tomography/TomographyIfaceModel.cpp
index 15c9f4550e6d57228cd464e6c3cb350e47c23449..5aaaaccde66a10647182a685e42fefe0ca5570aa 100644
--- a/MantidQt/CustomInterfaces/src/Tomography/TomographyIfaceModel.cpp
+++ b/MantidQt/CustomInterfaces/src/Tomography/TomographyIfaceModel.cpp
@@ -582,7 +582,6 @@ TomographyIfaceModel::loadFITSImage(const std::string &path) {
         "Failed to load image. Could not load this file as a "
         "FITS image: " +
         std::string(e.what()));
-    return WorkspaceGroup_sptr();
   }
   if (!alg->isExecuted()) {
     throw std::runtime_error(
diff --git a/MantidQt/CustomInterfaces/test/ReflMainViewMockObjects.h b/MantidQt/CustomInterfaces/test/ReflMainViewMockObjects.h
index 2d7f91d24a4c10c40bf3b3b3eb28cd15585c7b90..026b49d21b3e9966e32a84f26c1b3df3b72ea023 100644
--- a/MantidQt/CustomInterfaces/test/ReflMainViewMockObjects.h
+++ b/MantidQt/CustomInterfaces/test/ReflMainViewMockObjects.h
@@ -33,6 +33,7 @@ public:
   MOCK_METHOD2(giveUserCritical, void(std::string, std::string));
   MOCK_METHOD2(giveUserInfo, void(std::string, std::string));
   MOCK_METHOD2(giveUserWarning, void(std::string, std::string));
+  MOCK_METHOD0(requestNotebookPath, std::string());
 
   MOCK_METHOD1(showAlgorithmDialog, void(const std::string&));
   MOCK_METHOD1(plotWorkspaces, void(const std::set<std::string>&));
@@ -46,6 +47,7 @@ public:
   MOCK_CONST_METHOD0(getClipboard, std::string());
   MOCK_CONST_METHOD0(getSearchString, std::string());
   MOCK_CONST_METHOD0(getSearchInstrument, std::string());
+  MOCK_METHOD0(getEnableNotebook, bool());
 
   //Calls we don't care about
   virtual void showTable(QReflTableModel_sptr) {};
@@ -53,7 +55,6 @@ public:
   virtual void setOptionsHintStrategy(MantidQt::MantidWidgets::HintStrategy*) {};
   virtual void setProgressRange(int,int) {};
   virtual void setProgress(int) {};
-  virtual bool getEnableNotebook() {return false;};
   virtual void setTableList(const std::set<std::string>&) {};
   virtual void setInstrumentList(const std::vector<std::string>&, const std::string&) {};
   virtual std::string getProcessInstrument() const {return "FAKE";}
diff --git a/MantidQt/CustomInterfaces/test/ReflMainViewPresenterTest.h b/MantidQt/CustomInterfaces/test/ReflMainViewPresenterTest.h
index 4c53fb56bf68c8693e9933f650f7aa5440c18545..36d043f921e47425dc4ed88c241c0207f61cee26 100644
--- a/MantidQt/CustomInterfaces/test/ReflMainViewPresenterTest.h
+++ b/MantidQt/CustomInterfaces/test/ReflMainViewPresenterTest.h
@@ -13,6 +13,7 @@
 #include "MantidQtCustomInterfaces/ReflMainViewPresenter.h"
 
 #include "ReflMainViewMockObjects.h"
+#include "../inc/MantidQtCustomInterfaces/IReflPresenter.h"
 
 using namespace MantidQt::CustomInterfaces;
 using namespace Mantid::API;
@@ -136,6 +137,8 @@ public:
 
     TS_ASSERT(AnalysisDataService::Instance().doesExist("TestWorkspace"));
     AnalysisDataService::Instance().remove("TestWorkspace");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testSaveExisting() {
@@ -152,6 +155,8 @@ public:
     presenter.notify(IReflPresenter::SaveFlag);
 
     AnalysisDataService::Instance().remove("TestWorkspace");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testSaveAs() {
@@ -180,6 +185,8 @@ public:
 
     AnalysisDataService::Instance().remove("TestWorkspace");
     AnalysisDataService::Instance().remove("Workspace");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testAppendRow() {
@@ -220,6 +227,8 @@ public:
 
     // Tidy up
     AnalysisDataService::Instance().remove("TestWorkspace");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testAppendRowSpecify() {
@@ -263,6 +272,8 @@ public:
 
     // Tidy up
     AnalysisDataService::Instance().remove("TestWorkspace");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testAppendRowSpecifyPlural() {
@@ -305,6 +316,8 @@ public:
 
     // Tidy up
     AnalysisDataService::Instance().remove("TestWorkspace");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testPrependRow() {
@@ -344,6 +357,8 @@ public:
 
     // Tidy up
     AnalysisDataService::Instance().remove("TestWorkspace");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testPrependRowSpecify() {
@@ -386,6 +401,8 @@ public:
 
     // Tidy up
     AnalysisDataService::Instance().remove("TestWorkspace");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testPrependRowSpecifyPlural() {
@@ -429,6 +446,8 @@ public:
 
     // Tidy up
     AnalysisDataService::Instance().remove("TestWorkspace");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testDeleteRowNone() {
@@ -460,6 +479,8 @@ public:
 
     // Tidy up
     AnalysisDataService::Instance().remove("TestWorkspace");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testDeleteRowSingle() {
@@ -495,6 +516,8 @@ public:
 
     // Tidy up
     AnalysisDataService::Instance().remove("TestWorkspace");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testDeleteRowPlural() {
@@ -533,6 +556,8 @@ public:
 
     // Tidy up
     AnalysisDataService::Instance().remove("TestWorkspace");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testProcess() {
@@ -559,6 +584,11 @@ public:
     EXPECT_CALL(mockView, getSelectedRows())
         .Times(1)
         .WillRepeatedly(Return(rowlist));
+    EXPECT_CALL(mockView, getEnableNotebook())
+      .Times(1)
+      .WillRepeatedly(Return(false));
+    EXPECT_CALL(mockView, requestNotebookPath())
+      .Times(0);
     presenter.notify(IReflPresenter::ProcessFlag);
 
     // Check output workspaces were created as expected
@@ -579,6 +609,52 @@ public:
     AnalysisDataService::Instance().remove("IvsLam_12346");
     AnalysisDataService::Instance().remove("TOF_12346");
     AnalysisDataService::Instance().remove("IvsQ_12345_12346");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
+  }
+
+  void testProcessWithNotebook() {
+    MockView mockView;
+    ReflMainViewPresenter presenter(&mockView);
+
+    createPrefilledWorkspace("TestWorkspace");
+    EXPECT_CALL(mockView, getWorkspaceToOpen())
+      .Times(1)
+      .WillRepeatedly(Return("TestWorkspace"));
+    presenter.notify(IReflPresenter::OpenTableFlag);
+
+    std::set<int> rowlist;
+    rowlist.insert(0);
+    rowlist.insert(1);
+
+    createTOFWorkspace("TOF_12345", "12345");
+    createTOFWorkspace("TOF_12346", "12346");
+
+    // We should not receive any errors
+    EXPECT_CALL(mockView, giveUserCritical(_, _)).Times(0);
+
+    // The user hits the "process" button with the first two rows selected
+    EXPECT_CALL(mockView, getSelectedRows())
+      .Times(1)
+      .WillRepeatedly(Return(rowlist));
+    EXPECT_CALL(mockView, getEnableNotebook())
+      .Times(1)
+      .WillRepeatedly(Return(true));
+    EXPECT_CALL(mockView, requestNotebookPath())
+      .Times(1);
+    presenter.notify(IReflPresenter::ProcessFlag);
+
+    // Tidy up
+    AnalysisDataService::Instance().remove("TestWorkspace");
+    AnalysisDataService::Instance().remove("IvsQ_12345");
+    AnalysisDataService::Instance().remove("IvsLam_12345");
+    AnalysisDataService::Instance().remove("TOF_12345");
+    AnalysisDataService::Instance().remove("IvsQ_12346");
+    AnalysisDataService::Instance().remove("IvsLam_12346");
+    AnalysisDataService::Instance().remove("TOF_12346");
+    AnalysisDataService::Instance().remove("IvsQ_12345_12346");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   /*
@@ -641,6 +717,8 @@ public:
     AnalysisDataService::Instance().remove("IvsQ_12346");
     AnalysisDataService::Instance().remove("IvsLam_12346");
     AnalysisDataService::Instance().remove("IvsQ_dataA_12346");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testBadWorkspaceType() {
@@ -671,6 +749,8 @@ public:
     presenter.notify(IReflPresenter::OpenTableFlag);
 
     AnalysisDataService::Instance().remove("TestWorkspace");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testBadWorkspaceLength() {
@@ -705,6 +785,8 @@ public:
     presenter.notify(IReflPresenter::OpenTableFlag);
 
     AnalysisDataService::Instance().remove("TestWorkspace");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testPromptSaveAfterAppendRow() {
@@ -732,6 +814,8 @@ public:
     // The user tries to create a new table again, and does not get bothered
     EXPECT_CALL(mockView, askUserYesNo(_, _)).Times(0);
     presenter.notify(IReflPresenter::NewTableFlag);
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testPromptSaveAfterDeleteRow() {
@@ -771,6 +855,8 @@ public:
     // The user tries to create a new table again, and does not get bothered
     EXPECT_CALL(mockView, askUserYesNo(_, _)).Times(0);
     presenter.notify(IReflPresenter::NewTableFlag);
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testPromptSaveAndDiscard() {
@@ -791,6 +877,8 @@ public:
     // These next two times they don't get prompted - they have a new table
     presenter.notify(IReflPresenter::NewTableFlag);
     presenter.notify(IReflPresenter::NewTableFlag);
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testPromptSaveOnOpen() {
@@ -823,6 +911,8 @@ public:
         .WillRepeatedly(Return("TestWorkspace"));
     EXPECT_CALL(mockView, askUserYesNo(_, _)).Times(0);
     presenter.notify(IReflPresenter::OpenTableFlag);
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testExpandSelection() {
@@ -984,6 +1074,8 @@ public:
 
     // Tidy up
     AnalysisDataService::Instance().remove("TestWorkspace");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testClearRows() {
@@ -1043,6 +1135,8 @@ public:
 
     // Tidy up
     AnalysisDataService::Instance().remove("TestWorkspace");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testCopyRow() {
@@ -1066,6 +1160,8 @@ public:
         .Times(1)
         .WillRepeatedly(Return(rowlist));
     presenter.notify(IReflPresenter::CopySelectedFlag);
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testCopyRows() {
@@ -1095,6 +1191,8 @@ public:
         .Times(1)
         .WillRepeatedly(Return(rowlist));
     presenter.notify(IReflPresenter::CopySelectedFlag);
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testCutRow() {
@@ -1129,6 +1227,8 @@ public:
     TS_ASSERT_EQUALS(ws->String(0, RunCol), "12345");
     TS_ASSERT_EQUALS(ws->String(1, RunCol), "24681");
     TS_ASSERT_EQUALS(ws->String(2, RunCol), "24682");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testCutRows() {
@@ -1165,6 +1265,8 @@ public:
     TS_ASSERT_EQUALS(ws->rowCount(), 1);
     // Check the only unselected row is left behind
     TS_ASSERT_EQUALS(ws->String(0, RunCol), "24682");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testPasteRow() {
@@ -1212,6 +1314,8 @@ public:
     TS_ASSERT_EQUALS(ws->Double(1, ScaleCol), 5.0);
     TS_ASSERT_EQUALS(ws->Int(1, GroupCol), 6);
     TS_ASSERT_EQUALS(ws->String(1, OptionsCol), "abc");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testPasteNewRow() {
@@ -1257,6 +1361,8 @@ public:
     TS_ASSERT_EQUALS(ws->Double(4, ScaleCol), 5.0);
     TS_ASSERT_EQUALS(ws->Int(4, GroupCol), 6);
     TS_ASSERT_EQUALS(ws->String(4, OptionsCol), "abc");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testPasteRows() {
@@ -1315,6 +1421,8 @@ public:
     TS_ASSERT_EQUALS(ws->Double(2, ScaleCol), 3.0);
     TS_ASSERT_EQUALS(ws->Int(2, GroupCol), 2);
     TS_ASSERT_EQUALS(ws->String(2, OptionsCol), "def");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testPasteNewRows() {
@@ -1371,6 +1479,8 @@ public:
     TS_ASSERT_EQUALS(ws->Double(5, ScaleCol), 3.0);
     TS_ASSERT_EQUALS(ws->Int(5, GroupCol), 2);
     TS_ASSERT_EQUALS(ws->String(5, OptionsCol), "def");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testImportTable() {
@@ -1378,6 +1488,8 @@ public:
     ReflMainViewPresenter presenter(&mockView);
     EXPECT_CALL(mockView, showAlgorithmDialog("LoadReflTBL"));
     presenter.notify(IReflPresenter::ImportTableFlag);
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testExportTable() {
@@ -1385,6 +1497,8 @@ public:
     ReflMainViewPresenter presenter(&mockView);
     EXPECT_CALL(mockView, showAlgorithmDialog("SaveReflTBL"));
     presenter.notify(IReflPresenter::ExportTableFlag);
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testPlotRowWarn() {
@@ -1416,6 +1530,8 @@ public:
     // Tidy up
     AnalysisDataService::Instance().remove("TestWorkspace");
     AnalysisDataService::Instance().remove("TOF_12345");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 
   void testPlotGroupWarn() {
@@ -1447,6 +1563,8 @@ public:
     AnalysisDataService::Instance().remove("TestWorkspace");
     AnalysisDataService::Instance().remove("TOF_12345");
     AnalysisDataService::Instance().remove("TOF_12346");
+
+    TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView));
   }
 };
 
diff --git a/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/FunctionBrowser.h b/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/FunctionBrowser.h
index 87c698152d416147984d697f1388586bcfcbb8c6..c9ed1e70dcc5161d9133979b1a95a8ff6dcd466e 100644
--- a/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/FunctionBrowser.h
+++ b/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/FunctionBrowser.h
@@ -296,6 +296,8 @@ protected slots:
   void parameterChanged(QtProperty*);
   void parameterButtonClicked(QtProperty*);
   void globalChanged(QtProperty*, const QString&, bool);
+  /// Set value of an attribute (as a property) to a function
+  void setAttributeToFunction(Mantid::API::IFunction& fun, QtProperty* prop);
 
 protected:
   /// Manager for function group properties
diff --git a/MantidQt/MantidWidgets/src/FunctionBrowser.cpp b/MantidQt/MantidWidgets/src/FunctionBrowser.cpp
index edd8806fe5a7c6193b98df76b252a8d114346712..4184cc459586d37d77b198d246ceac180de1eab4 100644
--- a/MantidQt/MantidWidgets/src/FunctionBrowser.cpp
+++ b/MantidQt/MantidWidgets/src/FunctionBrowser.cpp
@@ -1348,6 +1348,28 @@ void FunctionBrowser::addFunction()
   emit functionStructureChanged();
 }
 
+/**
+ * Set value of an attribute (as a property) to a function.
+ * @param fun :: Function to which attribute is set.
+ * @param prop :: A property with the name and value of the attribute.
+ */
+void FunctionBrowser::setAttributeToFunction(Mantid::API::IFunction& fun, QtProperty* prop)
+{
+    std::string attName = prop->propertyName().toStdString();
+    SetAttributeFromProperty setter(this,prop);
+    Mantid::API::IFunction::Attribute attr = fun.getAttribute(attName);
+    attr.apply(setter);
+    try
+    {
+      fun.setAttribute(attName,attr);
+    }
+    catch(std::exception& expt)
+    {
+      QMessageBox::critical(this,"MantidPlot - Error", "Cannot set attribute " + QString::fromStdString(attName) + 
+        " of function " + prop->propertyName() + ":\n\n" + QString::fromStdString(expt.what()));
+    }
+}
+
 /**
  * Return the function 
  * @param prop :: Function property 
@@ -1380,6 +1402,10 @@ Mantid::API::IFunction_sptr FunctionBrowser::getFunction(QtProperty* prop, bool
           cf->addFunction(f);
         }
       }
+      else if (isAttribute(child))
+      {
+        setAttributeToFunction(*fun, child);
+      }
     }
   }
   else
@@ -1390,19 +1416,7 @@ Mantid::API::IFunction_sptr FunctionBrowser::getFunction(QtProperty* prop, bool
     {
       if (isAttribute(child))
       {
-        std::string attName = child->propertyName().toStdString();
-        SetAttributeFromProperty setter(this,child);
-        Mantid::API::IFunction::Attribute attr = fun->getAttribute(attName);
-        attr.apply(setter);
-        try
-        {
-          fun->setAttribute(attName,attr);
-        }
-        catch(std::exception& expt)
-        {
-          QMessageBox::critical(this,"MantidPlot - Error", "Cannot set attribute " + QString::fromStdString(attName) + 
-            " of function " + prop->propertyName() + ":\n\n" + QString::fromStdString(expt.what()));
-        }
+        setAttributeToFunction(*fun, child);
       }
       else if (!attributesOnly && isParameter(child))
       {
diff --git a/MantidQt/SliceViewer/src/PeaksViewer.cpp b/MantidQt/SliceViewer/src/PeaksViewer.cpp
index 8034a80c7909877c78b2e430082b98b8e5b4776a..ac8fb544ccfb0608c79fc78374bcc485ece737eb 100644
--- a/MantidQt/SliceViewer/src/PeaksViewer.cpp
+++ b/MantidQt/SliceViewer/src/PeaksViewer.cpp
@@ -122,9 +122,9 @@ PeaksViewer::~PeaksViewer() {}
  */
 bool PeaksViewer::hasThingsToShow() const { return m_presenter->size() >= 1; }
 
-void PeaksViewer::   clearPeaksModeRequest(
+void PeaksViewer::clearPeaksModeRequest(
     const PeaksWorkspaceWidget *const originWidget, const bool on) {
-  EditMode mode;
+  EditMode mode = None;
   if (on) {
     QList<PeaksWorkspaceWidget *> children =
         qFindChildren<PeaksWorkspaceWidget *>(this);
@@ -149,7 +149,7 @@ void PeaksViewer::   clearPeaksModeRequest(
 
 void PeaksViewer::addPeaksModeRequest(const PeaksWorkspaceWidget * const originWidget, const bool on)
 {
-    EditMode mode;
+    EditMode mode = None;
     if(on) {
     QList<PeaksWorkspaceWidget *> children =
         qFindChildren<PeaksWorkspaceWidget *>(this);
diff --git a/MantidQt/SpectrumViewer/inc/MantidQtSpectrumViewer/GraphDisplay.h b/MantidQt/SpectrumViewer/inc/MantidQtSpectrumViewer/GraphDisplay.h
index b3cd39f36e9a261ea1cfe2f29978d28b1efbb2c1..a7cdd630803f9bf82ed17fe8141e2dfad3eaac94 100644
--- a/MantidQt/SpectrumViewer/inc/MantidQtSpectrumViewer/GraphDisplay.h
+++ b/MantidQt/SpectrumViewer/inc/MantidQtSpectrumViewer/GraphDisplay.h
@@ -96,7 +96,7 @@ class EXPORT_OPT_MANTIDQT_SPECTRUMVIEWER GraphDisplay
    double m_minY;
    double m_maxY;
 
-   static QColor g_curveColors[];
+   static std::vector<QColor> g_curveColors;
 
 };
 
diff --git a/MantidQt/SpectrumViewer/src/GraphDisplay.cpp b/MantidQt/SpectrumViewer/src/GraphDisplay.cpp
index fb458c40088478e07a1b3a7bc941514268b022d4..3b3f3f25de46e91737a218ce8c00db2f5d172919 100644
--- a/MantidQt/SpectrumViewer/src/GraphDisplay.cpp
+++ b/MantidQt/SpectrumViewer/src/GraphDisplay.cpp
@@ -12,7 +12,7 @@ namespace MantidQt
 namespace SpectrumView
 {
 
-QColor GraphDisplay::g_curveColors[] = {Qt::black, Qt::red, Qt::green, Qt::blue};
+std::vector<QColor> GraphDisplay::g_curveColors;
 
 /**
  *  Construct a GraphDisplay to display selected graph on the specifed plot
@@ -40,6 +40,11 @@ GraphDisplay::GraphDisplay( QwtPlot*      graphPlot,
 {
   if(isVertical)
     graphPlot->setAxisMaxMajor( QwtPlot::xBottom, 3 );
+
+  g_curveColors.push_back(Qt::black);
+  g_curveColors.push_back(Qt::red);
+  g_curveColors.push_back(Qt::green);
+  g_curveColors.push_back(Qt::blue);
 }
 
 
@@ -130,7 +135,7 @@ void GraphDisplay::setData(const QVector<double> & xData,
   auto curve = new QwtPlotCurve;
   curve->setData( xData, yData );
   curve->attach( m_graphPlot );
-  auto colorIndex = m_curves.size() % sizeof(g_curveColors);
+  auto colorIndex = m_curves.size() % g_curveColors.size();
   curve->setPen(QPen(g_curveColors[colorIndex]));
   m_curves.append(curve);
 
diff --git a/Testing/SystemTests/tests/analysis/LoadVesuvioTest.py b/Testing/SystemTests/tests/analysis/LoadVesuvioTest.py
index d0fbaa674ef409534fa863367f3485c382d0a7c4..11fa3b62ea0893150faf633ee78992f4c4117bdd 100644
--- a/Testing/SystemTests/tests/analysis/LoadVesuvioTest.py
+++ b/Testing/SystemTests/tests/analysis/LoadVesuvioTest.py
@@ -238,6 +238,10 @@ class VesuvioTests(unittest.TestCase):
 
     #================== Failure cases ================================
 
+    def test_run_range_bad_order_raises_error(self):
+        self.assertRaises(RuntimeError, ms.LoadVesuvio, Filename="14188-14187",
+                          OutputWorkspace=self.ws_name)
+
     def test_missing_spectra_property_raises_error(self):
         self.assertRaises(RuntimeError, ms.LoadVesuvio, Filename="14188",
                           OutputWorkspace=self.ws_name)
diff --git a/Vates/VatesAPI/src/vtkMDHistoQuadFactory.cpp b/Vates/VatesAPI/src/vtkMDHistoQuadFactory.cpp
index 748722813c5ac3a15ecafcdd812c525e03cee2c2..5413e173b246519bac7a43cb2f923107b971d8ea 100644
--- a/Vates/VatesAPI/src/vtkMDHistoQuadFactory.cpp
+++ b/Vates/VatesAPI/src/vtkMDHistoQuadFactory.cpp
@@ -92,6 +92,12 @@ namespace Mantid
         coord_t incrementX = (maxX - minX) / static_cast<coord_t>(nBinsX);
         coord_t incrementY = (maxY - minY) / static_cast<coord_t>(nBinsY);
 
+        boost::scoped_ptr<MDHistoWorkspaceIterator> iterator(dynamic_cast<MDHistoWorkspaceIterator*>(createIteratorWithNormalization(m_normalizationOption, m_workspace.get())));
+        if (!iterator) {
+          throw std::runtime_error(
+              "Could not convert IMDIterator to a MDHistoWorkspaceIterator");
+        }
+
         const int imageSize = (nBinsX ) * (nBinsY );
         vtkPoints *points = vtkPoints::New();
         points->Allocate(static_cast<int>(imageSize));
@@ -119,8 +125,7 @@ namespace Mantid
 
         double progressFactor = 0.5/double(nBinsX);
         double progressOffset = 0.5;
-        boost::scoped_ptr<MDHistoWorkspaceIterator> iterator(dynamic_cast<MDHistoWorkspaceIterator*>(createIteratorWithNormalization(m_normalizationOption, m_workspace.get())));
-    
+
         size_t index = 0;
         for (int i = 0; i < nBinsX; i++)
         {
diff --git a/docs/source/algorithms/LoadMuonNexus-v1.rst b/docs/source/algorithms/LoadMuonNexus-v1.rst
index acd6e582bb31550062f1022df13e320769f1b1b6..5f8aaf88a3c54b19f06667b7430512ea550aefdc 100644
--- a/docs/source/algorithms/LoadMuonNexus-v1.rst
+++ b/docs/source/algorithms/LoadMuonNexus-v1.rst
@@ -79,77 +79,6 @@ The ChildAlgorithms used by LoadMuonNexus are:
    LoadInstrument fails. As the Nexus file has limited instrument data,
    this only populates a few fields.
 
-Usage
------
-
-.. include:: ../usagedata-note.txt
-
-**Example - Load ISIS muon MUSR dataset:**
-
-.. testcode:: LoadMuonNexusOnePeriod
-
-   # Load MUSR dataset
-   ws = LoadMuonNexus(Filename="MUSR00015189.nxs",EntryNumber=1)
-   print "Workspace has ",  ws[0].getNumberHistograms(), " spectra"
-
-Output:
-
-.. testoutput:: LoadMuonNexusOnePeriod
-
-   Workspace has  64  spectra
-
-**Example - Load event nexus file with time filtering:**
-
-.. testcode:: ExLoadMuonNexusSomeSpectra
-
-   # Load some spectra
-   ws = LoadMuonNexus(Filename="MUSR00015189.nxs",SpectrumMin=5,SpectrumMax=10,EntryNumber=1)
-   print "Workspace has ",  ws[0].getNumberHistograms(), " spectra"
-
-Output:
-
-.. testoutput:: ExLoadMuonNexusSomeSpectra
-
-   Workspace has  6  spectra
-
-**Example - Load dead times into table:**
-
-.. testcode:: ExLoadDeadTimeTable
-
-   # Load some spectra
-   ws = LoadMuonNexus(Filename="emu00006473.nxs",SpectrumMin=5,SpectrumMax=10,DeadTimeTable="deadTimeTable")
-   tab = mtd['deadTimeTable']
-   for i in range(0,tab.rowCount()):
-       print tab.cell(i,0), tab.cell(i,1)
-
-Output:
-
-.. testoutput:: ExLoadDeadTimeTable
-
-   5 0.00161112251226
-   6 0.00215016817674
-   7 0.0102171599865
-   8 0.00431686220691
-   9 0.00743605662137
-   10 0.00421147653833
-
-**Example - Load detector grouping into table:**
-
-.. testcode:: ExLoadDetectorGrouping
-
-   # Load some spectra
-   ws = LoadMuonNexus(Filename="emu00006473.nxs",SpectrumList="1,16,17,32",DetectorGroupingTable="detectorTable")
-   tab = mtd['detectorTable']
-   for i in range(0,tab.rowCount()):
-       print tab.cell(i,0)
-
-Output:
-
-.. testoutput:: ExLoadDetectorGrouping
-
-   [ 1 16]
-   [17 32]
-
 .. categories::
 
 .. sourcelink::
diff --git a/docs/source/algorithms/LoadMuonNexus-v2.rst b/docs/source/algorithms/LoadMuonNexus-v2.rst
index 0ca954061e4aad8e1f7858f51b8fbd86d6ad6d88..2e0732e98a485b22bc128fe43e25cb757d49a566 100644
--- a/docs/source/algorithms/LoadMuonNexus-v2.rst
+++ b/docs/source/algorithms/LoadMuonNexus-v2.rst
@@ -80,6 +80,77 @@ detects that it has been asked to load a previous version muon nexus
 file it will call the previous version of the algorithm to perform the
 task.
 
+Usage
+-----
+
+.. include:: ../usagedata-note.txt
+
+**Example - Load ISIS muon MUSR dataset:**
+
+.. testcode:: LoadMuonNexusOnePeriod
+
+   # Load MUSR dataset
+   ws = LoadMuonNexus(Filename="MUSR00015189.nxs",EntryNumber=1)
+   print "Workspace has ",  ws[0].getNumberHistograms(), " spectra"
+
+Output:
+
+.. testoutput:: LoadMuonNexusOnePeriod
+
+   Workspace has  64  spectra
+
+**Example - Load event nexus file with time filtering:**
+
+.. testcode:: ExLoadMuonNexusSomeSpectra
+
+   # Load some spectra
+   ws = LoadMuonNexus(Filename="MUSR00015189.nxs",SpectrumMin=5,SpectrumMax=10,EntryNumber=1)
+   print "Workspace has ",  ws[0].getNumberHistograms(), " spectra"
+
+Output:
+
+.. testoutput:: ExLoadMuonNexusSomeSpectra
+
+   Workspace has  6  spectra
+
+**Example - Load dead times into table:**
+
+.. testcode:: ExLoadDeadTimeTable
+
+   # Load some spectra
+   ws = LoadMuonNexus(Filename="emu00006473.nxs",SpectrumMin=5,SpectrumMax=10,DeadTimeTable="deadTimeTable")
+   tab = mtd['deadTimeTable']
+   for i in range(0,tab.rowCount()):
+       print tab.cell(i,0), tab.cell(i,1)
+
+Output:
+
+.. testoutput:: ExLoadDeadTimeTable
+
+   5 0.00161112251226
+   6 0.00215016817674
+   7 0.0102171599865
+   8 0.00431686220691
+   9 0.00743605662137
+   10 0.00421147653833
+
+**Example - Load detector grouping into table:**
+
+.. testcode:: ExLoadDetectorGrouping
+
+   # Load some spectra
+   ws = LoadMuonNexus(Filename="emu00006473.nxs",SpectrumList="1,16,17,32",DetectorGroupingTable="detectorTable")
+   tab = mtd['detectorTable']
+   for i in range(0,tab.rowCount()):
+       print tab.cell(i,0)
+
+Output:
+
+.. testoutput:: ExLoadDetectorGrouping
+
+   [ 1 16]
+   [17 32]
+
 .. categories::
 
 .. sourcelink::
diff --git a/docs/source/algorithms/SavePlot1DAsJson-v1.rst b/docs/source/algorithms/SavePlot1DAsJson-v1.rst
index 86cbeeefd4e066d2a6f835388fa7cd9269f02e8e..85bb7a8d062628aad864fac2e7a84bdde2c6c871 100644
--- a/docs/source/algorithms/SavePlot1DAsJson-v1.rst
+++ b/docs/source/algorithms/SavePlot1DAsJson-v1.rst
@@ -26,12 +26,12 @@ Usage
 
   import os, numpy as np
   # prepare input
-  E = np.arange(-50, 50, 1.0)
+  E = np.arange(-50, 50, 10.0)
   I = 1000 * np.exp(-E**2/10**2)
   err = I ** .5
   dataws = CreateWorkspace(
       DataX = E, DataY = I, DataE = err, NSpec = 1,
-      UnitX = "Energy(meV)")
+      UnitX = "Energy")
   # output path
   out_json = "myplot.json"
   # run algorithm
diff --git a/docs/source/algorithms/TOFTOFCropWorkspace-v1.rst b/docs/source/algorithms/TOFTOFCropWorkspace-v1.rst
new file mode 100644
index 0000000000000000000000000000000000000000..2a390bc98a778ae33750d5aaaa43175e39501f3b
--- /dev/null
+++ b/docs/source/algorithms/TOFTOFCropWorkspace-v1.rst
@@ -0,0 +1,59 @@
+.. algorithm::
+
+.. summary::
+
+.. alias::
+
+.. properties::
+
+Description
+-----------
+
+Applies algorithm :ref:`algm-Cropworkspace` to an input workspace or a group of workspaces to crop the empty time channels. Boundaries are calculated as follows:
+
+    :math:`X_{min} = 0`
+
+    :math:`X_{max} = N_{fc}\times\Delta t`
+
+where :math:`N_{fc}` is the number of full time channels defined in the *full_channels* sample log and :math:`\Delta t` is the channel width defined in the *channel_width* sample log.
+
+
+Restrictions on the input workspace
+###################################
+
+-  The unit of the X-axis must be **Time-of-flight**.
+-  Workspace must contain *channel_width* and *full_channels* sample logs.
+
+
+Usage
+-----
+
+**Example**
+
+.. testcode:: ExTOFTOFCropWorkspace
+
+    # Load data
+    ws=Load(Filename='TOFTOFTestdata.nxs')
+
+    print "Input workspace"
+    print "Total number of time channels: ",  len(ws.readX(0))
+    print  "Number of filled time channels: ", ws.getRun().getLogData('full_channels').value
+
+    wscropped = TOFTOFCropWorkspace(ws)
+
+    print "Output workspace"
+    print "Total number of time channels: ",  len(wscropped.readX(0))    
+
+Output:
+
+.. testoutput:: ExTOFTOFCropWorkspace
+
+    Input workspace
+    Total number of time channels:  1025
+    Number of filled time channels:  1020.0
+    Output workspace
+    Total number of time channels:  1020
+    
+.. categories::
+
+.. sourcelink::
diff --git a/scripts/Interface/ui/reflectometer/refl_save.py b/scripts/Interface/ui/reflectometer/refl_save.py
index 6dabce7fe2a500d16899e687dde973628f1c98de..52f4c8dc61f64444d7263953e7a70dcf40d99a0a 100644
--- a/scripts/Interface/ui/reflectometer/refl_save.py
+++ b/scripts/Interface/ui/reflectometer/refl_save.py
@@ -1,8 +1,8 @@
-#pylint: disable=invalid-name
+#pylint: disable-all
 from PyQt4 import QtCore, QtGui
 import os
 from mantid.simpleapi import *
-from mantid.api import WorkspaceGroup
+from mantid.api import WorkspaceGroup, AnalysisDataService
 import xml.etree.ElementTree as xml
 from isis_reflectometry.quick import *
 from isis_reflectometry.procedures import *
@@ -32,10 +32,12 @@ class Ui_SaveWindow(object):
     def setupUi(self, SaveWindow):
         self.SavePath=""
         SaveWindow.setObjectName(_fromUtf8("SaveWindow"))
-        SaveWindow.resize(700, 450)
+        SaveWindow.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding))
         SaveWindow.setAcceptDrops(True)
-
+        main_layout = QtGui.QHBoxLayout()
+        SaveWindow.setLayout(main_layout)
         self.centralWidget = QtGui.QWidget(SaveWindow)
+        main_layout.addWidget(self.centralWidget)
         self.centralWidget.setObjectName(_fromUtf8("centralWidget"))
         self.gridLayout_2 = QtGui.QGridLayout(self.centralWidget)
         self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
@@ -236,12 +238,18 @@ class Ui_SaveWindow(object):
 
     def retranslateUi(self, SaveWindow):
         SaveWindow.setWindowTitle(QtGui.QApplication.translate("SaveWindow", "SaveWindow", None, QtGui.QApplication.UnicodeUTF8))
-        self.pushButton.setText(QtGui.QApplication.translate("SaveWindow", "SAVE", None, QtGui.QApplication.UnicodeUTF8))
+        self.pushButton.setText(QtGui.QApplication.translate("SaveWindow", "Save", None, QtGui.QApplication.UnicodeUTF8))
         self.pushButton_2.setText(QtGui.QApplication.translate("SaveWindow", "Refresh", None, QtGui.QApplication.UnicodeUTF8))
 
+    def _get_saveable_workspace_names(self):
+        names = mtd.getObjectNames()
+        # Exclude WorkspaceGroups from our list. We cannot save them to ASCII.
+        names = [i for i in names if not isinstance(AnalysisDataService.retrieve(i), WorkspaceGroup)]
+        return names
+    
     def filterWksp(self):
         self.listWidget.clear()
-        names = mtd.getObjectNames()
+        names = self._get_saveable_workspace_names()
         if self.regExCheckBox.isChecked():
             regex=re.compile(self.filterEdit.text())
             filtered = list()
@@ -268,7 +276,7 @@ class Ui_SaveWindow(object):
 
     def populateList(self):
         self.listWidget.clear()
-        names = mtd.getObjectNames()
+        names = self._get_saveable_workspace_names()
         if len(names):
             RB_Number=groupGet(names[0],'samp','rb_proposal')
             for ws in names: