diff --git a/Framework/Crystal/inc/MantidCrystal/CentroidPeaks.h b/Framework/Crystal/inc/MantidCrystal/CentroidPeaks.h
index 964ce497aef2a408974e6dd55300153bf4ed9562..de9462ab0a32e3f0f5a206c46d872dde180144e8 100644
--- a/Framework/Crystal/inc/MantidCrystal/CentroidPeaks.h
+++ b/Framework/Crystal/inc/MantidCrystal/CentroidPeaks.h
@@ -18,7 +18,9 @@ namespace Crystal {
 class DLLExport CentroidPeaks : public API::Algorithm {
 public:
   /// Algorithm's name for identification
-  const std::string name() const override { return "CentroidPeaks"; };
+  const std::string name() const override {
+    return "CentroidPeaks";
+  };
   /// Summary of algorithms purpose
   const std::string summary() const override {
     return "Find the centroid of single-crystal peaks in a 2D Workspace, in "
@@ -26,7 +28,9 @@ public:
   }
 
   /// Algorithm's version for identification
-  int version() const override { return 1; };
+  int version() const override {
+    return 1;
+  };
   /// Algorithm's category for identification
   const std::string category() const override { return "Crystal\\Peaks"; }
 
@@ -38,7 +42,7 @@ private:
   void integrate();
   void integrateEvent();
   int findPixelID(std::string bankName, int col, int row);
-  bool edgePixel(std::string bankName, int col, int row, int Edge);
+  Geometry::Instrument_const_sptr inst;
 
   /// Input 2D Workspace
   API::MatrixWorkspace_sptr inWS;
diff --git a/Framework/Crystal/inc/MantidCrystal/SCDCalibratePanels.h b/Framework/Crystal/inc/MantidCrystal/SCDCalibratePanels.h
index b3a260ce82026b3848b0fadd66c6da7d1874f71a..de8314048a1ba4bfd88fb1a2f68c5d8858c0d52f 100644
--- a/Framework/Crystal/inc/MantidCrystal/SCDCalibratePanels.h
+++ b/Framework/Crystal/inc/MantidCrystal/SCDCalibratePanels.h
@@ -63,9 +63,6 @@ private:
                       boost::container::flat_set<std::string> &AllBankName,
                       double T0, std::string filename);
 
-  /// Function to find peaks near detector edge
-  bool edgePixel(const DataObjects::PeaksWorkspace &ws,
-                 const std::string &bankName, int col, int row, int Edge);
   /// Function to calculate U
   void findU(DataObjects::PeaksWorkspace_sptr peaksWs);
   /// save workspaces
diff --git a/Framework/Crystal/src/CentroidPeaks.cpp b/Framework/Crystal/src/CentroidPeaks.cpp
index 4588264f918c7120c291aaf8c4000d2e6e30c105..b266a6361ec7bc97f92d5733041d92fd7095322c 100644
--- a/Framework/Crystal/src/CentroidPeaks.cpp
+++ b/Framework/Crystal/src/CentroidPeaks.cpp
@@ -4,6 +4,7 @@
 #include "MantidKernel/Unit.h"
 #include "MantidKernel/VectorHelper.h"
 #include "MantidGeometry/Crystal/OrientedLattice.h"
+#include "MantidAPI/DetectorInfo.h"
 
 using Mantid::DataObjects::PeaksWorkspace;
 
@@ -23,27 +24,27 @@ using namespace Mantid::Crystal;
 /** Initialize the algorithm's properties.
  */
 void CentroidPeaks::init() {
-  declareProperty(make_unique<WorkspaceProperty<PeaksWorkspace>>(
+  declareProperty(make_unique<WorkspaceProperty<PeaksWorkspace> >(
                       "InPeaksWorkspace", "", Direction::Input),
                   "A PeaksWorkspace containing the peaks to centroid.");
 
   declareProperty(
-      make_unique<WorkspaceProperty<>>("InputWorkspace", "", Direction::Input),
+      make_unique<WorkspaceProperty<> >("InputWorkspace", "", Direction::Input),
       "An input 2D Workspace.");
 
   declareProperty(
-      make_unique<PropertyWithValue<int>>("PeakRadius", 10, Direction::Input),
+      make_unique<PropertyWithValue<int> >("PeakRadius", 10, Direction::Input),
       "Fixed radius around each peak position in which to calculate the "
       "centroid.");
 
   declareProperty(
-      make_unique<PropertyWithValue<int>>("EdgePixels", 0, Direction::Input),
+      make_unique<PropertyWithValue<int> >("EdgePixels", 0, Direction::Input),
       "The number of pixels where peaks are removed at edges. Only "
       "for instruments with RectangularDetectors. ");
 
   declareProperty(
-      make_unique<WorkspaceProperty<PeaksWorkspace>>("OutPeaksWorkspace", "",
-                                                     Direction::Output),
+      make_unique<WorkspaceProperty<PeaksWorkspace> >("OutPeaksWorkspace", "",
+                                                      Direction::Output),
       "The output PeaksWorkspace will be a copy of the input PeaksWorkspace "
       "with the peaks' positions modified by the new found centroids.");
 }
@@ -120,7 +121,7 @@ void CentroidPeaks::integrate() {
     for (int ichan = chanstart; ichan <= chanend; ++ichan) {
       for (int irow = rowstart; irow <= rowend; ++irow) {
         for (int icol = colstart; icol <= colend; ++icol) {
-          if (edgePixel(bankName, icol, irow, Edge))
+          if (DetectorInfo::edgePixel(inst, bankName, icol, irow, Edge))
             continue;
           const auto it =
               wi_to_detid_map.find(findPixelID(bankName, icol, irow));
@@ -148,7 +149,7 @@ void CentroidPeaks::integrate() {
 
     peak.setDetectorID(findPixelID(bankName, col, row));
     // Set wavelength to change tof for peak object
-    if (!edgePixel(bankName, col, row, Edge)) {
+    if (!DetectorInfo::edgePixel(inst, bankName, col, row, Edge)) {
       it = wi_to_detid_map.find(findPixelID(bankName, col, row));
       workspaceIndex = (it->second);
       Mantid::Kernel::Units::Wavelength wl;
@@ -175,7 +176,7 @@ void CentroidPeaks::integrate() {
     int row = peak.getRow();
     std::string bankName = peak.getBankName();
 
-    if (edgePixel(bankName, col, row, Edge)) {
+    if (DetectorInfo::edgePixel(inst, bankName, col, row, Edge)) {
       peakWS->removePeak(i);
     }
   }
@@ -237,7 +238,7 @@ void CentroidPeaks::integrateEvent() {
 
     double intensity = 0.0;
     double tofcentroid = 0.0;
-    if (edgePixel(bankName, col, row, Edge))
+    if (DetectorInfo::edgePixel(inst, bankName, col, row, Edge))
       continue;
 
     double tofstart = TOFPeakd * std::pow(1.004, -PeakRadius);
@@ -250,7 +251,7 @@ void CentroidPeaks::integrateEvent() {
     int colend = col + PeakRadius;
     for (int irow = rowstart; irow <= rowend; ++irow) {
       for (int icol = colstart; icol <= colend; ++icol) {
-        if (edgePixel(bankName, icol, irow, Edge))
+        if (DetectorInfo::edgePixel(inst, bankName, icol, irow, Edge))
           continue;
         auto it1 = wi_to_detid_map.find(findPixelID(bankName, icol, irow));
         size_t workspaceIndex = (it1->second);
@@ -276,7 +277,7 @@ void CentroidPeaks::integrateEvent() {
     row = std::max(0, row);
     col = int(colcentroid / intensity);
     col = std::max(0, col);
-    if (!edgePixel(bankName, col, row, Edge)) {
+    if (!DetectorInfo::edgePixel(inst, bankName, col, row, Edge)) {
       peak.setDetectorID(findPixelID(bankName, col, row));
 
       // Set wavelength to change tof for peak object
@@ -305,7 +306,7 @@ void CentroidPeaks::integrateEvent() {
     int row = peak.getRow();
     std::string bankName = peak.getBankName();
 
-    if (edgePixel(bankName, col, row, Edge)) {
+    if (DetectorInfo::edgePixel(inst, bankName, col, row, Edge)) {
       peakWS->removePeak(i);
     }
   }
@@ -318,7 +319,7 @@ void CentroidPeaks::integrateEvent() {
  */
 void CentroidPeaks::exec() {
   inWS = getProperty("InputWorkspace");
-
+  inst = inWS->getInstrument();
   // For quickly looking up workspace index from det id
   wi_to_detid_map = inWS->getDetectorIDToWorkspaceIndexMap();
 
@@ -332,9 +333,8 @@ void CentroidPeaks::exec() {
 }
 
 int CentroidPeaks::findPixelID(std::string bankName, int col, int row) {
-  Geometry::Instrument_const_sptr Iptr = inWS->getInstrument();
   boost::shared_ptr<const IComponent> parent =
-      Iptr->getComponentByName(bankName);
+      inst->getComponentByName(bankName);
   if (parent->type() == "RectangularDetector") {
     boost::shared_ptr<const RectangularDetector> RDet =
         boost::dynamic_pointer_cast<const RectangularDetector>(parent);
@@ -346,46 +346,16 @@ int CentroidPeaks::findPixelID(std::string bankName, int col, int row) {
     // Only works for WISH
     bankName0.erase(0, 4);
     std::ostringstream pixelString;
-    pixelString << Iptr->getName() << "/" << bankName0 << "/" << bankName
+    pixelString << inst->getName() << "/" << bankName0 << "/" << bankName
                 << "/tube" << std::setw(3) << std::setfill('0') << col
                 << "/pixel" << std::setw(4) << std::setfill('0') << row;
     boost::shared_ptr<const Geometry::IComponent> component =
-        Iptr->getComponentByName(pixelString.str());
+        inst->getComponentByName(pixelString.str());
     boost::shared_ptr<const Detector> pixel =
         boost::dynamic_pointer_cast<const Detector>(component);
     return pixel->getID();
   }
 }
-bool CentroidPeaks::edgePixel(std::string bankName, int col, int row,
-                              int Edge) {
-  if (bankName == "None")
-    return false;
-  Geometry::Instrument_const_sptr Iptr = inWS->getInstrument();
-  boost::shared_ptr<const IComponent> parent =
-      Iptr->getComponentByName(bankName);
-  if (parent->type() == "RectangularDetector") {
-    boost::shared_ptr<const RectangularDetector> RDet =
-        boost::dynamic_pointer_cast<const RectangularDetector>(parent);
-
-    return col < Edge || col >= (RDet->xpixels() - Edge) || row < Edge ||
-           row >= (RDet->ypixels() - Edge);
-  } else {
-    std::vector<Geometry::IComponent_const_sptr> children;
-    boost::shared_ptr<const Geometry::ICompAssembly> asmb =
-        boost::dynamic_pointer_cast<const Geometry::ICompAssembly>(parent);
-    asmb->getChildren(children, false);
-    boost::shared_ptr<const Geometry::ICompAssembly> asmb2 =
-        boost::dynamic_pointer_cast<const Geometry::ICompAssembly>(children[0]);
-    std::vector<Geometry::IComponent_const_sptr> grandchildren;
-    asmb2->getChildren(grandchildren, false);
-    int NROWS = static_cast<int>(grandchildren.size());
-    int NCOLS = static_cast<int>(children.size());
-    // Wish pixels and tubes start at 1 not 0
-    return col - 1 < Edge || col - 1 >= (NCOLS - Edge) || row - 1 < Edge ||
-           row - 1 >= (NROWS - Edge);
-  }
-  return false;
-}
 
 } // namespace Mantid
 } // namespace Crystal
diff --git a/Framework/Crystal/src/SCDCalibratePanels.cpp b/Framework/Crystal/src/SCDCalibratePanels.cpp
index b46aaf51a2eb6d9afcbeef46ed7f57336e011c76..93413e355305dd5ae8e04325ba0d1ddd2560b8cd 100644
--- a/Framework/Crystal/src/SCDCalibratePanels.cpp
+++ b/Framework/Crystal/src/SCDCalibratePanels.cpp
@@ -18,6 +18,7 @@
 #include "MantidGeometry/Crystal/IndexingUtils.h"
 #include "MantidGeometry/Crystal/OrientedLattice.h"
 #include "MantidGeometry/Crystal/ReducedCell.h"
+#include "MantidAPI/DetectorInfo.h"
 #include <boost/math/special_functions/round.hpp>
 #include <boost/container/flat_set.hpp>
 #include <Poco/File.h>
@@ -44,67 +45,21 @@ const std::string SCDCalibratePanels::category() const {
   return "Crystal\\Corrections";
 }
 
-//-----------------------------------------------------------------------------------------
-/**
-  @param  ws           Name of workspace containing peaks
-  @param  bankName     Name of bank containing peak
-  @param  col          Column number containing peak
-  @param  row          Row number containing peak
-  @param  Edge         Number of edge points for each bank
-  @return True if peak is on edge
-*/
-bool SCDCalibratePanels::edgePixel(const PeaksWorkspace &ws,
-                                   const std::string &bankName, int col,
-                                   int row, int Edge) {
-  if (bankName == "None")
-    return false;
-  auto Iptr = ws.getInstrument();
-  auto parent = Iptr->getComponentByName(bankName);
-  if (parent->type() == "RectangularDetector") {
-    auto RDet = boost::dynamic_pointer_cast<const RectangularDetector>(parent);
-    return col < Edge || col >= (RDet->xpixels() - Edge) || row < Edge ||
-           row >= (RDet->ypixels() - Edge);
-  } else {
-    std::vector<Geometry::IComponent_const_sptr> children;
-    auto asmb =
-        boost::dynamic_pointer_cast<const Geometry::ICompAssembly>(parent);
-    asmb->getChildren(children, false);
-    int startI = 1;
-    if (children[0]->getName() == "sixteenpack") {
-      startI = 0;
-      parent = children[0];
-      children.clear();
-      auto asmb =
-          boost::dynamic_pointer_cast<const Geometry::ICompAssembly>(parent);
-      asmb->getChildren(children, false);
-    }
-    auto asmb2 =
-        boost::dynamic_pointer_cast<const Geometry::ICompAssembly>(children[0]);
-    std::vector<Geometry::IComponent_const_sptr> grandchildren;
-    asmb2->getChildren(grandchildren, false);
-    int NROWS = static_cast<int>(grandchildren.size());
-    int NCOLS = static_cast<int>(children.size());
-    // Wish pixels and tubes start at 1 not 0
-    return col - startI < Edge || col - startI >= (NCOLS - Edge) ||
-           row - startI < Edge || row - startI >= (NROWS - Edge);
-  }
-  return false;
-}
-
 void SCDCalibratePanels::exec() {
   PeaksWorkspace_sptr peaksWs = getProperty("PeakWorkspace");
   // We must sort the peaks
-  std::vector<std::pair<std::string, bool>> criteria{{"BankName", true}};
+  std::vector<std::pair<std::string, bool> > criteria{ { "BankName", true } };
   peaksWs->sort(criteria);
   // Remove peaks on edge
   int edge = this->getProperty("EdgePixels");
   if (edge > 0) {
+    Geometry::Instrument_const_sptr inst = peaksWs->getInstrument();
     std::vector<Peak> &peaks = peaksWs->getPeaks();
-    auto it = std::remove_if(
-        peaks.begin(), peaks.end(), [&peaksWs, edge, this](const Peak &pk) {
-          return this->edgePixel(*peaksWs, pk.getBankName(), pk.getCol(),
-                                 pk.getRow(), edge);
-        });
+    auto it = std::remove_if(peaks.begin(), peaks.end(),
+                             [&peaksWs, edge, inst](const Peak &pk) {
+      return DetectorInfo::edgePixel(inst, pk.getBankName(), pk.getCol(),
+                                     pk.getRow(), edge);
+    });
     peaks.erase(it, peaks.end());
   }
   findU(peaksWs);
@@ -178,7 +133,8 @@ void SCDCalibratePanels::exec() {
     IAlgorithm_sptr fit_alg;
     try {
       fit_alg = createChildAlgorithm("Fit", -1, -1, false);
-    } catch (Exception::NotFoundError &) {
+    }
+    catch (Exception::NotFoundError &) {
       g_log.error("Can't locate Fit algorithm");
       throw;
     }
@@ -217,7 +173,8 @@ void SCDCalibratePanels::exec() {
       IAlgorithm_sptr fit2_alg;
       try {
         fit2_alg = createChildAlgorithm("Fit", -1, -1, false);
-      } catch (Exception::NotFoundError &) {
+      }
+      catch (Exception::NotFoundError &) {
         g_log.error("Can't locate Fit algorithm");
         throw;
       }
@@ -359,7 +316,8 @@ void SCDCalibratePanels::exec() {
           RowY[icount] = theoretical.getRow();
           TofX[icount] = peak.getTOF();
           TofY[icount] = theoretical.getTOF();
-        } catch (...) {
+        }
+        catch (...) {
           // g_log.debug() << "Problem only in printing peaks\n";
         }
         icount++;
@@ -417,7 +375,8 @@ void SCDCalibratePanels::findL1(int nPeaks,
   IAlgorithm_sptr fitL1_alg;
   try {
     fitL1_alg = createChildAlgorithm("Fit", -1, -1, false);
-  } catch (Exception::NotFoundError &) {
+  }
+  catch (Exception::NotFoundError &) {
     g_log.error("Can't locate Fit algorithm");
     throw;
   }
@@ -452,7 +411,8 @@ void SCDCalibratePanels::findU(DataObjects::PeaksWorkspace_sptr peaksWs) {
   IAlgorithm_sptr ub_alg;
   try {
     ub_alg = createChildAlgorithm("CalculateUMatrix", -1, -1, false);
-  } catch (Exception::NotFoundError &) {
+  }
+  catch (Exception::NotFoundError &) {
     g_log.error("Can't locate CalculateUMatrix algorithm");
     throw;
   }
@@ -532,11 +492,11 @@ void SCDCalibratePanels::saveIsawDetCal(
 }
 
 void SCDCalibratePanels::init() {
-  declareProperty(Kernel::make_unique<WorkspaceProperty<PeaksWorkspace>>(
+  declareProperty(Kernel::make_unique<WorkspaceProperty<PeaksWorkspace> >(
                       "PeakWorkspace", "", Kernel::Direction::InOut),
                   "Workspace of Indexed Peaks");
 
-  auto mustBePositive = boost::make_shared<BoundedValidator<double>>();
+  auto mustBePositive = boost::make_shared<BoundedValidator<double> >();
   mustBePositive->setLower(0.0);
 
   declareProperty("a", EMPTY_DBL(), mustBePositive,
@@ -566,7 +526,7 @@ void SCDCalibratePanels::init() {
                   "Remove peaks that are at pixels this close to edge. ");
 
   // ---------- outputs
-  const std::vector<std::string> detcalExts{".DetCal", ".Det_Cal"};
+  const std::vector<std::string> detcalExts{ ".DetCal", ".Det_Cal" };
   declareProperty(
       Kernel::make_unique<FileProperty>("DetCalFilename", "SCDCalibrate.DetCal",
                                         FileProperty::Save, detcalExts),