diff --git a/.gitattributes b/.gitattributes
index c850ad7ffeb1ae7783f8334efc42b91ada4df058..caf29b314ea3acfdd770d751cf6c52d654c779bc 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1036,8 +1036,6 @@ src/Structure/OpalWake.cpp -text
 src/Structure/OpalWake.h -text
 src/Structure/PriEmissionPhysics.cpp -text
 src/Structure/PriEmissionPhysics.h -text
-src/Structure/Restart.cpp -text
-src/Structure/Restart.h -text
 src/Structure/SecondaryEmissionPhysics.cpp -text
 src/Structure/SecondaryEmissionPhysics.h -text
 src/Structure/SurfacePhysics.cpp -text
diff --git a/classic/5.0/src/AbsBeamline/Collimator.cpp b/classic/5.0/src/AbsBeamline/Collimator.cpp
index 320177ee10870456e30625aef1583ffc315dbeba..1b19443a1388e3b4f1b069a7847d04bbf9f1773c 100644
--- a/classic/5.0/src/AbsBeamline/Collimator.cpp
+++ b/classic/5.0/src/AbsBeamline/Collimator.cpp
@@ -18,13 +18,13 @@
 //
 // ------------------------------------------------------------------------
 
-#include "Physics/Physics.h"
 #include "AbsBeamline/Collimator.h"
+#include "Physics/Physics.h"
 #include "Algorithms/PartBunch.h"
 #include "AbsBeamline/BeamlineVisitor.h"
 #include "Fields/Fieldmap.hh"
 #include "Structure/LossDataSink.h"
-#include "Solvers/SurfacePhysicsHandler.hh"  
+#include "Solvers/SurfacePhysicsHandler.hh"
 #include <memory>
 
 extern Inform *gmsg;
@@ -168,10 +168,10 @@ inline bool Collimator::isInColl(Vector_t R, Vector_t P, double recpgamma) {
      range of the collimator
   */
   const double z = R(2) + P(2) * recpgamma;
-  
+
   if((z > position_m) && (z <= position_m + getElementLength())) {
     if(isAPepperPot_m) {
-      
+
     /**
        ------------
        |(0)|  |(0)|
@@ -187,13 +187,13 @@ inline bool Collimator::isInColl(Vector_t R, Vector_t P, double recpgamma) {
        Observation: the area in a) is much larger than the
        area(s) (0). In a) particles are lost in (0)
        particles they are not lost.
-       
+
     */
       const double h  =   pitch_m;
       const double xL = - 0.5 * h * (nHolesX_m - 1);
       const double yL = - 0.5 * h * (nHolesY_m - 1);
       bool alive = false;
-    
+
       for(unsigned int m = 0; (m < nHolesX_m && (!alive)); m++) {
 	for(unsigned int n = 0; (n < nHolesY_m && (!alive)); n++) {
 	  double x_m = xL  + (m * h);
@@ -210,10 +210,10 @@ inline bool Collimator::isInColl(Vector_t R, Vector_t P, double recpgamma) {
         return (R(0) <= -getXsize() || R(1) <= -getYsize() || R(0) >= getXsize() || R(1) >= getYsize());
     } else if(isAWire_m) {
         ERRORMSG("Not yet implemented");
-    } else {            
+    } else {
         // case of an elliptic collimator
         const double trm1 = ((R(0)*R(0))/(getXsize()*getXsize()));
-        const double trm2 = ((R(1)*R(1))/(getYsize()*getYsize()));                                 
+        const double trm2 = ((R(1)*R(1))/(getYsize()*getYsize()));
         return (trm1 + trm2) > 1.0;
     }
   }
@@ -235,7 +235,7 @@ bool Collimator::apply(const size_t &i, const double &t, Vector_t &E, Vector_t &
     if(pdead) {
       double frac = (R(2) - position_m) / P(2) * recpgamma;
       lossDs_m->addParticle(R,P, RefPartBunch_m->ID[i], t + frac * RefPartBunch_m->getdT(), 0);
-    }    
+    }
     return pdead;
 }
 
@@ -302,15 +302,15 @@ void Collimator::initialise(PartBunch *bunch, double &startField, double &endFie
     position_m = startField;
     endField = position_m + getElementLength();
 
-    sphys_m = getSurfacePhysics();     
-    
+    sphys_m = getSurfacePhysics();
+
     if (!sphys_m) {
       if (filename_m == std::string(""))
         lossDs_m = std::unique_ptr<LossDataSink>(new LossDataSink(getName(), !Options::asciidump));
       else
         lossDs_m = std::unique_ptr<LossDataSink>(new LossDataSink(filename_m.substr(0, filename_m.rfind(".")), !Options::asciidump));
     }
-    
+
     goOnline();
 }
 
@@ -325,7 +325,7 @@ void Collimator::initialise(PartBunch *bunch, const double &scaleFactor) {
       else
         lossDs_m = std::unique_ptr<LossDataSink>(new LossDataSink(filename_m.substr(0, filename_m.rfind(".")), !Options::asciidump));
     }
-    
+
     goOnline();
 }
 
@@ -423,7 +423,7 @@ void Collimator::setOutputFN(std::string fn) {
 string Collimator::getOutputFN() {
     if (filename_m == std::string(""))
         return getName();
-    else 
+    else
         return filename_m.substr(0, filename_m.rfind("."));
 }
 
diff --git a/classic/5.0/src/AbsBeamline/Degrader.cpp b/classic/5.0/src/AbsBeamline/Degrader.cpp
index 509945b8a05171ae5c14721e1e7cfe710f6b48bb..b29845d15c3fed7e8ae022181238970d6e71041b 100644
--- a/classic/5.0/src/AbsBeamline/Degrader.cpp
+++ b/classic/5.0/src/AbsBeamline/Degrader.cpp
@@ -18,12 +18,12 @@
 //
 // ------------------------------------------------------------------------
 
-#include "Physics/Physics.h"
 #include "AbsBeamline/Degrader.h"
 #include "Algorithms/PartBunch.h"
 #include "AbsBeamline/BeamlineVisitor.h"
 #include "Fields/Fieldmap.hh"
 #include "Structure/LossDataSink.h"
+#include "Physics/Physics.h"
 #include <memory>
 
 extern Inform *gmsg;
diff --git a/classic/5.0/src/AbsBeamline/Monitor.cpp b/classic/5.0/src/AbsBeamline/Monitor.cpp
index 1402f4a6b39a2dbe9a74c2698a5e8edebadaaf65..d51336ed7a61e1b1c59d30fb3f3d2f4322f9e9b6 100644
--- a/classic/5.0/src/AbsBeamline/Monitor.cpp
+++ b/classic/5.0/src/AbsBeamline/Monitor.cpp
@@ -17,13 +17,13 @@
 // $Author: fci $
 //
 // ------------------------------------------------------------------------
+#include "AbsBeamline/Monitor.h"
 #include "Physics/Physics.h"
 #include "Algorithms/PartBunch.h"
 #include "AbsBeamline/BeamlineVisitor.h"
 #include "Fields/Fieldmap.hh"
 #include "Structure/LossDataSink.h"
 #include "Utilities/Options.h"
-#include "AbsBeamline/Monitor.h"
 
 #include <memory>
 
@@ -85,7 +85,7 @@ bool Monitor::apply(const size_t &i, const double &t, Vector_t &E, Vector_t &B)
         double frac = (position_m - R(2)) / (P(2) * recpgamma);
 
         lossDs_m->addParticle(Vector_t(R(0) + frac * P(0) * recpgamma, R(1) + frac * P(1) * recpgamma, position_m),
-                                   P, RefPartBunch_m->ID[i], t + frac * RefPartBunch_m->getdT(), 0);        
+                                   P, RefPartBunch_m->ID[i], t + frac * RefPartBunch_m->getdT(), 0);
     }
 
     return false;
@@ -172,7 +172,7 @@ map<string, unsigned int> Monitor::h5pfiles_s = map<string, unsigned int>();
 
     /*
     if (!Options::enableHDF5) return;
-	
+
 	reduce(online_m, online_m, OpOr());
 
     if(online_m) {
@@ -231,8 +231,8 @@ map<string, unsigned int> Monitor::h5pfiles_s = map<string, unsigned int>();
         std::unique_ptr<char> varray(new char[nLoc * sizeof(double)]);
         double *fvalues = reinterpret_cast<double*>(varray.get());
         h5_int64_t *ids = reinterpret_cast<h5_int64_t*>(varray.get());
-	
-	  FixMe: if I write with nLoc==0 -> rc == -2	  
+
+	  FixMe: if I write with nLoc==0 -> rc == -2
 
 
 
diff --git a/classic/5.0/src/AbsBeamline/Offset.cpp b/classic/5.0/src/AbsBeamline/Offset.cpp
index 7231458949f572dd5cef9d06dcfc8c1326b084ce..bcb115a1537dcb4892f88fddb2fe1d23992a7535 100644
--- a/classic/5.0/src/AbsBeamline/Offset.cpp
+++ b/classic/5.0/src/AbsBeamline/Offset.cpp
@@ -25,6 +25,8 @@
  *  POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "AbsBeamline/Offset.h"
+
 #include "math.h"
 
 #include "Utilities/OpalException.h"
@@ -32,7 +34,6 @@
 #include "AbsBeamline/BeamlineVisitor.h"
 #include "Elements/OpalRing.h"
 
-#include "AbsBeamline/Offset.h"
 
 double Offset::float_tolerance = 1e-12;
 
diff --git a/classic/5.0/src/AbsBeamline/SBend.cpp b/classic/5.0/src/AbsBeamline/SBend.cpp
index 2bfea3734cd9977f0d40632cafa26931be4547a7..dd0eebeab4d2660e4f50528c666973ac70e51b64 100644
--- a/classic/5.0/src/AbsBeamline/SBend.cpp
+++ b/classic/5.0/src/AbsBeamline/SBend.cpp
@@ -18,8 +18,8 @@
 //
 // ------------------------------------------------------------------------
 
-#include "Algorithms/PartPusher.h"
 #include "AbsBeamline/SBend.h"
+#include "Algorithms/PartPusher.h"
 #include "Algorithms/PartBunch.h"
 #include "AbsBeamline/BeamlineVisitor.h"
 #include "Fields/Fieldmap.hh"
@@ -1623,4 +1623,3 @@ bool SBend::TreatAsDrift(Inform &msg, double chordLength) {
     } else
         return false;
 }
-
diff --git a/classic/5.0/src/AbsBeamline/VariableRFCavity.cpp b/classic/5.0/src/AbsBeamline/VariableRFCavity.cpp
index f69e0185fb27db5fb5a1bd19655104d0b0dbceec..86cf4905c8e901243ad6286f3a57c1576bc7c271 100644
--- a/classic/5.0/src/AbsBeamline/VariableRFCavity.cpp
+++ b/classic/5.0/src/AbsBeamline/VariableRFCavity.cpp
@@ -1,34 +1,35 @@
-/* 
+/*
  *  Copyright (c) 2014, Chris Rogers
  *  All rights reserved.
- *  Redistribution and use in source and binary forms, with or without 
- *  modification, are permitted provided that the following conditions are met: 
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
  *  1. Redistributions of source code must retain the above copyright notice,
- *     this list of conditions and the following disclaimer. 
- *  2. Redistributions in binary form must reproduce the above copyright notice, 
- *     this list of conditions and the following disclaimer in the documentation 
+ *     this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright notice,
+ *     this list of conditions and the following disclaimer in the documentation
  *     and/or other materials provided with the distribution.
- *  3. Neither the name of STFC nor the names of its contributors may be used to 
- *     endorse or promote products derived from this software without specific 
+ *  3. Neither the name of STFC nor the names of its contributors may be used to
+ *     endorse or promote products derived from this software without specific
  *     prior written permission.
  *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  *  POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "AbsBeamline/VariableRFCavity.h"
+
 #include "Physics/Physics.h"
 #include "Algorithms/PartBunch.h"
 #include "AbsBeamline/BeamlineVisitor.h"
-#include "AbsBeamline/VariableRFCavity.h"
 
 VariableRFCavity::VariableRFCavity(const std::string &name) : Component(name) {
     initNull();  // initialise everything to NULL
@@ -216,6 +217,3 @@ void VariableRFCavity::setLength(double length) {
     _length = length;
     geometry.setElementLength(length);
 }
-
-
-
diff --git a/classic/5.0/src/Algorithms/AbstractTimeDependence.cpp b/classic/5.0/src/Algorithms/AbstractTimeDependence.cpp
index 5ee7598f7812ce7ee1c44e34cc434ce0854bd93b..3bee811c2fdab40e1851a4268dad4f47ab8561b9 100644
--- a/classic/5.0/src/Algorithms/AbstractTimeDependence.cpp
+++ b/classic/5.0/src/Algorithms/AbstractTimeDependence.cpp
@@ -1,5 +1,5 @@
+#include "Algorithms/AbstractTimeDependence.h"
 #include <sstream>
-#include "AbstractTimeDependence.h"
 
 std::map<std::string, AbstractTimeDependence*> AbstractTimeDependence::td_map =
                               std::map<std::string, AbstractTimeDependence*>();
@@ -32,4 +32,3 @@ std::string AbstractTimeDependence::getName(AbstractTimeDependence* time_dep) {
     throw OpalException("AbstractTimeDependence::getTimeDependence",
                         "Could not find TimeDependence with address "+ss.str());
 }
-
diff --git a/classic/5.0/src/Algorithms/PartBins.cpp b/classic/5.0/src/Algorithms/PartBins.cpp
index 092f8567956966c886fb0e4cadca0c4c34ba731c..93c7f82e456fa3462e72fe56d41e45cd4b1bdee1 100644
--- a/classic/5.0/src/Algorithms/PartBins.cpp
+++ b/classic/5.0/src/Algorithms/PartBins.cpp
@@ -1,8 +1,9 @@
-#include <cfloat>
-#include <vector>
 #include "Algorithms/PartBins.h"
 #include "Algorithms/PBunchDefs.h"
 #include "Physics/Physics.h"
+#include <cfloat>
+#include <vector>
+
 extern Inform *gmsg;
 
 PartBins::PartBins(int bins, int sbins) :
diff --git a/classic/5.0/src/Algorithms/PartBinsCyc.cpp b/classic/5.0/src/Algorithms/PartBinsCyc.cpp
index f42cee758e97dee1ba1a1ca6c6d585d4947674d5..e4e342f6e582a529dd2ed017b3fe44228fa2e851 100644
--- a/classic/5.0/src/Algorithms/PartBinsCyc.cpp
+++ b/classic/5.0/src/Algorithms/PartBinsCyc.cpp
@@ -1,15 +1,15 @@
-#include <cfloat>
-#include <vector>
 #include "Algorithms/PartBinsCyc.h"
 #include "Physics/Physics.h"
+#include <cfloat>
+#include <vector>
 extern Inform *gmsg;
 
-// constructer function for cyclotron 
+// constructer function for cyclotron
 PartBinsCyc::PartBinsCyc(int specifiedNumBins, int bins, size_t  partInBin[])
     : PartBins::PartBins(specifiedNumBins, 0) {
 
     bins_m = specifiedNumBins;        // max bin number
-    nemittedBins_m = bins;            // the bin number with particles 
+    nemittedBins_m = bins;            // the bin number with particles
     binsEmitted_m = new bool[bins_m]; // flag whether the bin contain particles or not
     nBin_m = new size_t[bins_m];      // number of particles in the bins on the local node
 
@@ -17,11 +17,11 @@ PartBinsCyc::PartBinsCyc(int specifiedNumBins, int bins, size_t  partInBin[])
         nBin_m[i] = 0;
         binsEmitted_m[i] = false;
     }
-     
+
 
     for(int i = 0; i < nemittedBins_m; i++) {
         nBin_m[i] = partInBin[i];
-	
+
         *gmsg << "Read in: Bin=" << i << " Particles Num=" << getTotalNumPerBin(i) << endl;
         binsEmitted_m[i] = true;
     }
@@ -33,7 +33,7 @@ PartBinsCyc::PartBinsCyc(int specifiedNumBins, int bins)
     : PartBins::PartBins(specifiedNumBins, 0) {
 
     bins_m = specifiedNumBins;        // max bin number
-    nemittedBins_m = bins;            // the bin number with particles 
+    nemittedBins_m = bins;            // the bin number with particles
     binsEmitted_m = new bool[bins_m]; // flag whether the bin contain particles or not
     nBin_m = new size_t[bins_m];      // number of particles in the bins on the local node
 
@@ -59,4 +59,3 @@ PartBinsCyc::~PartBinsCyc() {
     if(h_m)
         delete h_m;
 }
-
diff --git a/classic/5.0/src/Algorithms/PartBunch.cpp b/classic/5.0/src/Algorithms/PartBunch.cpp
index 4cbcaabb8c6a3a5b48635a03a60809571be6089b..07fa94dd6a305322253041adfd38ac68565fee90 100644
--- a/classic/5.0/src/Algorithms/PartBunch.cpp
+++ b/classic/5.0/src/Algorithms/PartBunch.cpp
@@ -33,7 +33,7 @@
 #include "Structure/FieldSolver.h"      // OPAL file
 #include "Utilities/Options.h"          // OPAL file
 
-#include "ListElem.h"
+#include "Algorithms/ListElem.h"
 #include "BasicActions/Option.h"
 
 #include <gsl/gsl_rng.h>
diff --git a/classic/5.0/src/Algorithms/PartBunch.h b/classic/5.0/src/Algorithms/PartBunch.h
index fef199dc16498ebc095d431e7025903bb67e4d7c..0b376df6ac87c723b1551b07919773c5a2565eb3 100644
--- a/classic/5.0/src/Algorithms/PartBunch.h
+++ b/classic/5.0/src/Algorithms/PartBunch.h
@@ -21,7 +21,7 @@
 // ------------------------------------------------------------------------
 
 #include "Ippl.h"
-#include "PBunchDefs.h"
+#include "Algorithms/PBunchDefs.h"
 #include "Algorithms/Particle.h"
 #include "FixedAlgebra/FMatrix.h"
 #include "FixedAlgebra/FVector.h"
@@ -104,7 +104,7 @@ public:
 
     void do_binaryRepart();
 
-    
+
 
     /// per default the MT value of the field solver is used
     void set_nBinsLineDensity(int n);
@@ -280,13 +280,13 @@ public:
     //void computeSelfFields_cycl(double gamma);
     //void computeSelfFields_cycl(int b);
 
-    // Replaced computeSelfFields_cycl() with versions that have meanR and the quaternion of the 
+    // Replaced computeSelfFields_cycl() with versions that have meanR and the quaternion of the
     // rotation of the particle bunch in order to take into account the rotation
     // when finding the boundary conditions for the fieldsolver. -DW
-    void computeSelfFields_cycl(double gamma, Vector_t const meanR=Vector_t(0.0, 0.0, 0.0), 
+    void computeSelfFields_cycl(double gamma, Vector_t const meanR=Vector_t(0.0, 0.0, 0.0),
 				              Quaternion_t const quaternion=Quaternion_t(1.0, 0.0, 0.0, 0.0));
 
-    void computeSelfFields_cycl(int b,        Vector_t const meanR=Vector_t(0.0, 0.0, 0.0), 
+    void computeSelfFields_cycl(int b,        Vector_t const meanR=Vector_t(0.0, 0.0, 0.0),
                                               Quaternion_t const quaternion=Quaternion_t(1.0, 0.0, 0.0, 0.0));
 
     void resetInterpolationCache(bool clearCache = false);
@@ -560,7 +560,7 @@ private:
 
     /// Initialize the translation vector and rotation quaternion
     /// here. Cyclotron tracker will reset these values each timestep
-    /// TTracker can just use 0 translation and 0 rotation (quat[1 0 0 0]). 
+    /// TTracker can just use 0 translation and 0 rotation (quat[1 0 0 0]).
     Vector_t globalMeanR_m = Vector_t(0.0, 0.0, 0.0);
     Quaternion_t globalToLocalQuaternion_m = Quaternion_t(1.0, 0.0, 0.0, 0.0);
 
@@ -688,7 +688,7 @@ private:
 
 };
 
-inline 
+inline
 bool PartBunch::isDcBeam() { return dcBeam_m;}
 
 inline
diff --git a/classic/5.0/src/Algorithms/Tracker.cpp b/classic/5.0/src/Algorithms/Tracker.cpp
index 191dc35804594f48cbd621a4972c906b31c74f93..14b618d83e3e3c8ed0a8339312cef4cd21f65133 100644
--- a/classic/5.0/src/Algorithms/Tracker.cpp
+++ b/classic/5.0/src/Algorithms/Tracker.cpp
@@ -19,15 +19,15 @@
 //
 // ------------------------------------------------------------------------
 
-#include <cfloat>
-#include <cmath>
-
 #include "Algorithms/Tracker.h"
 #include "AbsBeamline/AlignWrapper.h"
 #include "AbsBeamline/Patch.h"
 #include "Algorithms/MapIntegrator.h"
 #include "Fields/BMultipoleField.h"
 
+#include <cfloat>
+#include <cmath>
+
 typedef FTps<double, 2> Series2;
 typedef FTps<double, 6> Series;
 
diff --git a/classic/5.0/src/BeamlineGeometry/Euclid3DGeometry.cpp b/classic/5.0/src/BeamlineGeometry/Euclid3DGeometry.cpp
index cc7a9137999ad129cc82f8e084c338883f27818e..d27edba837bdacc4f18dd3743ab605de37e833ec 100644
--- a/classic/5.0/src/BeamlineGeometry/Euclid3DGeometry.cpp
+++ b/classic/5.0/src/BeamlineGeometry/Euclid3DGeometry.cpp
@@ -1,33 +1,34 @@
-/* 
+/*
  *  Copyright (c) 2014, Chris Rogers
  *  All rights reserved.
- *  Redistribution and use in source and binary forms, with or without 
- *  modification, are permitted provided that the following conditions are met: 
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
  *  1. Redistributions of source code must retain the above copyright notice,
- *     this list of conditions and the following disclaimer. 
- *  2. Redistributions in binary form must reproduce the above copyright notice, 
- *     this list of conditions and the following disclaimer in the documentation 
+ *     this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright notice,
+ *     this list of conditions and the following disclaimer in the documentation
  *     and/or other materials provided with the distribution.
- *  3. Neither the name of STFC nor the names of its contributors may be used to 
- *     endorse or promote products derived from this software without specific 
+ *  3. Neither the name of STFC nor the names of its contributors may be used to
+ *     endorse or promote products derived from this software without specific
  *     prior written permission.
  *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  *  POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "BeamlineGeometry/Euclid3DGeometry.h"
+
 #include "Utilities/OpalException.h"
 #include "math.h"
-#include "BeamlineGeometry/Euclid3DGeometry.h"
 
 Euclid3DGeometry::Euclid3DGeometry(Euclid3D transformation)
     : BGeometryBase(), transformation_m(transformation) {
@@ -67,4 +68,3 @@ Euclid3D Euclid3DGeometry::getTransform(double fromS, double toS) const {
 Euclid3D Euclid3DGeometry::getTotalTransform() const {
     return transformation_m;
 }
-
diff --git a/classic/5.0/src/Fields/Astra1DDynamic.cpp b/classic/5.0/src/Fields/Astra1DDynamic.cpp
index 0758b969a30d783791540ef5b73f8ceb870c6748..1e12fbe59f9f6ee0727b90fdc583057a7f4984bb 100644
--- a/classic/5.0/src/Fields/Astra1DDynamic.cpp
+++ b/classic/5.0/src/Fields/Astra1DDynamic.cpp
@@ -1,6 +1,3 @@
-#include <fstream>
-#include <ios>
-
 #include "Fields/Astra1DDynamic.hh"
 #include "Fields/Fieldmap.icc"
 #include "Physics/Physics.h"
@@ -8,6 +5,9 @@
 #include "gsl/gsl_spline.h"
 #include "gsl/gsl_fft_real.h"
 
+#include <fstream>
+#include <ios>
+
 using namespace std;
 using Physics::mu_0;
 using Physics::c;
diff --git a/classic/5.0/src/Fields/Astra1DDynamic_fast.cpp b/classic/5.0/src/Fields/Astra1DDynamic_fast.cpp
index 4fdf305c819615db4710f58c8592c0377ad4a568..ef691131267cba35f7405c4f108645bdef82bba4 100644
--- a/classic/5.0/src/Fields/Astra1DDynamic_fast.cpp
+++ b/classic/5.0/src/Fields/Astra1DDynamic_fast.cpp
@@ -1,11 +1,11 @@
-#include <fstream>
-#include <ios>
-
 #include "Fields/Astra1DDynamic_fast.hh"
 #include "Fields/Fieldmap.icc"
 #include "Physics/Physics.h"
 #include "gsl/gsl_fft_real.h"
 
+#include <fstream>
+#include <ios>
+
 using namespace std;
 using Physics::mu_0;
 using Physics::c;
diff --git a/classic/5.0/src/Fields/Astra1DElectroStatic.cpp b/classic/5.0/src/Fields/Astra1DElectroStatic.cpp
index 4ee77a898c680837b1d5a5c2eeabfa8c67f6a9d0..43f6d07fbfc201b40c47a5392d29e2d98018a1c0 100644
--- a/classic/5.0/src/Fields/Astra1DElectroStatic.cpp
+++ b/classic/5.0/src/Fields/Astra1DElectroStatic.cpp
@@ -1,6 +1,3 @@
-#include <fstream>
-#include <ios>
-
 #include "Fields/Astra1DElectroStatic.hh"
 #include "Fields/Fieldmap.icc"
 #include "Physics/Physics.h"
@@ -8,6 +5,9 @@
 #include "gsl/gsl_spline.h"
 #include "gsl/gsl_fft_real.h"
 
+#include <fstream>
+#include <ios>
+
 using namespace std;
 using Physics::mu_0;
 using Physics::c;
diff --git a/classic/5.0/src/Fields/Astra1DElectroStatic_fast.cpp b/classic/5.0/src/Fields/Astra1DElectroStatic_fast.cpp
index f5efae80d5cb7f3d17ab9e836f8db81c1e0f9594..c1e35ef36e5183efec813c3f85f62b940497a92d 100644
--- a/classic/5.0/src/Fields/Astra1DElectroStatic_fast.cpp
+++ b/classic/5.0/src/Fields/Astra1DElectroStatic_fast.cpp
@@ -1,11 +1,11 @@
-#include <fstream>
-#include <ios>
-
 #include "Fields/Astra1DElectroStatic_fast.hh"
 #include "Fields/Fieldmap.icc"
 #include "Physics/Physics.h"
 #include "gsl/gsl_fft_real.h"
 
+#include <fstream>
+#include <ios>
+
 using namespace std;
 using Physics::mu_0;
 using Physics::c;
diff --git a/classic/5.0/src/Fields/Astra1DMagnetoStatic.cpp b/classic/5.0/src/Fields/Astra1DMagnetoStatic.cpp
index 743ee8149004258b9a5f26922a1ee21ac81426f0..7b6ef4b6ea2806474cf0f7e02c9f5e8ba2b24646 100644
--- a/classic/5.0/src/Fields/Astra1DMagnetoStatic.cpp
+++ b/classic/5.0/src/Fields/Astra1DMagnetoStatic.cpp
@@ -1,7 +1,3 @@
-#include <fstream>
-#include <ios>
-
-
 #include "Fields/Astra1DMagnetoStatic.hh"
 #include "Fields/Fieldmap.icc"
 #include "Physics/Physics.h"
@@ -9,6 +5,9 @@
 #include "gsl/gsl_spline.h"
 #include "gsl/gsl_fft_real.h"
 
+#include <fstream>
+#include <ios>
+
 using namespace std;
 using Physics::mu_0;
 using Physics::c;
diff --git a/classic/5.0/src/Fields/Astra1DMagnetoStatic_fast.cpp b/classic/5.0/src/Fields/Astra1DMagnetoStatic_fast.cpp
index 7aab3b971ed44d0a40c1e17801f8e7f93bb7cc08..b215c144ea0623b277c4cc6f397eadec704fb76e 100644
--- a/classic/5.0/src/Fields/Astra1DMagnetoStatic_fast.cpp
+++ b/classic/5.0/src/Fields/Astra1DMagnetoStatic_fast.cpp
@@ -1,12 +1,11 @@
-#include <fstream>
-#include <ios>
-
-
 #include "Fields/Astra1DMagnetoStatic_fast.hh"
 #include "Fields/Fieldmap.icc"
 #include "Physics/Physics.h"
 #include "gsl/gsl_fft_real.h"
 
+#include <fstream>
+#include <ios>
+
 using namespace std;
 using Physics::mu_0;
 using Physics::c;
diff --git a/classic/5.0/src/Fields/FM1DDynamic.cpp b/classic/5.0/src/Fields/FM1DDynamic.cpp
index 52b21dd811345dceb2d3f4973e4504d17efd555a..a770eec08030ed3d7f35aef87461937bc8e94df8 100644
--- a/classic/5.0/src/Fields/FM1DDynamic.cpp
+++ b/classic/5.0/src/Fields/FM1DDynamic.cpp
@@ -1,12 +1,12 @@
-#include <fstream>
-#include <iostream>
-
 #include "Fields/FM1DDynamic.hh"
 #include "Fields/Fieldmap.icc"
 #include "Physics/Physics.h"
 
 #include "gsl/gsl_fft_real.h"
 
+#include <fstream>
+#include <iostream>
+
 FM1DDynamic::FM1DDynamic(std::string aFilename):
     Fieldmap(aFilename) {
 
diff --git a/classic/5.0/src/Fields/FM1DDynamic_fast.cpp b/classic/5.0/src/Fields/FM1DDynamic_fast.cpp
index d4c276e9736c0e70ef4b297dcdf0d6c002d40fb5..8a494d2b42622d0c697ab8df1edcdfc2d16a2a93 100644
--- a/classic/5.0/src/Fields/FM1DDynamic_fast.cpp
+++ b/classic/5.0/src/Fields/FM1DDynamic_fast.cpp
@@ -1,12 +1,12 @@
-#include <fstream>
-#include <ios>
-
 #include "Fields/FM1DDynamic_fast.hh"
 #include "Fields/Fieldmap.icc"
 #include "Physics/Physics.h"
 
 #include "gsl/gsl_fft_real.h"
 
+#include <fstream>
+#include <ios>
+
 FM1DDynamic_fast::FM1DDynamic_fast(std::string aFilename):
     Fieldmap(aFilename) {
 
diff --git a/classic/5.0/src/Fields/FM1DElectroStatic.cpp b/classic/5.0/src/Fields/FM1DElectroStatic.cpp
index 59038ed5ef5cbf13410bc0c14db459ecf908dc5a..2e3411bdfe4b092075724298f108b7e86c6617e5 100644
--- a/classic/5.0/src/Fields/FM1DElectroStatic.cpp
+++ b/classic/5.0/src/Fields/FM1DElectroStatic.cpp
@@ -1,12 +1,12 @@
-#include <fstream>
-#include <ios>
-
 #include "Fields/FM1DElectroStatic.hh"
 #include "Fields/Fieldmap.icc"
 #include "Physics/Physics.h"
 
 #include "gsl/gsl_fft_real.h"
 
+#include <fstream>
+#include <ios>
+
 FM1DElectroStatic::FM1DElectroStatic(std::string aFilename):
     Fieldmap(aFilename) {
 
diff --git a/classic/5.0/src/Fields/FM1DElectroStatic_fast.cpp b/classic/5.0/src/Fields/FM1DElectroStatic_fast.cpp
index 37fb69d2f772aea753ada9e8f0a89eac026b1061..18bf8b21a21c2565ef54486110853cdd360bda2e 100644
--- a/classic/5.0/src/Fields/FM1DElectroStatic_fast.cpp
+++ b/classic/5.0/src/Fields/FM1DElectroStatic_fast.cpp
@@ -1,12 +1,12 @@
-#include <fstream>
-#include <ios>
-
 #include "Fields/FM1DElectroStatic_fast.hh"
 #include "Fields/Fieldmap.icc"
 #include "Physics/Physics.h"
 
 #include "gsl/gsl_fft_real.h"
 
+#include <fstream>
+#include <ios>
+
 FM1DElectroStatic_fast::FM1DElectroStatic_fast(std::string aFilename):
     Fieldmap(aFilename) {
 
diff --git a/classic/5.0/src/Fields/FM1DMagnetoStatic.cpp b/classic/5.0/src/Fields/FM1DMagnetoStatic.cpp
index 7aa755d8799ce5e761842d3cf21e475755ceab3a..5badeb2d100068d11b33e39b8841f6864b96715d 100644
--- a/classic/5.0/src/Fields/FM1DMagnetoStatic.cpp
+++ b/classic/5.0/src/Fields/FM1DMagnetoStatic.cpp
@@ -1,11 +1,11 @@
-#include <fstream>
-#include <ios>
-
 #include "Fields/FM1DMagnetoStatic.hh"
 #include "Fields/Fieldmap.icc"
 #include "Physics/Physics.h"
 #include "gsl/gsl_fft_real.h"
 
+#include <fstream>
+#include <ios>
+
 FM1DMagnetoStatic::FM1DMagnetoStatic(std::string aFilename)
     : Fieldmap(aFilename) {
 
diff --git a/classic/5.0/src/Fields/FM1DMagnetoStatic_fast.cpp b/classic/5.0/src/Fields/FM1DMagnetoStatic_fast.cpp
index 24204c3737eec194cec5a2ac82faee69cbeacf8c..b9a8e7b7b8e97bb5b768c13d6bcbc720cbda1085 100644
--- a/classic/5.0/src/Fields/FM1DMagnetoStatic_fast.cpp
+++ b/classic/5.0/src/Fields/FM1DMagnetoStatic_fast.cpp
@@ -1,12 +1,12 @@
-#include <fstream>
-#include <ios>
-
 #include "Fields/FM1DMagnetoStatic_fast.hh"
 #include "Fields/Fieldmap.icc"
 #include "Physics/Physics.h"
 
 #include "gsl/gsl_fft_real.h"
 
+#include <fstream>
+#include <ios>
+
 FM1DMagnetoStatic_fast::FM1DMagnetoStatic_fast(std::string aFilename):
     Fieldmap(aFilename) {
 
diff --git a/classic/5.0/src/Fields/FM1DProfile1.cpp b/classic/5.0/src/Fields/FM1DProfile1.cpp
index 20c3b6b5b1f10b537aa9fa992df1eea79be87647..60c73f5d5715a803d65fa09c427938b757172709 100644
--- a/classic/5.0/src/Fields/FM1DProfile1.cpp
+++ b/classic/5.0/src/Fields/FM1DProfile1.cpp
@@ -1,10 +1,10 @@
-#include <fstream>
-#include <ios>
-
 #include "Fields/FM1DProfile1.hh"
 #include "Fields/Fieldmap.icc"
 #include "Physics/Physics.h"
 
+#include <fstream>
+#include <ios>
+
 FM1DProfile1::FM1DProfile1(std::string aFilename):
     Fieldmap(aFilename),
     entranceParameter1_m(0.0),
diff --git a/classic/5.0/src/Fields/FM1DProfile2.cpp b/classic/5.0/src/Fields/FM1DProfile2.cpp
index 8d9eed1a161092059381fb665b2c6083b8f694c0..6338cdf5c6a95696b8d6500a4028e4b954ca172b 100644
--- a/classic/5.0/src/Fields/FM1DProfile2.cpp
+++ b/classic/5.0/src/Fields/FM1DProfile2.cpp
@@ -1,10 +1,10 @@
-#include <fstream>
-#include <ios>
-
 #include "Fields/FM1DProfile2.hh"
 #include "Fields/Fieldmap.icc"
 #include "Physics/Physics.h"
 
+#include <fstream>
+#include <ios>
+
 using namespace std;
 using Physics::mu_0;
 using Physics::c;
diff --git a/classic/5.0/src/Fields/FM2DDynamic.cpp b/classic/5.0/src/Fields/FM2DDynamic.cpp
index 9812fbb7ee8144b3cacf546839f7a8e5ef7939f8..f3e660571194b50ac24446db9667f7f11f43080d 100644
--- a/classic/5.0/src/Fields/FM2DDynamic.cpp
+++ b/classic/5.0/src/Fields/FM2DDynamic.cpp
@@ -1,10 +1,10 @@
-#include <fstream>
-#include <ios>
-
 #include "Fields/FM2DDynamic.hh"
 #include "Fields/Fieldmap.icc"
 #include "Physics/Physics.h"
 
+#include <fstream>
+#include <ios>
+
 using namespace std;
 using Physics::mu_0;
 
diff --git a/classic/5.0/src/Fields/FM2DDynamic_cspline.cpp b/classic/5.0/src/Fields/FM2DDynamic_cspline.cpp
index b4ea249fa91daae7cce22ebb9ddc9c2543127d41..088ce68ad9c19f2fd62a6f05f538a1c7ae597f3a 100644
--- a/classic/5.0/src/Fields/FM2DDynamic_cspline.cpp
+++ b/classic/5.0/src/Fields/FM2DDynamic_cspline.cpp
@@ -1,10 +1,10 @@
-#include <fstream>
-#include <ios>
-
 #include "Fields/FM2DDynamic_cspline.hh"
 #include "Fields/Fieldmap.icc"
 #include "Physics/Physics.h"
 
+#include <fstream>
+#include <ios>
+
 using namespace std;
 using Physics::mu_0;
 
diff --git a/classic/5.0/src/Fields/FM2DElectroStatic.cpp b/classic/5.0/src/Fields/FM2DElectroStatic.cpp
index ade64358110f02ae37189bbcfa0d09bce311fd15..fdd30f3f89214b7b3a251c42c08d64388505d4af 100644
--- a/classic/5.0/src/Fields/FM2DElectroStatic.cpp
+++ b/classic/5.0/src/Fields/FM2DElectroStatic.cpp
@@ -1,9 +1,9 @@
-#include <fstream>
-#include <ios>
-
 #include "Fields/FM2DElectroStatic.hh"
 #include "Fields/Fieldmap.icc"
 
+#include <fstream>
+#include <ios>
+
 using namespace std;
 
 FM2DElectroStatic::FM2DElectroStatic(std::string aFilename)
diff --git a/classic/5.0/src/Fields/FM2DElectroStatic_cspline.cpp b/classic/5.0/src/Fields/FM2DElectroStatic_cspline.cpp
index c17b53b3e4c9683f9956751fedd50c598fa0981f..a0455055c905c3d9be3d3d1fac65740be5540384 100644
--- a/classic/5.0/src/Fields/FM2DElectroStatic_cspline.cpp
+++ b/classic/5.0/src/Fields/FM2DElectroStatic_cspline.cpp
@@ -1,9 +1,9 @@
-#include <fstream>
-#include <ios>
-
 #include "Fields/FM2DElectroStatic_cspline.hh"
 #include "Fields/Fieldmap.icc"
 
+#include <fstream>
+#include <ios>
+
 using namespace std;
 
 FM2DElectroStatic_cspline::FM2DElectroStatic_cspline(std::string aFilename):
diff --git a/classic/5.0/src/Fields/FM2DMagnetoStatic.cpp b/classic/5.0/src/Fields/FM2DMagnetoStatic.cpp
index 24596b2755cf9b7680ba20432289b85ab29cb838..b45efb51302b6cee480019f238e3e9afe021b7b2 100644
--- a/classic/5.0/src/Fields/FM2DMagnetoStatic.cpp
+++ b/classic/5.0/src/Fields/FM2DMagnetoStatic.cpp
@@ -1,9 +1,9 @@
-#include <fstream>
-#include <ios>
-
 #include "Fields/FM2DMagnetoStatic.hh"
 #include "Fields/Fieldmap.icc"
 
+#include <fstream>
+#include <ios>
+
 using namespace std;
 
 FM2DMagnetoStatic::FM2DMagnetoStatic(std::string aFilename):
diff --git a/classic/5.0/src/Fields/FM2DMagnetoStatic_cspline.cpp b/classic/5.0/src/Fields/FM2DMagnetoStatic_cspline.cpp
index 7241732bf59286c1e80db1f760b9e85af819bfa3..c1cb5410d38fba96e40fa6c0206e654c0e47f3bb 100644
--- a/classic/5.0/src/Fields/FM2DMagnetoStatic_cspline.cpp
+++ b/classic/5.0/src/Fields/FM2DMagnetoStatic_cspline.cpp
@@ -1,9 +1,9 @@
-#include <fstream>
-#include <ios>
-
 #include "Fields/FM2DMagnetoStatic_cspline.hh"
 #include "Fields/Fieldmap.icc"
 
+#include <fstream>
+#include <ios>
+
 using namespace std;
 
 FM2DMagnetoStatic_cspline::FM2DMagnetoStatic_cspline(std::string aFilename):
diff --git a/classic/5.0/src/Fields/FM3DDynamic.cpp b/classic/5.0/src/Fields/FM3DDynamic.cpp
index da9ea0abda028c59d02c49446445872f96e923f6..b065c3b9b2cb451679632afafdadc964090db427 100644
--- a/classic/5.0/src/Fields/FM3DDynamic.cpp
+++ b/classic/5.0/src/Fields/FM3DDynamic.cpp
@@ -1,11 +1,11 @@
-#include <fstream>
-#include <ios>
-
 #include "Fields/FM3DDynamic.hh"
 #include "Fields/Fieldmap.icc"
 
 #include "Physics/Physics.h"
 
+#include <fstream>
+#include <ios>
+
 using namespace std;
 using Physics::mu_0;
 
diff --git a/classic/5.0/src/Fields/FM3DH5Block.cpp b/classic/5.0/src/Fields/FM3DH5Block.cpp
index 92406d57cb957cbb22c2807f13c50de3fa2b988b..e04e1d844902435b91ba6dc8b4f6ca5c4e63e501 100644
--- a/classic/5.0/src/Fields/FM3DH5Block.cpp
+++ b/classic/5.0/src/Fields/FM3DH5Block.cpp
@@ -1,11 +1,11 @@
-#include <fstream>
-#include <ios>
-
 #include "Fields/FM3DH5Block.hh"
 #include "Fields/Fieldmap.icc"
 #include "H5hut.h"
 #include "Physics/Physics.h"
 
+#include <fstream>
+#include <ios>
+
 extern Inform *gmsg;
 
 using namespace std;
diff --git a/classic/5.0/src/Fields/FM3DH5Block_nonescale.cpp b/classic/5.0/src/Fields/FM3DH5Block_nonescale.cpp
index 239a513df37608bc8ea0280cd96aca389b1590a4..bac90224bfbcc3d3e08c48cd4347d237ea719b40 100644
--- a/classic/5.0/src/Fields/FM3DH5Block_nonescale.cpp
+++ b/classic/5.0/src/Fields/FM3DH5Block_nonescale.cpp
@@ -1,11 +1,11 @@
-#include <fstream>
-#include <ios>
-
 #include "Fields/FM3DH5Block_nonescale.hh"
 #include "Fields/Fieldmap.icc"
 #include "H5hut.h"
 #include "Physics/Physics.h"
 
+#include <fstream>
+#include <ios>
+
 extern Inform *gmsg;
 
 using namespace std;
diff --git a/classic/5.0/src/Fields/FM3DMagnetoStaticH5Block.cpp b/classic/5.0/src/Fields/FM3DMagnetoStaticH5Block.cpp
index f950b3b1e8ae75d2c80256e57bd5377f731ad04a..2e33efc103a0e1ae796d1a5ba521c668d484492c 100644
--- a/classic/5.0/src/Fields/FM3DMagnetoStaticH5Block.cpp
+++ b/classic/5.0/src/Fields/FM3DMagnetoStaticH5Block.cpp
@@ -1,11 +1,11 @@
-#include <fstream>
-#include <ios>
-
 #include "Fields/FM3DMagnetoStaticH5Block.hh"
 #include "Fields/Fieldmap.icc"
 #include "H5hut.h"
 #include "Physics/Physics.h"
 
+#include <fstream>
+#include <ios>
+
 extern Inform *gmsg;
 
 using namespace std;
diff --git a/classic/5.0/src/Fields/Fieldmap.cpp b/classic/5.0/src/Fields/Fieldmap.cpp
index fdaa82547cfb089e6cec51b3a70a99794bdece17..693c818b7dae993b3a52ba44283f3c1ff9cc6dd7 100644
--- a/classic/5.0/src/Fields/Fieldmap.cpp
+++ b/classic/5.0/src/Fields/Fieldmap.cpp
@@ -1,6 +1,3 @@
-#include <iostream>
-#include <fstream>
-#include <ios>
 #include "Fields/Fieldmap.hh"
 #include "Fields/FM3DDynamic.hh"
 #include "Fields/FM3DH5Block.hh"
@@ -29,6 +26,10 @@
 #include "Fields/FMDummy.hh"
 #include "H5hut.h"
 
+#include <iostream>
+#include <fstream>
+#include <ios>
+
 #define REGISTER_PARSE_TYPE(X) template <> struct Fieldmap::TypeParseTraits<X> \
     { static const char* name; } ; const char* Fieldmap::TypeParseTraits<X>::name = #X
 
diff --git a/classic/5.0/src/Fields/SectorMagneticFieldMap.cpp b/classic/5.0/src/Fields/SectorMagneticFieldMap.cpp
index c612839577dc05010e57abc69dcab1c346e8a382..40fea7f29bd5f6748dc5f54f9b6f670b959c051f 100644
--- a/classic/5.0/src/Fields/SectorMagneticFieldMap.cpp
+++ b/classic/5.0/src/Fields/SectorMagneticFieldMap.cpp
@@ -1,30 +1,37 @@
-/* 
+/*
  *  Copyright (c) 2012, Chris Rogers
  *  All rights reserved.
- *  Redistribution and use in source and binary forms, with or without 
- *  modification, are permitted provided that the following conditions are met: 
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
  *  1. Redistributions of source code must retain the above copyright notice,
- *     this list of conditions and the following disclaimer. 
- *  2. Redistributions in binary form must reproduce the above copyright notice, 
- *     this list of conditions and the following disclaimer in the documentation 
+ *     this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright notice,
+ *     this list of conditions and the following disclaimer in the documentation
  *     and/or other materials provided with the distribution.
- *  3. Neither the name of STFC nor the names of its contributors may be used to 
- *     endorse or promote products derived from this software without specific 
+ *  3. Neither the name of STFC nor the names of its contributors may be used to
+ *     endorse or promote products derived from this software without specific
  *     prior written permission.
  *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  *  POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "Fields/SectorMagneticFieldMap.h"
+#include "Fields/SectorMagneticFieldMap/Mesh.h"
+#include "Fields/SectorMagneticFieldMap/ThreeDGrid.h"
+#include "Fields/SectorMagneticFieldMap/Interpolator3dGridTo3d.h"
+
+#include "Utilities/LogicalError.h"
+
 #include <math.h>
 
 #include <algorithm>
@@ -33,13 +40,6 @@
 #include <fstream>
 #include <string>
 
-#include "Utilities/LogicalError.h"
-
-#include "Fields/SectorMagneticFieldMap/Mesh.h"
-#include "Fields/SectorMagneticFieldMap/ThreeDGrid.h"
-#include "Fields/SectorMagneticFieldMap/Interpolator3dGridTo3d.h"
-#include "Fields/SectorMagneticFieldMap.h"
-
 // allow a fairly generous phi tolerance - we don't care about phi much and
 // calculation can be flaky due to ascii truncation of double and conversions
 // from polar to Cartesian
@@ -251,7 +251,7 @@ const double SectorMagneticFieldMap::IO::floatTolerance_m = 1e-3;
 const int SectorMagneticFieldMap::IO::sortOrder_m[3] = {0, 1, 2};
 
 Interpolator3dGridTo3d* SectorMagneticFieldMap::IO::readMap
-                          (std::string file_name, std::vector<double> units, 
+                          (std::string file_name, std::vector<double> units,
                                         SectorMagneticFieldMap::symmetry sym) {
     try {
         INFOMSG("Opening sector field map " << file_name << endl);
@@ -429,4 +429,3 @@ ThreeDGrid* SectorMagneticFieldMap::IO::generateGrid
 double dot_prod(Vector_t vec_1, Vector_t vec_2) {
     return vec_1[0]*vec_2[0] + vec_1[1]*vec_2[1] + vec_1[2]*vec_2[2];
 }
-
diff --git a/classic/5.0/src/Fields/SectorMagneticFieldMap/Interpolator3dGridTo3d.cpp b/classic/5.0/src/Fields/SectorMagneticFieldMap/Interpolator3dGridTo3d.cpp
index 679a74438552a353c232d564725e17ced851fad3..31a04529982c46baf5dc94a9161f33ae1dbbdc16 100644
--- a/classic/5.0/src/Fields/SectorMagneticFieldMap/Interpolator3dGridTo3d.cpp
+++ b/classic/5.0/src/Fields/SectorMagneticFieldMap/Interpolator3dGridTo3d.cpp
@@ -1,32 +1,32 @@
-/* 
+/*
  *  Copyright (c) 2012, Chris Rogers
  *  All rights reserved.
- *  Redistribution and use in source and binary forms, with or without 
- *  modification, are permitted provided that the following conditions are met: 
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
  *  1. Redistributions of source code must retain the above copyright notice,
- *     this list of conditions and the following disclaimer. 
- *  2. Redistributions in binary form must reproduce the above copyright notice, 
- *     this list of conditions and the following disclaimer in the documentation 
+ *     this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright notice,
+ *     this list of conditions and the following disclaimer in the documentation
  *     and/or other materials provided with the distribution.
- *  3. Neither the name of STFC nor the names of its contributors may be used to 
- *     endorse or promote products derived from this software without specific 
+ *  3. Neither the name of STFC nor the names of its contributors may be used to
+ *     endorse or promote products derived from this software without specific
  *     prior written permission.
  *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  *  POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include "Utilities/LogicalError.h"
 #include "Fields/SectorMagneticFieldMap/Interpolator3dGridTo3d.h"
+#include "Utilities/LogicalError.h"
 
 Interpolator3dGridTo3d::Interpolator3dGridTo3d
                                            (const Interpolator3dGridTo3d& rhs) {
@@ -77,5 +77,3 @@ void Interpolator3dGridTo3d::setAll(ThreeDGrid* grid,
       );
     }
 }
-
-
diff --git a/classic/5.0/src/Fields/SectorMagneticFieldMap/Mesh.cpp b/classic/5.0/src/Fields/SectorMagneticFieldMap/Mesh.cpp
index 2e1a7e91149c8acffb31b40de70e649295f29588..58d72f6aeb59e21fb8cc6e3721d0b0c88047c074 100644
--- a/classic/5.0/src/Fields/SectorMagneticFieldMap/Mesh.cpp
+++ b/classic/5.0/src/Fields/SectorMagneticFieldMap/Mesh.cpp
@@ -1,34 +1,34 @@
-/* 
+/*
  *  Copyright (c) 2012, Chris Rogers
  *  All rights reserved.
- *  Redistribution and use in source and binary forms, with or without 
- *  modification, are permitted provided that the following conditions are met: 
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
  *  1. Redistributions of source code must retain the above copyright notice,
- *     this list of conditions and the following disclaimer. 
- *  2. Redistributions in binary form must reproduce the above copyright notice, 
- *     this list of conditions and the following disclaimer in the documentation 
+ *     this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright notice,
+ *     this list of conditions and the following disclaimer in the documentation
  *     and/or other materials provided with the distribution.
- *  3. Neither the name of STFC nor the names of its contributors may be used to 
- *     endorse or promote products derived from this software without specific 
+ *  3. Neither the name of STFC nor the names of its contributors may be used to
+ *     endorse or promote products derived from this software without specific
  *     prior written permission.
  *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  *  POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include <iomanip>
-
 #include "Fields/SectorMagneticFieldMap/Mesh.h"
 
+#include <iomanip>
+
 std::ostream& operator<<(std::ostream& out, const Mesh::Iterator& it) {
     out << std::setw(5) << it.toInteger() << " ** ";
     for (unsigned int i = 0; i < it.getState().size(); i++)
@@ -39,4 +39,3 @@ std::ostream& operator<<(std::ostream& out, const Mesh::Iterator& it) {
             << it.getPosition()[i] << " ";
     return out;
 }
-
diff --git a/classic/5.0/src/Fields/SectorMagneticFieldMap/SectorField.cpp b/classic/5.0/src/Fields/SectorMagneticFieldMap/SectorField.cpp
index 8d33e463bab477a771a4c68135787b7d99f9a6c5..8f0c20c10594f72b8ca606f281650d9871ce68f9 100644
--- a/classic/5.0/src/Fields/SectorMagneticFieldMap/SectorField.cpp
+++ b/classic/5.0/src/Fields/SectorMagneticFieldMap/SectorField.cpp
@@ -1,30 +1,32 @@
-/* 
+/*
  *  Copyright (c) 2012, Chris Rogers
  *  All rights reserved.
- *  Redistribution and use in source and binary forms, with or without 
- *  modification, are permitted provided that the following conditions are met: 
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
  *  1. Redistributions of source code must retain the above copyright notice,
- *     this list of conditions and the following disclaimer. 
- *  2. Redistributions in binary form must reproduce the above copyright notice, 
- *     this list of conditions and the following disclaimer in the documentation 
+ *     this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright notice,
+ *     this list of conditions and the following disclaimer in the documentation
  *     and/or other materials provided with the distribution.
- *  3. Neither the name of STFC nor the names of its contributors may be used to 
- *     endorse or promote products derived from this software without specific 
+ *  3. Neither the name of STFC nor the names of its contributors may be used to
+ *     endorse or promote products derived from this software without specific
  *     prior written permission.
  *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  *  POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "Fields/SectorMagneticFieldMap/SectorField.h"
+
 #include <math.h>
 
 #include <limits>
@@ -33,8 +35,6 @@
 
 #include "Utilities/LogicalError.h"
 
-#include "Fields/SectorMagneticFieldMap/SectorField.h"
-
 // note I don't use exactly max() as the bounding box because I don't want to
 // accidentally wrap around due to some unforeseen floating point precision
 // issue
@@ -212,5 +212,3 @@ void SectorField::getFieldDimensions(double &xIni, double &xFinal,
     yFinal = bbMax_m[1];
     zFinal = bbMax_m[2];
 }
-
-
diff --git a/classic/5.0/src/Fields/SectorMagneticFieldMap/ThreeDGrid.cpp b/classic/5.0/src/Fields/SectorMagneticFieldMap/ThreeDGrid.cpp
index d867af522014a1a6b244b071980804deeddd1410..0fce740caa55387ad966ff31f967334523aeefcf 100644
--- a/classic/5.0/src/Fields/SectorMagneticFieldMap/ThreeDGrid.cpp
+++ b/classic/5.0/src/Fields/SectorMagneticFieldMap/ThreeDGrid.cpp
@@ -1,32 +1,32 @@
-/* 
+/*
  *  Copyright (c) 2012, Chris Rogers
  *  All rights reserved.
- *  Redistribution and use in source and binary forms, with or without 
- *  modification, are permitted provided that the following conditions are met: 
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
  *  1. Redistributions of source code must retain the above copyright notice,
- *     this list of conditions and the following disclaimer. 
- *  2. Redistributions in binary form must reproduce the above copyright notice, 
- *     this list of conditions and the following disclaimer in the documentation 
+ *     this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright notice,
+ *     this list of conditions and the following disclaimer in the documentation
  *     and/or other materials provided with the distribution.
- *  3. Neither the name of STFC nor the names of its contributors may be used to 
- *     endorse or promote products derived from this software without specific 
+ *  3. Neither the name of STFC nor the names of its contributors may be used to
+ *     endorse or promote products derived from this software without specific
  *     prior written permission.
  *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  *  POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include "Utilities/LogicalError.h"
 #include "Fields/SectorMagneticFieldMap/ThreeDGrid.h"
+#include "Utilities/LogicalError.h"
 
 ThreeDGrid::ThreeDGrid()
     : x_m(2, 0), y_m(2, 0), z_m(2, 0), xSize_m(0), ySize_m(0), zSize_m(0), maps_m(0),
@@ -273,4 +273,3 @@ Mesh::Iterator ThreeDGrid::getNearest(const double* position) const {
         index[2] = zSize_m;
     return Mesh::Iterator(index, this);
 }
-
diff --git a/classic/5.0/src/Solvers/CSRIGFWakeFunction.cpp b/classic/5.0/src/Solvers/CSRIGFWakeFunction.cpp
index 82d64bec329e777f64ea888c43754fc9b2a1515a..5a7cc677ebfe7a6ab54bc779a77db82f496383bc 100644
--- a/classic/5.0/src/Solvers/CSRIGFWakeFunction.cpp
+++ b/classic/5.0/src/Solvers/CSRIGFWakeFunction.cpp
@@ -1,5 +1,3 @@
-#include <iostream>
-#include <fstream>
 #include "Solvers/CSRIGFWakeFunction.hh"
 #include "Algorithms/PartBunch.h"
 #include "Filters/Filter.h"
@@ -8,6 +6,8 @@
 #include "AbsBeamline/SBend.h"
 #include "Utilities/Options.h"
 
+#include <iostream>
+#include <fstream>
 
 CSRIGFWakeFunction::CSRIGFWakeFunction(const std::string &name, ElementBase *element, std::vector<Filter *> filters, const unsigned int &N):
     WakeFunction(name, element),
diff --git a/classic/5.0/src/Solvers/CSRWakeFunction.cpp b/classic/5.0/src/Solvers/CSRWakeFunction.cpp
index 56a0c971d7ea135627db6dfd120283ae0d46fadd..651f5e06c1905c63878687ecc1b142c5d1387bf6 100644
--- a/classic/5.0/src/Solvers/CSRWakeFunction.cpp
+++ b/classic/5.0/src/Solvers/CSRWakeFunction.cpp
@@ -1,5 +1,3 @@
-#include <iostream>
-#include <fstream>
 #include "Solvers/CSRWakeFunction.hh"
 #include "Algorithms/PartBunch.h"
 #include "Filters/Filter.h"
@@ -8,6 +6,8 @@
 #include "AbsBeamline/SBend.h"
 #include "Utilities/Options.h"
 
+#include <iostream>
+#include <fstream>
 // using namespace std;
 
 CSRWakeFunction::CSRWakeFunction(const std::string &name, ElementBase *element, std::vector<Filter *> filters, const unsigned int &N):
diff --git a/classic/5.0/src/Utilities/SwitcherError.cpp b/classic/5.0/src/Utilities/SwitcherError.cpp
index 07f228a3efd78b90e6d3243a2ec411bc83b5bcfd..5abb64c6bab4455a8fe335477f5231042d9910f8 100644
--- a/classic/5.0/src/Utilities/SwitcherError.cpp
+++ b/classic/5.0/src/Utilities/SwitcherError.cpp
@@ -1,4 +1,4 @@
-#include "SwitcherError.h"
+#include "Utilities/SwitcherError.h"
 
 SwitcherError::SwitcherError(const std::string &meth, const std::string &msg):
     ClassicException(meth, msg)
diff --git a/src/AbstractObjects/Attribute.cpp b/src/AbstractObjects/Attribute.cpp
index c9c5396eb7f4015ca73fc8fffedda984811863a5..2b47340c65d423a89118c1ef45e2c93d93f4c53f 100644
--- a/src/AbstractObjects/Attribute.cpp
+++ b/src/AbstractObjects/Attribute.cpp
@@ -16,13 +16,13 @@
 //
 // ------------------------------------------------------------------------
 
-#include <set>
-#include <iostream>
-
 #include "AbstractObjects/Attribute.h"
 #include "AbstractObjects/AttributeBase.h"
 #include "Utilities/Options.h"
 
+#include <set>
+#include <iostream>
+
 extern Inform *gmsg;
 
 
diff --git a/src/AbstractObjects/BeamSequence.cpp b/src/AbstractObjects/BeamSequence.cpp
index 68fe09d56d009d290a014999ed48b3ee52a48be1..21be879a2dfd6984fd01dec2d1f903a85eb1fb0b 100644
--- a/src/AbstractObjects/BeamSequence.cpp
+++ b/src/AbstractObjects/BeamSequence.cpp
@@ -16,7 +16,6 @@
 //
 // ------------------------------------------------------------------------
 
-#include "AbstractObjects/OpalData.h"
 #include "AbstractObjects/BeamSequence.h"
 #include "AbstractObjects/OpalData.h"
 #include "Utilities/OpalException.h"
diff --git a/src/Algorithms/ParallelCyclotronTracker.cpp b/src/Algorithms/ParallelCyclotronTracker.cpp
index 14c45796913faa9ff8a64be58c5859c69d4180ac..d07de01e5a07df4dd63b69b0267fe8d75f0e814d 100644
--- a/src/Algorithms/ParallelCyclotronTracker.cpp
+++ b/src/Algorithms/ParallelCyclotronTracker.cpp
@@ -15,12 +15,14 @@
 // $Author: adelmann, yang, winklehner $
 //
 // ------------------------------------------------------------------------
+
+#include "Algorithms/ParallelCyclotronTracker.h"
+
 #include <cfloat>
 #include <iostream>
 #include <fstream>
 #include <vector>
 #include "AbstractObjects/OpalData.h"
-#include "Algorithms/ParallelCyclotronTracker.h"
 
 #include "AbsBeamline/Collimator.h"
 #include "AbsBeamline/Corrector.h"
diff --git a/src/Algorithms/ParallelSliceTracker.cpp b/src/Algorithms/ParallelSliceTracker.cpp
index ccf7234e9b42856f47bb0c3faa770b81af5c887d..284351f555dd847513ef08d73153902db5228cf0 100644
--- a/src/Algorithms/ParallelSliceTracker.cpp
+++ b/src/Algorithms/ParallelSliceTracker.cpp
@@ -1,11 +1,11 @@
+#include "Algorithms/ParallelSliceTracker.h"
+
 #include <cfloat>
 #include <iostream>
 #include <fstream>
 #include <iomanip>
 
 #include "AbstractObjects/OpalData.h"
-#include "Algorithms/bet/EnvelopeBunch.h"
-#include "Algorithms/ParallelSliceTracker.h"
 #include "Beamlines/Beamline.h"
 #include "Distribution/Distribution.h"
 #include "Lines/Sequence.h"
diff --git a/src/Algorithms/ParallelSliceTracker.h b/src/Algorithms/ParallelSliceTracker.h
index b60b0b1164018891866f5434a13ec3fd342ef35c..e5202bb6ac30643d0733aec0fad0836bcd3a5c3e 100644
--- a/src/Algorithms/ParallelSliceTracker.h
+++ b/src/Algorithms/ParallelSliceTracker.h
@@ -4,7 +4,7 @@
 #include <vector>
 #include <list>
 
-class EnvelopeBunch;
+#include "Algorithms/bet/EnvelopeBunch.h"
 
 #include "Algorithms/Vektor.h"
 #include "Algorithms/Tracker.h"
diff --git a/src/Algorithms/ParallelTTracker.cpp b/src/Algorithms/ParallelTTracker.cpp
index 2176752ef33921cf034c68f6cd9ccc0aa3b1374e..f86f45f986894163a15bc0a9e4cae2a5c59cba1a 100644
--- a/src/Algorithms/ParallelTTracker.cpp
+++ b/src/Algorithms/ParallelTTracker.cpp
@@ -17,6 +17,8 @@
 //
 // ------------------------------------------------------------------------
 
+#include "Algorithms/ParallelTTracker.h"
+
 #include <cfloat>
 #include <iostream>
 #include <fstream>
@@ -26,7 +28,6 @@
 #include <limits>
 #include <cmath>
 
-#include "Algorithms/ParallelTTracker.h"
 #include "Algorithms/PartPusher.h"
 #include "AbsBeamline/AlignWrapper.h"
 #include "AbsBeamline/BeamBeam.h"
diff --git a/src/Algorithms/ThickTracker.cpp b/src/Algorithms/ThickTracker.cpp
index 1bdc2f31352965cb3d3e4c33194ae33036e97c76..e0029d3961bb95f25da9f8d148ed5524a247cc14 100644
--- a/src/Algorithms/ThickTracker.cpp
+++ b/src/Algorithms/ThickTracker.cpp
@@ -18,10 +18,10 @@
 //
 // ------------------------------------------------------------------------
 
-#include <cfloat>
-
 #include "Algorithms/ThickTracker.h"
 
+#include <cfloat>
+
 #include "AbsBeamline/Collimator.h"
 #include "AbsBeamline/Corrector.h"
 #include "AbsBeamline/Diagnostic.h"
diff --git a/src/BasicActions/Dump.cpp b/src/BasicActions/Dump.cpp
index f5f619bdc4c1be8f0d7e9f0af6d3c9bda3afc41d..955ab445716672aa213d75bca389949f0cfcc9b4 100644
--- a/src/BasicActions/Dump.cpp
+++ b/src/BasicActions/Dump.cpp
@@ -16,8 +16,9 @@
 //
 // ------------------------------------------------------------------------
 
-#include "Utility/IpplInfo.h"
 #include "BasicActions/Dump.h"
+
+#include "Utility/IpplInfo.h"
 #include "AbstractObjects/OpalData.h"
 #include "AbstractObjects/ObjectFunction.h"
 #include <iostream>
diff --git a/src/BasicActions/System.cpp b/src/BasicActions/System.cpp
index cfe5fa45af27fb3265783ecf4d96fb24e25f893b..44cf1c0d66e114c892f85f122842515e519ec855 100644
--- a/src/BasicActions/System.cpp
+++ b/src/BasicActions/System.cpp
@@ -15,8 +15,10 @@
 // $Author: jsberg $
 //
 // ------------------------------------------------------------------------
-#include "Ippl.h"
+
 #include "BasicActions/System.h"
+
+#include "Ippl.h"
 #include "Attributes/Attributes.h"
 
 #include <cstdlib>
diff --git a/src/Distribution/Distribution.cpp b/src/Distribution/Distribution.cpp
index a3ecef4314d2458d1882d27089588996a6e99c23..fd4832f7f4687b61b92002cb0f478fee3c593c3f 100644
--- a/src/Distribution/Distribution.cpp
+++ b/src/Distribution/Distribution.cpp
@@ -10,6 +10,9 @@
 //   The class for the OPAL Distribution command.
 //
 // ------------------------------------------------------------------------
+
+#include "Distribution/Distribution.h"
+
 #include <cmath>
 #include <cfloat>
 #include <iomanip>
@@ -18,7 +21,6 @@
 #include <vector>
 #include <numeric>
 
-#include "Distribution/Distribution.h"
 #include "AbstractObjects/Expressions.h"
 #include "Attributes/Attributes.h"
 #include "Utilities/Options.h"
@@ -41,7 +43,7 @@
 
 extern Inform *gmsg;
 
-#define DISTDBG1	
+#define DISTDBG1
 #define noDISTDBG2
 
 //
@@ -703,7 +705,7 @@ void Distribution::DoRestartOpalCycl(PartBunch &beam, size_t Np, int restartStep
         }
     }
 
-    *gmsg << "Restart from hdf5 format file " << fn 
+    *gmsg << "Restart from hdf5 format file " << fn
           << ", read phase space data of DumpStep " << (int)restartStep << endl;
 
     rc = H5SetStep(H5file, restartStep);
@@ -721,7 +723,7 @@ void Distribution::DoRestartOpalCycl(PartBunch &beam, size_t Np, int restartStep
         endi = -1;
     else
         endi = starti + numberOfParticlesPerNode - 1;
-    
+
     rc = H5PartSetView(H5file, starti, endi);
     if(rc != H5_SUCCESS)
         ERRORMSG("H5 rc= " << rc << " in " << __FILE__ << " @ line " << __LINE__ << endl);
@@ -1529,7 +1531,7 @@ double Distribution::ConvertMeVPerCToBetaGamma(double valueInMeVPerC, double mas
 
 void Distribution::CreateDistributionBinomial(size_t numberOfParticles, double massIneV) {
 
-    SetDistParametersBinomial(massIneV);    
+    SetDistParametersBinomial(massIneV);
     GenerateBinomial(numberOfParticles);
 }
 
@@ -1699,9 +1701,9 @@ void Distribution::CreateOpalCycl(PartBunch &beam,
      * for the first pass.
      */
 
-    /* 
-       Fixme: 
-       
+    /*
+       Fixme:
+
        avrgpz_m = beam.getP()/beam.getM();
     */
     size_t numberOfPartToCreate = numberOfParticles;
@@ -1781,7 +1783,7 @@ void Distribution::CreateOpalE(Beam *beam,
     ChooseInputMomentumUnits(InputMomentumUnitsT::NONE);
 
     SetDistType();
-    
+
     // Check if this is to be an emitted beam.
     CheckIfEmitted();
 
@@ -2349,14 +2351,14 @@ void Distribution::GenerateBinomial(size_t numberOfParticles) {
 
     /*!
      *
-     * \brief Following W. Johos for his report  <a href="http://gfa.web.psi.ch/publications/presentations/WernerJoho/TM-11-14.pdf"> TM-11-14 </a> 
+     * \brief Following W. Johos for his report  <a href="http://gfa.web.psi.ch/publications/presentations/WernerJoho/TM-11-14.pdf"> TM-11-14 </a>
      *
      * For the \f$x,p_x\f$ phase space we have:
      * \f[
      *  \epsilon_x = \sigma_x \sigma_{p_x} \cos{( \arcsin{(\sigma_{12}) }) }
      *  \f]
      *
-     * \f{eqnarray*}{     
+     * \f{eqnarray*}{
      * \beta_x &=& \frac{\sigma_x^2}{\epsilon_x} \\
      * \gamma_x &=& \frac{\sigma_{p_x}^2}{\epsilon_x} \\
      * \alpha_x &=& -\sigma_{12} \sqrt{(\beta_x \gamma_x)} \\
@@ -2558,7 +2560,7 @@ void Distribution::GenerateFlattopLaserProfile(size_t numberOfParticles) {
 void Distribution::GenerateFlattopT(size_t numberOfParticles) {
 
     gsl_rng_env_setup();
-    gsl_rng  *randGenStandard = gsl_rng_alloc(gsl_rng_default);  
+    gsl_rng  *randGenStandard = gsl_rng_alloc(gsl_rng_default);
     gsl_qrng *quasiRandGen2D = NULL;
 
     if(Options::rngtype != std::string("RANDOM")) {
@@ -2631,7 +2633,7 @@ void Distribution::GenerateFlattopT(size_t numberOfParticles) {
 void Distribution::GenerateFlattopZ(size_t numberOfParticles) {
 
     gsl_rng_env_setup();
-    gsl_rng *randGenStandard = gsl_rng_alloc(gsl_rng_default);  
+    gsl_rng *randGenStandard = gsl_rng_alloc(gsl_rng_default);
     gsl_qrng *quasiRandGen1D = NULL;
     gsl_qrng *quasiRandGen2D = NULL;
     if(Options::rngtype != std::string("RANDOM")) {
@@ -2712,17 +2714,17 @@ void Distribution::GenerateFlattopZ(size_t numberOfParticles) {
         gsl_qrng_free(quasiRandGen2D);
 }
 
-void Distribution::GenerateGaussZ(size_t numberOfParticles) { 
+void Distribution::GenerateGaussZ(size_t numberOfParticles) {
 
     gsl_rng_env_setup();
-    gsl_rng *randGen = gsl_rng_alloc(gsl_rng_default);  
+    gsl_rng *randGen = gsl_rng_alloc(gsl_rng_default);
 
     gsl_matrix * m  = gsl_matrix_alloc (6, 6);
     gsl_vector * rx = gsl_vector_alloc(6);
     gsl_vector * ry = gsl_vector_alloc(6);
-        
+
     int i,j;
-    
+
     for (i = 0; i < 6; i++) {
         for (j = 0; j < 6; j++) {
 	    if (i==j)
@@ -2742,7 +2744,7 @@ void Distribution::GenerateGaussZ(size_t numberOfParticles) {
     gsl_matrix_set (m,0,5, distCorr_m.at(3));
     gsl_matrix_set (m,5,1, distCorr_m.at(4));
     gsl_matrix_set (m,1,5, distCorr_m.at(4));
-    
+
     gsl_matrix_set (m,4,0, distCorr_m.at(5));
     gsl_matrix_set (m,0,4, distCorr_m.at(5));
     gsl_matrix_set (m,4,1, distCorr_m.at(6));
@@ -2752,7 +2754,7 @@ void Distribution::GenerateGaussZ(size_t numberOfParticles) {
     for (int i = 0; i < 6; i++) {
       for (int j = 0; j < 6; j++) {
 	if (j==0)
-	  *gmsg << "* r(" << std::setprecision(1) << i << "," << std::setprecision(1) << j << ") = " 
+	  *gmsg << "* r(" << std::setprecision(1) << i << "," << std::setprecision(1) << j << ") = "
 		<< std::setprecision(3) << gsl_matrix_get (m, i, j);
 	else
 	  *gmsg << "\t" << std::setprecision(3) << gsl_matrix_get (m, i, j);
@@ -2772,14 +2774,14 @@ void Distribution::GenerateGaussZ(size_t numberOfParticles) {
       for (int j = 0; j < i ; j++) {
 	gsl_matrix_set (m, i, j, 0.0);
       }
-    }        
+    }
     gsl_matrix_transpose(m);
 
 #ifdef DISTDBG2
     for (int i = 0; i < 6; i++) {
       for (int j = 0; j < 6; j++) {
 	if (j==0)
-	  *gmsg << "* r(" << std::setprecision(1) << i << "," << std::setprecision(1) << j << ") = " 
+	  *gmsg << "* r(" << std::setprecision(1) << i << "," << std::setprecision(1) << j << ") = "
 		<< std::setprecision(3) << gsl_matrix_get (m, i, j);
 	else
 	  *gmsg << "\t" << std::setprecision(3) << gsl_matrix_get (m, i, j);
@@ -2787,7 +2789,7 @@ void Distribution::GenerateGaussZ(size_t numberOfParticles) {
       *gmsg << endl;
     }
 #endif
-    
+
     int saveProcessor = -1;
     for (size_t partIndex = 0; partIndex < numberOfParticles; partIndex++) {
 
@@ -2795,27 +2797,27 @@ void Distribution::GenerateGaussZ(size_t numberOfParticles) {
 
       while (std::abs((rval = gsl_ran_gaussian (randGen,1.0)))>cutoffR_m[0])
 	;
-      gsl_vector_set(rx,0,rval);       
+      gsl_vector_set(rx,0,rval);
 
       while (std::abs((rval = gsl_ran_gaussian (randGen,1.0)))>cutoffP_m[0])
 	;
-      gsl_vector_set(rx,1,rval);       
+      gsl_vector_set(rx,1,rval);
 
       while (std::abs((rval = gsl_ran_gaussian (randGen,1.0)))>cutoffR_m[1])
 	;
-      gsl_vector_set(rx,2,rval);       
+      gsl_vector_set(rx,2,rval);
 
       while (std::abs((rval = gsl_ran_gaussian (randGen,1.0)))>cutoffP_m[1])
 	;
-      gsl_vector_set(rx,3,rval);       
+      gsl_vector_set(rx,3,rval);
 
       while (std::abs((rval = gsl_ran_gaussian (randGen,1.0)))>cutoffR_m[2])
 	;
-      gsl_vector_set(rx,4,rval);       
+      gsl_vector_set(rx,4,rval);
 
       while (std::abs((rval = gsl_ran_gaussian (randGen,1.0)))>cutoffP_m[2])
 	;
-      gsl_vector_set(rx,5,rval);       
+      gsl_vector_set(rx,5,rval);
 
       // Save to each processor in turn.
       saveProcessor++;
@@ -2833,7 +2835,7 @@ void Distribution::GenerateGaussZ(size_t numberOfParticles) {
 	pyDist_m.push_back(           sigmaP_m[1]*gsl_vector_get(ry, 3));
 	tOrZDist_m.push_back(         sigmaR_m[2]*gsl_vector_get(ry, 4));
 	pzDist_m.push_back(avrgpz_m +(sigmaP_m[2]*gsl_vector_get(ry, 5)));
-      }      
+      }
     }
 
     /*
@@ -2914,7 +2916,7 @@ void Distribution::GenerateLongFlattopT(size_t numberOfParticles) {
         modulationPeriod = flattopTime / numModulationPeriods;
 
     gsl_rng_env_setup();
-    gsl_rng *randGen = gsl_rng_alloc(gsl_rng_default);  
+    gsl_rng *randGen = gsl_rng_alloc(gsl_rng_default);
     gsl_qrng *quasiRandGen1D = NULL;
     gsl_qrng *quasiRandGen2D = NULL;
     if(Options::rngtype != std::string("RANDOM")) {
@@ -3009,7 +3011,7 @@ void Distribution::GenerateLongFlattopT(size_t numberOfParticles) {
             pzDist_m.push_back(pz);
         }
     }
-    
+
     gsl_rng_free(randGenGSL);
 
     if (randGen)
@@ -3026,7 +3028,7 @@ void Distribution::GenerateTransverseGauss(size_t numberOfParticles) {
 
     // Generate coordinates.
     gsl_rng_env_setup();
-    gsl_rng *randGen = gsl_rng_alloc(gsl_rng_default);  
+    gsl_rng *randGen = gsl_rng_alloc(gsl_rng_default);
 
     int saveProcessor = -1;
     for (size_t partIndex = 0; partIndex < numberOfParticles; partIndex++) {
@@ -3043,7 +3045,7 @@ void Distribution::GenerateTransverseGauss(size_t numberOfParticles) {
         bool allow = false;
         while (!allow) {
 
-            
+
             random1 = gsl_ran_gaussian (randGen,1.0);
             random2 = gsl_ran_gaussian (randGen,1.0);
             x = random1 * sigmaR_m[0];
@@ -3148,7 +3150,7 @@ void Distribution::InjectBeam(PartBunch &beam) {
     pzDist_m.clear();
 
     beam.boundp();
-   
+
     if (distrTypeT_m != DistrTypeT::FROMFILE)
       beam.correctEnergy(avrgpz_m);
     beam.calcEMean();
@@ -4143,11 +4145,11 @@ void Distribution::SetDistParametersBinomial(double massIneV) {
     cutoffR_m = Vector_t(Attributes::getReal(itsAttr[AttributesT::CUTOFFX]),
                          Attributes::getReal(itsAttr[AttributesT::CUTOFFY]),
                          Attributes::getReal(itsAttr[AttributesT::CUTOFFLONG]));
-    
+
     cutoffP_m = Vector_t(Attributes::getReal(itsAttr[AttributesT::CUTOFFPX]),
                          Attributes::getReal(itsAttr[AttributesT::CUTOFFPY]),
                          Attributes::getReal(itsAttr[AttributesT::CUTOFFPZ]));
-    
+
     if (mBinomial_m[2] == 0.0
         || Attributes::getReal(itsAttr[AttributesT::MZ]) != 0.0)
         mBinomial_m[2] = std::abs(Attributes::getReal(itsAttr[AttributesT::MZ]));
@@ -4292,9 +4294,9 @@ void Distribution::SetDistParametersGauss(double massIneV) {
     cutoffP_m = Vector_t(Attributes::getReal(itsAttr[AttributesT::CUTOFFPX]),
                          Attributes::getReal(itsAttr[AttributesT::CUTOFFPY]),
                          Attributes::getReal(itsAttr[AttributesT::CUTOFFPZ]));
-    
+
     std::vector<double> cr = Attributes::getRealArray(itsAttr[AttributesT::R]);
-    
+
     if(cr.size()>0) {
         if(cr.size() == 15) {
             *gmsg << "* Use r to specify correlations" << endl;
@@ -4316,17 +4318,17 @@ void Distribution::SetDistParametersGauss(double massIneV) {
         distCorr_m.push_back(Attributes::getReal(itsAttr[AttributesT::CORRX]));
         distCorr_m.push_back(Attributes::getReal(itsAttr[AttributesT::CORRY]));
         distCorr_m.push_back(Attributes::getReal(itsAttr[AttributesT::CORRT]));
-        
+
         // CORRZ overrides CORRT.
         if (Attributes::getReal(itsAttr[AttributesT::CORRZ]) != 0.0)
             distCorr_m.at(2) = Attributes::getReal(itsAttr[AttributesT::CORRZ]);
-        
+
         distCorr_m.push_back(Attributes::getReal(itsAttr[AttributesT::R61]));
         distCorr_m.push_back(Attributes::getReal(itsAttr[AttributesT::R62]));
         distCorr_m.push_back(Attributes::getReal(itsAttr[AttributesT::R51]));
-        distCorr_m.push_back(Attributes::getReal(itsAttr[AttributesT::R52]));    
+        distCorr_m.push_back(Attributes::getReal(itsAttr[AttributesT::R52]));
     }
-    
+
     if (emitting_m) {
 
         sigmaR_m = Vector_t(std::abs(Attributes::getReal(itsAttr[AttributesT::SIGMAX])),
@@ -4422,7 +4424,7 @@ void Distribution::SetupEmissionModelAstra(PartBunch &beam) {
     pTotThermal_m = ConverteVToBetaGamma(wThermal, beam.getM());
 
     gsl_rng_env_setup();
-    randGenEmit_m = gsl_rng_alloc(gsl_rng_default);  
+    randGenEmit_m = gsl_rng_alloc(gsl_rng_default);
 }
 
 void Distribution::SetupEmissionModelNone(PartBunch &beam) {
@@ -4447,7 +4449,7 @@ void Distribution::SetupEmissionModelNonEquil() {
                              + Physics::kB * cathodeTemp_m * log(1.0e9 - 1.0);
 
     gsl_rng_env_setup();
-    randGenEmit_m = gsl_rng_alloc(gsl_rng_default);  
+    randGenEmit_m = gsl_rng_alloc(gsl_rng_default);
 }
 
 void Distribution::SetupEnergyBins(double maxTOrZ, double minTOrZ) {
@@ -4567,7 +4569,7 @@ void Distribution::ShiftDistCoordinates(double massIneV) {
 
     if (Attributes::getReal(itsAttr[AttributesT::SIZE + LegacyAttributesT::PT])!=0.0)
       WARNMSG("PT & PZ are obsolet and will be ignored. The moments of the beam is defined with PC" << endl);
-    
+
     // Check input momentum units.
     switch (inputMoUnits_m) {
     case InputMomentumUnitsT::EV:
diff --git a/src/Distribution/halton1d_sequence.cpp b/src/Distribution/halton1d_sequence.cpp
index 1ed6d13c9c08df81b79b84c9af03d7a555b15441..f7c3f76a635c7a6cecde0fe80fc6b64ff79b85eb 100644
--- a/src/Distribution/halton1d_sequence.cpp
+++ b/src/Distribution/halton1d_sequence.cpp
@@ -1,6 +1,7 @@
+#include "Distribution/halton1d_sequence.hh"
+
 #include <cmath>
 #include <iostream>
-#include "halton1d_sequence.hh"
 
 #define DIM 1
 
@@ -9,20 +10,20 @@ typedef struct
     unsigned int sequence_count;
     unsigned int call_count;
     double x[DIM];
-} 
+}
 halton_state_t;
 
 static void
 halton1d_set(void * vstate, unsigned long int s) {
     halton_state_t *h_state = (halton_state_t *) vstate;
-    
+
     h_state->sequence_count = 0;
     h_state->call_count = 0;
 }
 
-static double 
+static double
 halton1d_get_double(void *vstate) {
-    
+
     // double x[DIM];
     // gsl_qrng_halton->get(vstate, DIM, x);
     // return x[DIM-1];
@@ -37,12 +38,12 @@ halton1d_get_double(void *vstate) {
     return x;
 }
 
-static unsigned long int 
+static unsigned long int
 halton1d_get(void *vstate) {
     return static_cast<unsigned long int>(halton1d_get_double(vstate) * 16777216.0);
 }
 
-static const gsl_rng_type halton1d_type = 
+static const gsl_rng_type halton1d_type =
     {"halton1d",
      0x00ffffffUL,
      0,
@@ -52,4 +53,3 @@ static const gsl_rng_type halton1d_type =
      &halton1d_get_double};
 
 const gsl_rng_type *gsl_rng_1dhalton = &halton1d_type;
-
diff --git a/src/Elements/OpalOffset/OpalGlobalCartesianOffset.cpp b/src/Elements/OpalOffset/OpalGlobalCartesianOffset.cpp
index 1d1c878737830dbd1b6ec30992fbe0a70dd3b87c..96bfea26a81cb59093b7d141df328bdaf3ef66b2 100644
--- a/src/Elements/OpalOffset/OpalGlobalCartesianOffset.cpp
+++ b/src/Elements/OpalOffset/OpalGlobalCartesianOffset.cpp
@@ -25,11 +25,12 @@
  *  POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "Elements/OpalOffset/OpalGlobalCartesianOffset.h"
+
 #include <string>
 
 #include "AbsBeamline/Offset.h"
 #include "Elements/OpalElement.h"
-#include "Elements/OpalOffset/OpalGlobalCartesianOffset.h"
 
 #include "Attributes/Attributes.h"
 
diff --git a/src/Elements/OpalOffset/OpalGlobalCylindricalOffset.cpp b/src/Elements/OpalOffset/OpalGlobalCylindricalOffset.cpp
index e988ee9d81602d56063a2f444894f27aa12d89d8..f9f3458687f08f155f2ac598f020493ba600cbde 100644
--- a/src/Elements/OpalOffset/OpalGlobalCylindricalOffset.cpp
+++ b/src/Elements/OpalOffset/OpalGlobalCylindricalOffset.cpp
@@ -25,11 +25,12 @@
  *  POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "Elements/OpalOffset/OpalGlobalCylindricalOffset.h"
+
 #include <string>
 
 #include "AbsBeamline/Offset.h"
 #include "Elements/OpalElement.h"
-#include "Elements/OpalOffset/OpalGlobalCylindricalOffset.h"
 
 #include "Attributes/Attributes.h"
 
diff --git a/src/Elements/OpalOffset/OpalLocalCartesianOffset.cpp b/src/Elements/OpalOffset/OpalLocalCartesianOffset.cpp
index 83e100bce630906732a4a254ee12b7629c31ce89..6162ec8e6f2aea150c0eaed8eba464d452321659 100644
--- a/src/Elements/OpalOffset/OpalLocalCartesianOffset.cpp
+++ b/src/Elements/OpalOffset/OpalLocalCartesianOffset.cpp
@@ -25,12 +25,13 @@
  *  POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "Elements/OpalOffset/OpalLocalCartesianOffset.h"
+
 #include <string>
 
 #include "AbsBeamline/Offset.h"
 #include "Utilities/OpalException.h"
 #include "Elements/OpalElement.h"
-#include "Elements/OpalOffset/OpalLocalCartesianOffset.h"
 
 #include "Attributes/Attributes.h"
 
diff --git a/src/Elements/OpalOffset/OpalLocalCylindricalOffset.cpp b/src/Elements/OpalOffset/OpalLocalCylindricalOffset.cpp
index 4885ff955772efe056e083824861b5cf165f3ba3..0068589cac3455a64b16c94eb31977cb090ffb1d 100644
--- a/src/Elements/OpalOffset/OpalLocalCylindricalOffset.cpp
+++ b/src/Elements/OpalOffset/OpalLocalCylindricalOffset.cpp
@@ -25,11 +25,12 @@
  *  POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "Elements/OpalOffset/OpalLocalCylindricalOffset.h"
+
 #include <string>
 
 #include "AbsBeamline/Offset.h"
 #include "Elements/OpalElement.h"
-#include "Elements/OpalOffset/OpalLocalCylindricalOffset.h"
 
 #include "Attributes/Attributes.h"
 
diff --git a/src/Elements/OpalPolynomialTimeDependence.cpp b/src/Elements/OpalPolynomialTimeDependence.cpp
index 3a795c2beb8fdcac073c849973a2458809ac84f5..30ca2b333f34baa9240072f023ae856f7f708ef0 100644
--- a/src/Elements/OpalPolynomialTimeDependence.cpp
+++ b/src/Elements/OpalPolynomialTimeDependence.cpp
@@ -25,9 +25,10 @@
  *  POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "Elements/OpalPolynomialTimeDependence.h"
+
 #include <string>
 
-#include "Elements/OpalPolynomialTimeDependence.h"
 #include "Algorithms/PolynomialTimeDependence.h"
 
 #include "Attributes/Attributes.h"
diff --git a/src/Elements/OpalRing.cpp b/src/Elements/OpalRing.cpp
index 2f62478304a2d093b7d532ef81bd6d8431c78b70..e1753139fd31805884fd43bca050054fe31b6430 100644
--- a/src/Elements/OpalRing.cpp
+++ b/src/Elements/OpalRing.cpp
@@ -1,30 +1,32 @@
-/* 
+/*
  *  Copyright (c) 2012-2014, Chris Rogers
  *  All rights reserved.
- *  Redistribution and use in source and binary forms, with or without 
- *  modification, are permitted provided that the following conditions are met: 
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
  *  1. Redistributions of source code must retain the above copyright notice,
- *     this list of conditions and the following disclaimer. 
- *  2. Redistributions in binary form must reproduce the above copyright notice, 
- *     this list of conditions and the following disclaimer in the documentation 
+ *     this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright notice,
+ *     this list of conditions and the following disclaimer in the documentation
  *     and/or other materials provided with the distribution.
- *  3. Neither the name of STFC nor the names of its contributors may be used to 
- *     endorse or promote products derived from this software without specific 
+ *  3. Neither the name of STFC nor the names of its contributors may be used to
+ *     endorse or promote products derived from this software without specific
  *     prior written permission.
  *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  *  POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "Elements/OpalRing.h"
+
 #include <sstream>
 #include <limits>
 
@@ -37,8 +39,6 @@
 #include "Utilities/OpalException.h"
 #include "Utilities/OpalRingSection.h"
 
-#include "Elements/OpalRing.h"
-
 // fairly generous tolerance here... maybe too generous? Maybe should be
 // user parameter?
 const double OpalRing::lengthTolerance_m = 1e-2;
@@ -136,7 +136,7 @@ bool OpalRing::apply(const Vector_t &R, const Vector_t &centroid,
 
     std::vector<OpalRingSection*> sections = getSectionsAt(R);
     bool outOfBounds = true;
-    // assume field maps don't set B, E to 0... 
+    // assume field maps don't set B, E to 0...
     for (size_t i = 0; i < sections.size(); ++i) {
         Vector_t B_temp(0.0, 0.0, 0.0);
         Vector_t E_temp(0.0, 0.0, 0.0);
@@ -220,7 +220,7 @@ void OpalRing::rotateToCyclCoordinates(Euclid3D& delta) const {
     delta = euclid;
 }
 
- 
+
 Vector_t OpalRing::getNextPosition() const {
     if (section_list_m.size() > 0) {
         return section_list_m.back()->getEndPosition();
@@ -314,7 +314,7 @@ void OpalRing::lockRing() {
     // Apply symmetry properties; I think it is fastest to just duplicate
     // elements rather than try to do some angle manipulations when we do field
     // lookups because we do field lookups in Cartesian coordinates in general.
-    msg << "Applying symmetry to OpalRing" << endl;  
+    msg << "Applying symmetry to OpalRing" << endl;
     for (int i = 1; i < symmetry_m; ++i) {
         for (size_t j = 0; j < sectionListSize; ++j) {
             appendElement(*section_list_m[j]->getComponent());
@@ -351,7 +351,7 @@ void OpalRing::checkAndClose() {
     Vector_t last_pos = section_list_m.back()->getEndPosition();
     Vector_t last_norm = section_list_m.back()->getEndNormal();
     for (int i = 0; i < 3; ++i) {
-        if (fabs(first_pos(i) - last_pos(i)) > lengthTolerance_m || 
+        if (fabs(first_pos(i) - last_pos(i)) > lengthTolerance_m ||
             fabs(first_norm(i) - last_norm(i)) > angleTolerance_m)
             throw OpalException("OpalRing::lockRing",
                                 "Ring is not closed");
@@ -385,4 +385,3 @@ bool OpalRing::sectionCompare(OpalRingSection const* const sec1,
                               OpalRingSection const* const sec2) {
     return sec1 > sec2;
 }
-
diff --git a/src/Elements/OpalRingDefinition.cpp b/src/Elements/OpalRingDefinition.cpp
index 007c8cfe749699290490344cb6fab6d6fe2c5d07..d2709d09db4ce7e956f6bb762659554abbfd7cdb 100644
--- a/src/Elements/OpalRingDefinition.cpp
+++ b/src/Elements/OpalRingDefinition.cpp
@@ -25,9 +25,10 @@
  *  POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "Elements/OpalRingDefinition.h"
+
 #include <limits>
 
-#include "Elements/OpalRingDefinition.h"
 #include "Elements/OpalRing.h"
 
 #include "Attributes/Attributes.h"
diff --git a/src/Elements/OpalVariableRFCavity.cpp b/src/Elements/OpalVariableRFCavity.cpp
index 6b94de9e7c2bf320378185b56d7389b67f522cf5..10420d90dfc61224480791b868dcdc7e75bddc03 100644
--- a/src/Elements/OpalVariableRFCavity.cpp
+++ b/src/Elements/OpalVariableRFCavity.cpp
@@ -1,40 +1,41 @@
-/* 
+/*
  *  Copyright (c) 2012, Chris Rogers
  *  All rights reserved.
- *  Redistribution and use in source and binary forms, with or without 
- *  modification, are permitted provided that the following conditions are met: 
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
  *  1. Redistributions of source code must retain the above copyright notice,
- *     this list of conditions and the following disclaimer. 
- *  2. Redistributions in binary form must reproduce the above copyright notice, 
- *     this list of conditions and the following disclaimer in the documentation 
+ *     this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright notice,
+ *     this list of conditions and the following disclaimer in the documentation
  *     and/or other materials provided with the distribution.
- *  3. Neither the name of STFC nor the names of its contributors may be used to 
- *     endorse or promote products derived from this software without specific 
+ *  3. Neither the name of STFC nor the names of its contributors may be used to
+ *     endorse or promote products derived from this software without specific
  *     prior written permission.
  *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  *  POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "Elements/OpalVariableRFCavity.h"
+
 #include "Physics/Physics.h"
 #include "Utilities/OpalException.h"
 #include "Attributes/Attributes.h"
 #include "Algorithms/AbstractTimeDependence.h"
 #include "AbsBeamline/VariableRFCavity.h"
-#include "Elements/OpalVariableRFCavity.h"
 
 extern Inform *gmsg;
 
-const std::string OpalVariableRFCavity::doc_string = 
+const std::string OpalVariableRFCavity::doc_string =
       std::string("The \"VARIABLE_RF_CAVITY\" element defines an RF cavity ")+
       std::string("with time dependent frequency, phase and amplitude.");
 
@@ -117,4 +118,3 @@ void OpalVariableRFCavity::update() {
     cavity->setHeight(height);
     setElement(cavity->makeAlignWrapper());
 }
-
diff --git a/src/Expressions/Expressions.cpp b/src/Expressions/Expressions.cpp
index 2039e8b69f769b63cb1578343032e22be120248f..b76a9428068815de5370351b7fc863dcc01348ca 100644
--- a/src/Expressions/Expressions.cpp
+++ b/src/Expressions/Expressions.cpp
@@ -17,8 +17,9 @@
 //
 // ------------------------------------------------------------------------
 
-#include "AbstractObjects/Attribute.h"
 #include "AbstractObjects/Expressions.h"
+
+#include "AbstractObjects/Attribute.h"
 #include "AbstractObjects/PlaceRep.h"
 #include "AbstractObjects/RangeRep.h"
 #include "AbstractObjects/Table.h"
diff --git a/src/OpalParser/IfStatement.cpp b/src/OpalParser/IfStatement.cpp
index 905cf64590833c113cc2ae06783e86d717ca6469..675b59e7b35d175f0524e8bbb1f4e4cca6290e75 100644
--- a/src/OpalParser/IfStatement.cpp
+++ b/src/OpalParser/IfStatement.cpp
@@ -16,9 +16,10 @@
 //
 // ------------------------------------------------------------------------
 
+#include "OpalParser/IfStatement.h"
+
 #include "OpalParser/CompoundStatement.h"
 #include "AbstractObjects/OpalData.h"
-#include "OpalParser/IfStatement.h"
 #include "Attributes/Attributes.h"
 #include "Parser/Parser.h"
 #include "Parser/Token.h"
diff --git a/src/Solvers/ArbitraryDomain.cpp b/src/Solvers/ArbitraryDomain.cpp
index e8922455fd1d5a9fde1bd44ed97e6bc3d5bdc23a..bb510e7dbaa55c28323780b426011ce4a7f196db 100644
--- a/src/Solvers/ArbitraryDomain.cpp
+++ b/src/Solvers/ArbitraryDomain.cpp
@@ -4,7 +4,7 @@
 // Copyright & License: See Copyright.readme in src directory
 // ------------------------------------------------------------------------
 // Class ArbitraryDomain
-//   Interface to iterative solver and boundary geometry 
+//   Interface to iterative solver and boundary geometry
 //   for space charge calculation
 //
 // ------------------------------------------------------------------------
@@ -14,6 +14,8 @@
 //#define DEBUG_INTERSECT_RAY_BOUNDARY
 
 #ifdef HAVE_SAAMG_SOLVER
+#include "Solvers/ArbitraryDomain.h"
+
 #include <map>
 #include <cmath>
 #include <iostream>
@@ -23,12 +25,10 @@
 #define MIN2(a,b) (((a) < (b)) ? (a) : (b))
 #define MAX2(a,b) (((a) > (b)) ? (a) : (b))
 
-#include "ArbitraryDomain.h"
-
 ArbitraryDomain::ArbitraryDomain(
-	BoundaryGeometry * bgeom, 
-	Vector_t nr, 
-	Vector_t hr, 
+	BoundaryGeometry * bgeom,
+	Vector_t nr,
+	Vector_t hr,
 	std::string interpl) {
 
     	bgeom_m  = bgeom;
@@ -68,7 +68,7 @@ void ArbitraryDomain::Compute(Vector_t hr, NDIndex<3> localId) {
     int yGhostOffsetRight = (localId[1].last() == nr[1] - 1) ? 0 : 1;
     int xGhostOffsetLeft  = (localId[0].first()== 0) ? 0 : 1;
     int xGhostOffsetRight = (localId[0].last() == nr[0] - 1) ? 0 : 1;
-    
+
     hasGeometryChanged_m = true;
 
     IntersectLoX.clear();
@@ -79,7 +79,7 @@ void ArbitraryDomain::Compute(Vector_t hr, NDIndex<3> localId) {
     IntersectHiZ.clear();
 
 
-    //calculate intersection 
+    //calculate intersection
     Vector_t P, dir, I;
     for (int idz = localId[2].first()-zGhostOffsetLeft; idz <= localId[2].last()+zGhostOffsetRight; idz++) {
 	 P[2] = (idz - (nr[2]-1)/2.0)*hr[2];
@@ -119,7 +119,7 @@ void ArbitraryDomain::Compute(Vector_t hr, NDIndex<3> localId) {
 	 }
      }
 
-    //number of ghost nodes to the right 
+    //number of ghost nodes to the right
     int znumGhostNodesRight = 0;
     if(zGhostOffsetRight != 0) {
         for(int idx = localId[0].first(); idx <= localId[0].last(); idx++) {
@@ -130,7 +130,7 @@ void ArbitraryDomain::Compute(Vector_t hr, NDIndex<3> localId) {
         }
     }
 
-    //number of ghost nodes to the left 
+    //number of ghost nodes to the left
     int znumGhostNodesLeft = 0;
     if(zGhostOffsetLeft != 0) {
         for(int idx = localId[0].first(); idx <= localId[0].last(); idx++) {
@@ -141,7 +141,7 @@ void ArbitraryDomain::Compute(Vector_t hr, NDIndex<3> localId) {
         }
     }
 
-    //number of ghost nodes to the right 
+    //number of ghost nodes to the right
     int ynumGhostNodesRight = 0;
     if(yGhostOffsetRight != 0) {
         for(int idx = localId[0].first(); idx <= localId[0].last(); idx++) {
@@ -152,7 +152,7 @@ void ArbitraryDomain::Compute(Vector_t hr, NDIndex<3> localId) {
         }
     }
 
-    //number of ghost nodes to the left 
+    //number of ghost nodes to the left
     int ynumGhostNodesLeft = 0;
     if(yGhostOffsetLeft != 0) {
         for(int idx = localId[0].first(); idx <= localId[0].last(); idx++) {
@@ -164,7 +164,7 @@ void ArbitraryDomain::Compute(Vector_t hr, NDIndex<3> localId) {
     }
 
 
-    //number of ghost nodes to the right 
+    //number of ghost nodes to the right
     int xnumGhostNodesRight = 0;
     if(xGhostOffsetRight != 0) {
 	for (int idy = localId[1].first(); idy <= localId[1].last(); idy++) {
@@ -175,7 +175,7 @@ void ArbitraryDomain::Compute(Vector_t hr, NDIndex<3> localId) {
         }
     }
 
-    //number of ghost nodes to the left 
+    //number of ghost nodes to the left
     int xnumGhostNodesLeft = 0;
     if(xGhostOffsetLeft != 0) {
        	for (int idy = localId[1].first(); idy <= localId[1].last(); idy++) {
@@ -186,7 +186,7 @@ void ArbitraryDomain::Compute(Vector_t hr, NDIndex<3> localId) {
         }
     }
     //xy points in z plane
-    int numxy; 
+    int numxy;
     int numtotalxy = 0;
 
     numXY.clear();
@@ -210,7 +210,7 @@ void ArbitraryDomain::Compute(Vector_t hr, NDIndex<3> localId) {
     //build up index and coord map
     IdxMap.clear();
     CoordMap.clear();
-    
+
     register int id = startId - xnumGhostNodesLeft - ynumGhostNodesLeft - znumGhostNodesLeft;
      for (int idz = localId[2].first()-zGhostOffsetLeft; idz <= localId[2].last()+zGhostOffsetRight; idz++) {
     	 for (int idy = localId[1].first()-yGhostOffsetLeft; idy <= localId[1].last()+yGhostOffsetRight; idy++) {
@@ -229,10 +229,10 @@ void ArbitraryDomain::Compute(Vector_t hr, NDIndex<3> localId, Vector_t globalMe
 
     setHr(hr);
     globalMeanR_m = globalMeanR;
-    globalToLocalQuaternion_m = globalToLocalQuaternion;	
+    globalToLocalQuaternion_m = globalToLocalQuaternion;
     localToGlobalQuaternion_m[0] = globalToLocalQuaternion[0];
     for (int i=1; i<4; i++)
-		localToGlobalQuaternion_m[i] = -globalToLocalQuaternion[i];	
+		localToGlobalQuaternion_m[i] = -globalToLocalQuaternion[i];
 
     int zGhostOffsetLeft  = (localId[2].first()== 0) ? 0 : 1;
     int zGhostOffsetRight = (localId[2].last() == nr[2] - 1) ? 0 : 1;
@@ -240,7 +240,7 @@ void ArbitraryDomain::Compute(Vector_t hr, NDIndex<3> localId, Vector_t globalMe
     int yGhostOffsetRight = (localId[1].last() == nr[1] - 1) ? 0 : 1;
     int xGhostOffsetLeft  = (localId[0].first()== 0) ? 0 : 1;
     int xGhostOffsetRight = (localId[0].last() == nr[0] - 1) ? 0 : 1;
-    
+
     hasGeometryChanged_m = true;
 
     IntersectLoX.clear();
@@ -250,12 +250,12 @@ void ArbitraryDomain::Compute(Vector_t hr, NDIndex<3> localId, Vector_t globalMe
     IntersectLoZ.clear();
     IntersectHiZ.clear();
 
-    //calculate intersection 
+    //calculate intersection
     Vector_t P, saveP, dir, I;
-    // TODO: Find and set the reference point for any time of geometry 
+    // TODO: Find and set the reference point for any time of geometry
     //Reference Point inside the boundary for IsoDar Geo
-    Vector_t P0 = Vector_t(0,0,bgeom_m->getmincoords()[2]+hr[2]);     
-    //Reference Point where the boundary geometry is cylinder 
+    Vector_t P0 = Vector_t(0,0,bgeom_m->getmincoords()[2]+hr[2]);
+    //Reference Point where the boundary geometry is cylinder
     P0 = Vector_t(0,0,0);
     for (int idz = localId[2].first()-zGhostOffsetLeft; idz <= localId[2].last()+zGhostOffsetRight; idz++) {
 	 saveP[2] = (idz - (nr[2]-1)/2.0)*hr[2];
@@ -264,19 +264,19 @@ void ArbitraryDomain::Compute(Vector_t hr, NDIndex<3> localId, Vector_t globalMe
     	     for (int idx = localId[0].first()-xGhostOffsetLeft; idx <= localId[0].last()+xGhostOffsetRight; idx++) {
 	       	  saveP[0] = (idx - (nr[0]-1)/2.0)*hr[0];
 		  P = saveP;
-		  rotateWithQuaternion(P, localToGlobalQuaternion_m); 
+		  rotateWithQuaternion(P, localToGlobalQuaternion_m);
 		  P += globalMeanR_m;
 
 		  if (bgeom_m->fastIsInside(P0, P) % 2 == 0) {
 		     P0 = P;
-       		     
+
                      std::tuple<int, int, int> pos(idx, idy, idz);
 
 		     rotateZAxisWithQuaternion(dir, localToGlobalQuaternion_m);
 		     if (bgeom_m->intersectRayBoundary(P, dir, I)) {
 //			setYRangeMax(MIN2(intersectMaxCoords_m(2),I[2]));
 			I -= globalMeanR_m;
-			rotateWithQuaternion(I, globalToLocalQuaternion_m); 
+			rotateWithQuaternion(I, globalToLocalQuaternion_m);
        	      		IntersectHiZ.insert(std::pair< std::tuple<int, int, int>, double >(pos, I[2]));
 		     } else {
 #ifdef DEBUG_INTERSECT_RAY_BOUNDARY
@@ -287,19 +287,19 @@ void ArbitraryDomain::Compute(Vector_t hr, NDIndex<3> localId, Vector_t globalMe
 		     if (bgeom_m->intersectRayBoundary(P, -dir, I)) {
 //			setYRangeMin(MAX2(intersectMinCoords_m(2),I[2]));
 		        I -= globalMeanR_m;
-			rotateWithQuaternion(I, globalToLocalQuaternion_m); 
+			rotateWithQuaternion(I, globalToLocalQuaternion_m);
        	      		IntersectLoZ.insert(std::pair< std::tuple<int, int, int>, double >(pos, I[2]));
 		     } else {
 #ifdef DEBUG_INTERSECT_RAY_BOUNDARY
 			   *gmsg << "zdir=-1 " << -dir << " x,y,z= " << idx << "," << idy << "," << idz << " P=" << P <<" I=" << I << endl;
 #endif
 	  	     }
-	
+
 	             rotateYAxisWithQuaternion(dir, localToGlobalQuaternion_m);
 		     if (bgeom_m->intersectRayBoundary(P, dir, I)) {
 //			 setZRangeMax(MIN2(intersectMaxCoords_m(1),I[1]));
 			 I -= globalMeanR_m;
-			 rotateWithQuaternion(I, globalToLocalQuaternion_m); 
+			 rotateWithQuaternion(I, globalToLocalQuaternion_m);
        	      		 IntersectHiY.insert(std::pair< std::tuple<int, int, int>, double >(pos, I[1]));
 	   	     } else {
 #ifdef DEBUG_INTERSECT_RAY_BOUNDARY
@@ -310,7 +310,7 @@ void ArbitraryDomain::Compute(Vector_t hr, NDIndex<3> localId, Vector_t globalMe
 		     if (bgeom_m->intersectRayBoundary(P, -dir, I)) {
 //	    	        setZRangeMin(MAX2(intersectMinCoords_m(1),I[1]));
 		   	I -= globalMeanR_m;
-			rotateWithQuaternion(I, globalToLocalQuaternion_m); 
+			rotateWithQuaternion(I, globalToLocalQuaternion_m);
        	      		IntersectLoY.insert(std::pair< std::tuple<int, int, int>, double >(pos, I[1]));
 		     } else {
 #ifdef DEBUG_INTERSECT_RAY_BOUNDARY
@@ -322,28 +322,28 @@ void ArbitraryDomain::Compute(Vector_t hr, NDIndex<3> localId, Vector_t globalMe
 		     if (bgeom_m->intersectRayBoundary(P, dir, I)) {
 //			setXRangeMax(MIN2(intersectMaxCoords_m(0),I[0]));
 			I -= globalMeanR_m;
-			rotateWithQuaternion(I, globalToLocalQuaternion_m); 
+			rotateWithQuaternion(I, globalToLocalQuaternion_m);
        	      		IntersectHiX.insert(std::pair< std::tuple<int, int, int>, double >(pos, I[0]));
 		     } else {
 #ifdef DEBUG_INTERSECT_RAY_BOUNDARY
 			   *gmsg << "xdir=+1 " << dir << " x,y,z= " << idx << "," << idy << "," << idz << " P=" << P <<" I=" << I << endl;
-#endif	
+#endif
 		     }
 
 		     if (bgeom_m->intersectRayBoundary(P, -dir, I)){
 //			setXRangeMin(MAX2(intersectMinCoords_m(0),I[0]));
 			I -= globalMeanR_m;
-			rotateWithQuaternion(I, globalToLocalQuaternion_m); 
+			rotateWithQuaternion(I, globalToLocalQuaternion_m);
        	      		IntersectLoX.insert(std::pair< std::tuple<int, int, int>, double >(pos, I[0]));
 		     } else {
 #ifdef DEBUG_INTERSECT_RAY_BOUNDARY
 			   *gmsg << "xdir=-1 " << -dir << " x,y,z= " << idx << "," << idy << "," << idz << " P=" << P <<" I=" << I << endl;
-#endif		
+#endif
 		     }
 		  } else {
 #ifdef DEBUG_INTERSECT_RAY_BOUNDARY
 			   *gmsg << "OUTSIDE" << " x,y,z= " << idx << "," << idy << "," << idz << " P=" << P <<" I=" << I << endl;
-#endif		
+#endif
 		  }
 	     }
 	 }
@@ -371,7 +371,7 @@ inline int ArbitraryDomain::toCoordIdx(int idx, int idy, int idz) {
 // Conversion from (x,y,z) to index on the 3D grid
 int ArbitraryDomain::getIdx(int idx, int idy, int idz) {
     return IdxMap[toCoordIdx(idx, idy, idz)];
-} 
+}
 
 // Conversion from a 3D index to (x,y,z)
 inline void ArbitraryDomain::getCoord(int idxyz, int &idx, int &idy, int &idz) {
@@ -395,7 +395,7 @@ inline bool ArbitraryDomain::isInside(int idx, int idy, int idz) {
     int  countH, countL;
     std::multimap < std::tuple<int, int, int>, double >::iterator itrH, itrL;
     std::tuple<int, int, int> coordxyz(idx, idy, idz);
-             
+
     //check if z is inside with x,y coords
     itrH = IntersectHiZ.find(coordxyz);
     itrL = IntersectLoZ.find(coordxyz);
@@ -422,12 +422,12 @@ inline bool ArbitraryDomain::isInside(int idx, int idy, int idz) {
     countL = IntersectLoX.count(coordxyz);
     if(countH == 1 && countL == 1)
         ret = ret && (P[0] <= itrH->second) && (P[0] >= itrL->second);
-   
-    return ret; 
+
+    return ret;
 }
 
 int ArbitraryDomain::getNumXY(int z) {
-    
+
 	return numXY[z];
 }
 
@@ -471,22 +471,22 @@ void ArbitraryDomain::ConstantInterpolation(int idx, int idy, int idz, double& W
 
     if(!isInside(idx-1,idy,idz))
         W = 0.0;
-    if(!isInside(idx+1,idy,idz)) 
+    if(!isInside(idx+1,idy,idz))
         E = 0.0;
 
     if(!isInside(idx,idy+1,idz))
         N = 0.0;
-    if(!isInside(idx,idy-1,idz)) 
+    if(!isInside(idx,idy-1,idz))
         S = 0.0;
-    
-    if(!isInside(idx,idy,idz-1)) 
-	F = 0.0;	
-    if(!isInside(idx,idy,idz+1)) 
-	B = 0.0;	
+
+    if(!isInside(idx,idy,idz-1))
+	F = 0.0;
+    if(!isInside(idx,idy,idz+1))
+	B = 0.0;
 }
 
 /*
-void ArbitraryDomain::LinearInterpolation(int idx, int idy, int idz, double& W, double& E, double& S, double& N, double& F, double& B, double& C, double &scaleFactor) 
+void ArbitraryDomain::LinearInterpolation(int idx, int idy, int idz, double& W, double& E, double& S, double& N, double& F, double& B, double& C, double &scaleFactor)
 {
 
     scaleFactor = 1.0;
@@ -501,7 +501,7 @@ void ArbitraryDomain::LinearInterpolation(int idx, int idy, int idz, double& W,
     std::multimap < std::tuple<int, int, int>, double >::iterator itrH, itrL;
 
     std::tuple<int, int, int> coordxyz(idx, idy, idz);
-             
+
     //check if z is inside with x,y coords
     itrH = IntersectHiZ.find(coordxyz);
     itrL = IntersectLoZ.find(coordxyz);
@@ -544,7 +544,7 @@ void ArbitraryDomain::LinearInterpolation(int idx, int idy, int idz, double& W,
 
     // we are a right boundary point
     if(dx >= 0 && dx > cx)
-    {	
+    {
         C += 1/((dx-cx)*de);
         E = 0.0;
     } else {
@@ -582,7 +582,7 @@ void ArbitraryDomain::LinearInterpolation(int idx, int idy, int idz, double& W,
         S = -1/(ds*ds);
     }
 
-    F = -1/(hr[2]*hr[2]); 
+    F = -1/(hr[2]*hr[2]);
     B = -1/(hr[2]*hr[2]);
 
     //XXX: In stand-alone only Dirichlet for validation purposes
@@ -594,13 +594,13 @@ void ArbitraryDomain::LinearInterpolation(int idx, int idy, int idz, double& W,
         //C += 1/hr[2]*1/hr[2];
 
         // case where we are on the Neumann BC in Z-direction
-        // where we distinguish two cases  
+        // where we distinguish two cases
         if(z == 0)
             F = 0.0;
-        else 
+        else
             B = 0.0;
 
-        //for test no neumann 
+        //for test no neumann
         //C += 2/((hr[2]*nr[2]/2.0) * hr[2]);
         //
         //   double d = hr[2]*(nr[2])/2;
@@ -616,10 +616,10 @@ void ArbitraryDomain::LinearInterpolation(int idx, int idy, int idz, double& W,
 
         scaleFactor *= 0.5;
 
-    } else 
+    } else
         C += 2*1/hr[2]*1/hr[2];
 }
-*/        
+*/
 
 void ArbitraryDomain::getNeighbours(int id, int &W, int &E, int &S, int &N, int &F, int &B) {
 
@@ -638,7 +638,7 @@ void ArbitraryDomain::getNeighbours(int idx, int idy, int idz, int &W, int &E, i
     F = getIdx(idx, idy, idz - 1);
     B = getIdx(idx, idy, idz + 1);
 
-    if(!isInside(idx+1,idy,idz)) 
+    if(!isInside(idx+1,idy,idz))
         E = -1;
 
     if(!isInside(idx-1,idy,idz))
@@ -647,14 +647,14 @@ void ArbitraryDomain::getNeighbours(int idx, int idy, int idz, int &W, int &E, i
     if(!isInside(idx,idy+1,idz))
         N = -1;
 
-    if(!isInside(idx,idy-1,idz)) 
+    if(!isInside(idx,idy-1,idz))
         S = -1;
-    
-    if(!isInside(idx,idy,idz-1)) 
-	F = -1;	
 
-    if(!isInside(idx,idy,idz+1)) 
-	B = -1;	
+    if(!isInside(idx,idy,idz-1))
+	F = -1;
+
+    if(!isInside(idx,idy,idz+1))
+	B = -1;
 
 }
 
@@ -671,31 +671,31 @@ inline void ArbitraryDomain::rotateWithQuaternion(Vector_t & v, Vektor<double, 4
 
     Vector_t const quaternionVectorComponent = Vector_t(quaternion(1), quaternion(2), quaternion(3));
     double const quaternionScalarComponent = quaternion(0);
-        
-    v = 2.0 * dot(quaternionVectorComponent, v) * quaternionVectorComponent 
-        + (quaternionScalarComponent * quaternionScalarComponent  
-        -  dot(quaternionVectorComponent, quaternionVectorComponent)) * v 
+
+    v = 2.0 * dot(quaternionVectorComponent, v) * quaternionVectorComponent
+        + (quaternionScalarComponent * quaternionScalarComponent
+        -  dot(quaternionVectorComponent, quaternionVectorComponent)) * v
         + 2.0 * quaternionScalarComponent * cross(quaternionVectorComponent, v);
 }
 
 inline void ArbitraryDomain::rotateXAxisWithQuaternion(Vector_t & v, Vektor<double, 4> const quaternion) {
     // rotates the positive xaxis using a quaternion.
-   
-    v(0) = quaternion(0) * quaternion(0) 
-         + quaternion(1) * quaternion(1) 
-         - quaternion(2) * quaternion(2) 
+
+    v(0) = quaternion(0) * quaternion(0)
+         + quaternion(1) * quaternion(1)
+         - quaternion(2) * quaternion(2)
          - quaternion(3) * quaternion(3);
- 
+
     v(1) = 2.0 * (quaternion(1) * quaternion(2) + quaternion(0) * quaternion(3));
     v(2) = 2.0 * (quaternion(1) * quaternion(3) - quaternion(0) * quaternion(2));
 }
 
 inline void ArbitraryDomain::rotateYAxisWithQuaternion(Vector_t & v, Vektor<double, 4> const quaternion) {
     // rotates the positive yaxis using a quaternion.
-    
+
     v(0) = 2.0 * (quaternion(1) * quaternion(2) - quaternion(0) * quaternion(3));
-      
-    v(1) = quaternion(0) * quaternion(0) 
+
+    v(1) = quaternion(0) * quaternion(0)
          - quaternion(1) * quaternion(1)
          + quaternion(2) * quaternion(2)
          - quaternion(3) * quaternion(3);
@@ -706,9 +706,9 @@ inline void ArbitraryDomain::rotateYAxisWithQuaternion(Vector_t & v, Vektor<doub
 inline void ArbitraryDomain::rotateZAxisWithQuaternion(Vector_t & v, Vektor<double, 4> const quaternion) {
     // rotates the positive zaxis using a quaternion.
     v(0) = 2.0 * (quaternion(1) * quaternion(3) + quaternion(0) * quaternion(2));
-    v(1) = 2.0 * (quaternion(2) * quaternion(3) - quaternion(0) * quaternion(1));    
+    v(1) = 2.0 * (quaternion(2) * quaternion(3) - quaternion(0) * quaternion(1));
 
-    v(2) = quaternion(0) * quaternion(0) 
+    v(2) = quaternion(0) * quaternion(0)
          - quaternion(1) * quaternion(1)
          - quaternion(2) * quaternion(2)
          + quaternion(3) * quaternion(3);
diff --git a/src/Solvers/BoxCornerDomain.cpp b/src/Solvers/BoxCornerDomain.cpp
index 4b41836ac4d339f7d7cc53ccb870b354e482d6dd..b1101935fc7d35dd54e91ed20099da976234addf 100644
--- a/src/Solvers/BoxCornerDomain.cpp
+++ b/src/Solvers/BoxCornerDomain.cpp
@@ -1,4 +1,6 @@
 #ifdef HAVE_SAAMG_SOLVER
+#include "Solvers/BoxCornerDomain.h"
+
 #include <map>
 #include <string>
 #include <cmath>
@@ -7,8 +9,6 @@
 
 //FIXME: ORDER HOW TO TRAVERSE NODES IS FIXED, THIS SHOULD BE MORE GENERIC! (PLACES MARKED)
 
-#include "BoxCornerDomain.h"
-
 extern Inform *gmsg;
 
 BoxCornerDomain::BoxCornerDomain(Vector_t nr, Vector_t hr) {
diff --git a/src/Solvers/EllipticDomain.cpp b/src/Solvers/EllipticDomain.cpp
index 3735f6dc7ae48860fe32403776717faf60730708..d20d5e71f3043abaaafc0f16513ac9d51b07a27d 100644
--- a/src/Solvers/EllipticDomain.cpp
+++ b/src/Solvers/EllipticDomain.cpp
@@ -1,5 +1,7 @@
 #ifdef HAVE_SAAMG_SOLVER
 
+#include "Solvers/EllipticDomain.h"
+
 #include <map>
 #include <cmath>
 #include <iostream>
@@ -7,7 +9,6 @@
 
 //FIXME: ORDER HOW TO TRAVERSE NODES IS FIXED, THIS SHOULD BE MORE GENERIC! (PLACES MARKED)
 
-#include "EllipticDomain.h"
 
 EllipticDomain::EllipticDomain(Vector_t nr, Vector_t hr) {
     setNr(nr);
diff --git a/src/Solvers/FFTBoxPoissonSolver.cpp b/src/Solvers/FFTBoxPoissonSolver.cpp
index b6bb1da281368d0c47d39b410a6284cd4dbba829..648fcd01b8d4ab576708a0f4006d60ef55f6c676 100644
--- a/src/Solvers/FFTBoxPoissonSolver.cpp
+++ b/src/Solvers/FFTBoxPoissonSolver.cpp
@@ -8,8 +8,9 @@
  ***************************************************************************/
 
 // include files
+#include "Solvers/FFTBoxPoissonSolver.h"
+
 #include "Algorithms/PartBunch.h"
-#include "FFTBoxPoissonSolver.h"
 #include "Physics/Physics.h"
 #include <fstream>
 //////////////////////////////////////////////////////////////////////////////
diff --git a/src/Solvers/FFTPoissonSolver.cpp b/src/Solvers/FFTPoissonSolver.cpp
index 0ca2c07021cde4dcf1c9ddfaaa49552b92fbdd11..874e3193207aa5548f45751f5ede4b9691c1cc3e 100644
--- a/src/Solvers/FFTPoissonSolver.cpp
+++ b/src/Solvers/FFTPoissonSolver.cpp
@@ -13,7 +13,7 @@
  ***************************************************************************/
 
 // include files
-#include "FFTPoissonSolver.h"
+#include "Solvers/FFTPoissonSolver.h"
 #include "Algorithms/PartBunch.h"
 #include "Physics/Physics.h"
 #include <fstream>
@@ -57,9 +57,9 @@ FFTPoissonSolver::FFTPoissonSolver(Mesh_t *mesh, FieldLayout_t *fl, std::string
     layout4_m(nullptr),
     greensFunction_m(greensFunction) {
     int i;
-    
+
     bcz_m = (bcz==std::string("PERIODIC"));   // for DC beams, the z direction has periodic boundary conditions
-	
+
     domain_m = layout_m->getDomain();
 
     // For efficiency in the FFT's, we can use a parallel decomposition
@@ -90,13 +90,13 @@ FFTPoissonSolver::FFTPoissonSolver(Mesh_t *mesh, FieldLayout_t *fl, std::string
       for(i = 0; i < 2 * 3; ++i) {
         bc_m[i] = new ZeroFace<double, 3, Mesh_t, Center_t>(i);
         vbc_m[i] = new ZeroFace<Vector_t, 3, Mesh_t, Center_t>(i);
-      }    
+      }
       // z-direction
       bc_m[4] = new ParallelPeriodicFace<double,3,Mesh_t,Center_t>(4);
       bc_m[5] = new ParallelPeriodicFace<double,3,Mesh_t,Center_t>(5);
       vbc_m[4] = new ZeroFace<Vector_t, 3, Mesh_t, Center_t>(4);
       vbc_m[5] = new ZeroFace<Vector_t, 3, Mesh_t, Center_t>(5);
-    } 
+    }
     else {
       // The FFT's require double-sized field sizes in order to
       // simulate an isolated system.  The FFT of the charge density field, rho,
@@ -112,7 +112,7 @@ FFTPoissonSolver::FFTPoissonSolver(Mesh_t *mesh, FieldLayout_t *fl, std::string
       for(i = 0; i < 2 * 3; ++i) {
         bc_m[i] = new ZeroFace<double, 3, Mesh_t, Center_t>(i);
         vbc_m[i] = new ZeroFace<Vector_t, 3, Mesh_t, Center_t>(i);
-      }    
+      }
     }
 
     // create double sized mesh and layout objects for the use in the FFT's
@@ -135,7 +135,7 @@ FFTPoissonSolver::FFTPoissonSolver(Mesh_t *mesh, FieldLayout_t *fl, std::string
     // complex transformed fields
     mesh3_m = std::unique_ptr<Mesh_t>(new Mesh_t(domain3_m));
     layout3_m = std::unique_ptr<FieldLayout_t>(new FieldLayout_t(*mesh3_m, decomp2));
- 
+
     rho2tr_m.initialize(*mesh3_m, *layout3_m);
     imgrho2tr_m.initialize(*mesh3_m, *layout3_m);
     grntr_m.initialize(*mesh3_m, *layout3_m);
@@ -674,4 +674,3 @@ Inform &FFTPoissonSolver::print(Inform &os) const {
  * $RCSfile: FFTPoissonSolver.cc,v $   $Author: adelmann $
  * $Revision: 1.6 $   $Date: 2001/08/16 09:36:08 $
  ***************************************************************************/
-
diff --git a/src/Solvers/MGPoissonSolver.cpp b/src/Solvers/MGPoissonSolver.cpp
index a33fd1380c61e83603070a1d6f0f89573bebb3df..67ae24a7970d4c4b3e177d940f225d163fc080f1 100644
--- a/src/Solvers/MGPoissonSolver.cpp
+++ b/src/Solvers/MGPoissonSolver.cpp
@@ -1,7 +1,7 @@
 #ifdef HAVE_SAAMG_SOLVER
 #define DBG_STENCIL
 
-#include "MGPoissonSolver.h"
+#include "Solvers/MGPoissonSolver.h"
 
 #include "Structure/BoundaryGeometry.h"
 #include "ArbitraryDomain.h"
diff --git a/src/Solvers/RectangularDomain.cpp b/src/Solvers/RectangularDomain.cpp
index 2ec7b98518511d05d613bf479be5cfd6ddbe2846..e8cd2baa8c7e25baca36648df01f5bba26bde601 100644
--- a/src/Solvers/RectangularDomain.cpp
+++ b/src/Solvers/RectangularDomain.cpp
@@ -1,6 +1,6 @@
 #ifdef HAVE_SAAMG_SOLVER
 
-#include "RectangularDomain.h"
+#include "Solvers/RectangularDomain.h"
 
 RectangularDomain::RectangularDomain(Vector_t nr, Vector_t hr) {
     setNr(nr);
diff --git a/src/Solvers/TaperDomain.cpp b/src/Solvers/TaperDomain.cpp
index a2774a7bf2dcef5d2d6a73c750f013091219272f..2514ea4df32ab81673cee5a95236c4354c9e2a56 100644
--- a/src/Solvers/TaperDomain.cpp
+++ b/src/Solvers/TaperDomain.cpp
@@ -1,6 +1,6 @@
 #ifdef HAVE_SAAMG_SOLVER
 
-#include "TaperDomain.h"
+#include "Solvers/TaperDomain.h"
 
 TaperDomain::TaperDomain(Vector_t nr, Vector_t hr) {
     setNr(nr);
diff --git a/src/Structure/BoundaryGeometry.cpp b/src/Structure/BoundaryGeometry.cpp
index deaa268727699cef193879f96b65c3cf716ab54c..e7490df0d243a7581efa7c822ec4dd48cd0bea7f 100644
--- a/src/Structure/BoundaryGeometry.cpp
+++ b/src/Structure/BoundaryGeometry.cpp
@@ -6,11 +6,12 @@
 
 #define   ENABLE_DEBUG
 
+#include "Structure/BoundaryGeometry.h"
+
 #include <fstream>
 
 #include "H5hut.h"
 
-#include "Structure/BoundaryGeometry.h"
 #include "Structure/PriEmissionPhysics.h"
 #include "Expressions/SRefExpr.h"
 #include "Elements/OpalBeamline.h"
diff --git a/src/Structure/DataSink.cpp b/src/Structure/DataSink.cpp
index fc4f970b7fb8715d6b7edddaa13aa3ac269433bb..ea4a05c3369bff23d500bb378c11a1f065b22e8f 100644
--- a/src/Structure/DataSink.cpp
+++ b/src/Structure/DataSink.cpp
@@ -2,9 +2,9 @@
 //  Copyright & License: See Copyright.readme in src directory
 //
 
-#include "config.h"
-#include "DataSink.h"
+#include "Structure/DataSink.h"
 
+#include "config.h"
 #include "Algorithms/bet/EnvelopeBunch.h"
 #include "AbstractObjects/OpalData.h"
 #include "Utilities/Options.h"
@@ -28,7 +28,7 @@ using namespace std;
 
 DataSink::DataSink() :
     lossWrCounter_m(0),
-    doHDF5_m(true) 
+    doHDF5_m(true)
 {
     /// Constructor steps:
     /// Get timers from IPPL.
@@ -48,9 +48,9 @@ DataSink::DataSink() :
     lBalFileName_m = fn + string(".lbal");
 
     fn += string(".h5");
-    
+
     doHDF5_m = Options::enableHDF5;
-	
+
     if (doHDF5_m) {
         /// Open H5 file. Check that it opens correctly.
 #ifdef PARALLEL_IO
@@ -74,9 +74,9 @@ DataSink::DataSink() :
 
 DataSink::DataSink(int restartStep) :
     lossWrCounter_m(0)
-{		
+{
     doHDF5_m = Options::enableHDF5;
-    if (!doHDF5_m) {	
+    if (!doHDF5_m) {
       ERRORMSG ("Can not restart when HDF5 is disabled" << endl);
       exit(1);
     }
@@ -133,7 +133,7 @@ DataSink::DataSink(int restartStep) :
     int numStepsInFile = H5GetNumSteps(H5file_m);
 
     *gmsg << "numStepsInFile " << numStepsInFile << endl;
-    
+
     if(restartStep == -1) {
       restartStep = numStepsInFile;
     }
@@ -161,9 +161,9 @@ DataSink::~DataSink() {
 }
 
 void DataSink::writeH5FileAttributes() {
- 
+
     if (!doHDF5_m) return;
-	
+
 	h5_int64_t rc;
     /// Function steps:
 
@@ -445,7 +445,7 @@ void DataSink::writeH5FileAttributes() {
 }
 
 void DataSink::retriveCavityInformation(string fn) {
-	
+
   h5_int64_t rc;
   h5_int64_t nAutoPhaseCavities = 0;
   rc = H5ReadFileAttribInt64(H5file_m, "nAutoPhaseCavities", &nAutoPhaseCavities);
@@ -549,7 +549,7 @@ int DataSink::storeFieldmaps() {
 }
 
 void DataSink::writePhaseSpace(PartBunch &beam, Vector_t FDext[], double sposHead, double sposRef, double sposTail) {
-  
+
 	if (!doHDF5_m) return;
 
 	h5_int64_t rc;
@@ -651,7 +651,7 @@ void DataSink::writePhaseSpace(PartBunch &beam, Vector_t FDext[], double sposHea
     rc = H5WriteStepAttribFloat64(H5file_m, "minP", (h5_float64_t *)&minP, 3);
     if(rc != H5_SUCCESS)
         ERRORMSG("H5 rc= " << rc << " in " << __FILE__ << " @ line " << __LINE__ << endl);
-     
+
     rc = H5WriteStepAttribFloat64(H5file_m, "#varepsilon-geom", (h5_float64_t *)&geomvareps, 3);
     if(rc != H5_SUCCESS)
         ERRORMSG("H5 rc= " << rc << " in " << __FILE__ << " @ line " << __LINE__ << endl);
@@ -683,12 +683,12 @@ void DataSink::writePhaseSpace(PartBunch &beam, Vector_t FDext[], double sposHea
     rc = H5WriteStepAttribFloat64(H5file_m, "RefPartR", (h5_float64_t *)&RefPartR, 3);
     if(rc != H5_SUCCESS)
         ERRORMSG("H5 rc= " << rc << " in " << __FILE__ << " @ line " << __LINE__ << endl);
-    
+
     rc = H5WriteStepAttribFloat64(H5file_m, "RefPartP", (h5_float64_t *)&RefPartP, 3);
     if(rc != H5_SUCCESS)
         ERRORMSG("H5 rc= " << rc << " in " << __FILE__ << " @ line " << __LINE__ << endl);
 
-    // scalar values 
+    // scalar values
 
     rc = H5WriteStepAttribFloat64(H5file_m, "SPOS",     &actPos, 1);
     if(rc != H5_SUCCESS)
@@ -705,7 +705,7 @@ void DataSink::writePhaseSpace(PartBunch &beam, Vector_t FDext[], double sposHea
     rc = H5WriteStepAttribFloat64(H5file_m, "TIME",     &t, 1);
     if(rc != H5_SUCCESS)
         ERRORMSG("H5 rc= " << rc << " in " << __FILE__ << " @ line " << __LINE__ << endl);
- 
+
     rc = H5WriteStepAttribFloat64(H5file_m, "ENERGY",   &meanEnergy, 1);
     if(rc != H5_SUCCESS)
         ERRORMSG("H5 rc= " << rc << " in " << __FILE__ << " @ line " << __LINE__ << endl);
@@ -733,7 +733,7 @@ void DataSink::writePhaseSpace(PartBunch &beam, Vector_t FDext[], double sposHea
 
     rc = H5WriteStepAttribFloat64(H5file_m, "Q", &Q, 1);
     if(rc != H5_SUCCESS)
-        ERRORMSG("H5 rc= " << rc << " in " << __FILE__ << " @ line " << __LINE__ << endl);    
+        ERRORMSG("H5 rc= " << rc << " in " << __FILE__ << " @ line " << __LINE__ << endl);
 
     rc = H5WriteStepAttribFloat64(H5file_m, "spos-head", &sposHead, 1);
     if(rc != H5_SUCCESS)
@@ -745,24 +745,24 @@ void DataSink::writePhaseSpace(PartBunch &beam, Vector_t FDext[], double sposHea
     if(rc != H5_SUCCESS)
         ERRORMSG("H5 rc= " << rc << " in " << __FILE__ << " @ line " << __LINE__ << endl);
 
-    /* 
-       Attributes originally not in OPAL-t 
+    /*
+       Attributes originally not in OPAL-t
 
     */
 
     h5_int64_t numBunch = 1;
     h5_int64_t SteptoLastInj = 0;
-    
+
     rc = H5WriteStepAttribInt64(H5file_m, "NumBunch",         &numBunch, 1);
     if(rc != H5_SUCCESS)
         ERRORMSG("H5 rc= " << rc << " in " << __FILE__ << " @ line " << __LINE__ << endl);
-    
+
     rc = H5WriteStepAttribInt64(H5file_m, "SteptoLastInj",    &SteptoLastInj, 1);
     if(rc != H5_SUCCESS)
         ERRORMSG("H5 rc= " << rc << " in " << __FILE__ << " @ line " << __LINE__ << endl);
 
-    /* 
-       Done attributes originally not in OPAL-t 
+    /*
+       Done attributes originally not in OPAL-t
 
     */
 
@@ -927,13 +927,13 @@ void DataSink::writePhaseSpace(PartBunch &beam, Vector_t FDext[], double sposHea
 
 
 
-int DataSink::writePhaseSpace_cycl(PartBunch &beam, Vector_t FDext[], double meanEnergy, 
-                                   double refPr, double refPt, double refPz, 
+int DataSink::writePhaseSpace_cycl(PartBunch &beam, Vector_t FDext[], double meanEnergy,
+                                   double refPr, double refPt, double refPz,
                                    double refR, double refTheta, double refZ,
                                    double azimuth, double elevation) {
-    
+
   if (!doHDF5_m) return -1;
-  //if (beam.getLocalNum() == 0) return -1; //TEMP for testing -DW 
+  //if (beam.getLocalNum() == 0) return -1; //TEMP for testing -DW
 
   h5_int64_t rc;
   IpplTimings::startTimer(H5PartTimer_m);
@@ -950,29 +950,29 @@ int DataSink::writePhaseSpace_cycl(PartBunch &beam, Vector_t FDext[], double mea
   Vektor<double, 3 > psigma = beam.get_prms();
   Vektor<double, 3 > geomvareps = beam.get_emit();
   Vektor<double, 3 > vareps = beam.get_norm_emit();
-  
+
   Vektor<double, 3 > RefPartR = beam.RefPart_R;
   Vektor<double, 3 > RefPartP = beam.RefPart_P;
 
   double energySpread = beam.getdE();
-  
+
   double sigma = ((xsigma[0] * xsigma[0]) + (xsigma[1] * xsigma[1])) /
     (2.0 * beam.get_gamma() * 17.0e3 * ((geomvareps[0] * geomvareps[0]) + (geomvareps[1] * geomvareps[1])));
-  
+
   Vektor< double, 3 >  maxP(0.0);
-  Vektor< double, 3 >  minP(0.0);    
+  Vektor< double, 3 >  minP(0.0);
   beam.get_PBounds(minP, maxP);
-  
+
   std::unique_ptr<char[]> varray(new char[(nLoc)*sizeof(double)]);
   double *farray = reinterpret_cast<double *>(varray.get());
   h5_int64_t *larray = reinterpret_cast<h5_int64_t *>(varray.get());
-  
+
   double  pathLength = beam.getLPath();
   h5_int64_t localTrackStep = (h5_int64_t)beam.getLocalTrackStep();
   h5_int64_t globalTrackStep = (h5_int64_t)beam.getGlobalTrackStep();
   h5_int64_t numBunch = (h5_int64_t)beam.getNumBunch();
   h5_int64_t SteptoLastInj = (h5_int64_t)beam.getSteptoLastInj();
-    
+
     ///Get the particle decomposition from all the compute nodes.
     std::unique_ptr<size_t[]> locN(new size_t[Ippl::getNodes()]);
     std::unique_ptr<size_t[]> globN(new size_t[Ippl::getNodes()]);
@@ -982,9 +982,9 @@ int DataSink::writePhaseSpace_cycl(PartBunch &beam, Vector_t FDext[], double mea
     }
     locN[Ippl::myNode()] = nLoc;
     reduce(locN.get(), locN.get() + Ippl::getNodes(), globN.get(), OpAddAssign());
-    
+
     /* ------------------------------------------------------------------------ */
-    
+
     rc = H5SetStep(H5file_m, H5call_m);
     if(rc != H5_SUCCESS)
         ERRORMSG("H5 rc= " << rc << " in " << __FILE__ << " @ line " << __LINE__ << endl);
@@ -1061,7 +1061,7 @@ int DataSink::writePhaseSpace_cycl(PartBunch &beam, Vector_t FDext[], double mea
     if(rc != H5_SUCCESS)
         ERRORMSG("H5 rc= " << rc << " in " << __FILE__ << " @ line " << __LINE__ << endl);
 
-    rc = H5WriteStepAttribFloat64(H5file_m, "B-ref", (h5_float64_t *)&FDext[0], 3);    
+    rc = H5WriteStepAttribFloat64(H5file_m, "B-ref", (h5_float64_t *)&FDext[0], 3);
     if(rc != H5_SUCCESS)
         ERRORMSG("H5 rc= " << rc << " in " << __FILE__ << " @ line " << __LINE__ << endl);
 
@@ -1088,7 +1088,7 @@ int DataSink::writePhaseSpace_cycl(PartBunch &beam, Vector_t FDext[], double mea
     rc = H5WriteStepAttribFloat64(H5file_m, "RefPartR", (h5_float64_t *)&RefPartR, 3);
     if(rc != H5_SUCCESS)
         ERRORMSG("H5 rc= " << rc << " in " << __FILE__ << " @ line " << __LINE__ << endl);
-    
+
     rc = H5WriteStepAttribFloat64(H5file_m, "RefPartP", (h5_float64_t *)&RefPartP, 3);
     if(rc != H5_SUCCESS)
         ERRORMSG("H5 rc= " << rc << " in " << __FILE__ << " @ line " << __LINE__ << endl);
@@ -1119,8 +1119,8 @@ int DataSink::writePhaseSpace_cycl(PartBunch &beam, Vector_t FDext[], double mea
 
     rc = H5WriteStepAttribFloat64(H5file_m, "AZIMUTH", (h5_float64_t *)&azimuth, 1);
     if(rc != H5_SUCCESS)
-        ERRORMSG("H5 rc= " << rc << " in " << __FILE__ << " @ line " << __LINE__ << endl); 
-   
+        ERRORMSG("H5 rc= " << rc << " in " << __FILE__ << " @ line " << __LINE__ << endl);
+
     rc = H5WriteStepAttribFloat64(H5file_m, "ELEVATION", (h5_float64_t *)&elevation, 1);
     if(rc != H5_SUCCESS)
         ERRORMSG("H5 rc= " << rc << " in " << __FILE__ << " @ line " << __LINE__ << endl);
@@ -1135,7 +1135,7 @@ int DataSink::writePhaseSpace_cycl(PartBunch &beam, Vector_t FDext[], double mea
 
     rc = H5WriteStepAttribFloat64(H5file_m, "Q", &Q, 1);
     if(rc != H5_SUCCESS)
-        ERRORMSG("H5 rc= " << rc << " in " << __FILE__ << " @ line " << __LINE__ << endl);    
+        ERRORMSG("H5 rc= " << rc << " in " << __FILE__ << " @ line " << __LINE__ << endl);
 
 
     rc = H5WriteStepAttribInt64(H5file_m, "NumBunch",         &numBunch, 1);
@@ -1147,11 +1147,11 @@ int DataSink::writePhaseSpace_cycl(PartBunch &beam, Vector_t FDext[], double mea
         ERRORMSG("H5 rc= " << rc << " in " << __FILE__ << " @ line " << __LINE__ << endl);
 
 
-    /* 
+    /*
        Attributes originally not in OPAL-cycl
     */
 
-    double sposHead = 0.0; 
+    double sposHead = 0.0;
     double sposRef = 0.0;
     double sposTail = 0.0;
     rc = H5WriteStepAttribFloat64(H5file_m, "spos-head", &sposHead, 1);
@@ -1164,8 +1164,8 @@ int DataSink::writePhaseSpace_cycl(PartBunch &beam, Vector_t FDext[], double mea
     if(rc != H5_SUCCESS)
         ERRORMSG("H5 rc= " << rc << " in " << __FILE__ << " @ line " << __LINE__ << endl);
 
-    /* 
-       Done attributes originally not in OPAL-cycl 
+    /*
+       Done attributes originally not in OPAL-cycl
     */
 
     setOPALcycl();
@@ -1239,13 +1239,13 @@ int DataSink::writePhaseSpace_cycl(PartBunch &beam, Vector_t FDext[], double mea
         rc = H5PartWriteDataFloat64(H5file_m, "Ex", farray);
         if(rc != H5_SUCCESS)
             ERRORMSG("H5 rc= " << rc << " in " << __FILE__ << " @ line " << __LINE__ << endl);
-        
+
         for(size_t i = 0; i < nLoc; i++)
             farray[i] =  beam.Ef[i](1);
         rc = H5PartWriteDataFloat64(H5file_m, "Ey", farray);
         if(rc != H5_SUCCESS)
             ERRORMSG("H5 rc= " << rc << " in " << __FILE__ << " @ line " << __LINE__ << endl);
-        
+
         for(size_t i = 0; i < nLoc; i++)
             farray[i] =  beam.Ef[i](2);
         rc = H5PartWriteDataFloat64(H5file_m, "Ez", farray);
@@ -1263,7 +1263,7 @@ int DataSink::writePhaseSpace_cycl(PartBunch &beam, Vector_t FDext[], double mea
         rc = H5PartWriteDataFloat64(H5file_m, "By", farray);
         if(rc != H5_SUCCESS)
             ERRORMSG("H5 rc= " << rc << " in " << __FILE__ << " @ line " << __LINE__ << endl);
-        
+
         for(size_t i = 0; i < nLoc; i++)
             farray[i] =  beam.Bf[i](2);
         rc = H5PartWriteDataFloat64(H5file_m, "Bz", farray);
@@ -1329,7 +1329,7 @@ int DataSink::writePhaseSpace_cycl(PartBunch &beam, Vector_t FDext[], double mea
 void DataSink::writePhaseSpaceEnvelope(EnvelopeBunch &beam, Vector_t FDext[], double sposHead, double sposRef, double sposTail) {
 
     if (!doHDF5_m) return;
-	
+
 	h5_int64_t rc;
     /// Function steps:
 
@@ -1576,7 +1576,7 @@ void DataSink::writePhaseSpaceEnvelope(EnvelopeBunch &beam, Vector_t FDext[], do
 void DataSink::stashPhaseSpaceEnvelope(EnvelopeBunch &beam, Vector_t FDext[], double sposHead, double sposRef, double sposTail) {
 
 	if (!doHDF5_m) return;
-	 
+
 	/// Start timer.
     IpplTimings::startTimer(H5PartTimer_m);
 
@@ -1665,9 +1665,9 @@ void DataSink::stashPhaseSpaceEnvelope(EnvelopeBunch &beam, Vector_t FDext[], do
 }
 
 void DataSink::dumpStashedPhaseSpaceEnvelope() {
-    
+
 	if (!doHDF5_m) return;
-	
+
 	h5_int64_t rc;
     /// Start timer.
     IpplTimings::startTimer(H5PartTimer_m);
@@ -1836,13 +1836,13 @@ void DataSink::doWriteStatData(PartBunch &beam, Vector_t FDext[], double sposHea
     /// Calculate beam statistics and gather load balance statistics.
     beam.calcBeamParameters();
     beam.gatherLoadBalanceStatistics();
-    
+
     double  pathLength = 0.0;
     if (OpalData::getInstance()->isInOPALCyclMode())
       pathLength = beam.getLPath();
     else
       pathLength = sposRef;
-    
+
     /// Write data to files. If this is the first write to the beam statistics file, write SDDS
     /// header information.
     ofstream os_statData;
@@ -2323,9 +2323,9 @@ void DataSink::writePartlossZASCII(PartBunch &beam, BoundaryGeometry &bg, string
 }
 
 void DataSink::writeSurfaceInteraction(PartBunch &beam, long long &step, BoundaryGeometry &bg, string fn) {
- 
+
 	if (!doHDF5_m) return;
-	
+
 	h5_int64_t rc;
     /// Start timer.
     IpplTimings::startTimer(H5PartTimer_m);
@@ -2552,7 +2552,7 @@ void DataSink::writeGeomToVtk(BoundaryGeometry &bg, string fn) {
 void DataSink::storeOneBunch(const PartBunch &beam, const string fn_appendix) {
 
 	if (!doHDF5_m) return;
-	
+
     h5_int64_t rc;
     /// Define file names.
     string fn = OpalData::getInstance()->getInputBasename();
@@ -2690,7 +2690,7 @@ void DataSink::storeOneBunch(const PartBunch &beam, const string fn_appendix) {
 bool DataSink::readOneBunch(PartBunch &beam, const string fn_appendix, const size_t BinID) {
 
     if (!doHDF5_m) return false;
-	
+
     h5_int64_t rc;
     /// Define file names.
     string fn = OpalData::getInstance()->getInputBasename();
@@ -2811,7 +2811,7 @@ bool DataSink::readOneBunch(PartBunch &beam, const string fn_appendix, const siz
 }
 
 /** \brief Find out which if we write HDF5 or not
- *   
+ *
  *
  *
  */
@@ -2843,7 +2843,7 @@ bool DataSink::isOPALt() {
 void DataSink::setOPALcycl() {
 
     if (!doHDF5_m) return;
-	
+
 	string OPALFlavour("opal-cycl");
     h5_int64_t rc = H5WriteStepAttribString(H5file_m, "OPAL_flavour", OPALFlavour.c_str());
     if(rc != H5_SUCCESS)
@@ -2856,9 +2856,9 @@ void DataSink::setOPALcycl() {
  *
  */
 void DataSink::setOPALt() {
-  
+
 	if (!doHDF5_m) return;
-	
+
 	string OPALFlavour("opal-t");
     h5_int64_t rc = H5WriteStepAttribString(H5file_m, "OPAL_flavour", OPALFlavour.c_str());
     if(rc != H5_SUCCESS)
@@ -2869,5 +2869,3 @@ void DataSink::setOPALt() {
  * $RCSfile: DataSink.cpp,v $   $Author: adelmann $
  * $Revision: 1.3 $   $Date: 2004/06/02 19:38:54 $
  ***************************************************************************/
-
-
diff --git a/src/Structure/LossDataSink.cpp b/src/Structure/LossDataSink.cpp
index d9822ec5dcd8e649552b2b8cadab1e477377de60..1f7a88331729848d831a2f5b82d19685fe5381bc 100644
--- a/src/Structure/LossDataSink.cpp
+++ b/src/Structure/LossDataSink.cpp
@@ -1,6 +1,7 @@
+#include <Structure/LossDataSink.h>
+
 #include "Ippl.h"
 #include "Algorithms/PBunchDefs.h"
-#include <Structure/LossDataSink.h>
 #include "Utilities/Options.h"
 
 using namespace Options;
@@ -50,7 +51,7 @@ void LossDataSink::openH5() {
 #else
     H5file_m = H5OpenFile(fn_m.c_str(), H5_O_WRONLY, 0);
 #endif
-    
+
     if(!H5file_m) {
         ERRORMSG("h5 file open failed: exiting!" << endl);
         exit(0);
@@ -58,7 +59,7 @@ void LossDataSink::openH5() {
 }
 
 void LossDataSink::writeHeaderH5() {
-	
+
     h5_int64_t rc;
     // Write file attributes to describe phase space to H5 file.
     std::stringstream OPAL_version;
@@ -142,7 +143,7 @@ void LossDataSink::save() {
 
     if (element_m == std::string("")) return;
 
-    if (hasNoParticlesToDump()) return;  
+    if (hasNoParticlesToDump()) return;
 
     if (h5hut_mode_m) {
 
@@ -161,7 +162,7 @@ void LossDataSink::save() {
 
         fn_m = element_m + std::string(".loss");
         INFOMSG("Save " << fn_m << endl);
-        if(OpalData::getInstance()->inRestartRun()) 
+        if(OpalData::getInstance()->inRestartRun())
 	    append();
         else
 	    open();
@@ -180,13 +181,13 @@ void LossDataSink::save() {
     pz_m.clear();
     id_m.clear();
     turn_m.clear();
-    time_m.clear();        
+    time_m.clear();
 }
 
 // Note: This was changed to calculate the global number of dumped particles
-// because there are two cases to be considered: 
-// 1. ALL nodes have 0 lost particles -> nothing to be done. 
-// 2. Some nodes have 0 lost particles, some not -> H5 can handle that but all 
+// because there are two cases to be considered:
+// 1. ALL nodes have 0 lost particles -> nothing to be done.
+// 2. Some nodes have 0 lost particles, some not -> H5 can handle that but all
 // nodes HAVE to participate, otherwise H5 waits endlessly for a response from
 // the nodes that didn't enter the saveH5 function. -DW
 bool LossDataSink::hasNoParticlesToDump() {
@@ -204,21 +205,21 @@ void LossDataSink::saveH5() {
     size_t nLoc = x_m.size();
 
     INFOMSG("saveH5 n = " << nLoc << endl);
-    
+
     std::unique_ptr<char[]> varray(new char[(nLoc)*sizeof(double)]);
     double *farray = reinterpret_cast<double *>(varray.get());
     h5_int64_t *larray = reinterpret_cast<h5_int64_t *>(varray.get());
-    
+
     std::unique_ptr<size_t[]> locN(new size_t[Ippl::getNodes()]);
     std::unique_ptr<size_t[]> globN(new size_t[Ippl::getNodes()]);
-    
+
     for(int i = 0; i < Ippl::getNodes(); i++) {
         globN[i] = locN[i] = 0;
     }
-    
+
     locN[Ippl::myNode()] = nLoc;
     reduce(locN.get(), locN.get() + Ippl::getNodes(), globN.get(), OpAddAssign());
-    
+
     /// Set current record/time step.
     rc = H5SetStep(H5file_m, 0);
     if(rc != H5_SUCCESS)
@@ -226,26 +227,26 @@ void LossDataSink::saveH5() {
     rc = H5PartSetNumParticles(H5file_m, nLoc);
     if(rc != H5_SUCCESS)
         ERRORMSG("H5 rc= " << rc << " in " << __FILE__ << " @ line " << __LINE__ << endl);
-    
+
     // Write all data
     for(size_t i = 0; i < nLoc; i++)
         farray[i] = x_m[i];
     rc = H5PartWriteDataFloat64(H5file_m, "x", farray);
     if(rc != H5_SUCCESS)
         ERRORMSG("H5 rc= " << rc << " in " << __FILE__ << " @ line " << __LINE__ << endl);
-    
+
     for(size_t i = 0; i < nLoc; i++)
         farray[i] = y_m[i];
     rc = H5PartWriteDataFloat64(H5file_m, "y", farray);
     if(rc != H5_SUCCESS)
         ERRORMSG("H5 rc= " << rc << " in " << __FILE__ << " @ line " << __LINE__ << endl);
-    
+
     for(size_t i = 0; i < nLoc; i++)
         farray[i] = z_m[i];
     rc = H5PartWriteDataFloat64(H5file_m, "z", farray);
     if(rc != H5_SUCCESS)
         ERRORMSG("H5 rc= " << rc << " in " << __FILE__ << " @ line " << __LINE__ << endl);
-        
+
     for(size_t i = 0; i < nLoc; i++)
         farray[i] = px_m[i];
     rc = H5PartWriteDataFloat64(H5file_m, "px", farray);
@@ -271,7 +272,7 @@ void LossDataSink::saveH5() {
     if(rc != H5_SUCCESS)
         ERRORMSG("H5 rc= " << rc << " in " << __FILE__ << " @ line " << __LINE__ << endl);
 
-    if (time_m.size() != 0) {            
+    if (time_m.size() != 0) {
         for(size_t i = 0; i < nLoc; i++)
             farray[i] = time_m[i];
         rc = H5PartWriteDataFloat64(H5file_m, "time", farray);
@@ -290,13 +291,13 @@ void LossDataSink::saveH5() {
 void LossDataSink::saveASCII() {
 
     /*
-      ASCII output      
-    */        
+      ASCII output
+    */
     int tag = Ippl::Comm->next_tag(IPPL_APP_TAG3, IPPL_APP_CYCLE);
     if(Ippl::Comm->myNode() == 0) {
         const unsigned partCount = x_m.size();
-        
-        if (time_m.size() != 0) {            
+
+        if (time_m.size() != 0) {
             for(unsigned i = 0; i < partCount; i++) {
                 os_m << element_m   << "   ";
                 os_m << x_m[i] << "   ";
@@ -307,7 +308,7 @@ void LossDataSink::saveASCII() {
                 os_m << pz_m[i] << "   ";
                 os_m << id_m[i]   << "   ";
                 os_m << turn_m[i] << "   ";
-                os_m << time_m[i] << " " << std::endl;                
+                os_m << time_m[i] << " " << std::endl;
             }
         }
         else {
@@ -332,7 +333,7 @@ void LossDataSink::saveASCII() {
             }
             notReceived--;
             rmsg->get(&dataBlocks);
-            if (time_m.size() != 0) {            
+            if (time_m.size() != 0) {
                 for(unsigned i = 0; i < dataBlocks; i++) {
                     long id, turn;
                     double rx, ry, rz, px, py, pz, time;
@@ -344,7 +345,7 @@ void LossDataSink::saveASCII() {
                     rmsg->get(&py);
                     rmsg->get(&pz);
                     rmsg->get(&turn);
-                    rmsg->get(&time);                           
+                    rmsg->get(&time);
                     os_m << element_m << "   ";
                     os_m << rx << "   ";
                     os_m << ry << "   ";
@@ -354,7 +355,7 @@ void LossDataSink::saveASCII() {
                     os_m << pz << "   ";
                     os_m << id << "   ";
                     os_m << turn << "   ";
-                    os_m << time << std::endl;                
+                    os_m << time << std::endl;
                 }
             }
             else {
@@ -375,7 +376,7 @@ void LossDataSink::saveASCII() {
                     os_m << px << "   ";
                     os_m << py << "   ";
                     os_m << pz << "   ";
-                    os_m << id << " " << std::endl;                   
+                    os_m << id << " " << std::endl;
                 }
             }
             delete rmsg;
@@ -384,7 +385,7 @@ void LossDataSink::saveASCII() {
         Message *smsg = new Message();
         const unsigned msgsize = x_m.size();
         smsg->put(msgsize);
-        if (time_m.size() != 0) {            
+        if (time_m.size() != 0) {
             for(unsigned i = 0; i < msgsize; i++) {
                 smsg->put(id_m[i]);
                 smsg->put(x_m[i]);
@@ -394,7 +395,7 @@ void LossDataSink::saveASCII() {
                 smsg->put(py_m[i]);
                 smsg->put(pz_m[i]);
                 smsg->put(turn_m[i]);
-                smsg->put(time_m[i]);                
+                smsg->put(time_m[i]);
             }
         }
         else {
@@ -413,4 +414,3 @@ void LossDataSink::saveASCII() {
             ERRORMSG("LossDataSink Ippl::Comm->send(smsg, 0, tag) failed " << endl;);
     }
 }
-
diff --git a/src/Structure/Restart.cpp b/src/Structure/Restart.cpp
deleted file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000
diff --git a/src/Structure/Restart.h b/src/Structure/Restart.h
deleted file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000
diff --git a/src/Structure/SecondaryEmissionPhysics.cpp b/src/Structure/SecondaryEmissionPhysics.cpp
index 7aa122883819b01eaef65cf96fc2720de3ed3dfc..779a247be51176b632b2c0b2cd24b884d4cd9aa0 100644
--- a/src/Structure/SecondaryEmissionPhysics.cpp
+++ b/src/Structure/SecondaryEmissionPhysics.cpp
@@ -1,9 +1,9 @@
+#include "Structure/SecondaryEmissionPhysics.h"
 #include <vector>
 #include <cmath>
 #include <algorithm>
 #include <sys/stat.h>
 #include "Algorithms/PartBunch.h"
-#include "Structure/SecondaryEmissionPhysics.h"
 #include "Utilities/Options.h"
 
 using namespace myeps;
diff --git a/src/Utilities/OpalFilter.cpp b/src/Utilities/OpalFilter.cpp
index 0cdd3b5ad8585643cb8ddfaca7f86382b034071f..9a5d8a23c636f914bfabfac5ba364f3d9c0edbf5 100644
--- a/src/Utilities/OpalFilter.cpp
+++ b/src/Utilities/OpalFilter.cpp
@@ -14,8 +14,9 @@
 //
 // ------------------------------------------------------------------------
 
-#include "Filters/Filters.h"
 #include "Utilities/OpalFilter.h"
+
+#include "Filters/Filters.h"
 #include "AbstractObjects/OpalData.h"
 #include "Attributes/Attributes.h"
 #include "Physics/Physics.h"
diff --git a/src/Utilities/OpalRingSection.cpp b/src/Utilities/OpalRingSection.cpp
index 7005d057b4bb2996d658fc214e849a5f92bde7dc..5244147ddbdfa9ca5ae873843777f427ce93fee1 100644
--- a/src/Utilities/OpalRingSection.cpp
+++ b/src/Utilities/OpalRingSection.cpp
@@ -1,35 +1,36 @@
-/* 
+/*
  *  Copyright (c) 2012-2014, Chris Rogers
  *  All rights reserved.
- *  Redistribution and use in source and binary forms, with or without 
- *  modification, are permitted provided that the following conditions are met: 
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
  *  1. Redistributions of source code must retain the above copyright notice,
- *     this list of conditions and the following disclaimer. 
- *  2. Redistributions in binary form must reproduce the above copyright notice, 
- *     this list of conditions and the following disclaimer in the documentation 
+ *     this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright notice,
+ *     this list of conditions and the following disclaimer in the documentation
  *     and/or other materials provided with the distribution.
- *  3. Neither the name of STFC nor the names of its contributors may be used to 
- *     endorse or promote products derived from this software without specific 
+ *  3. Neither the name of STFC nor the names of its contributors may be used to
+ *     endorse or promote products derived from this software without specific
  *     prior written permission.
  *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  *  POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "Utilities/OpalRingSection.h"
+
 #include "Physics/Physics.h"
 #include "Utilities/OpalException.h"
-#include "Utilities/OpalRingSection.h"
 
-OpalRingSection::OpalRingSection() 
+OpalRingSection::OpalRingSection()
   : component_m(NULL),
     componentPosition_m(0.), componentOrientation_m(0.),
     startPosition_m(0.), startOrientation_m(0.),
@@ -42,7 +43,7 @@ OpalRingSection::OpalRingSection(const OpalRingSection& rhs)
     startPosition_m(0.), startOrientation_m(0.),
     endPosition_m(0.), endOrientation_m(0.) {
     *this = rhs;
-} 
+}
 
 OpalRingSection::~OpalRingSection() {
     //if (component_m != NULL)
@@ -170,7 +171,7 @@ bool OpalRingSection::doesOverlap(double phiStart, double phiEnd) const {
     bool hasBefore = false; // some elements in bb are before phiVirtualORS
     bool hasAfter = false; // some elements in bb are after phiVirtualORS
     for (size_t i = 0; i < virtualBB.size(); ++i) {
-        hasBefore = hasBefore || 
+        hasBefore = hasBefore ||
                     !phiVirtualORS.isOnOrPastStartPlane(virtualBB[i]);
         hasAfter = hasAfter ||
                    phiVirtualORS.isPastEndPlane(virtualBB[i]);
@@ -194,5 +195,3 @@ void OpalRingSection::rotate_back(Vector_t& vector) const {
     vector(0) = +cos2_m * temp(0) - sin2_m * temp(1);
     vector(1) = +sin2_m * temp(0) + cos2_m * temp(1);
 }
-
-