diff --git a/Framework/DataHandling/src/LoadILLSANS.cpp b/Framework/DataHandling/src/LoadILLSANS.cpp
index f5af0252b8bbbf53b914ea9e0db52833b75464b1..a6058f67e96a6b394408be4ed34fc33f7ec6d11e 100644
--- a/Framework/DataHandling/src/LoadILLSANS.cpp
+++ b/Framework/DataHandling/src/LoadILLSANS.cpp
@@ -132,7 +132,7 @@ void LoadILLSANS::exec() {
     if (m_instrumentName == "D22") {
       double offset = m_loader.getDoubleFromNexusPath(
           firstEntry, instrumentPath + "/detector/dtr_actual");
-      moveDetectorHorizontal(offset / 1000, "detector"); // mm to meter
+      moveDetectorHorizontal(-offset / 1000, "detector"); // mm to meter
       /*TODO: DO NOT ROTATE UNTIL CONFIRMED BY INSTRUMENT SCIENTIST
       double angle = m_loader.getDoubleFromNexusPath(
           firstEntry, instrumentPath + "/detector/dan_actual");
@@ -234,11 +234,11 @@ void LoadILLSANS::initWorkSpaceD33(NeXus::NXEntry &firstEntry,
   NXInt dataRear = dataGroup1.openIntData();
   dataRear.load();
   NXData dataGroup2 = firstEntry.openNXData("data2");
-  NXInt dataLeft = dataGroup2.openIntData();
-  dataLeft.load();
-  NXData dataGroup3 = firstEntry.openNXData("data3");
-  NXInt dataRight = dataGroup3.openIntData();
+  NXInt dataRight = dataGroup2.openIntData();
   dataRight.load();
+  NXData dataGroup3 = firstEntry.openNXData("data3");
+  NXInt dataLeft = dataGroup3.openIntData();
+  dataLeft.load();
   NXData dataGroup4 = firstEntry.openNXData("data4");
   NXInt dataDown = dataGroup4.openIntData();
   dataDown.load();
@@ -308,10 +308,10 @@ void LoadILLSANS::initWorkSpaceD33(NeXus::NXEntry &firstEntry,
       std::string distancePrefix(instrumentPath + "/tof/tof_distance_detector");
       binningRear = getVariableTimeBinning(firstEntry, distancePrefix + "1",
                                            channelWidthSum, channelWidthTimes);
-      binningLeft = getVariableTimeBinning(firstEntry, distancePrefix + "2",
-                                           channelWidthSum, channelWidthTimes);
-      binningRight = getVariableTimeBinning(firstEntry, distancePrefix + "3",
+      binningRight = getVariableTimeBinning(firstEntry, distancePrefix + "2",
                                             channelWidthSum, channelWidthTimes);
+      binningLeft = getVariableTimeBinning(firstEntry, distancePrefix + "3",
+                                           channelWidthSum, channelWidthTimes);
       binningDown = getVariableTimeBinning(firstEntry, distancePrefix + "4",
                                            channelWidthSum, channelWidthTimes);
       binningUp = getVariableTimeBinning(firstEntry, distancePrefix + "5",
@@ -326,11 +326,10 @@ void LoadILLSANS::initWorkSpaceD33(NeXus::NXEntry &firstEntry,
                                   "/tof/tof_wavelength_detector");
         binningRear = m_loader.getTimeBinningFromNexusPath(firstEntry,
                                                            binPathPrefix + "1");
-
-        binningLeft = m_loader.getTimeBinningFromNexusPath(firstEntry,
-                                                           binPathPrefix + "2");
         binningRight = m_loader.getTimeBinningFromNexusPath(
-            firstEntry, binPathPrefix + "3");
+            firstEntry, binPathPrefix + "2");
+        binningLeft = m_loader.getTimeBinningFromNexusPath(firstEntry,
+                                                           binPathPrefix + "3");
         binningDown = m_loader.getTimeBinningFromNexusPath(firstEntry,
                                                            binPathPrefix + "4");
         binningUp = m_loader.getTimeBinningFromNexusPath(firstEntry,
diff --git a/Framework/DataHandling/test/LoadILLSANSTest.h b/Framework/DataHandling/test/LoadILLSANSTest.h
index 18245958d944a1457f127489e2c3522c414c8e20..822eda9b45ede03888b136cc772d854c41ad0a7c 100644
--- a/Framework/DataHandling/test/LoadILLSANSTest.h
+++ b/Framework/DataHandling/test/LoadILLSANSTest.h
@@ -117,7 +117,7 @@ public:
         instrument->getComponentByName("detector");
     V3D pos = component->getPos();
     TS_ASSERT_DELTA(pos.Z(), 8, 0.01)
-    TS_ASSERT_DELTA(pos.X(), 0.35, 0.01)
+    TS_ASSERT_DELTA(pos.X(), -0.35, 0.01)
     const auto &xAxis = outputWS->x(0).rawData();
     const auto &spec6 = outputWS->y(6).rawData();
     const auto &err6 = outputWS->e(6).rawData();
diff --git a/Framework/PythonInterface/test/python/plugins/algorithms/WorkflowAlgorithms/SANSILLReductionTest.py b/Framework/PythonInterface/test/python/plugins/algorithms/WorkflowAlgorithms/SANSILLReductionTest.py
index e780119ca950e82d66cb82d824a69707f6a5fe93..dc141e1ede58498907a1d60431cd6c0564724213 100644
--- a/Framework/PythonInterface/test/python/plugins/algorithms/WorkflowAlgorithms/SANSILLReductionTest.py
+++ b/Framework/PythonInterface/test/python/plugins/algorithms/WorkflowAlgorithms/SANSILLReductionTest.py
@@ -88,7 +88,7 @@ class SANSILLReductionTest(unittest.TestCase):
         self._check_output(mtd['beam'], True, 30, 256*256+2)
         self._check_process_flag(mtd['beam'], 'Beam')
         run = mtd['beam'].getRun()
-        self.assertAlmostEqual(run.getLogData('BeamCenterX').value, -0.0025, delta=1e-4)
+        self.assertAlmostEqual(run.getLogData('BeamCenterX').value, 0.0025, delta=1e-4)
         self.assertAlmostEqual(run.getLogData('BeamCenterY').value, 0.0009, delta=1e-4)
         self._check_output(mtd['flux'], False, 30, 256*256+2)
         self._check_process_flag(mtd['flux'], 'Beam')
diff --git a/Testing/Data/SystemTest/ILL/D22/D22_mask.nxs.md5 b/Testing/Data/SystemTest/ILL/D22/D22_mask.nxs.md5
index f5650b4e64b272d86c307fcf6c44e7d0c4c67f46..9e65311bc192c88e9e251280116da90f1c642b73 100644
--- a/Testing/Data/SystemTest/ILL/D22/D22_mask.nxs.md5
+++ b/Testing/Data/SystemTest/ILL/D22/D22_mask.nxs.md5
@@ -1 +1 @@
-8c3021d883683303d4928eea278fcbb3
+20ba10e6cd8c52e795cba124e1255bff
diff --git a/Testing/Data/SystemTest/ILL/D33/D33_mask.nxs.md5 b/Testing/Data/SystemTest/ILL/D33/D33_mask.nxs.md5
index 309f6f99eb800b97b913fd4b7f63004cbb48eafa..27fc08850a5ae7668b5d36e398dedb0bc386d7b4 100644
--- a/Testing/Data/SystemTest/ILL/D33/D33_mask.nxs.md5
+++ b/Testing/Data/SystemTest/ILL/D33/D33_mask.nxs.md5
@@ -1 +1 @@
-6d24d0341f4ae57431bf49ce53fc820f
+faca2abb9b4843beac4ca0675c5df431
diff --git a/Testing/SystemTests/tests/analysis/reference/ILL_SANS_D22_IQ.nxs.md5 b/Testing/SystemTests/tests/analysis/reference/ILL_SANS_D22_IQ.nxs.md5
index 92016d08b04ec268cf8e46bc3cab8416880ede7e..648c47ae6faef53136d400a34fe9e5b50687c2b1 100644
--- a/Testing/SystemTests/tests/analysis/reference/ILL_SANS_D22_IQ.nxs.md5
+++ b/Testing/SystemTests/tests/analysis/reference/ILL_SANS_D22_IQ.nxs.md5
@@ -1 +1 @@
-22b6add1080501cc99d689031ee43f41
+202208c966f9af5cc479cc12801a9113
diff --git a/Testing/SystemTests/tests/analysis/reference/ILL_SANS_D33_IQ.nxs.md5 b/Testing/SystemTests/tests/analysis/reference/ILL_SANS_D33_IQ.nxs.md5
index 7339a581de67da6e601c4dc074153deda011975e..0401877b04da09c97ce0c7ffc28960fa7501cedf 100644
--- a/Testing/SystemTests/tests/analysis/reference/ILL_SANS_D33_IQ.nxs.md5
+++ b/Testing/SystemTests/tests/analysis/reference/ILL_SANS_D33_IQ.nxs.md5
@@ -1 +1 @@
-b295d56a6a50850780571e013de71363
+b2736c2cb28e09bf50bb8e8ef4c9363f
diff --git a/Testing/SystemTests/tests/analysis/reference/ILL_SANS_D33_LTOF_IQ.nxs.md5 b/Testing/SystemTests/tests/analysis/reference/ILL_SANS_D33_LTOF_IQ.nxs.md5
index 2522e7d4d2399e9c34c1d3b02b5e28b8f88723a8..b40fc76b3809a07e0f10086ede32d5c74d8fc3db 100644
--- a/Testing/SystemTests/tests/analysis/reference/ILL_SANS_D33_LTOF_IQ.nxs.md5
+++ b/Testing/SystemTests/tests/analysis/reference/ILL_SANS_D33_LTOF_IQ.nxs.md5
@@ -1 +1 @@
-c5806ff289823dbf00599957cd1a6010
+328b88b2d1b45a4a62729139e462591c
diff --git a/Testing/SystemTests/tests/analysis/reference/ILL_SANS_D33_VTOF_IQ.nxs.md5 b/Testing/SystemTests/tests/analysis/reference/ILL_SANS_D33_VTOF_IQ.nxs.md5
index dacef36e1d88d7cb11b53b0c6be96cd8ccce40f0..8b58417d5d87acf965a79d1730fc91a72c9df4ee 100644
--- a/Testing/SystemTests/tests/analysis/reference/ILL_SANS_D33_VTOF_IQ.nxs.md5
+++ b/Testing/SystemTests/tests/analysis/reference/ILL_SANS_D33_VTOF_IQ.nxs.md5
@@ -1 +1 @@
-2bd81479a7dc78e2872d562c1392fe03
+c025c6ce05cfe3c3484921cd3366d82c
diff --git a/docs/source/release/v4.3.0/sans.rst b/docs/source/release/v4.3.0/sans.rst
index f57fee14d05645fd7f546020f328e1eaee49b7f9..683c3414fcbd6b6d681e24ec0df211380d7d02f6 100644
--- a/docs/source/release/v4.3.0/sans.rst
+++ b/docs/source/release/v4.3.0/sans.rst
@@ -9,9 +9,9 @@ New
 ###
 - New EQ-SANS instrument definition file to adjust the position of the detector array accoring to log entry "detectorZ".
 
-
 Improved
 ########
+- Detector numbering is fixed for the SANS instruments D22 and D33 at the ILL.
 - :ref:`MaskBTP <algm-MaskBTP>` now handles both old and new instrument definitions for BIOSANS and GPSANS
 - Data with invalid proton charge logs will now be fixed before performing
   slicing. A warning is emitted when this happens.
diff --git a/instrument/D22_Definition.xml b/instrument/D22_Definition.xml
index 905ec4ea7ea8b7141c83724fba022e20f62d5043..5554279939b8c611d0c61f45bf0918d38519377f 100644
--- a/instrument/D22_Definition.xml
+++ b/instrument/D22_Definition.xml
@@ -1,5 +1,5 @@
 <?xml version='1.0' encoding='ASCII'?>
-<instrument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.mantidproject.org/IDF/1.0" last-modified="2019-07-11 10:49:44.830663" name="D22" valid-from="2017-10-01 23:59:59" valid-to="2100-01-31 23:59:59" xsi:schemaLocation="http://www.mantidproject.org/IDF/1.0 http://schema.mantidproject.org/IDF/1.0/IDFSchema.xsd">
+<instrument xmlns="http://www.mantidproject.org/IDF/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="D22" valid-from="2017-10-01 23:59:59" valid-to="2100-01-31 23:59:59" last-modified="2020-01-17 10:00:17.968252" xsi:schemaLocation="http://www.mantidproject.org/IDF/1.0 http://schema.mantidproject.org/IDF/1.0/IDFSchema.xsd">
   <!-- This is the instrument definition file of the D22 Large dynamic range small-angle diffractometer
        at the ILL.
        Generated file, PLEASE DO NOT EDIT THIS FILE!
@@ -43,31 +43,31 @@
       <pointing-up axis="y"/>
       <handedness val="right"/>
     </reference-frame>
-    <default-view axis-view="z-" view="3D"/>
+    <default-view view="3D" axis-view="z-"/>
   </defaults>
   <!--SOURCE-->
   <component type="moderator">
     <location x="0.0" y="0.0" z="-2.0"/>
   </component>
-  <type is="Source" name="moderator"/>
+  <type name="moderator" is="Source"/>
   <!--Sample position-->
   <component type="sample_position">
     <location x="0.0" y="0.0" z="0.0"/>
   </component>
-  <type is="SamplePos" name="sample_position"/>
+  <type name="sample_position" is="SamplePos"/>
   <!--MONITORS-->
-  <component idlist="monitors" type="monitors">
+  <component type="monitors" idlist="monitors">
     <location/>
   </component>
   <type name="monitors">
     <component type="monitor">
-      <location name="monitor1" z="-16.7"/>
-      <location name="monitor2" z="-1.2"/>
+      <location z="-16.7" name="monitor1"/>
+      <location z="-1.2" name="monitor2"/>
     </component>
   </type>
   <!--MONITOR SHAPE-->
   <!--FIXME: Do something real here.-->
-  <type is="monitor" name="monitor">
+  <type name="monitor" is="monitor">
     <cylinder id="cyl-approx">
       <centre-of-bottom-base p="0.0" r="0.0" t="0.0"/>
       <axis x="0.0" y="0.0" z="1.0"/>
@@ -82,12 +82,14 @@
     <id val="100001"/>
   </idlist>
   <!--DETECTOR-->
-  <component idfillbyfirst="y" idstart="0" idstepbyrow="256" type="detector">
-    <location x="0.0" y="0.0" z="12.8"/>
+  <component type="detector" idstart="0" idfillbyfirst="y" idstepbyrow="256">
+    <location x="0.0" y="0.0" z="12.8">
+      <rot val="180.0" axis-x="0" axis-y="1" axis-z="0"/>
+    </location>
   </component>
-  <type is="rectangular_detector" name="detector" type="pixel" xpixels="128" xstart="-0.508" xstep="0.008" ypixels="256" ystart="-0.51" ystep="0.004"/>
+  <type xstart="-0.508" xstep="0.008" xpixels="128" ystart="-0.51" ystep="0.004" ypixels="256" name="detector" is="rectangular_detector" type="pixel"/>
   <!--PIXEL, EACH PIXEL IS A DETECTOR-->
-  <type is="detector" name="pixel">
+  <type name="pixel" is="detector">
     <cuboid id="pixel-shape">
       <left-front-bottom-point x="-0.004" y="-0.002" z="5e-05"/>
       <left-front-top-point x="-0.004" y="0.002" z="5e-05"/>
diff --git a/instrument/D22lr_Definition.xml b/instrument/D22lr_Definition.xml
index efdc35a33180e6766a103435bd46b2e19d7a3bdb..c2aab3e862aa36f8d1a2309b0380d592732c270f 100644
--- a/instrument/D22lr_Definition.xml
+++ b/instrument/D22lr_Definition.xml
@@ -1,5 +1,5 @@
 <?xml version='1.0' encoding='ASCII'?>
-<instrument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.mantidproject.org/IDF/1.0" last-modified="2019-07-11 10:49:33.026308" name="D22lr" valid-from="2017-10-01 23:59:59" valid-to="2100-01-31 23:59:59" xsi:schemaLocation="http://www.mantidproject.org/IDF/1.0 http://schema.mantidproject.org/IDF/1.0/IDFSchema.xsd">
+<instrument xmlns="http://www.mantidproject.org/IDF/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="D22" valid-from="2017-10-01 23:59:59" valid-to="2100-01-31 23:59:59" last-modified="2020-01-17 10:03:49.764974" xsi:schemaLocation="http://www.mantidproject.org/IDF/1.0 http://schema.mantidproject.org/IDF/1.0/IDFSchema.xsd">
   <!-- This is the instrument definition file of the D22 Large dynamic range small-angle diffractometer
        at the ILL.
        Generated file, PLEASE DO NOT EDIT THIS FILE!
@@ -43,31 +43,31 @@
       <pointing-up axis="y"/>
       <handedness val="right"/>
     </reference-frame>
-    <default-view axis-view="z-" view="3D"/>
+    <default-view view="3D" axis-view="z-"/>
   </defaults>
   <!--SOURCE-->
   <component type="moderator">
     <location x="0.0" y="0.0" z="-2.0"/>
   </component>
-  <type is="Source" name="moderator"/>
+  <type name="moderator" is="Source"/>
   <!--Sample position-->
   <component type="sample_position">
     <location x="0.0" y="0.0" z="0.0"/>
   </component>
-  <type is="SamplePos" name="sample_position"/>
+  <type name="sample_position" is="SamplePos"/>
   <!--MONITORS-->
-  <component idlist="monitors" type="monitors">
+  <component type="monitors" idlist="monitors">
     <location/>
   </component>
   <type name="monitors">
     <component type="monitor">
-      <location name="monitor1" z="-16.7"/>
-      <location name="monitor2" z="-1.2"/>
+      <location z="-16.7" name="monitor1"/>
+      <location z="-1.2" name="monitor2"/>
     </component>
   </type>
   <!--MONITOR SHAPE-->
   <!--FIXME: Do something real here.-->
-  <type is="monitor" name="monitor">
+  <type name="monitor" is="monitor">
     <cylinder id="cyl-approx">
       <centre-of-bottom-base p="0.0" r="0.0" t="0.0"/>
       <axis x="0.0" y="0.0" z="1.0"/>
@@ -82,12 +82,14 @@
     <id val="100001"/>
   </idlist>
   <!--DETECTOR-->
-  <component idfillbyfirst="y" idstart="0" idstepbyrow="128" type="detector">
-    <location x="0.0" y="0.0" z="12.8"/>
+  <component type="detector" idstart="0" idfillbyfirst="y" idstepbyrow="128">
+    <location x="0.0" y="0.0" z="12.8">
+      <rot val="180.0" axis-x="0" axis-y="1" axis-z="0"/>
+    </location>
   </component>
-  <type is="rectangular_detector" name="detector" type="pixel" xpixels="128" xstart="-0.508" xstep="0.008" ypixels="128" ystart="-0.508" ystep="0.008"/>
+  <type xstart="-0.508" xstep="0.008" xpixels="128" ystart="-0.508" ystep="0.008" ypixels="128" name="detector" is="rectangular_detector" type="pixel"/>
   <!--PIXEL, EACH PIXEL IS A DETECTOR-->
-  <type is="detector" name="pixel">
+  <type name="pixel" is="detector">
     <cuboid id="pixel-shape">
       <left-front-bottom-point x="-0.004" y="-0.004" z="5e-05"/>
       <left-front-top-point x="-0.004" y="0.004" z="5e-05"/>
diff --git a/instrument/D33_Definition.xml b/instrument/D33_Definition.xml
index 7a3dd9043c312e4aed9f8235ce6e2fd061c9bb50..0dc129941b120335aaeb8d4d8a05da1f14b30554 100644
--- a/instrument/D33_Definition.xml
+++ b/instrument/D33_Definition.xml
@@ -1,5 +1,5 @@
 <?xml version='1.0' encoding='ASCII'?>
-<instrument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.mantidproject.org/IDF/1.0" last-modified="2019-07-11 10:50:50.653599" name="D33" valid-from="2017-10-01 23:59:59" valid-to="2100-01-31 23:59:59" xsi:schemaLocation="http://www.mantidproject.org/IDF/1.0 http://schema.mantidproject.org/IDF/1.0/IDFSchema.xsd">
+<instrument xmlns="http://www.mantidproject.org/IDF/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="D33" valid-from="2017-10-01 23:59:59" valid-to="2100-01-31 23:59:59" last-modified="2020-01-17 16:19:35.745520" xsi:schemaLocation="http://www.mantidproject.org/IDF/1.0 http://schema.mantidproject.org/IDF/1.0/IDFSchema.xsd">
   <!-- This is the instrument definition file of the D33 Massive dynamic q-range small-angle diffractometer
        at the ILL.
        Generated file, PLEASE DO NOT EDIT THIS FILE!
@@ -51,31 +51,31 @@
       <pointing-up axis="y"/>
       <handedness val="right"/>
     </reference-frame>
-    <default-view axis-view="z-" view="3D"/>
+    <default-view view="3D" axis-view="z-"/>
   </defaults>
   <!--SOURCE-->
   <component type="moderator">
     <location x="0.0" y="0.0" z="-22"/>
   </component>
-  <type is="Source" name="moderator"/>
+  <type name="moderator" is="Source"/>
   <!--Sample position-->
   <component type="sample_position">
     <location x="0.0" y="0.0" z="0.0"/>
   </component>
-  <type is="SamplePos" name="sample_position"/>
+  <type name="sample_position" is="SamplePos"/>
   <!--MONITORS-->
-  <component idlist="monitors" type="monitors">
+  <component type="monitors" idlist="monitors">
     <location/>
   </component>
   <type name="monitors">
     <component type="monitor">
-      <location name="monitor1" z="-16.7"/>
-      <location name="monitor2" z="-1.2"/>
+      <location z="-16.7" name="monitor1"/>
+      <location z="-1.2" name="monitor2"/>
     </component>
   </type>
   <!--MONITOR SHAPE-->
   <!--FIXME: Do something real here.-->
-  <type is="monitor" name="monitor">
+  <type name="monitor" is="monitor">
     <cylinder id="cyl-approx">
       <centre-of-bottom-base p="0.0" r="0.0" t="0.0"/>
       <axis x="0.0" y="0.0" z="1.0"/>
@@ -94,48 +94,50 @@
     <location x="0.0" y="0.0" z="0.0"/>
   </component>
   <type name="detector">
-    <component idfillbyfirst="y" idstart="0" idstepbyrow="128" type="back_detector">
-      <location x="0.0" y="0.0" z="12.8"/>
+    <component type="back_detector" idstart="0" idfillbyfirst="y" idstepbyrow="128">
+      <location x="0.0" y="0.0" z="12.8">
+        <rot val="180.0" axis-x="0" axis-y="1" axis-z="0"/>
+      </location>
     </component>
     <component type="front_detector">
       <location x="0.0" y="0.0" z="0.0"/>
     </component>
   </type>
   <type name="front_detector">
-    <component idfillbyfirst="x" idstart="100000" idstepbyrow="256" type="front_detector_right">
-      <location x="0.4" y="0.0" z="1.2">
-        <rot axis-x="0" axis-y="1" axis-z="0" val="180.0">
-          <rot axis-x="0" axis-y="0" axis-z="1" val="90.0"/>
-        </rot>
+    <component type="front_detector_right" idstart="100000" idfillbyfirst="x" idstepbyrow="256">
+      <location x="-0.4" y="0.0" z="1.2">
+        <rot val="90.0" axis-x="0" axis-y="0" axis-z="1"/>
       </location>
     </component>
-    <component idfillbyfirst="x" idstart="200000" idstepbyrow="256" type="front_detector_left">
-      <location x="-0.4" y="0.0" z="1.2">
-        <rot axis-x="0" axis-y="1" axis-z="0" val="180.0">
-          <rot axis-x="0" axis-y="0" axis-z="1" val="90.0"/>
-        </rot>
+    <component type="front_detector_left" idstart="200000" idfillbyfirst="x" idstepbyrow="256">
+      <location x="0.4" y="0.0" z="1.2">
+        <rot val="90.0" axis-x="0" axis-y="0" axis-z="1"/>
       </location>
     </component>
-    <component idfillbyfirst="y" idstart="300000" idstepbyrow="256" type="front_detector_bottom">
-      <location x="0.0" y="-0.4" z="1.2"/>
+    <component type="front_detector_bottom" idstart="300000" idfillbyfirst="y" idstepbyrow="32">
+      <location x="0.0" y="-0.4" z="1.2">
+        <rot val="180.0" axis-x="0" axis-y="1" axis-z="0"/>
+      </location>
     </component>
-    <component idfillbyfirst="y" idstart="400000" idstepbyrow="256" type="front_detector_top">
-      <location x="0.0" y="0.4" z="1.2"/>
+    <component type="front_detector_top" idstart="400000" idfillbyfirst="y" idstepbyrow="32">
+      <location x="0.0" y="0.4" z="1.2">
+        <rot val="180.0" axis-x="0" axis-y="1" axis-z="0"/>
+      </location>
     </component>
   </type>
   <!--REAR DETECTOR-->
-  <type is="rectangular_detector" name="back_detector" type="pixel" xpixels="256" xstart="-0.31875000000000003" xstep="0.0025" ypixels="128" ystart="-0.3175" ystep="0.005"/>
+  <type xstart="-0.31875000000000003" xstep="0.0025" xpixels="256" ystart="-0.3175" ystep="0.005" ypixels="128" name="back_detector" is="rectangular_detector" type="pixel"/>
   <!--4 FRONT DETECTORS, from detector to sample in +Z direction-->
   <!--RIGHT-->
-  <type is="rectangular_detector" name="front_detector_right" type="pixel" xpixels="256" xstart="-0.31875000000000003" xstep="0.0025" ypixels="32" ystart="-0.0775" ystep="0.005"/>
+  <type xstart="-0.31875000000000003" xstep="0.0025" xpixels="256" ystart="-0.0775" ystep="0.005" ypixels="32" name="front_detector_right" is="rectangular_detector" type="pixel"/>
   <!--LEFT-->
-  <type is="rectangular_detector" name="front_detector_left" type="pixel" xpixels="256" xstart="-0.31875000000000003" xstep="0.0025" ypixels="32" ystart="-0.0775" ystep="0.005"/>
+  <type xstart="-0.31875000000000003" xstep="0.0025" xpixels="256" ystart="-0.0775" ystep="0.005" ypixels="32" name="front_detector_left" is="rectangular_detector" type="pixel"/>
   <!--BOTTOM-->
-  <type is="rectangular_detector" name="front_detector_bottom" type="pixel" xpixels="256" xstart="-0.31875000000000003" xstep="0.0025" ypixels="32" ystart="-0.0775" ystep="0.005"/>
+  <type xstart="-0.31875000000000003" xstep="0.0025" xpixels="256" ystart="-0.0775" ystep="0.005" ypixels="32" name="front_detector_bottom" is="rectangular_detector" type="pixel"/>
   <!--TOP-->
-  <type is="rectangular_detector" name="front_detector_top" type="pixel" xpixels="256" xstart="-0.31875000000000003" xstep="0.0025" ypixels="32" ystart="-0.0775" ystep="0.005"/>
+  <type xstart="-0.31875000000000003" xstep="0.0025" xpixels="256" ystart="-0.0775" ystep="0.005" ypixels="32" name="front_detector_top" is="rectangular_detector" type="pixel"/>
   <!--PIXEL, EACH PIXEL IS A DETECTOR-->
-  <type is="detector" name="pixel">
+  <type name="pixel" is="detector">
     <cuboid id="pixel-shape">
       <left-front-bottom-point x="-0.00125" y="-0.0025" z="5e-05"/>
       <left-front-top-point x="-0.00125" y="0.0025" z="5e-05"/>