diff --git a/CMakeLists.txt b/CMakeLists.txt
index b64f7beef5dc6710b776390efaeb1638fa68e98e..3e07e1ea1570b9dbd150e6c248343e63cdfb28cd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -41,6 +41,7 @@ set (CMAKE_CXX_STANDARD 11)
 set (CMAKE_CXX_STANDARD_REQUIRED ON)
 set (CMAKE_CXX_EXTENSIONS OFF)
 
+# Disable compile time assert (used by IPPL)
 add_definitions (-DNOCTAssert)
 
 add_compile_options (-Wall)
@@ -171,7 +172,7 @@ if (ENABLE_AMR)
 endif ()
 
 option (ENABLE_AMR_MG_SOLVER "Enable AMR MG solver" OFF)
-option (ENABLE_SAAMG_SOLVER "Enable iteartive SA-AMG-PCG self field solver" OFF)
+option (ENABLE_SAAMG_SOLVER "Enable iterative SA-AMG-PCG self field solver" OFF)
 if (ENABLE_SAAMG_SOLVER OR ENABLE_AMR_MG_SOLVER)
     #
     # :FIXME: We have to add checks whether the required Trilinos modules
diff --git a/CMakeModules/FindGTest.cmake b/CMakeModules/FindGTest.cmake
index 371778229c62a64dbe2e2087972460abdfb1eabe..d8ad2823e0e1644915b03ff927273a76f8f11ee0 100644
--- a/CMakeModules/FindGTest.cmake
+++ b/CMakeModules/FindGTest.cmake
@@ -1,10 +1,6 @@
 #
 # Find gtest Google Test includes and library
 #
-# gtest
-# It can be found at:
-#     http://amas.web.psi.ch/tools/GSL/index.html
-#
 # GTEST_INCLUDE_DIR - where to find gtest/gtest.h
 # GTEST_LIBRARY     - libgtest.a path
 # GTEST_MAIN_LIBRARY     - libgtest_main.a path
diff --git a/ippl/src/AppTypes/Vektor.h b/ippl/src/AppTypes/Vektor.h
index 7f92412ccaaa370542d42311b4593044958bb655..7a7ef5f14fbee068baa4510b944ffed0af94bad9 100644
--- a/ippl/src/AppTypes/Vektor.h
+++ b/ippl/src/AppTypes/Vektor.h
@@ -17,6 +17,7 @@
 #include "PETE/IpplExpressions.h"
 #include "AppTypes/TSVMeta.h"
 
+#include <cmath>
 #include <iostream>
 #include <iomanip>
 
@@ -277,6 +278,17 @@ cross(const Vektor<T1,D> &lhs, const Vektor<T2,D> &rhs)
   return TSV_MetaCross< Vektor<T1,D> , Vektor<T2,D> > :: apply(lhs,rhs);
 }
 
+//----------------------------------------------------------------------
+// euclidean norm
+//----------------------------------------------------------------------
+template < class T, unsigned D >
+inline double
+euclidean_norm(const Vektor<T, D> &a)
+{
+  return std::sqrt(dot(a, a));
+}
+
+
 //----------------------------------------------------------------------
 // I/O
 template<class T, unsigned D>
@@ -296,10 +308,4 @@ inline std::ostream& operator<<(std::ostream& out, const Vektor<T,D>& rhs)
   return out;
 }
 
-#endif // VEKTOR_H
-
-/***************************************************************************
- * $RCSfile: Vektor.h,v $   $Author: adelmann $
- * $Revision: 1.1.1.1 $   $Date: 2003/01/23 07:40:24 $
- * IPPL_VERSION_ID: $Id: Vektor.h,v 1.1.1.1 2003/01/23 07:40:24 adelmann Exp $
- ***************************************************************************/
\ No newline at end of file
+#endif // VEKTOR_H
\ No newline at end of file
diff --git a/ippl/src/FFT/CMakeLists.txt b/ippl/src/FFT/CMakeLists.txt
index 86490c2ed55e41f4d01c0d3b1715b36b6a382d40..5b9fd8541cb2649dee43d565a31454d943d2d82c 100644
--- a/ippl/src/FFT/CMakeLists.txt
+++ b/ippl/src/FFT/CMakeLists.txt
@@ -7,6 +7,7 @@ set (_HDRS
     FFTBase.h
     FFT.hpp
     FFT.h
+    fftpack.h
     fftpack_FFT.h
     )
 
diff --git a/ippl/src/FFT/FFT.hpp b/ippl/src/FFT/FFT.hpp
index b1a3c67747654b87bf99837b7c38e905af3a601a..91c8e6ff1ba24f5edd72d9b119689648c467a16f 100644
--- a/ippl/src/FFT/FFT.hpp
+++ b/ippl/src/FFT/FFT.hpp
@@ -15,7 +15,7 @@
 #include "FFT/FFT.h"
 #include "FieldLayout/FieldLayout.h"
 #include "Field/BareField.h"
-#include "Utility/IpplStats.h"
+//#include "Utility/IpplStats.h"
 
 //=============================================================================
 // FFT CCTransform Constructors
diff --git a/ippl/src/Field/BareField.h b/ippl/src/Field/BareField.h
index 7af317ab2c1d7f608e9980b007ffc58c9ab490dc..23e7cff063c9b90c6adfe1d2e7aa717a1d92618d 100644
--- a/ippl/src/Field/BareField.h
+++ b/ippl/src/Field/BareField.h
@@ -31,6 +31,7 @@
 #include "Index/SIndex.h"
 #include "SubField/SubBareField.h"
 #include "Utility/IpplInfo.h"
+#include "Utility/IpplStats.h"
 #include "Utility/PAssert.h"
 #include "Utility/Unique.h"
 #include "Utility/my_auto_ptr.h"
diff --git a/ippl/src/Field/BareField.hpp b/ippl/src/Field/BareField.hpp
index 0bb7f462d2ffb53915cc946308fce78ad09bab9f..6b7a8f2ad78f227001df38ba9d56634588c2be0d 100644
--- a/ippl/src/Field/BareField.hpp
+++ b/ippl/src/Field/BareField.hpp
@@ -33,10 +33,9 @@
 #include "Utility/Inform.h"
 #include "Utility/Unique.h"
 #include "Utility/IpplInfo.h"
-#include "Utility/IpplStats.h"
+//#include "Utility/IpplStats.h"
 
 #include <map>
-#include <utility>
 #include <cstdlib>
 
 
diff --git a/ippl/src/Field/CMakeLists.txt b/ippl/src/Field/CMakeLists.txt
index f36268336d229565029b17a43a57450efaf1ad1b..2877244625d038fd0007f7774391fec71d9aeb31 100644
--- a/ippl/src/Field/CMakeLists.txt
+++ b/ippl/src/Field/CMakeLists.txt
@@ -3,10 +3,10 @@ set (_SRCS
 
 set (_HDRS
     Assign.hpp
+    Assign.h
     AssignDefs.h
     AssignGeneralBF.hpp
     AssignGeneralIBF.hpp
-    Assign.h
     AssignTags.h
     BareField.hpp
     BareField.h
diff --git a/ippl/src/Index/SIndexAssign.hpp b/ippl/src/Index/SIndexAssign.hpp
index cb7ce6b6605abd3ad20d68ef8bec2129521a87f0..fab0558d6822c4fc8dd9f3e8c860dcbe28c9843e 100644
--- a/ippl/src/Index/SIndexAssign.hpp
+++ b/ippl/src/Index/SIndexAssign.hpp
@@ -27,9 +27,9 @@
 #include "Index/SIndexAssign.h"
 #include "Index/SIndex.h"
 #include "Field/BrickIterator.h"
-#include "Field/Field.h"
-#include "Field/IndexedField.h"
-#include "Field/Assign.h"
+// #include "Field/Field.h"
+// #include "Field/IndexedField.h"
+// #include "Field/Assign.h"
 #include "Utility/IpplInfo.h"
 
 
diff --git a/ippl/src/Meshes/UniformCartesian.hpp b/ippl/src/Meshes/UniformCartesian.hpp
index c220b1c475a1e9c43ac5894eb03bad3395ce7abc..203b15ba59aea87dbf5b40aec5b2624aef60b99b 100644
--- a/ippl/src/Meshes/UniformCartesian.hpp
+++ b/ippl/src/Meshes/UniformCartesian.hpp
@@ -14,7 +14,6 @@
 #include "Field/BareField.h"
 #include "Field/BrickExpression.h"
 #include "Field/LField.h"
-#include "Field/Field.h"
 #include "Field/Assign.h"
 #include "Field/AssignDefs.h"
 
diff --git a/ippl/src/Message/Communicate.cpp b/ippl/src/Message/Communicate.cpp
index 377cc3193d2555150afd09dfbeac2656f1fb3e6c..4db98415c385ba6909dc6f499983a0004532b6e5 100644
--- a/ippl/src/Message/Communicate.cpp
+++ b/ippl/src/Message/Communicate.cpp
@@ -38,7 +38,6 @@
 
 #include "Utility/IpplInfo.h"
 #include "Utility/IpplStats.h"
-#include "Utility/RandomNumberGen.h"
 #include "Utility/PAssert.h"
 #include <cstdio>
 
diff --git a/ippl/src/Message/Message.h b/ippl/src/Message/Message.h
index 65ca219a1f04d6d18b5507351b3641329a084b20..13499e08eb0d3b071eee8874eae637ac5a401142 100644
--- a/ippl/src/Message/Message.h
+++ b/ippl/src/Message/Message.h
@@ -31,7 +31,6 @@
  * of resolving who needs to free up the storage used for the Message elements.
  ***************************************************************************/
 
-#include "Utility/Inform.h"
 #include <complex>
 #include <cstddef>
 #include <vector>
diff --git a/ippl/src/Message/Message.hpp b/ippl/src/Message/Message.hpp
index 67e7b0b3148d7e148b716b79d1077f0a04c3d3f0..033c187a6f96f4c212fad4add0c5cc8c79696265 100644
--- a/ippl/src/Message/Message.hpp
+++ b/ippl/src/Message/Message.hpp
@@ -12,7 +12,6 @@
  ***************************************************************************/
 
 #include "Message/Message.h"
-#include "Utility/Inform.h"
 #include "Utility/IpplInfo.h"
 
 #include <iterator>
diff --git a/ippl/src/Particle/AbstractParticle.h b/ippl/src/Particle/AbstractParticle.h
index 9ba7e8c0e4d99a1b0a72582bcde2396242563c77..64e46479f547dc301ee4ce47f4585b85e435bac9 100644
--- a/ippl/src/Particle/AbstractParticle.h
+++ b/ippl/src/Particle/AbstractParticle.h
@@ -22,7 +22,9 @@
 #define ABSTRACT_PARTICLE_H
 
 #include "Particle/ParticleLayout.h"
-#include "Particle/ParticleAttrib.h"
+
+template<class T> class ParticleAttrib;
+class ParticleAttribBase;
 
 template <class T, unsigned Dim>
 class AbstractParticle {
diff --git a/ippl/src/Particle/CMakeLists.txt b/ippl/src/Particle/CMakeLists.txt
index e648eeb6ec56d2cc55150d0682cf66f8d280f535..418631c9376a677ca547fd7c685fda53ec06be87 100644
--- a/ippl/src/Particle/CMakeLists.txt
+++ b/ippl/src/Particle/CMakeLists.txt
@@ -2,6 +2,7 @@ set (_SRCS
     )
 
 set (_HDRS
+    AbstractParticle.h
     BoxParticleCachingPolicy.h
     CellParticleCachingPolicy.h
     GenArrayParticle.h
@@ -9,8 +10,8 @@ set (_HDRS
     IntCIC.h
     Interpolator.h
     IntNGP.h
-    IntTSC.h
     IntSUDS.h
+    IntTSC.h
     NoParticleCachingPolicy.h
     PairBuilder/BasicPairBuilder.h
     PairBuilder/HashPairBuilder.h
diff --git a/ippl/src/Particle/Interpolator.h b/ippl/src/Particle/Interpolator.h
index 41142fe01f521e422dc99840e35ca9a1406fd97c..ee11f7e04d016525ac4a768284f4922dc97bfe3f 100644
--- a/ippl/src/Particle/Interpolator.h
+++ b/ippl/src/Particle/Interpolator.h
@@ -16,14 +16,13 @@
 #include "Field/LField.h"
 #include "Field/CompressedBrickIterator.h"
 #include "Index/NDIndex.h"
+#include "Meshes/Centering.h"
 #include "AppTypes/Vektor.h"
 #include "Utility/IpplInfo.h"
 #include "Utility/IpplException.h"
 
-#include <iostream>
+#include <ostream>
 #include <vector>
-#include <utility>
-#include <cmath>
 
 // Helper class and functions for finding nearest grid point given centering
 
diff --git a/ippl/src/Particle/IpplParticleBase.h b/ippl/src/Particle/IpplParticleBase.h
index fa5e4a1639b8e8fdf6f6f90a6d45f2c475795ebe..bf2b807ad78eb3600d54171751ecb933fa8273df 100644
--- a/ippl/src/Particle/IpplParticleBase.h
+++ b/ippl/src/Particle/IpplParticleBase.h
@@ -95,15 +95,18 @@
 
 // include files
 #include "Particle/AbstractParticle.h"
+#include "Particle/ParticleAttribBase.h"
+#include "Particle/ParticleLayout.h"
 #include "AppTypes/Vektor.h"
 #include "DataSource/DataSource.h"
 #include "DataSource/MakeDataSource.h"
 #include "Message/Formatter.h"
 #include <vector>
-#include <algorithm>  // Include algorithms
 #include <utility>
 #include <iostream>
 
+template <class T, unsigned Dim>
+using PLayout = ParticleLayout<T, Dim>;
 
 // forward declarations
 class Inform;
@@ -120,7 +123,6 @@ template <class T, unsigned D> class ParticleBConds;
 template<class PLayout>
 class IpplParticleBase : public DataSource,
                          public AbstractParticle<typename PLayout::Position_t, PLayout::Dimension> {
-
 public:
     // useful enums
     enum { Dim = PLayout::Dimension };
diff --git a/ippl/src/Particle/PAssignDefs.h b/ippl/src/Particle/PAssignDefs.h
index e70c126691c9dbef0ce14160ff74bc3f7142e1f2..8304ecb041812deba5609c617af928e42ddf9c1b 100644
--- a/ippl/src/Particle/PAssignDefs.h
+++ b/ippl/src/Particle/PAssignDefs.h
@@ -18,7 +18,8 @@
 // forward declarations
 template<class T> class ParticleAttrib;
 template<class T, unsigned Dim> class ParticleAttribElem;
-
+template<class T> class ParticleAttribIterator;
+template <class T> class ParticleAttribConstIterator;
 
 //////////////////////////////////////////////////////////////////////
 //
diff --git a/ippl/src/Particle/ParticleAttrib.h b/ippl/src/Particle/ParticleAttrib.h
index 3673425b8cab7b497285b84a75c2db2c1ec90899..f84b6332385f93594877006860351e25dee26cc7 100644
--- a/ippl/src/Particle/ParticleAttrib.h
+++ b/ippl/src/Particle/ParticleAttrib.h
@@ -73,6 +73,7 @@
 // include files
 #include "Particle/ParticleAttribBase.h"
 #include "Particle/ParticleAttribElem.h"
+#include "Particle/PAssign.h"
 #include "SubParticle/SubParticleAttrib.h"
 #include "DataSource/DataSource.h"
 #include "DataSource/MakeDataSource.h"
diff --git a/ippl/src/SubParticle/SubParticleAssignDefs.h b/ippl/src/SubParticle/SubParticleAssignDefs.h
index 4535de9781d97a1cbe630163c9b7466347a547aa..82d40b001812adf11026e3ae29a9b1efa7b64af6 100644
--- a/ippl/src/SubParticle/SubParticleAssignDefs.h
+++ b/ippl/src/SubParticle/SubParticleAssignDefs.h
@@ -13,7 +13,7 @@
 
 // include files
 #include "SubField/SubFieldAssignDefs.h"
-#include "SubParticle/SubParticleAssign.h"
+#include "SubParticle/SubParticleAttrib.h"
 
 //////////////////////////////////////////////////////////////////////
 //
diff --git a/ippl/src/Utility/DiscField.h b/ippl/src/Utility/DiscField.h
index 2cdbb53cd318aea2f0fe64f1be66abdc68c7fea8..48b7a336f1cfbde9b042dd4ea532f2b54810f221 100644
--- a/ippl/src/Utility/DiscField.h
+++ b/ippl/src/Utility/DiscField.h
@@ -14,7 +14,6 @@
 // include files
 #include "Index/NDIndex.h"
 #include "Field/BrickExpression.h"
-#include "Field/Field.h"
 #include "Utility/DiscBuffer.h"
 #include "Utility/DiscConfig.h"
 #include "Utility/Inform.h"
@@ -24,8 +23,6 @@
 #include <cstdlib>
 #include <unistd.h>
 #include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/types.h>
 
 #include <vector>
 #include <iostream>
diff --git a/ippl/src/Utility/DiscField.hpp b/ippl/src/Utility/DiscField.hpp
index 2582eb84e2fe1c6a0f0b800cc25f13b3c9be8b20..e6ba341234945a58fcb13f3554d1c325b41171a1 100644
--- a/ippl/src/Utility/DiscField.hpp
+++ b/ippl/src/Utility/DiscField.hpp
@@ -27,7 +27,6 @@
 #include "Utility/DiscField.h"
 #include "Utility/DiscConfig.h"
 #include "Utility/DiscMeta.h"
-#include "Field/BrickIterator.h"
 #include "Message/Tags.h"
 
 #include "Utility/PAssert.h"
diff --git a/ippl/src/Utility/DiscParticle.h b/ippl/src/Utility/DiscParticle.h
index 632ec760f4bcc501751445e67ad9448326ebbb3e..51bfee3dbeaed246e50784e59b5172bbdc93d1f8 100644
--- a/ippl/src/Utility/DiscParticle.h
+++ b/ippl/src/Utility/DiscParticle.h
@@ -15,9 +15,9 @@
 #include "Utility/DiscConfig.h"
 #include "Utility/IpplInfo.h"
 #include "Utility/PAssert.h"
+#include "Message/Communicate.h"
 #include "Message/Message.h"
-
-
+#include "Message/Tags.h"
 
 #include <vector>
 #include <iostream>
@@ -26,7 +26,6 @@
 // forward declarations
 template<class T> class IpplParticleBase;
 template<class T> class ParticleAttrib;
-class Message;
 
 class DiscParticle {
 
diff --git a/ippl/src/Utility/Inform.h b/ippl/src/Utility/Inform.h
index 3317301d48925afedbd875ea35f37c98a997ba5c..21c9f86d2cc8f4358619b8095fa8daa3839fada9 100644
--- a/ippl/src/Utility/Inform.h
+++ b/ippl/src/Utility/Inform.h
@@ -34,6 +34,7 @@
 #include <iostream>
 #include <iomanip>
 #include <sstream>
+#include <string>
 
 #define INFORM_ALL_NODES        (-1)
 
diff --git a/ippl/src/Utility/IpplInfo.cpp b/ippl/src/Utility/IpplInfo.cpp
index a626255a5e01f70e8b771232c0ac3a90f12526a9..113bd119813451d0e6f8d7a36521934bc346a99f 100644
--- a/ippl/src/Utility/IpplInfo.cpp
+++ b/ippl/src/Utility/IpplInfo.cpp
@@ -25,6 +25,7 @@
 
 // include files
 #include "Utility/IpplInfo.h"
+#include "Utility/Inform.h"
 #include "Utility/IpplStats.h"
 #include "Utility/PAssert.h"
 #include "Utility/RandomNumberGen.h"
diff --git a/ippl/src/Utility/IpplInfo.h b/ippl/src/Utility/IpplInfo.h
index ce1fe8211492dbbec6210be4d76818a6391119a4..09b9ea33b900bf024d12f1d77f0c9a48fe7ee488 100644
--- a/ippl/src/Utility/IpplInfo.h
+++ b/ippl/src/Utility/IpplInfo.h
@@ -43,9 +43,8 @@
  */
 
 // include files
-#include "Utility/Inform.h"
-#include "Message/Communicate.h"
 #include "Utility/StaticIpplInfo.h"
+#include "Utility/Inform.h"
 
 #include <iostream>
 #include <stack>
@@ -56,6 +55,7 @@
 #include <mpi.h>
 
 // forward declarations
+class Communicate;
 class IpplStats;
 class IpplInfo;
 std::ostream& operator<<(std::ostream&, const IpplInfo&);
diff --git a/ippl/src/Utility/IpplMemoryUsage.cpp b/ippl/src/Utility/IpplMemoryUsage.cpp
index 2e2ca97e6c0cbc43ada250e8afeab4b9b9358561..b5bfbedc87be74eeb43548654247c35739cda33b 100644
--- a/ippl/src/Utility/IpplMemoryUsage.cpp
+++ b/ippl/src/Utility/IpplMemoryUsage.cpp
@@ -40,6 +40,9 @@
 //
 #include "Utility/IpplMemoryUsage.h"
 
+#include "Message/GlobalComm.h"
+#include "Utility/IpplInfo.h"
+
 //////////////////////////////////////////////////////////////////////
 IpplMemoryUsage::IpplMemoryUsage()
 { }
diff --git a/ippl/src/Utility/IpplMemoryUsage.h b/ippl/src/Utility/IpplMemoryUsage.h
index bcb43a779140d3bfaa483c8801d72e472bbd3bb7..094915ab8940725ad52d5a0ec72ca386ef4c077d 100644
--- a/ippl/src/Utility/IpplMemoryUsage.h
+++ b/ippl/src/Utility/IpplMemoryUsage.h
@@ -38,11 +38,11 @@
 // You should have received a copy of the GNU General Public License
 // along with OPAL. If not, see <https://www.gnu.org/licenses/>.
 //
-#ifndef IPPL_MEMPRYUSAGE_H
-#define IPPL_MEMPRYUSAGE_H
+#ifndef IPPL_MEMORYUSAGE_H
+#define IPPL_MEMORYUSAGE_H
 
-#include "Ippl.h"
 #include <memory>
+#include <string>
 
 #include <sys/resource.h>
 #include <sys/time.h> // not required but increases portability
diff --git a/ippl/src/Utility/IpplStats.h b/ippl/src/Utility/IpplStats.h
index a7be10ac3fb40373d187ccb86a5ee83fbed41fbb..b22678d39e6804baf67a1a1947ed9d75bbbfd0e7 100644
--- a/ippl/src/Utility/IpplStats.h
+++ b/ippl/src/Utility/IpplStats.h
@@ -38,10 +38,11 @@
 // include files
 #include "Utility/IpplInfo.h"
 #include "Utility/Timer.h"
-#include "Utility/Inform.h"
 
 #include <vector>
 
+class Inform;
+
 class IpplStats {
 
 public:
diff --git a/ippl/src/Utility/IpplTimings.cpp b/ippl/src/Utility/IpplTimings.cpp
index 427c52cf669d456dbd3737c78536bc0d984c3903..884407a6af73ac50d42ecf0e12a1b8d7a6bcbb33 100644
--- a/ippl/src/Utility/IpplTimings.cpp
+++ b/ippl/src/Utility/IpplTimings.cpp
@@ -7,7 +7,6 @@
 
 #include "Utility/IpplTimings.h"
 #include "Utility/Inform.h"
-#include "Utility/IpplInfo.h"
 #include "Message/GlobalComm.h"
 #include "PETE/IpplExpressions.h"
 
diff --git a/ippl/src/Utility/PAssert.h b/ippl/src/Utility/PAssert.h
index a780daef37e92601fb9052b590a323edd0bf415a..4659fa032aabb10939082e52c37749075f069f18 100644
--- a/ippl/src/Utility/PAssert.h
+++ b/ippl/src/Utility/PAssert.h
@@ -6,7 +6,6 @@
 
 #ifndef PASSERT_H
 #define PASSERT_H
-#include "Utility/IpplInfo.h"
 
 #include <exception>
 #include <stdexcept>
diff --git a/ippl/test/FFT/SeaborgRes/TestFFT-PPP.cpp b/ippl/test/FFT/SeaborgRes/TestFFT-PPP.cpp
index 92d3ec33e2e4c432316729a50777fd1a1db9873f..727233b70c8650fa0edaaa3d7d5f29e29a8ca425 100644
--- a/ippl/test/FFT/SeaborgRes/TestFFT-PPP.cpp
+++ b/ippl/test/FFT/SeaborgRes/TestFFT-PPP.cpp
@@ -49,10 +49,6 @@ bool Configure(int argc, char *argv[], InterPolT *interPol,
   Inform msg("Configure ");
   Inform errmsg("Error ");
 
-  string bc_str;
-  string interPol_str;
-  string dist_str;
-
   for (int i=1; i < argc; ++i) {
     string s(argv[i]);
     if (s == "-grid") {
diff --git a/ippl/test/FFT/SeaborgRes/TestFFT-SPP.cpp b/ippl/test/FFT/SeaborgRes/TestFFT-SPP.cpp
index c9cc83d87ea772499faad3c59e51ece32c783107..323bcc08ce9f165784bce9ce69ce7373e9d149df 100644
--- a/ippl/test/FFT/SeaborgRes/TestFFT-SPP.cpp
+++ b/ippl/test/FFT/SeaborgRes/TestFFT-SPP.cpp
@@ -24,10 +24,6 @@ bool Configure(int argc, char *argv[], InterPolT *interPol,
   Inform msg("Configure ");
   Inform errmsg("Error ");
 
-  string bc_str;
-  string interPol_str;
-  string dist_str;
-
   for (int i=1; i < argc; ++i) {
     string s(argv[i]);
     if (s == "-grid") {
diff --git a/ippl/test/FFT/SeaborgRes/TestFFT-SSP.cpp b/ippl/test/FFT/SeaborgRes/TestFFT-SSP.cpp
index 80b4b50124a5e713af193edf235a847a1bb1f890..c2726c9c010cd8ab9be94d3ea3eb6556cb2ab09d 100644
--- a/ippl/test/FFT/SeaborgRes/TestFFT-SSP.cpp
+++ b/ippl/test/FFT/SeaborgRes/TestFFT-SSP.cpp
@@ -49,10 +49,6 @@ bool Configure(int argc, char *argv[], InterPolT *interPol,
   Inform msg("Configure ");
   Inform errmsg("Error ");
 
-  string bc_str;
-  string interPol_str;
-  string dist_str;
-
   for (int i=1; i < argc; ++i) {
     string s(argv[i]);
     if (s == "-grid") {
@@ -247,16 +243,4 @@ int main(int argc, char *argv[])
     testmsg << " nx= " << nx << " ny= " << ny << " nz= " << nz;
     testmsg << " ||d||= " << fabs(realDiff) << endl;
     return 0;
-}
-
-/***************************************************************************
- * $RCSfile: TestFFT-SSP.cpp,v $   $Author: adelmann $
- * $Revision: 1.1.1.1 $   $Date: 2003/01/23 07:40:36 $
- ***************************************************************************/
-
-/***************************************************************************
- * $RCSfile: addheaderfooter,v $   $Author: adelmann $
- * $Revision: 1.1.1.1 $   $Date: 2003/01/23 07:40:17 $
- * IPPL_VERSION_ID: $Id: addheaderfooter,v 1.1.1.1 2003/01/23 07:40:17 adelmann Exp $ 
- ***************************************************************************/
-
+}
\ No newline at end of file
diff --git a/ippl/test/FFT/SeaborgRes/TestFFT.cpp b/ippl/test/FFT/SeaborgRes/TestFFT.cpp
index c7f457f715668d3cce49391138bc26ed2891b369..13fc0374478e0a3e1a767b7d3af1dd10d50fb1e0 100644
--- a/ippl/test/FFT/SeaborgRes/TestFFT.cpp
+++ b/ippl/test/FFT/SeaborgRes/TestFFT.cpp
@@ -49,10 +49,6 @@ bool Configure(int argc, char *argv[], InterPolT *interPol,
   Inform msg("Configure ");
   Inform errmsg("Error ");
 
-  string bc_str;
-  string interPol_str;
-  string dist_str;
-
   for (int i=1; i < argc; ++i) {
     string s(argv[i]);
     if (s == "-grid") {
diff --git a/ippl/test/FFT/TestFFT-XT3.cpp b/ippl/test/FFT/TestFFT-XT3.cpp
index 914aa453f318750180e32fd9cbdebe884e93df6b..4177f44f5d265796c6f7d43cff0cfe1d0561b5ed 100644
--- a/ippl/test/FFT/TestFFT-XT3.cpp
+++ b/ippl/test/FFT/TestFFT-XT3.cpp
@@ -51,10 +51,6 @@ bool Configure(int argc, char *argv[], InterPolT *interPol,
   Inform msg("Configure ");
   Inform errmsg("Error ");
 
-  string bc_str;
-  string interPol_str;
-  string dist_str;
-
   for (int i=1; i < argc; ++i) {
     string s(argv[i]);
     if (s == "-grid") {
diff --git a/ippl/test/FFT/TestRCMIC.cpp b/ippl/test/FFT/TestRCMIC.cpp
index fbfa3869ea7476cc7be27951f5a451fa49355e7a..a5880d331e24a9a68d4f2f3cc4702481a350f00c 100644
--- a/ippl/test/FFT/TestRCMIC.cpp
+++ b/ippl/test/FFT/TestRCMIC.cpp
@@ -26,9 +26,6 @@ bool Configure(int argc, char *argv[],
   Inform msg("Configure ");
   Inform errmsg("Error ");
 
-  string bc_str;
-  string dist_str;
-
   for (int i=1; i < argc; ++i) {
     string s(argv[i]);
     if (s == "-grid") {
@@ -167,8 +164,8 @@ int main(int argc, char *argv[])
   BareField<double,D>   RFieldSPStan_save(layoutSPStan);
   BareField<std::complex<double>,D> CFieldSPStan0h(layoutSPStan0h);
 
-  INFOMSG("RFieldSPStan   layout= " << layoutSPStan << endl;);
-  INFOMSG("CFieldSPStan0h layout= " << layoutSPStan0h << endl;);
+  INFOMSG("RFieldSPStan   layout= " << layoutSPStan << endl);
+  INFOMSG("CFieldSPStan0h layout= " << layoutSPStan0h << endl);
 
   // For calling FieldDebug functions from debugger, set up output format:
   setFormat(4,3);
diff --git a/ippl/test/PwrSpec/PwrSpec.cpp b/ippl/test/PwrSpec/PwrSpec.cpp
index 02ef5cb2ed7fd2c4410c118085b8c0d1489c4039..d849f8d6590b2b5c7b94f80094ea0cb7cecc8ccb 100644
--- a/ippl/test/PwrSpec/PwrSpec.cpp
+++ b/ippl/test/PwrSpec/PwrSpec.cpp
@@ -195,7 +195,7 @@ void PwrSpec<T,Dim>::CICforward(ChargedParticles<T,Dim> *univ)
 
     rho_m[gDomainL_m]  = rhocic_m[gDomainL_m];
 
-    INFOMSG("rhocic_m= " << sum(rhocic_m) << " sum(M)= " << sum(univ->M) << " rho_m= " << sum(rho_m) << endl;);
+    INFOMSG("rhocic_m= " << sum(rhocic_m) << " sum(M)= " << sum(univ->M) << " rho_m= " << sum(rho_m) << endl);
 }
 
 /***************************************************************************
diff --git a/ippl/test/particle/PIC3d.cpp b/ippl/test/particle/PIC3d.cpp
index 9385229fce2c06635ee78841aa7ad8a419a9974f..10c950a52c2ab99b5c41b1b6d4bdcb12ad4ffa1e 100644
--- a/ippl/test/particle/PIC3d.cpp
+++ b/ippl/test/particle/PIC3d.cpp
@@ -474,7 +474,7 @@ public:
                 smsg->put(tmp[i]);
             bool res = Ippl::Comm->send(smsg, 0, tag);
             if (! res)
-                ERRORMSG("Ippl::Comm->send(smsg, 0, tag) failed " << endl;);
+                ERRORMSG("Ippl::Comm->send(smsg, 0, tag) failed " << endl);
         }
     }
 
diff --git a/ippl/test/toyfdtf/ipplToyFDTD2.cpp b/ippl/test/toyfdtf/ipplToyFDTD2.cpp
index ae86ab556ba247e2c70b75891f500effbcea9dd7..0d9c8725ae7aa13d9025b24d85026aeac48ba0ba 100644
--- a/ippl/test/toyfdtf/ipplToyFDTD2.cpp
+++ b/ippl/test/toyfdtf/ipplToyFDTD2.cpp
@@ -211,8 +211,6 @@ int main(int argc, char *argv[]){
     Inform msg(argv[0]);
     Inform msg2all(argv[0],INFORM_ALL_NODES);
 
-    // variable declarations
-    int i,j,k;
     // indices of the 3D array of cells
     int nx, ny, nz;
     // total number of cells along the x, y, and z axes, respectively
diff --git a/optimizer/Comm/types.h b/optimizer/Comm/types.h
index 259fb38f3ffbe8f411fc2c28d56c21bfb6b151c8..ecd0a4a3cfc2dac62219d9ecebeec07e3f11d622 100644
--- a/optimizer/Comm/types.h
+++ b/optimizer/Comm/types.h
@@ -21,8 +21,6 @@
 #ifndef __COMM_TYPES__
 #define __COMM_TYPES__
 
-#include <vector>
-
 #include "mpi.h"
 
 namespace Comm {
diff --git a/optimizer/Util/CmdArguments.cpp b/optimizer/Util/CmdArguments.cpp
index f247e56404d5098b5b83c389988539017b4b0ca1..038fdebd377df587feeacc6acbabb80bedb3723a 100644
--- a/optimizer/Util/CmdArguments.cpp
+++ b/optimizer/Util/CmdArguments.cpp
@@ -27,6 +27,8 @@
 //
 #include "Util/CmdArguments.h"
 
+#include "boost/algorithm/string.hpp"
+
 void CmdArguments::addArguments(int argc, char **argv) {
 
     for(int i=1; i<argc; i++) {
diff --git a/optimizer/Util/CmdArguments.h b/optimizer/Util/CmdArguments.h
index bff896739fbd47e5002b65b2dc80d93e32db9cb0..2f079944ee27564a3db6a99617c3ace086835355 100644
--- a/optimizer/Util/CmdArguments.h
+++ b/optimizer/Util/CmdArguments.h
@@ -35,7 +35,6 @@
 #include <set>
 
 #include "boost/smart_ptr.hpp"
-#include "boost/algorithm/string.hpp"
 #include "boost/utility/value_init.hpp"
 
 #include "Util/OptPilotException.h"
diff --git a/optimizer/Util/MPIHelper.cpp b/optimizer/Util/MPIHelper.cpp
index be01293828bde017343cf43e8685d4657fe2f9a9..d3ebc395458c2e4f86eddbf0b343bc6243fbbe8d 100644
--- a/optimizer/Util/MPIHelper.cpp
+++ b/optimizer/Util/MPIHelper.cpp
@@ -22,6 +22,7 @@
 
 #include <boost/static_assert.hpp>
 #include <boost/serialization/map.hpp>
+#include <boost/serialization/vector.hpp>
 
 #include <boost/archive/text_oarchive.hpp>
 #include <boost/archive/text_iarchive.hpp>
diff --git a/optimizer/Util/Types.h b/optimizer/Util/Types.h
index cff85c900cb725346a49217c1e575976a68e8ce4..3d32e070429ea34fd7e6282112de2c477253c934 100644
--- a/optimizer/Util/Types.h
+++ b/optimizer/Util/Types.h
@@ -21,17 +21,12 @@
 #ifndef __TYPES_H__
 #define __TYPES_H__
 
-#include <vector>
 #include <map>
+#include <utility>
+#include <vector>
 
-#include <boost/serialization/map.hpp>
-#include "boost/serialization/vector.hpp"
 #include "boost/tuple/tuple.hpp"
 
-#include "boost/variant.hpp"
-#include "boost/fusion/adapted/struct/adapt_struct.hpp"
-#include "boost/fusion/include/adapt_struct.hpp"
-
 #include "Expression/Expression.h"
 
 //FIXME: add namespaces
diff --git a/src/AbstractObjects/Attribute.cpp b/src/AbstractObjects/Attribute.cpp
index 9ad9e8991b7647efe63ad63eaf17e5354e4cfff2..d7285595a891d63ae4f08bb2d661e67fbce80ace 100644
--- a/src/AbstractObjects/Attribute.cpp
+++ b/src/AbstractObjects/Attribute.cpp
@@ -20,6 +20,8 @@
 #include "AbstractObjects/AttributeBase.h"
 #include "Utilities/Options.h"
 
+#include "Utility/Inform.h"
+
 #include <set>
 #include <iostream>
 
diff --git a/src/AbstractObjects/Attribute.h b/src/AbstractObjects/Attribute.h
index 3449810550e95065f05e0b214a1a1e4ed94b6fef..77907f8cc90e1c0e7624fdfc29ebd4c32a2370a8 100644
--- a/src/AbstractObjects/Attribute.h
+++ b/src/AbstractObjects/Attribute.h
@@ -24,9 +24,6 @@
 #include <iosfwd>
 #include <string>
 
-// #include <Ippl.h>
-#include <Utility/Inform.h>
-
 class Statement;
 
 // Class Attribute
diff --git a/src/AbstractObjects/OpalData.h b/src/AbstractObjects/OpalData.h
index 7be29388aa4b82dfe09ffc79b7e694d392afda62..5e19821159741898e6c1fc4d1bfd4aad24700307 100644
--- a/src/AbstractObjects/OpalData.h
+++ b/src/AbstractObjects/OpalData.h
@@ -38,9 +38,6 @@ class BoundaryGeometry;
 // store element name, max phase
 typedef std::pair<std::string, double > MaxPhasesT;
 typedef std::map<double, double> energyEvolution_t;
-typedef energyEvolution_t::value_type energyEvData_t;
-
-
 
 // Class OpalData
 // ------------------------------------------------------------------------
diff --git a/src/Algorithms/ParallelCyclotronTracker.cpp b/src/Algorithms/ParallelCyclotronTracker.cpp
index 2fcbf31ec52e3cc6124386477dbb103e0ba07f8b..fcfd363f3e0b74fac0c6d12ee1ae85455ed29a16 100644
--- a/src/Algorithms/ParallelCyclotronTracker.cpp
+++ b/src/Algorithms/ParallelCyclotronTracker.cpp
@@ -899,7 +899,7 @@ void ParallelCyclotronTracker::visitRFCavity(const RFCavity &as) {
     RFCavity *elptr = dynamic_cast<RFCavity *>(as.clone());
     myElements.push_back(elptr);
 
-    if((elptr->getComponentType() != "SINGLEGAP") && (elptr->getComponentType() != "DOUBLEGAP")) {
+    if ( elptr->getComponentType() != "SINGLEGAP" ) {
         *gmsg << (elptr->getComponentType()) << endl;
         throw OpalException("ParallelCyclotronTracker::visitRFCavity",
                             "The ParallelCyclotronTracker can only play with cyclotron type RF system currently ...");
@@ -1633,7 +1633,7 @@ double ParallelCyclotronTracker::getHarmonicNumber() const {
         return elcycl->getCyclHarm();
     throw OpalException("ParallelCyclotronTracker::getHarmonicNumber()",
                         std::string("The first item in the FieldDimensions list does not ")
-                        +std::string("seem to be an Ring or a Cyclotron element"));
+                        +std::string("seem to be a Ring or a Cyclotron element"));
 }
 
 
diff --git a/src/Algorithms/ParallelTTracker.cpp b/src/Algorithms/ParallelTTracker.cpp
index 73c32bcd8301f1e264d48f214f64f4e5a500587a..868cb338f0221e79f87dc0d43fe211b4609e6e20 100644
--- a/src/Algorithms/ParallelTTracker.cpp
+++ b/src/Algorithms/ParallelTTracker.cpp
@@ -22,19 +22,18 @@
 #include "Algorithms/ParallelTTracker.h"
 
 #include <cfloat>
-#include <iostream>
+#include <cmath>
 #include <fstream>
+#include <limits>
 #include <iomanip>
+#include <iostream>
 #include <sstream>
 #include <string>
-#include <limits>
-#include <cmath>
 
 #include "Algorithms/OrbitThreader.h"
 #include "Algorithms/CavityAutophaser.h"
 #include "Beamlines/Beamline.h"
 #include "Beamlines/FlaggedBeamline.h"
-#include "Lines/Sequence.h"
 
 #include "Solvers/CSRWakeFunction.hh"
 
diff --git a/src/Algorithms/ThickTracker.h b/src/Algorithms/ThickTracker.h
index 7ea954f78927ba0e627aa8660e2f671f38ea0ebc..175731ac5c3c558e8f0e71fe28e2874d4349b668 100644
--- a/src/Algorithms/ThickTracker.h
+++ b/src/Algorithms/ThickTracker.h
@@ -24,42 +24,27 @@
 #define OPAL_ThickTracker_HH
 
 #include "Algorithms/Tracker.h"
-#include "Structure/DataSink.h"
 
 #include "Hamiltonian.h"
 
-#include "MapAnalyser.h"
-
 #include "Algorithms/IndexMap.h"
 #include "AbsBeamline/BeamStripping.h"
-#include "AbsBeamline/CCollimator.h"
-#include "AbsBeamline/Corrector.h"
-#include "AbsBeamline/Degrader.h"
 #include "AbsBeamline/Drift.h"
-#include "AbsBeamline/FlexibleCollimator.h"
 #include "AbsBeamline/ElementBase.h"
-#include "AbsBeamline/Marker.h"
-#include "AbsBeamline/Monitor.h"
 #include "AbsBeamline/Multipole.h"
-#include "AbsBeamline/Probe.h"
-#include "AbsBeamline/RFCavity.h"
-#include "AbsBeamline/RBend.h"
 #include "AbsBeamline/RBend3D.h"
 #include "AbsBeamline/SBend.h"
-#include "AbsBeamline/Septum.h"
-#include "AbsBeamline/Solenoid.h"
-#include "AbsBeamline/TravelingWave.h"
 
 #include "Elements/OpalBeamline.h"
 
-#include "Structure/Beam.h"
-
-//#include <array>
 #include <cmath>
-
+#include <list>
+#include <string>
 #include <tuple>
+#include <vector>
 
 class BMultipoleField;
+class DataSink;
 
 template <class T, unsigned Dim>
 class PartBunchBase;
@@ -101,14 +86,13 @@ class PartBunchBase;
 
 class ThickTracker: public Tracker {
 
-public:
+private:
     typedef Hamiltonian::series_t                       series_t;
-    typedef MapAnalyser::fMatrix_t                      fMatrix_t;
-    typedef MapAnalyser::cfMatrix_t                     cfMatrix_t;
     typedef FVps<double, 6>                             map_t;
     typedef FVector<double, 6>                          particle_t;
     typedef std::tuple<series_t, std::size_t, double>   tuple_t;
     typedef std::list<tuple_t>                          beamline_t;
+    typedef FMatrix<double, 6, 6>                       fMatrix_t;
 
 public:
 
@@ -331,7 +315,6 @@ private:
 
 
     Hamiltonian hamiltonian_m;
-    MapAnalyser mapAnalyser_m;
 
 
     Vector_t RefPartR_m;
diff --git a/src/Algorithms/lomb.cpp b/src/Algorithms/lomb.cpp
index 7fb2600d86a22f18ea9cacea53303eac9015c592..07dcdae98b428a96127bec745277d0fdf929dcd7 100644
--- a/src/Algorithms/lomb.cpp
+++ b/src/Algorithms/lomb.cpp
@@ -52,8 +52,6 @@ int LOMB_class::period(std::vector<LOMB_TYPE> *indata, std::vector<LOMB_TYPE> *o
     LOMB_TYPE pt;
 
     CI_lt p, q;
-    CI_vd ai;
-
     /*---------------------------------------------------------------------------*/
 
     wi.erase(wi.begin(), wi.end());
@@ -266,10 +264,7 @@ int LOMB_class::moment(std::vector<LOMB_TYPE> *indata, double *ave, double *adev
     int      n;
     double  pnr, s, ep;
 
-    std::vector<double> xvec;
-
     CI_lt p, q;
-    CI_vd xp;
     /*---------------------------------------------------------------------------*/
 
     p = indata->begin();
diff --git a/src/Amr/AmrYtWriter.cpp b/src/Amr/AmrYtWriter.cpp
index 91647c5ff859655c996dde39c794bfc8862957bf..2de79b8633198542f448348ac28d2277eb6a2735 100644
--- a/src/Amr/AmrYtWriter.cpp
+++ b/src/Amr/AmrYtWriter.cpp
@@ -496,9 +496,9 @@ void AmrYtWriter::writeBunch(const AmrPartBunch* bunch_p,
         std::string filePrefix(LevelDir);
         filePrefix += '/';
         filePrefix += "DATA_";
-        bool groupSets(false), setBuf(true);
 
         if (gotsome) {
+            bool groupSets(false), setBuf(true);
             for(amrex::NFilesIter nfi(nOutFiles, filePrefix, groupSets, setBuf); nfi.ReadyToWrite(); ++nfi) {
                 std::ofstream& myStream = (std::ofstream&) nfi.Stream();
                 //
diff --git a/src/Amr/AmrYtWriter.h b/src/Amr/AmrYtWriter.h
index 73572ccec2c238fc656fba0299b320894482dfaf..581985071f34bcec56bb0f1fd172e92105d62664 100644
--- a/src/Amr/AmrYtWriter.h
+++ b/src/Amr/AmrYtWriter.h
@@ -39,7 +39,7 @@ public:
      * @param step we write
      * @param bin energy bin we write (multi-bunch simulation)
      */
-    AmrYtWriter(int step, int bin = 0);
+    explicit AmrYtWriter(int step, int bin = 0);
     
     /*!
      * Write yt files to the simulation subdirectory
diff --git a/src/BasicActions/Option.cpp b/src/BasicActions/Option.cpp
index bb80d744adab2da32ee70438c8133eb25bc3e20e..1c8f2c15878eb49b627c7a2ad2df732ad87a66c9 100644
--- a/src/BasicActions/Option.cpp
+++ b/src/BasicActions/Option.cpp
@@ -20,13 +20,13 @@
 #include "BasicActions/Option.h"
 #include "Attributes/Attributes.h"
 #include "Parser/FileStream.h"
+#include "Utilities/OpalException.h"
 #include "Utilities/Options.h"
 #include "Utilities/OptionTypes.h"
 #include "Utilities/ClassicRandom.h"
-#include "Utility/IpplInfo.h"
-
-#include "Utilities/OpalException.h"
 
+#include "Utility/Inform.h"
+#include "Utility/IpplInfo.h"
 #include "Utility/IpplMemoryUsage.h"
 
 #include <ctime>
diff --git a/src/BasicActions/PSystem.cpp b/src/BasicActions/PSystem.cpp
index a8c34ed5b87032b2a8daac397b7242f19e81e02e..d3698e7fcaaf9d20da3f27d4adb74ef76719329f 100644
--- a/src/BasicActions/PSystem.cpp
+++ b/src/BasicActions/PSystem.cpp
@@ -18,9 +18,10 @@
 
 #include "BasicActions/PSystem.h"
 
-#include "Ippl.h"
 #include "Attributes/Attributes.h"
 
+#include "Utility/IpplInfo.h"
+
 #include <cstdlib>
 // Class PSystem
 // ------------------------------------------------------------------------
diff --git a/src/BasicActions/System.cpp b/src/BasicActions/System.cpp
index 6a78bd47c627a0f72dbd733bca1f290a8aa8320b..7c3b614d50c10bce94037cd44fff875bd25b952a 100644
--- a/src/BasicActions/System.cpp
+++ b/src/BasicActions/System.cpp
@@ -18,9 +18,10 @@
 
 #include "BasicActions/System.h"
 
-#include "Ippl.h"
 #include "Attributes/Attributes.h"
 
+#include "Utility/IpplInfo.h"
+
 #include <cstdlib>
 // Class System
 // ------------------------------------------------------------------------
diff --git a/src/Classic/AbsBeamline/BeamStripping.cpp b/src/Classic/AbsBeamline/BeamStripping.cpp
index a456fdb4dbd0b48da054fd07b3f909fc41830b84..90f384fe91d3ff3ed50011f9024521f74f37dd6a 100644
--- a/src/Classic/AbsBeamline/BeamStripping.cpp
+++ b/src/Classic/AbsBeamline/BeamStripping.cpp
@@ -38,10 +38,7 @@
 #include <cmath>
 #include <cstdio>
 
-#include "Ippl.h"
-
-#include "gsl/gsl_spline.h"
-#include "gsl/gsl_interp.h"
+#include "Utility/Inform.h"
 
 #define CHECK_BSTP_FSCANF_EOF(arg) if (arg == EOF)\
 throw GeneralClassicException("BeamStripping::getPressureFromFile",\
diff --git a/src/Classic/AbsBeamline/Component.h b/src/Classic/AbsBeamline/Component.h
index 8f9f5fa133e81fddd4e36efe21416d416785bc56..51c92da2f917258a8560f0b8eada10a32dc572c7 100644
--- a/src/Classic/AbsBeamline/Component.h
+++ b/src/Classic/AbsBeamline/Component.h
@@ -25,7 +25,6 @@
 
 #include "AbsBeamline/ElementBase.h"
 #include "Fields/EMField.h"
-#include "Algorithms/Vektor.h"
 
 class PartData;
 
diff --git a/src/Classic/AbsBeamline/Degrader.cpp b/src/Classic/AbsBeamline/Degrader.cpp
index df2c02cc1c41930adccb79f3d67db66ec89bf29b..13930d0bcb082581531d3ec566fd941b9d922cb8 100644
--- a/src/Classic/AbsBeamline/Degrader.cpp
+++ b/src/Classic/AbsBeamline/Degrader.cpp
@@ -21,13 +21,12 @@
 #include "AbsBeamline/Degrader.h"
 #include "Algorithms/PartBunchBase.h"
 #include "AbsBeamline/BeamlineVisitor.h"
-#include "Fields/Fieldmap.h"
 #include "Structure/LossDataSink.h"
 #include "Utilities/Options.h"
 #include "Solvers/ParticleMatterInteractionHandler.hh"
 #include "Physics/Physics.h"
-#include "Utilities/Util.h"
 #include <memory>
+#include <string>
 
 extern Inform *gmsg;
 
@@ -52,23 +51,14 @@ Degrader::Degrader(const Degrader &right):
 {}
 
 Degrader::Degrader(const std::string &name):
-    Component(name),
-    filename_m(""),
-    PosX_m(0),
-    PosY_m(0),
-    PosZ_m(0),
-    MomentumX_m(0),
-    MomentumY_m(0),
-    MomentumZ_m(0),
-    time_m(0),
-    id_m(0)
+    Component(name)
 {}
 
 
 Degrader::~Degrader() {
 
-  if (online_m)
-    goOffline();
+    if(online_m)
+        goOffline();
 }
 
 
@@ -129,13 +119,8 @@ bool Degrader::applyToReferenceParticle(const Vector_t &R,
 }
 
 void Degrader::initialise(PartBunchBase<double, 3> *bunch, double &startField, double &endField) {
-    RefPartBunch_m = bunch;
+    initialise(bunch);
     endField = startField + getElementLength();
-
-    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));
 }
 
 void Degrader::initialise(PartBunchBase<double, 3> *bunch) {
@@ -149,20 +134,22 @@ void Degrader::initialise(PartBunchBase<double, 3> *bunch) {
 
 void Degrader::finalise()
 {
-  *gmsg << "* Finalize Degrader" << endl;
+    *gmsg << "* Finalize Degrader" << endl;
 }
 
 void Degrader::goOnline(const double &) {
     Inform msg("Degrader::goOnline ");
 
-    PosX_m.reserve((int)(1.1 * RefPartBunch_m->getLocalNum()));
-    PosY_m.reserve((int)(1.1 * RefPartBunch_m->getLocalNum()));
-    PosZ_m.reserve((int)(1.1 * RefPartBunch_m->getLocalNum()));
-    MomentumX_m.reserve((int)(1.1 * RefPartBunch_m->getLocalNum()));
-    MomentumY_m.reserve((int)(1.1 * RefPartBunch_m->getLocalNum()));
-    MomentumZ_m.reserve((int)(1.1 * RefPartBunch_m->getLocalNum()));
-    time_m.reserve((int)(1.1 * RefPartBunch_m->getLocalNum()));
-    id_m.reserve((int)(1.1 * RefPartBunch_m->getLocalNum()));
+    int maximumSize = (int)(1.1 * RefPartBunch_m->getLocalNum());
+
+    PosX_m.reserve(maximumSize);
+    PosY_m.reserve(maximumSize);
+    PosZ_m.reserve(maximumSize);
+    MomentumX_m.reserve(maximumSize);
+    MomentumY_m.reserve(maximumSize);
+    MomentumZ_m.reserve(maximumSize);
+    time_m.reserve(maximumSize);
+    id_m.reserve(maximumSize);
     online_m = true;
 }
 
diff --git a/src/Classic/AbsBeamline/Degrader.h b/src/Classic/AbsBeamline/Degrader.h
index 239c1ea911b2b21e2de1727b622bd831f9447b43..7426f5c436c180a7967e86c3b7dddb3c74a377b8 100644
--- a/src/Classic/AbsBeamline/Degrader.h
+++ b/src/Classic/AbsBeamline/Degrader.h
@@ -25,6 +25,8 @@
 #include "AbsBeamline/Component.h"
 #include "AbsBeamline/BeamlineVisitor.h"
 #include "BeamlineGeometry/StraightGeometry.h"
+
+#include <string>
 #include <vector>
 
 class LossDataSink;
diff --git a/src/Classic/AbsBeamline/ElementBase.h b/src/Classic/AbsBeamline/ElementBase.h
index 7121877da9160b56a6c9f978d1bb2cd6d7aa264a..87f5d6e8e730d6f0bc581b667702c1b6f48ae562 100644
--- a/src/Classic/AbsBeamline/ElementBase.h
+++ b/src/Classic/AbsBeamline/ElementBase.h
@@ -65,8 +65,8 @@
 
 #include "AbsBeamline/AttributeSet.h"
 #include "BeamlineGeometry/Geometry.h"
+#include "BeamlineGeometry/Euclid3D.h"
 #include "MemoryManagement/RCObject.h"
-#include "Algorithms/Vektor.h"
 #include "Algorithms/Quaternion.h"
 #include "Algorithms/CoordinateSystemTrafo.h"
 #include "Utilities/GeneralClassicException.h"
@@ -328,7 +328,6 @@ public:
 
     virtual bool isInside(const Vector_t &r) const;
 
-    void setMisalignment(double x, double y, double s);
     void setMisalignment(const CoordinateSystemTrafo &cst);
 
     void getMisalignment(double &x, double &y, double &s) const;
diff --git a/src/Classic/AbsBeamline/RFCavity.cpp b/src/Classic/AbsBeamline/RFCavity.cpp
index b07b73f4a35832d5600a27f1325b3586e3ee3215..62f9718bafb7984f5a3a51b3a80e445f09504a93 100644
--- a/src/Classic/AbsBeamline/RFCavity.cpp
+++ b/src/Classic/AbsBeamline/RFCavity.cpp
@@ -180,7 +180,7 @@ void RFCavity::initialise(PartBunchBase<double, 3> *bunch, double &startField, d
     fieldmap_m->getFieldDimensions(startField_m, endField);
     if (endField <= startField_m) {
         throw GeneralClassicException("RFCavity::initialise",
-                                      "The length of the field map '" + filename_m + "' is zero or negativ");
+                                      "The length of the field map '" + filename_m + "' is zero or negative");
     }
 
     msg << level2 << getName() << " using file ";
@@ -534,7 +534,7 @@ double RFCavity::getAutoPhaseEstimateFallback(double E0, double t0, double q, do
 }
 
 double RFCavity::getAutoPhaseEstimate(const double &E0, const double &t0, const double &q, const double &mass) {
-	std::vector<double> t, E, t2, E2;
+    std::vector<double> t, E, t2, E2;
     std::vector<double> F;
     std::vector< std::pair< double, double > > G;
     gsl_spline *onAxisInterpolants;
@@ -543,6 +543,7 @@ double RFCavity::getAutoPhaseEstimate(const double &E0, const double &t0, const
     double phi = 0.0, tmp_phi, dphi = 0.5 * Physics::pi / 180.;
     double dz = 1.0, length = 0.0;
     fieldmap_m->getOnaxisEz(G);
+    if (G.size() == 0) return 0.0;
     double begin = (G.front()).first;
     double end   = (G.back()).first;
     std::unique_ptr<double[]> zvals(      new double[G.size()]);
@@ -628,9 +629,9 @@ double RFCavity::getAutoPhaseEstimate(const double &E0, const double &t0, const
             t[i] = t[i - 1] + getdT(i, E, dz, mass);
             t2[i] = t2[i - 1] + getdT(i, E2, dz, mass);
 
-            E[i] = E[i - 1];
+            E[i]  = E [i - 1];
             E2[i] = E2[i - 1];
-            E[i] += q * scale_m * getdE(i, t, dz, phi, frequency_m, F) ;
+            E[i]  += q * scale_m * getdE(i, t, dz, phi, frequency_m, F) ;
             E2[i] += q * scale_m * getdE(i, t2, dz, phi + dphi, frequency_m, F);
         }
 
diff --git a/src/Classic/AbsBeamline/SBend.cpp b/src/Classic/AbsBeamline/SBend.cpp
index 6c89c6708b71558a78c75b0d5bc4e246fdd42e77..15fe1b9122035cbf068d9f7a396db610b11a18f5 100644
--- a/src/Classic/AbsBeamline/SBend.cpp
+++ b/src/Classic/AbsBeamline/SBend.cpp
@@ -19,13 +19,10 @@
 // ------------------------------------------------------------------------
 
 #include "AbsBeamline/SBend.h"
-#include "Algorithms/PartBunchBase.h"
 #include "AbsBeamline/BeamlineVisitor.h"
-#include "Utilities/Options.h"
 #include "Fields/Fieldmap.h"
-#include "AbstractObjects/OpalData.h"
-#include <iostream>
-#include <fstream>
+
+#include <string>
 
 extern Inform *gmsg;
 
diff --git a/src/Classic/AbsBeamline/TravelingWave.cpp b/src/Classic/AbsBeamline/TravelingWave.cpp
index 50e2f4e389b6b3b4b94d58a9a7b7d686b8e38dc2..6575e3fd9a6a943b7d448c8b033e1b50cd664e3c 100644
--- a/src/Classic/AbsBeamline/TravelingWave.cpp
+++ b/src/Classic/AbsBeamline/TravelingWave.cpp
@@ -199,7 +199,6 @@ void TravelingWave::initialise(PartBunchBase<double, 3> *bunch, double &startFie
     }
 
     Inform msg("TravelingWave ", *gmsg);
-    std::stringstream errormsg;
 
     RefPartBunch_m = bunch;
     double zBegin = 0.0, zEnd = 0.0;
diff --git a/src/Classic/AbsBeamline/TravelingWave.h b/src/Classic/AbsBeamline/TravelingWave.h
index e82e9ea67527d87b5a14e3f1d74e05c389d9a839..ab6c4f4a2d0631556987137c8125c3b3df2676fc 100644
--- a/src/Classic/AbsBeamline/TravelingWave.h
+++ b/src/Classic/AbsBeamline/TravelingWave.h
@@ -30,8 +30,8 @@ class Fieldmap;
 
 // Class TravelingWave
 // ------------------------------------------------------------------------
-/// Interface for RF cavity.
-//  Class TravelingWave defines the abstract interface for RF cavities.
+/// Interface for Traveling Wave.
+//  Class TravelingWave defines the abstract interface for Traveling Wave.
 
 
 class TravelingWave: public RFCavity {
diff --git a/src/Classic/Algorithms/PBunchDefs.h b/src/Classic/Algorithms/PBunchDefs.h
index 9071c70465966bc421f306aae55222e438ac8529..89fed8cd0fcc0e6423d3e7959f831516af8f4f1f 100644
--- a/src/Classic/Algorithms/PBunchDefs.h
+++ b/src/Classic/Algorithms/PBunchDefs.h
@@ -3,17 +3,10 @@
 
 #include "Algorithms/Vektor.h"
 #include "Particle/IntCIC.h"
-#include "Particle/IntNGP.h"
-#include "Particle/IntSUDS.h"
-#include "Particle/IntTSC.h"
 #include "Particle/ParticleSpatialLayout.h"
-#include "Particle/ParticleUniformLayout.h"
-#include "Particle/ParticleAttrib.h"
 #include "Meshes/UniformCartesian.h"
-#include "Meshes/Centering.h"
 #include "FieldLayout/CenteredFieldLayout.h"
 #include "Field/Field.h"
-#include "FFT/FFT.h"
 
 #ifdef ENABLE_AMR
     #include "Amr/AmrDefs.h"
@@ -22,37 +15,21 @@
 #endif
 
 typedef IntCIC  IntrplCIC_t;
-typedef IntNGP  IntrplNGP_t;
-typedef IntSUDS IntrplSUDS_t;
-typedef IntTSC  IntrplTSC_t;
 
 typedef ParticleSpatialLayout<double, 3>::ParticlePos_t Ppos_t;
 typedef ParticleSpatialLayout<double, 3>::ParticleIndex_t PID_t;
 
-typedef ParticleUniformLayout<double, 3>::ParticlePos_t UPpos_t;
-typedef ParticleUniformLayout<double, 3>::ParticleIndex_t UPID_t;
-
-typedef ParticleAttrib<double> Pscalar_t;
-
-typedef InterpolatorTraits<double, 3, IntrplCIC_t>::Cache_t Pcache_t;
-
 typedef UniformCartesian<3, double> Mesh_t;
 
 typedef ParticleSpatialLayout< double, 3, Mesh_t  > Layout_t;
-typedef ParticleUniformLayout< double, 3  > ULayout_t;
 
 typedef Cell Center_t;
 
 typedef CenteredFieldLayout<3, Mesh_t, Center_t> FieldLayout_t;
+
 typedef Field<double, 3, Mesh_t, Center_t>       Field_t;
 typedef Field<Vector_t, 3, Mesh_t, Center_t>     VField_t;
 
-typedef Field<int, 3, Mesh_t, Center_t>          IField_t;
-typedef Field<std::complex<double>, 3, Mesh_t, Center_t>     CxField_t;
-typedef FFT<RCTransform, 3, double>              FFT_t;
-typedef FFT<SineTransform, 3, double>            SINE_t;
-typedef FFT<CCTransform, 3, double>              FFTC_t;
-
 #ifdef ENABLE_AMR
     typedef amr::AmrField_t                      AmrField_t;
     typedef amr::AmrScalarFieldContainer_t       AmrScalarFieldContainer_t;
@@ -61,10 +38,4 @@ typedef FFT<CCTransform, 3, double>              FFTC_t;
     typedef BoxLibParticle<AmrLayout_t>          AmrParticle_t;
 #endif
 
-namespace ParticleType {
-    enum type { REGULAR,
-                SECONDARY,
-                STRIPPED};
-}
-
 #endif
\ No newline at end of file
diff --git a/src/Classic/Algorithms/PartBins.h b/src/Classic/Algorithms/PartBins.h
index 7d77d894193ccb4027c74f25c362952db9e8e3ba..4e11711a0fc8492d33195a1f25c154f1520b704c 100644
--- a/src/Classic/Algorithms/PartBins.h
+++ b/src/Classic/Algorithms/PartBins.h
@@ -25,8 +25,6 @@
 #include <memory>
 #include <vector>
 
-#include "Algorithms/PBunchDefs.h"
-
 class Inform;
 
 class PartBins {
diff --git a/src/Classic/Algorithms/PartBunch.cpp b/src/Classic/Algorithms/PartBunch.cpp
index 2be8fe9af747162e8cb6e4722b4b1cb65c3e7aa8..767369953dad34b0e195703f37036dc8a7a45fbd 100644
--- a/src/Classic/Algorithms/PartBunch.cpp
+++ b/src/Classic/Algorithms/PartBunch.cpp
@@ -17,32 +17,24 @@
 // along with OPAL. If not, see <https://www.gnu.org/licenses/>.
 //
 #include "Algorithms/PartBunch.h"
-#include "FixedAlgebra/FMatrix.h"
-#include "FixedAlgebra/FVector.h"
+
 #include <cfloat>
 #include <memory>
 #include <utility>
 
-
-#include "Distribution/Distribution.h"  // OPAL file
-#include "Structure/FieldSolver.h"      // OPAL file
-#include "Utilities/GeneralClassicException.h"
+#include "FixedAlgebra/FMatrix.h"
+#include "FixedAlgebra/FVector.h"
+#include "Particle/ParticleBalancer.h"
 
 #include "Algorithms/ListElem.h"
-
-#include <gsl/gsl_rng.h>
-#include <gsl/gsl_histogram.h>
-#include <gsl/gsl_cdf.h>
-#include <gsl/gsl_randist.h>
-#include <gsl/gsl_sf_erf.h>
-#include <gsl/gsl_qrng.h>
+#include "Distribution/Distribution.h"
+#include "Structure/FieldSolver.h"
+#include "Utilities/GeneralClassicException.h"
 
 #ifdef DBG_SCALARFIELD
     #include "Structure/FieldWriter.h"
 #endif
 
-
-
 //#define FIELDSTDOUT
 
 PartBunch::PartBunch(const PartData *ref): // Layout is set using setSolver()
@@ -345,7 +337,7 @@ void PartBunch::resizeMesh() {
                R[n](1) < ymin || R[n](1) > ymax) {
 
                 // delete the particle
-                INFOMSG(level2 << "destroyed particle with id=" << ID[n] << endl;);
+                INFOMSG(level2 << "destroyed particle with id=" << ID[n] << endl);
                 destroy(1, n);
             }
 
@@ -831,38 +823,6 @@ void PartBunch::updateFields(const Vector_t& /*hr*/, const Vector_t& origin) {
                     vbc_m);
 }
 
-
-/**
- * Here we emit particles from the cathode. All particles in a new simulation (not a restart) initially reside in the bin
- container "pbin_m" and are not part of the beam bunch (so they cannot "see" fields, space charge etc.). In pbin_m, particles
- are sorted into the bins of a time histogram that describes the longitudinal time distribution of the beam, where the number
- of bins is given by \f$NBIN \times SBIN\f$. \f$NBIN\f$ and \f$SBIN\f$ are parameters given when defining the initial beam
- distribution. During emission, the time step of the simulation is set so that an integral number of these bins are emitted each step.
- Once all of the particles have been emitted, the simulation time step is reset to the value defined in the input file.
-
- A typical integration time step, \f$\Delta t\f$, is broken down into 3 sub-steps:
-
- 1) Drift particles for \f$\frac{\Delta t}{2}\f$.
-
- 2) Calculate fields and advance momentum.
-
- 3) Drift particles for \f$\frac{\Delta t}{2}\f$ at the new momentum to complete the
- full time step.
-
- The difficulty for emission is that at the cathode position there is a step function discontinuity in the  fields. If we
- apply the typical integration time step across this boundary, we get an artificial numerical bunching of the beam, especially
- at very high accelerating fields. This function takes the cathode position boundary into account in order to achieve
- smoother particle emission.
-
- During an emission step, an integral number of time bins from the distribution histogram are emitted. However, each particle
- contained in those time bins will actually be emitted from the cathode at a different time, so will only spend some fraction
- of the total time step, \f$\Delta t_{full-timestep}\f$, in the simulation. The trick to emission is to give each particle
- a unique time step, \f$Delta t_{temp}\f$, that is equal to the actual time during the emission step that the particle
- exists in the simulation. For the next integration time step, the particle's time step is set back to the global time step,
- \f$\Delta t_{full-timestep}\f$.
-  */
-
-
 inline
 PartBunch::VectorPair_t PartBunch::getEExtrema() {
     const Vector_t maxE = max(eg_m);
diff --git a/src/Classic/Algorithms/PartBunchBase.h b/src/Classic/Algorithms/PartBunchBase.h
index 47b865bd6587ccaacf28de35295d892cb421313a..be9af282f1a973c900efb1b834b76eb33386bd30 100644
--- a/src/Classic/Algorithms/PartBunchBase.h
+++ b/src/Classic/Algorithms/PartBunchBase.h
@@ -18,29 +18,36 @@
 #ifndef PART_BUNCH_BASE_H
 #define PART_BUNCH_BASE_H
 
-#include "Ippl.h"
-#include "Particle/AbstractParticle.h" //TODO should be in Ippl.h
-#include "Algorithms/PBunchDefs.h"
-#include "Algorithms/OpalParticle.h"
+#include "Utility/IpplTimings.h"
+#include "Particle/AbstractParticle.h"
+#include "Particle/ParticleAttrib.h"
+
 #include "Algorithms/CoordinateSystemTrafo.h"
+#include "Algorithms/OpalParticle.h"
+#include "Algorithms/PBunchDefs.h"
+#include "Algorithms/Quaternion.h"
+#include "Algorithms/Vektor.h"
+
 #include "FixedAlgebra/FMatrix.h"
 #include "FixedAlgebra/FVector.h"
-#include "Algorithms/PartBins.h"
-#include "Algorithms/PartBinsCyc.h"
-#include "Algorithms/PartData.h"
-#include "Algorithms/Quaternion.h"
 
 #include <memory>
 #include <utility>
 #include <vector>
 
-#include "Structure/FieldSolver.h"
-#include "Algorithms/ListElem.h"
-
 class Distribution;
-
-template <class T, int, int> class FMatrix;
-template <class T, int> class FVector;
+class FieldSolver;
+class PartBins;
+class PartBinsCyc;
+class PartData;
+
+namespace ParticleType {
+    enum type { REGULAR,
+                FIELDEMISSION,
+                SECONDARY,
+                NEWSECONDARY,
+                STRIPPED};
+}
 
 template <class T, unsigned Dim>
 class PartBunchBase
@@ -59,8 +66,6 @@ public:
 
 public:
 
-    explicit PartBunchBase(AbstractParticle<T, Dim>* pb);
-
     virtual ~PartBunchBase() { }
 
     PartBunchBase(AbstractParticle<T, Dim>* pb, const PartData *ref);
@@ -629,7 +634,7 @@ protected:
     int distDump_m;
 
     /// Mesh enlargement
-    double dh_m; /// in % how much the mesh is enlarged
+    double dh_m; /// relative enlargement of the mesh
 
     /// if larger than 0, emitt particles for tEmission_m [s]
     double tEmission_m;
diff --git a/src/Classic/Algorithms/PartBunchBase.hpp b/src/Classic/Algorithms/PartBunchBase.hpp
index a99a1232c0c9254d584835b35ee7c0ff604c8a8d..4559a3d35181d8189f8ec3cc0d22c0710ccd3a5b 100644
--- a/src/Classic/Algorithms/PartBunchBase.hpp
+++ b/src/Classic/Algorithms/PartBunchBase.hpp
@@ -24,7 +24,11 @@
 #include "Distribution/Distribution.h"
 
 #include "AbstractObjects/OpalData.h"   // OPAL file
+#include "Algorithms/PartBins.h"
+#include "Algorithms/PartBinsCyc.h"
+#include "Algorithms/PartData.h"
 #include "Physics/Physics.h"
+#include "Structure/FieldSolver.h"
 #include "Utilities/GeneralClassicException.h"
 #include "Utilities/OpalException.h"
 #include "Utilities/Options.h"
@@ -34,7 +38,7 @@
 extern Inform *gmsg;
 
 template <class T, unsigned Dim>
-PartBunchBase<T, Dim>::PartBunchBase(AbstractParticle<T, Dim>* pb)
+PartBunchBase<T, Dim>::PartBunchBase(AbstractParticle<T, Dim>* pb, const PartData *ref)
     : R(*(pb->R_p)),
       ID(*(pb->ID_p)),
       pbin_m(nullptr),
@@ -42,7 +46,7 @@ PartBunchBase<T, Dim>::PartBunchBase(AbstractParticle<T, Dim>* pb)
       pmsg_m(nullptr),
       f_stream(nullptr),
       fixed_grid(false),
-//       reference(ref), //FIXME
+      reference(ref),
       unit_state_(units),
       stateOfLastBoundP_(unitless),
       moments_m(),
@@ -93,13 +97,6 @@ PartBunchBase<T, Dim>::PartBunchBase(AbstractParticle<T, Dim>* pb)
     setup(pb);
 }
 
-template <class T, unsigned Dim>
-PartBunchBase<T, Dim>::PartBunchBase(AbstractParticle<T, Dim>* pb, const PartData *ref)
-    : PartBunchBase(pb)
-{
-    reference = ref;
-}
-
 /*
  * Bunch common member functions
  */
diff --git a/src/Classic/Algorithms/PartData.h b/src/Classic/Algorithms/PartData.h
index 735d544161903544a3f71f64d55f5f3a5f8b1c74..73636d2a3bc2b7ca35380b052a5a33f985e10e4c 100644
--- a/src/Classic/Algorithms/PartData.h
+++ b/src/Classic/Algorithms/PartData.h
@@ -19,9 +19,6 @@
 //
 // ------------------------------------------------------------------------
 
-class LogicalError;
-
-
 // Class PartData
 // ------------------------------------------------------------------------
 /// Particle reference data.
diff --git a/src/Classic/Algorithms/PolynomialTimeDependence.cpp b/src/Classic/Algorithms/PolynomialTimeDependence.cpp
index 00a07a7bffbec68b1785b771f2d03c3087be900d..6827726d73b18fe3ce4378bae53ae116a643e804 100644
--- a/src/Classic/Algorithms/PolynomialTimeDependence.cpp
+++ b/src/Classic/Algorithms/PolynomialTimeDependence.cpp
@@ -27,6 +27,8 @@
 
 #include "Algorithms/PolynomialTimeDependence.h"
 
+#include "Utility/Inform.h"
+
 Inform &PolynomialTimeDependence::print(Inform &os) {
   Inform::FmtFlags_t ff = os.flags();
   os << std::scientific;
diff --git a/src/Classic/Algorithms/PolynomialTimeDependence.h b/src/Classic/Algorithms/PolynomialTimeDependence.h
index ac2e7abaa31ee5dc91cf7eb83241169dbd1fd016..300f1ad653ad02ab02f8622d806c8964497457cf 100644
--- a/src/Classic/Algorithms/PolynomialTimeDependence.h
+++ b/src/Classic/Algorithms/PolynomialTimeDependence.h
@@ -30,9 +30,9 @@
 
 #include <vector>
 #include <iostream>
-#include "Ippl.h"
 #include "Algorithms/AbstractTimeDependence.h"
 
+class Inform;
 
 /** @class PolynomialTimeDependence
  * 
@@ -91,5 +91,4 @@ Inform &operator<<(Inform &os, PolynomialTimeDependence &p) {
   return p.print(os);
 }
 
-#endif
-
+#endif
\ No newline at end of file
diff --git a/src/Classic/Algorithms/SplineTimeDependence.cpp b/src/Classic/Algorithms/SplineTimeDependence.cpp
index 40d9c3515c988a73429f7678204a4e30a4288620..6ea5ff6e06096bde8c9067ab31bdc36a82f4ce68 100644
--- a/src/Classic/Algorithms/SplineTimeDependence.cpp
+++ b/src/Classic/Algorithms/SplineTimeDependence.cpp
@@ -31,6 +31,8 @@
 #include "Utilities/GeneralClassicException.h"
 #include "Algorithms/SplineTimeDependence.h"
 
+#include "Utility/Inform.h"
+
 SplineTimeDependence::SplineTimeDependence(size_t splineOrder,
                                            std::vector<double> times,
                                            std::vector<double> values)
diff --git a/src/Classic/Algorithms/SplineTimeDependence.h b/src/Classic/Algorithms/SplineTimeDependence.h
index ede981913b18e7a72dda0b114cfc823f8b4fff1a..47e004160a6d93273f8ff0e74306e96a45dff675 100644
--- a/src/Classic/Algorithms/SplineTimeDependence.h
+++ b/src/Classic/Algorithms/SplineTimeDependence.h
@@ -28,14 +28,15 @@
 #ifndef _CLASSIC_SRC_ALGORITHMS_SPLINETIMEDEPENDENCE_H_
 #define _CLASSIC_SRC_ALGORITHMS_SPLINETIMEDEPENDENCE_H_
 
-#include <memory>
+#include <vector>
 
 #include <gsl/gsl_spline.h>
 
-#include "Ippl.h"
 #include "Utilities/GeneralClassicException.h"
 #include "Algorithms/AbstractTimeDependence.h"
 
+class Inform;
+
 /** @class SplineTimeDependence
  * 
  *  Time dependence that follows a spline. Interpolation is supported at 
diff --git a/src/Classic/Algorithms/Tracker.cpp b/src/Classic/Algorithms/Tracker.cpp
index 2e90c97a521fdd317fe0ce80e320f671864a323d..76c0623f09f3a5dbb3060716d78f7d8c1557df69 100644
--- a/src/Classic/Algorithms/Tracker.cpp
+++ b/src/Classic/Algorithms/Tracker.cpp
@@ -81,10 +81,8 @@ typedef FTps<double, 6> Series;
 
 Tracker::Tracker(const Beamline &beamline, const PartData &reference,
                  bool backBeam, bool backTrack):
-    AbstractTracker(beamline, reference, backBeam, backTrack),
-    itsBeamline_m(beamline),
-    itsBunch_m(nullptr)
-{ }
+    Tracker(beamline, nullptr, reference, backBeam, backTrack)
+{}
 
 
 Tracker::Tracker(const Beamline &beamline,
diff --git a/src/Classic/Algorithms/Tracker.h b/src/Classic/Algorithms/Tracker.h
index c2d9408f25a425802884c297b2c73fe394057323..faba8cf63bb5edcc84422084395d0c01279791e2 100644
--- a/src/Classic/Algorithms/Tracker.h
+++ b/src/Classic/Algorithms/Tracker.h
@@ -81,8 +81,8 @@ public:
     //  The beam line to be tracked is [b]bl[/b].
     //  The particle reference data are taken from [b]data[/b].
     //  The particle bunch is initially empty.
-    //  If [b]revBeam[/b] is true, the beam runs from s = C to s = 0.
-    //  If [b]revTrack[/b] is true, we track against the beam.
+    //  If [b]backBeam[/b] is true, the beam runs from s = C to s = 0.
+    //  If [b]backTrack[/b] is true, we track against the beam.
     Tracker(const Beamline &, const PartData &,
             bool backBeam, bool backTrack);
 
@@ -90,8 +90,8 @@ public:
     //  The beam line to be tracked is [b]bl[/b].
     //  The particle reference data are taken from [b]data[/b].
     //  The particle bunch is taken from [b]bunch[/b].
-    //  If [b]revBeam[/b] is true, the beam runs from s = C to s = 0.
-    //  If [b]revTrack[/b] is true, we track against the beam.
+    //  If [b]backBeam[/b] is true, the beam runs from s = C to s = 0.
+    //  If [b]backTrack[/b] is true, we track against the beam.
     Tracker(const Beamline &, PartBunchBase<double, 3> *bunch,
             const PartData &, bool backBeam, bool backTrack);
 
diff --git a/src/Classic/Algorithms/Vektor.h b/src/Classic/Algorithms/Vektor.h
index 7e974849a2bf1d2f4267f1b265e31381f898b5ef..84ffdb3a7d16a28a5bba8b7c893167443004a894 100644
--- a/src/Classic/Algorithms/Vektor.h
+++ b/src/Classic/Algorithms/Vektor.h
@@ -5,11 +5,4 @@
 
 typedef Vektor<double, 3> Vector_t;
 
-/// comment: this should go to AppTypes/Vektor.h
-
-inline
-double euclidean_norm(Vector_t a) {
-    return std::sqrt(dot(a,a));
-}
-
 #endif
\ No newline at end of file
diff --git a/src/Classic/Beamlines/Beamline.h b/src/Classic/Beamlines/Beamline.h
index 80e4e8d72ac566eb0de9910a5f4c5b23e210362a..07598825933bf695ea9dbfbde034d10287c2849d 100644
--- a/src/Classic/Beamlines/Beamline.h
+++ b/src/Classic/Beamlines/Beamline.h
@@ -24,9 +24,6 @@
 #include "Algorithms/Vektor.h"
 #include "Algorithms/Quaternion.h"
 
-class CLRangeError;
-
-
 // Class Beamline
 // ------------------------------------------------------------------------
 /// An abstract sequence of beam line components.
diff --git a/src/Classic/Beamlines/TBeamline.h b/src/Classic/Beamlines/TBeamline.h
index 2e20b65223f0a23a619bc9d0eb7b5d19d73b6031..7b9a88182a300db8911f0bc83bbf2cd82582c761 100644
--- a/src/Classic/Beamlines/TBeamline.h
+++ b/src/Classic/Beamlines/TBeamline.h
@@ -23,10 +23,10 @@
 #include "Beamlines/Beamline.h"
 #include "AbsBeamline/BeamlineVisitor.h"
 #include "Beamlines/BeamlineGeometry.h"
-#include "Utilities/CLRangeError.h"
 #include "Algorithms/Vektor.h"
 #include "Algorithms/Quaternion.h"
 #include <algorithm>
+#include <string>
 #include <list>
 
 template <class T>
diff --git a/src/Classic/Fields/Fieldmap.cpp b/src/Classic/Fields/Fieldmap.cpp
index b01f97905c9abe24eadff81d4bcd35bd9de9d93b..91ec1594d91e5f44c596c42883fed9bca527b3c8 100644
--- a/src/Classic/Fields/Fieldmap.cpp
+++ b/src/Classic/Fields/Fieldmap.cpp
@@ -290,6 +290,10 @@ MapType Fieldmap::readHeader(std::string Filename) {
     if (Filename == "1DPROFILE1-DEFAULT")
         return T1DProfile1;
 
+    if (Filename.empty())
+        throw GeneralClassicException("Fieldmap::readHeader()",
+                                      "No field map file specified");
+
     if (!fs::exists(Filename))
         throw GeneralClassicException("Fieldmap::readHeader()",
                                       "File \"" + Filename + "\" doesn't exist");
diff --git a/src/Classic/Fields/Interpolation/MMatrix.cpp b/src/Classic/Fields/Interpolation/MMatrix.cpp
index 69bdab9d9ddc983d7c912ebe9efc9b3aaa35cdca..f1c6e1faaadeba733cc9ea73849e010492584775 100644
--- a/src/Classic/Fields/Interpolation/MMatrix.cpp
+++ b/src/Classic/Fields/Interpolation/MMatrix.cpp
@@ -374,17 +374,6 @@ template <class Tmplt> std::istream& operator>>(std::istream& in, MMatrix<Tmplt>
 
 
 ///////////////// INTERFACES
-const gsl_matrix*         MMatrix_to_gsl(const MMatrix<double>&    m)
-{
-  if(m._matrix == NULL) throw(GeneralClassicException("MMatrix_to_gsl", "Attempt to reference uninitialised matrix"));
-  return (gsl_matrix*)m._matrix;
-}
-
-const gsl_matrix_complex* MMatrix_to_gsl(const MMatrix<m_complex>& m)
-{
-  if(m._matrix == NULL) throw(GeneralClassicException("MMatrix_to_gsl", "Attempt to reference uninitialised matrix"));
-  return (gsl_matrix_complex*)m._matrix;
-}
 
 MMatrix<double>    re(MMatrix<m_complex> mc)
 {
diff --git a/src/Classic/Fields/Interpolation/MMatrix.h b/src/Classic/Fields/Interpolation/MMatrix.h
index c76295ce6f723d75bf4ca814402c5cfbe5e4fba7..588ffff75bb1f77e83cf20e414a11e7eaacc9e61 100644
--- a/src/Classic/Fields/Interpolation/MMatrix.h
+++ b/src/Classic/Fields/Interpolation/MMatrix.h
@@ -172,10 +172,7 @@ public:
   friend MMatrix<m_complex>& operator +=(MMatrix<m_complex>& m1, const MMatrix<m_complex>& m2);
   friend MMatrix<double>&    operator +=(MMatrix<double>&    m1, const MMatrix<double>&    m2);
   template <class Tmplt2> friend MMatrix<Tmplt2>      operator + (MMatrix<Tmplt2>      m1, const MMatrix<Tmplt2>      m2);
- 
-  friend const gsl_matrix*         MMatrix_to_gsl(const MMatrix<double>& m);
-  friend const gsl_matrix_complex* MMatrix_to_gsl(const MMatrix<gsl_complex>& m);
- 
+
   friend class MMatrix<double>; //To do the eigenvector problem, MMatrix<double> needs to see MMatrix<complex>'s _matrix
 
 
@@ -233,10 +230,6 @@ MMatrix<double>    im(MMatrix<m_complex> m);
 MMatrix<m_complex> complex(MMatrix<double> real);
 MMatrix<m_complex> complex(MMatrix<double> real, MMatrix<double> imaginary);
 
-//return pointer to gsl_matrix objects that store matrix data in m
-const gsl_matrix*         MMatrix_to_gsl(const MMatrix<double>&      m);
-const gsl_matrix_complex* MMatrix_to_gsl(const MMatrix<gsl_complex>& m);
-
 //////////////////////////// MMatrix declaration end ///////////////
 
 
diff --git a/src/Classic/Fields/Interpolation/MVector.cpp b/src/Classic/Fields/Interpolation/MVector.cpp
index 56454291d0e44fe9aedc90e74e00dd86b5294cad..a442602b12e323a7cd0b465dad9161e21cad687e 100644
--- a/src/Classic/Fields/Interpolation/MVector.cpp
+++ b/src/Classic/Fields/Interpolation/MVector.cpp
@@ -188,11 +188,6 @@ template <class Tmplt> std::istream& operator>>(std::istream& in, MVector<Tmplt>
   return in;
 }
 
-const gsl_vector*         MVector_to_gsl(const MVector<double>&      vd)
-{return vd.get_vector(vd);}
-const gsl_vector_complex* MVector_to_gsl(const MVector<gsl_complex>& vc)
-{return vc.get_vector(vc);}
-
 template <class Tmplt>
 MVector<Tmplt> MVector<Tmplt>::sub(size_t n1, size_t n2) const
 {
diff --git a/src/Classic/Fields/Interpolation/MVector.h b/src/Classic/Fields/Interpolation/MVector.h
index 88829aa6c42d581718239d4eeb49b01fb4efb786..4042147cedaed6d659844aa0d766c27784a905ce 100644
--- a/src/Classic/Fields/Interpolation/MVector.h
+++ b/src/Classic/Fields/Interpolation/MVector.h
@@ -150,11 +150,6 @@ public:
   friend class MMatrix<Tmplt>;
   friend class MMatrix<double>;
 
-//  friend gsl_vector*         MVectorToGSL(MVector<double>&     );
-//  friend gsl_vector_complex* MVectorToGSL(MVector<gsl_complex>&);
-  friend const gsl_vector*         MVector_to_gsl(const MVector<double>&     );
-  friend const gsl_vector_complex* MVector_to_gsl(const MVector<gsl_complex>&);
-
 private:
   void build_vector ( size_t size ); //copy from data and put it in the vector
   void build_vector ( const Tmplt* data_start, const Tmplt* data_end ); //copy from data and put it in the vector
@@ -204,10 +199,6 @@ MVector<m_complex> complex(MVector<double> real, MVector<double> imaginary);
 MVector<double>    re     (MVector<m_complex> mv);
 MVector<double>    im     (MVector<m_complex> mv);
 
-//Interface to gsl
-const gsl_vector*         MVector_to_gsl(const MVector<double>&      vd);
-const gsl_vector_complex* MVector_to_gsl(const MVector<gsl_complex>& vc);
-
 ///////////////// MVector End ///////////////// Nb: some inlined functions below...
 
 //////////////////////////// MVector Inlined Functions //////////////
diff --git a/src/Classic/Fields/Interpolation/PPSolveFactory.h b/src/Classic/Fields/Interpolation/PPSolveFactory.h
index 87531e0f1ee672d553dcfd99828357534cec7a94..3f67f4096a58c3319ea621f2416139cc9e5ba3d2 100644
--- a/src/Classic/Fields/Interpolation/PPSolveFactory.h
+++ b/src/Classic/Fields/Interpolation/PPSolveFactory.h
@@ -122,7 +122,7 @@ class PPSolveFactory {
     void getDerivPoints();
     void getDerivs(Mesh::Iterator it);
 
-    // nothing calls this method but I don't quite field brave enought to remove
+    // nothing calls this method but I don't quite feel brave enough to remove
     // it...
     std::vector<double> outOfBoundsPosition(Mesh::Iterator outOfBoundsIt);
     static void nearbyPointsRecursive(
diff --git a/src/Classic/Fields/SectorField.h b/src/Classic/Fields/SectorField.h
index 0578bd3fa582a9be62ab51be7517ea473836cbec..a6eb80c425e8105fe2a0b953b6aee55174079c8e 100644
--- a/src/Classic/Fields/SectorField.h
+++ b/src/Classic/Fields/SectorField.h
@@ -79,8 +79,8 @@ class SectorField {
      *         Overwrites any existing data
      *  \returns true if any field value is non-zero
      */
-    virtual bool getFieldstrengthPolar
-                  (const Vector_t &R_p, Vector_t &E_p, Vector_t &B_p) const = 0;
+    /* virtual bool getFieldstrengthPolar */
+    /*               (const Vector_t &R_p, Vector_t &E_p, Vector_t &B_p) const = 0; */
 
     /** Return the field value in cartesian coordinates
      *
diff --git a/src/Classic/Fields/SectorMagneticFieldMap.cpp b/src/Classic/Fields/SectorMagneticFieldMap.cpp
index e3579d63e3cfdf2d6d0c299002ec936e141d6b22..9836ce02062dc157cb7a693db675dc74bc615181 100644
--- a/src/Classic/Fields/SectorMagneticFieldMap.cpp
+++ b/src/Classic/Fields/SectorMagneticFieldMap.cpp
@@ -189,8 +189,9 @@ std::string SectorMagneticFieldMap::SymmetryToString
           ));
 }
 
-bool SectorMagneticFieldMap::getFieldstrengthPolar (
-        const Vector_t &R_p, Vector_t &/*E_p*/, Vector_t &B_p) const {
+/*
+bool SectorMagneticFieldMap::getFieldstrengthPolar
+                    (const Vector_t &R_p, Vector_t &, Vector_t &B_p) const {
     // vector_t::operator[i] const returns by value, not by const reference
     // so we need to make an array here
     double R_temp[3] = {R_p[0], R_p[1], R_p[2]};
@@ -202,13 +203,14 @@ bool SectorMagneticFieldMap::getFieldstrengthPolar (
     SectorField::convertToPolar(R_temp, &(B_p[0]));
     return false;
 }
+*/
 
 bool SectorMagneticFieldMap::getFieldstrength (
         const Vector_t &R_c, Vector_t &/*E_c*/, Vector_t &B_c) const {
     // coordinate transform; field is in the x-z plane but OPAL-CYCL assumes
     // x-y plane; rotate to the start of the bend and into polar coordinates;
     // apply mirror symmetry about the midplane
-    double radius = (getPolarBoundingBoxMin()[0]+getPolarBoundingBoxMax()[0])/2;
+    double radius   = (getPolarBoundingBoxMin()[0]+getPolarBoundingBoxMax()[0])/2;
     double midplane = (getPolarBoundingBoxMin()[1]+getPolarBoundingBoxMax()[1])/2;
     double R_temp[3] = {R_c(0)+radius, R_c(1), R_c(2)};
     double B_temp[3] = {0., 0., 0.};
diff --git a/src/Classic/Fields/SectorMagneticFieldMap.h b/src/Classic/Fields/SectorMagneticFieldMap.h
index ae1417485b4ea8f6c2da05b726eef7386a3df920..26a59ecb3584feee7d1a344cf75c477679d8dcc0 100644
--- a/src/Classic/Fields/SectorMagneticFieldMap.h
+++ b/src/Classic/Fields/SectorMagneticFieldMap.h
@@ -114,8 +114,8 @@ class SectorMagneticFieldMap : public SectorField {
      *         Overwrites any existing data
      *  \returns false if R_p is inside the bounding box
      */
-    bool getFieldstrengthPolar
-                  (const Vector_t &R_p, Vector_t &E_p, Vector_t &B_p) const;
+    /* bool getFieldstrengthPolar */
+    /*               (const Vector_t &R_p, Vector_t &E_p, Vector_t &B_p) const; */
 
     /** Get the field value in cartesian coordinates
      *
diff --git a/src/Classic/FixedAlgebra/FTpsData.h b/src/Classic/FixedAlgebra/FTpsData.h
index b11700df1412504158553e313f2c87f8e153a37a..3779396d2b35d01c353000600bc147065a942bca 100644
--- a/src/Classic/FixedAlgebra/FTpsData.h
+++ b/src/Classic/FixedAlgebra/FTpsData.h
@@ -25,8 +25,6 @@
 #include "FixedAlgebra/FArray1D.h"
 #include "FixedAlgebra/FMonomial.h"
 
-#define DEBUG_FTpsData_H
-
 // Template class FTpsData<N>
 // ------------------------------------------------------------------------
 /// Internal utility class for FTps<T,N> class.
diff --git a/src/Classic/MemoryManagement/RCObject.h b/src/Classic/MemoryManagement/RCObject.h
index 2260ce7d65230b029f6bf0db145845216df3e812..679d770267130e0187600790032527af3902971e 100644
--- a/src/Classic/MemoryManagement/RCObject.h
+++ b/src/Classic/MemoryManagement/RCObject.h
@@ -36,8 +36,6 @@
 //  All constructors, the destructor, and the assignment operators are
 //  protected, since a stand-alone RCObject makes no sense.
 
-//#include <Ippl.h>
-
 
 class RCObject {
 
diff --git a/src/Classic/Parser/Statement.h b/src/Classic/Parser/Statement.h
index da2d3b9e0abb6d9aaa58e343ddf3e4de5025628c..3c13c0187d28b968964c45779ce43d45d4e457f5 100644
--- a/src/Classic/Parser/Statement.h
+++ b/src/Classic/Parser/Statement.h
@@ -25,7 +25,7 @@
 #include <list>
 #include <string>
 
-#include <Ippl.h>
+#include "Utility/Inform.h"
 
 class Parser;
 
diff --git a/src/Classic/Solvers/BeamStrippingPhysics.cpp b/src/Classic/Solvers/BeamStrippingPhysics.cpp
index f94dce5bea0f9c49ae2d60e7367a6a884f175da3..bb4cafcb6f11d84cd35af762d3bb7ad8d92e0d76 100644
--- a/src/Classic/Solvers/BeamStrippingPhysics.cpp
+++ b/src/Classic/Solvers/BeamStrippingPhysics.cpp
@@ -31,7 +31,7 @@
 #include "Structure/LossDataSink.h"
 #include "Utilities/Options.h"
 
-#include "Ippl.h"
+#include "Utility/Inform.h"
 
 #include <iostream>
 #include <fstream>
@@ -635,12 +635,6 @@ bool BeamStrippingPhysics::stillActive() {
     return locPartsInMat_m != 0;
 }
 
-bool BeamStrippingPhysics::stillAlive(PartBunchBase<double, 3> */*bunch*/) {
-    bool beamstrippingAlive = true;
-    return beamstrippingAlive;
-}
-
-
 /*
     Cross sections parameters for interaction with air
     -- [1] -> Nitrogen
diff --git a/src/Classic/Solvers/BeamStrippingPhysics.hh b/src/Classic/Solvers/BeamStrippingPhysics.hh
index 931ea0b3109e8909d14ac75e9354020d450b7196..8aa88ae3b72cc416dd63bb961fbaa830c633822a 100644
--- a/src/Classic/Solvers/BeamStrippingPhysics.hh
+++ b/src/Classic/Solvers/BeamStrippingPhysics.hh
@@ -52,15 +52,14 @@ public:
                        const std::pair<Vector_t, double> &boundingSphere);
 
     virtual const std::string getType() const;
-    void print(Inform& msg);
-    bool stillActive();
-    bool stillAlive(PartBunchBase<double, 3> *bunch);
-
-    inline double getTime() {return T_m;}
-    std::string getName() {return element_ref_m->getName();}
-    size_t getParticlesInMat() {return locPartsInMat_m;}
-    unsigned getRediffused() {return rediffusedStat_m;}
-    unsigned int getNumEntered() {return bunchToMatStat_m;}
+    virtual void print(Inform& msg);
+    virtual bool stillActive();
+
+    virtual inline double getTime() {return T_m;}
+    virtual std::string getName() {return element_ref_m->getName();}
+    virtual size_t getParticlesInMat() {return locPartsInMat_m;}
+    virtual unsigned getRediffused() {return rediffusedStat_m;}
+    virtual unsigned int getNumEntered() {return bunchToMatStat_m;}
     inline void doPhysics(PartBunchBase<double, 3> *bunch);
 
 private:
diff --git a/src/Classic/Solvers/CollimatorPhysics.cpp b/src/Classic/Solvers/CollimatorPhysics.cpp
index 11e529447c39268fb911327c03d783e0a73576d2..2041184624321fa72be55361fcbc15128dfcc28b 100644
--- a/src/Classic/Solvers/CollimatorPhysics.cpp
+++ b/src/Classic/Solvers/CollimatorPhysics.cpp
@@ -35,7 +35,7 @@
 #include "Utilities/Util.h"
 #include "Utilities/Timer.h"
 
-#include "Ippl.h"
+#include "Utility/Inform.h"
 
 #include <gsl/gsl_randist.h>
 
@@ -44,6 +44,8 @@
 #include <fstream>
 #include <algorithm>
 
+#include <sys/time.h>
+
 namespace {
     struct DegraderInsideTester: public InsideTester {
         explicit DegraderInsideTester(ElementBase * el) {
@@ -301,7 +303,7 @@ bool CollimatorPhysics::computeEnergyLoss(Vector_t &P,
     double gamma = Util::getGamma(P);
     const double gammaSqr = std::pow(gamma, 2);
     const double betaSqr = 1.0 - 1.0 / gammaSqr;
-    double beta = sqrt(betaSqr);
+    double beta = std::sqrt(betaSqr);
     double Ekin = (gamma - 1) * massProton_keV;
     double dEdx = 0.0;
 
@@ -329,12 +331,12 @@ bool CollimatorPhysics::computeEnergyLoss(Vector_t &P,
     }
 
     if (includeFluctuations) {
-        double sigma_E = sqrt(K * massElectron_keV * rho_m * (Z_m / A_m) * deltas * m2cm);
+        double sigma_E = std::sqrt(K * massElectron_keV * rho_m * (Z_m / A_m) * deltas * m2cm);
         Ekin += gsl_ran_gaussian(rGen_m, sigma_E);
     }
 
     gamma = Ekin / massProton_keV + 1.0;
-    beta = sqrt(1.0 - 1.0 / std::pow(gamma, 2));
+    beta = std::sqrt(1.0 - 1.0 / std::pow(gamma, 2));
     P = gamma * beta * P / euclidean_norm(P);
 
     bool stopped = (Ekin < 10 || dEdx > 0);
@@ -364,10 +366,10 @@ void  CollimatorPhysics::applyRotation(Vector_t &P,
 
 void CollimatorPhysics::applyRandomRotation(Vector_t &P, double theta0) {
 
-    double thetaru = 2.5 / sqrt(gsl_rng_uniform(rGen_m)) * 2.0 * theta0;
+    double thetaru = 2.5 / std::sqrt(gsl_rng_uniform(rGen_m)) * 2.0 * theta0;
     double phiru = Physics::two_pi * gsl_rng_uniform(rGen_m);
 
-    double normPtrans = sqrt(P(0) * P(0) + P(1) * P(1));
+    double normPtrans = std::sqrt(P(0) * P(0) + P(1) * P(1));
     double Theta = std::atan(normPtrans / std::abs(P(2)));
     double CosT = cos(Theta);
     double SinT = sin(Theta);
@@ -397,10 +399,10 @@ void  CollimatorPhysics::computeCoulombScattering(Vector_t &R,
     constexpr double sqrtThreeInv = 0.57735026918962576451; // sqrt(1.0 / 3.0)
     const double normP = euclidean_norm(P);
     const double gammaSqr = std::pow(normP, 2) + 1.0;
-    const double beta = sqrt(1.0 - 1.0 / gammaSqr);
+    const double beta = std::sqrt(1.0 - 1.0 / gammaSqr);
     const double deltas = dt * beta * Physics::c;
     const double theta0 = (13.6e6 / (beta * normP * massProton_eV) *
-                           chargeProton * sqrt(deltas / X0_m) *
+                           chargeProton * std::sqrt(deltas / X0_m) *
                            (1.0 + 0.038 * log(deltas / X0_m)));
 
     double phi = Physics::two_pi * gsl_rng_uniform(rGen_m);
@@ -503,7 +505,7 @@ void CollimatorPhysics::copyFromBunch(PartBunchBase<double, 3> *bunch,
             hitTester_m->checkHit(bunch->R[i]))
         {
             // adjust the time step for those particles that enter the material
-            // such that it corresponds to the time needed to reach the curren
+            // such that it corresponds to the time needed to reach the current
             // location form the edge of the material. Only use this time step
             // for the computation of the interaction with the material, not for
             // the integration of the particles. This will ensure that the momenta
@@ -574,31 +576,6 @@ bool CollimatorPhysics::stillActive() {
     return totalPartsInMat_m != 0;
 }
 
-bool CollimatorPhysics::stillAlive(PartBunchBase<double, 3> *bunch) {
-
-    bool degraderAlive = true;
-
-    //free GPU memory in case element is degrader, it is empty and bunch has moved past it
-    if (collshape_m == ElementBase::DEGRADER && totalPartsInMat_m == 0) {
-        Degrader *deg = static_cast<Degrader *>(element_ref_m);
-
-        //get the size of the degrader
-        double zBegin, zEnd;
-        deg->getDimensions(zBegin, zEnd);
-
-        //get the average Z position of the bunch
-        Vector_t bunchOrigin = bunch->get_origin();
-
-        //if bunch has moved past degrader free GPU memory
-        if (bunchOrigin[2] > zBegin) {
-            degraderAlive = false;
-        }
-    }
-
-    return degraderAlive;
-
-}
-
 namespace {
     bool myCompF(PART x, PART y) {
       return x.label > y.label;
diff --git a/src/Classic/Solvers/CollimatorPhysics.hh b/src/Classic/Solvers/CollimatorPhysics.hh
index fc8fc6bfae79c00641e2b197b7ac82dfdf447f9f..bccf439b776605a1c964ecf58966581edca980cf 100644
--- a/src/Classic/Solvers/CollimatorPhysics.hh
+++ b/src/Classic/Solvers/CollimatorPhysics.hh
@@ -21,18 +21,18 @@
 #ifndef COLLIMATORPHYSICS_HH
 #define COLLIMATORPHYSICS_HH
 
-#include <vector>
 #include "Solvers/ParticleMatterInteractionHandler.hh"
+
+#include "AbsBeamline/ElementBase.h"
 #include "Algorithms/Vektor.h"
-#include "AbsBeamline/Component.h"
-#include "AbsBeamline/CCollimator.h"
-#include "AbsBeamline/FlexibleCollimator.h"
-#include "AbsBeamline/Degrader.h"
 #include <gsl/gsl_rng.h>
 
 #include "Utility/IpplTimings.h"
 
-class ElementBase;
+#include <memory>
+#include <utility>
+#include <string>
+#include <vector>
 
 template <class T, unsigned Dim>
 class PartBunchBase;
@@ -75,15 +75,14 @@ public:
 
     virtual const std::string getType() const;
 
-    void print(Inform& os);
-    bool stillActive();
-    bool stillAlive(PartBunchBase<double, 3> *bunch);
+    virtual void print(Inform& os);
+    virtual bool stillActive();
 
-    double getTime();
-    std::string getName();
-    size_t getParticlesInMat();
-    unsigned getRediffused();
-    unsigned int getNumEntered();
+    virtual double getTime();
+    virtual std::string getName();
+    virtual size_t getParticlesInMat();
+    virtual unsigned getRediffused();
+    virtual unsigned int getNumEntered();
     void computeInteraction();
 
     virtual bool computeEnergyLoss(Vector_t &P,
diff --git a/src/Classic/Solvers/ParticleMatterInteractionHandler.hh b/src/Classic/Solvers/ParticleMatterInteractionHandler.hh
index f952bdb51946951158d6c5d8e122878fb27deeb7..af4fc75ad42382060a326fa9746be44156b08d85 100644
--- a/src/Classic/Solvers/ParticleMatterInteractionHandler.hh
+++ b/src/Classic/Solvers/ParticleMatterInteractionHandler.hh
@@ -19,7 +19,6 @@ public:
     virtual const std::string getType() const = 0;
     virtual void print(Inform& os) = 0;
     virtual bool stillActive() = 0;
-    virtual bool stillAlive(PartBunchBase<double, 3> *bunch) = 0;
     virtual double getTime() = 0;
     virtual std::string getName() = 0;
     virtual size_t getParticlesInMat() = 0;
diff --git a/src/Classic/Structure/LossDataSink.cpp b/src/Classic/Structure/LossDataSink.cpp
index fe465ead4b393cd8849f9bf2c0aa41c4afcfb874..121b8118b142afd067458f6175739763cdcb4215 100644
--- a/src/Classic/Structure/LossDataSink.cpp
+++ b/src/Classic/Structure/LossDataSink.cpp
@@ -1,6 +1,5 @@
 #include "Structure/LossDataSink.h"
 
-#include "Ippl.h"
 #include "Utilities/Options.h"
 #include "AbstractObjects/OpalData.h"
 #include "Utilities/GeneralClassicException.h"
diff --git a/src/Classic/Structure/LossDataSink.h b/src/Classic/Structure/LossDataSink.h
index cb3d147246fc3145aad06dc800e830050f45c24c..771c8c89eacaafd58b7c03a03d9d7d4458af313e 100644
--- a/src/Classic/Structure/LossDataSink.h
+++ b/src/Classic/Structure/LossDataSink.h
@@ -2,11 +2,10 @@
 //  Copyright & License: See Copyright.readme in src directory
 //
 
-#ifndef OPAL_LOSSOUTPUT_H_
-#define OPAL_LOSSOUTPUT_H_
+#ifndef LOSSDATASINK_H_
+#define LOSSDATASINK_H_
 
 //////////////////////////////////////////////////////////////
-#include "Utility/IpplInfo.h"
 #include "Algorithms/Vektor.h"
 #include "AbsBeamline/ElementBase.h"
 #include "AbstractObjects/OpalData.h"
@@ -17,7 +16,6 @@
 #include <functional>
 #include <set>
 
-#include <hdf5.h>
 #include "H5hut.h"
 
 struct SetStatistics {
@@ -199,4 +197,4 @@ std::set<SetStatistics> LossDataSink::computeStatistics(unsigned int numStatisti
 // c-basic-offset: 4
 // indent-tabs-mode: nil
 // require-final-newline: nil
-// End:
+// End:
\ No newline at end of file
diff --git a/src/Classic/Structure/MeshGenerator.h b/src/Classic/Structure/MeshGenerator.h
index 018f7713e5c910bf238bc125ad0ae507801a296f..ddd428e9005f9275d68391a0003404842f124231 100644
--- a/src/Classic/Structure/MeshGenerator.h
+++ b/src/Classic/Structure/MeshGenerator.h
@@ -1,4 +1,23 @@
-#include "AbsBeamline/ElementBase.h"
+//
+// Mesh Generator
+//
+// Copyright (c) 2008-2020
+// Paul Scherrer Institut, Villigen PSI, Switzerland
+// All rights reserved.
+//
+// OPAL is licensed under GNU GPL version 3.
+//
+
+#ifndef MESHGENERATOR_H_
+#define MESHGENERATOR_H_
+
+#include "Algorithms/Vektor.h"
+
+#include <string>
+#include <utility>
+#include <vector>
+
+class ElementBase;
 
 class MeshData {
 public:
@@ -41,6 +60,8 @@ private:
     std::vector<MeshData> elements_m;
 };
 
+#endif
+
 // vi: set et ts=4 sw=4 sts=4:
 // Local Variables:
 // mode:c
diff --git a/src/Classic/Structure/PeakFinder.cpp b/src/Classic/Structure/PeakFinder.cpp
index 5c6150269376d0a9103ad44440b32b5ea0f0d755..e06688c5c185fcc7170b5c5ee4bf392366c950c6 100644
--- a/src/Classic/Structure/PeakFinder.cpp
+++ b/src/Classic/Structure/PeakFinder.cpp
@@ -5,7 +5,9 @@
 #include <iterator>
 
 #include "AbstractObjects/OpalData.h"
-#include "Ippl.h"
+
+#include "Message/GlobalComm.h"
+#include "Utility/IpplInfo.h"
 
 PeakFinder::PeakFinder(std::string elem, double min,
                        double max, double binWidth, bool singlemode)
diff --git a/src/Classic/Structure/PeakFinder.h b/src/Classic/Structure/PeakFinder.h
index a6b0777e8c4318f3defb3ba1f00db714318ecec6..b74916ee9dfa2da1f6e75695d540ab736c9cbf01 100644
--- a/src/Classic/Structure/PeakFinder.h
+++ b/src/Classic/Structure/PeakFinder.h
@@ -14,7 +14,6 @@
  * used for the cyclotron probe element.
  */
 
-#include "Utility/IpplInfo.h"
 #include "Algorithms/Vektor.h"
 
 #include <fstream>
diff --git a/src/Classic/TrimCoils/OpalTrimCoil.cpp b/src/Classic/TrimCoils/OpalTrimCoil.cpp
index 992e6638e0fd34ef02d6e587b2a1cbbe7b4eacdc..270c5f6cfe2a8d882308cb9b1c2fe6f450779c5e 100644
--- a/src/Classic/TrimCoils/OpalTrimCoil.cpp
+++ b/src/Classic/TrimCoils/OpalTrimCoil.cpp
@@ -31,7 +31,7 @@
 #include "TrimCoils/TrimCoilPhaseFit.h"
 #include "TrimCoils/TrimCoilMirrored.h"
 #include "Utilities/OpalException.h"
-#include "Utility/IpplInfo.h"
+#include "Utility/Inform.h"
 
 extern Inform *gmsg;
 
diff --git a/src/Classic/TrimCoils/OpalTrimCoil.h b/src/Classic/TrimCoils/OpalTrimCoil.h
index 4591db3334c5901d9f2bfc15ac1848f2a0b62fae..67e0a757086216d5afd61d15d9c9b70671ca420f 100644
--- a/src/Classic/TrimCoils/OpalTrimCoil.h
+++ b/src/Classic/TrimCoils/OpalTrimCoil.h
@@ -31,6 +31,7 @@
 #include "AbstractObjects/Definition.h"
 
 class Attribute;
+class Inform;
 class TrimCoil;
 
 class OpalTrimCoil: public Definition {
diff --git a/src/Classic/Utilities/ClassicField.h b/src/Classic/Utilities/ClassicField.h
index 766780492036d840888bc34ae27bf6d9299490a3..97cc566a2c6c05bf5da4b6bb1780d4ed44ff49b9 100644
--- a/src/Classic/Utilities/ClassicField.h
+++ b/src/Classic/Utilities/ClassicField.h
@@ -1,12 +1,9 @@
 #ifndef CLASSIC_FIELD_H
 #define CLASSIC_FIELD_H
 
-#include <vector>
 #include <list>
 #include <memory>
 #include "AbsBeamline/Component.h"
-#include "Algorithms/Quaternion.h"
-#include "Algorithms/CoordinateSystemTrafo.h"
 
 class ClassicField {
 public:
@@ -34,10 +31,6 @@ public:
 
     ElementBase::BoundingBox getBoundingBoxInLabCoords() const;
 
-    CoordinateSystemTrafo getCoordTransformationTo() const ;
-    void setCoordTransformationTo(const CoordinateSystemTrafo &trafo);
-    bool isPositioned() const;
-    void fixPosition();
     unsigned int order_m;
 private:
     std::shared_ptr<Component> element_m;
@@ -80,26 +73,6 @@ inline void ClassicField::setEnd(const double & z) {
     end_m = z;
 }
 
-inline
-CoordinateSystemTrafo ClassicField::getCoordTransformationTo() const {
-    return element_m->getCSTrafoGlobal2Local();
-}
-
-inline
-void ClassicField::setCoordTransformationTo(const CoordinateSystemTrafo &trafo) {
-    element_m->setCSTrafoGlobal2Local(trafo);
-}
-
-inline
-bool ClassicField::isPositioned() const {
-    return element_m->isPositioned();
-}
-
-inline
-void ClassicField::fixPosition() {
-    element_m->fixPosition();
-}
-
 inline
 ElementBase::BoundingBox ClassicField::getBoundingBoxInLabCoords() const {
     return element_m->getBoundingBoxInLabCoords();
diff --git a/src/Distribution/ClosedOrbitFinder.h b/src/Distribution/ClosedOrbitFinder.h
index aede80ce4b02f9c84bbb879026a199baee14ec69..27771a60b7ceaa8a02918a163571a410cd0a8f9b 100644
--- a/src/Distribution/ClosedOrbitFinder.h
+++ b/src/Distribution/ClosedOrbitFinder.h
@@ -37,7 +37,6 @@
 #include <utility>
 #include <vector>
 
-#include "Utilities/Options.h"
 #include "Utilities/Options.h"
 #include "Utilities/OpalException.h"
 #include "Physics/Physics.h"
diff --git a/src/Distribution/Distribution.cpp b/src/Distribution/Distribution.cpp
index 1cf37f4dbaa88696e7dc0fab1833f8c3b3679aa7..8e6ae954e359b833fadc6f0ba12b86306837a7bb 100644
--- a/src/Distribution/Distribution.cpp
+++ b/src/Distribution/Distribution.cpp
@@ -27,7 +27,6 @@
 #include "AbstractObjects/OpalData.h"
 #include "Algorithms/PartBins.h"
 #include "Algorithms/PartBunchBase.h"
-#include "Structure/Beam.h"
 #include "Algorithms/PartBinsCyc.h"
 #include "BasicActions/Option.h"
 #include "Distribution/LaserProfile.h"
@@ -304,7 +303,7 @@ void Distribution::create(size_t &numberOfParticles, double massIneV, double cha
         createDistributionMultiGauss(numberOfLocalParticles, massIneV);
         break;
     default:
-        INFOMSG("Distribution unknown." << endl;);
+        INFOMSG("Distribution unknown." << endl);
         break;
     }
 
@@ -1194,15 +1193,15 @@ void Distribution::createMatchedGaussDistribution(size_t numberOfParticles,
     int Nsectors = (int)Attributes::getReal(itsAttr[Attrib::Distribution::NSECTORS]);
 
     if ( Nint < 0 )
-        throw OpalException("Distribution::CreateMatchedGaussDistribution()",
+        throw OpalException("Distribution::createMatchedGaussDistribution()",
                             "Negative number of integration steps");
 
     if ( Nsectors < 0 )
-        throw OpalException("Distribution::CreateMatchedGaussDistribution()",
+        throw OpalException("Distribution::createMatchedGaussDistribution()",
                             "Negative number of sectors");
 
     if ( Nsectors > 1 && full == false )
-        throw OpalException("Distribution::CreateMatchedGaussDistribution()",
+        throw OpalException("Distribution::createMatchedGaussDistribution()",
                             "Averaging over sectors can only be done with SECTOR=FALSE");
 
     *gmsg << "* ----------------------------------------------------" << endl;
@@ -1226,7 +1225,7 @@ void Distribution::createMatchedGaussDistribution(size_t numberOfParticles,
     if ( CyclotronElement->getFMLowE()  < 0 ||
          CyclotronElement->getFMHighE() < 0 )
     {
-        throw OpalException("Distribution::CreateMatchedGaussDistribution()",
+        throw OpalException("Distribution::createMatchedGaussDistribution()",
                             "Missing attributes 'FMLOWE' and/or 'FMHIGHE' in "
                             "'CYCLOTRON' definition.");
     }
@@ -1241,7 +1240,7 @@ void Distribution::createMatchedGaussDistribution(size_t numberOfParticles,
         Attributes::getReal(itsAttr[Attrib::Distribution::DENERGY]);
 
     if ( denergy < 0.0 )
-        throw OpalException("Distribution:CreateMatchedGaussDistribution()",
+        throw OpalException("Distribution:createMatchedGaussDistribution()",
                             "DENERGY < 0");
 
     double accuracy =
@@ -1256,7 +1255,7 @@ void Distribution::createMatchedGaussDistribution(size_t numberOfParticles,
         cof_t cof(massIneV*1E-6, charge, Nint, CyclotronElement, full, Nsectors);
         cof.findOrbit(accuracy, maxitCOF, E_m*1E-6, denergy, rguess, true);
 
-        throw EarlyLeaveException("Distribution::CreateMatchedGaussDistribution()",
+        throw EarlyLeaveException("Distribution::createMatchedGaussDistribution()",
                                   "Do only tune calculation.");
     }
 
diff --git a/src/Distribution/SigmaGenerator.h b/src/Distribution/SigmaGenerator.h
index f70f034dc7d16c9b2a3793b810bac4a2384547d4..30b46d2f36755d26ce908fbf0ce484e85833fb28 100644
--- a/src/Distribution/SigmaGenerator.h
+++ b/src/Distribution/SigmaGenerator.h
@@ -33,16 +33,19 @@
 #define SIGMAGENERATOR_H
 
 #include <array>
+#include <fstream>
+#include <functional>
 #include <string>
 #include <vector>
 
+#include <boost/numeric/ublas/matrix.hpp>
+
 #include "AbsBeamline/Cyclotron.h"
 #include "FixedAlgebra/FTps.h"
 #include "Physics/Physics.h"
 
 #include "Distribution/RealDiracMatrix.h"
 
-
 class SigmaGenerator
 {
 public:
@@ -54,7 +57,7 @@ public:
     typedef RealDiracMatrix::vector_t vector_t;
     /// Container for storing the properties for each angle
     typedef std::vector<double> container_t;
-    /// Type of the truncated powere series
+    /// Type of the truncated power series
     typedef FTps<double,2*3> Series;
     /// Type of a map
     typedef FVps<double,2*3> Map;
diff --git a/src/Elements/OpalBeamline.cpp b/src/Elements/OpalBeamline.cpp
index 3a9cddc3cda176241cbec2142107ae2e8006cc06..83637239f980e737125ca1a9c0576ac0d93df284 100644
--- a/src/Elements/OpalBeamline.cpp
+++ b/src/Elements/OpalBeamline.cpp
@@ -53,7 +53,7 @@ std::set<std::shared_ptr<Component>> OpalBeamline::getElements(const Vector_t &x
     const FieldList::iterator end = elements_m.end();
     for (; it != end; ++ it) {
         std::shared_ptr<Component> element = (*it).getElement();
-        Vector_t r = (*it).getCoordTransformationTo().transformTo(x);
+        Vector_t r = element->getCSTrafoGlobal2Local().transformTo(x);
 
         if (element->isInside(r)) {
             elementSet.insert(element);
@@ -212,11 +212,11 @@ void OpalBeamline::compute3DLattice() {
 
         FieldList::iterator it = elements_m.begin();
         for (; it != end; ++ it) {
-            if ((*it).isPositioned()) {
+            std::shared_ptr<Component> element = (*it).getElement();
+            if (element->isPositioned()) {
                 continue;
             }
             (*it).order_m = minOrder;
-            std::shared_ptr<Component> element = (*it).getElement();
 
             if (element->getType() != ElementBase::SBEND &&
                 element->getType() != ElementBase::RBEND &&
@@ -266,7 +266,7 @@ void OpalBeamline::compute3DLattice() {
             CoordinateSystemTrafo fromEndLastToEndThis(endThis3D,
                                                        rotationAboutAxis.conjugate());
 
-            (*it).setCoordTransformationTo(fromEndLastToBeginThis * currentCoordTrafo);
+            element->setCSTrafoGlobal2Local(fromEndLastToBeginThis * currentCoordTrafo);
 
             currentCoordTrafo = (fromEndLastToEndThis * currentCoordTrafo);
 
@@ -279,11 +279,11 @@ void OpalBeamline::compute3DLattice() {
 
     FieldList::iterator it = elements_m.begin();
     for (; it != end; ++ it) {
-        if ((*it).isPositioned()) continue;
+        std::shared_ptr<Component> element = (*it).getElement();
+        if (element->isPositioned()) continue;
 
         (*it).order_m = order ++;
 
-        std::shared_ptr<Component> element = (*it).getElement();
         double beginThisPathLength = element->getElementPosition();
         double thisLength = element->getElementLength();
         Vector_t beginThis3D(0, 0, beginThisPathLength - endPriorPathLength);
@@ -344,10 +344,10 @@ void OpalBeamline::compute3DLattice() {
 
             CoordinateSystemTrafo fromLastToThis(beginThis3D, rotationAboutZ);
 
-            (*it).setCoordTransformationTo(fromLastToThis * currentCoordTrafo);
+            element->setCSTrafoGlobal2Local(fromLastToThis * currentCoordTrafo);
         }
 
-        (*it).fixPosition();
+        element->fixPosition();
     }
 }
 
@@ -376,8 +376,8 @@ void OpalBeamline::save3DLattice() {
     MeshGenerator mesh;
     for (; it != end; ++ it) {
         std::shared_ptr<Component> element = (*it).getElement();
-        CoordinateSystemTrafo toBegin = element->getEdgeToBegin() * (*it).getCoordTransformationTo();
-        CoordinateSystemTrafo toEnd = element->getEdgeToEnd() * (*it).getCoordTransformationTo();
+        CoordinateSystemTrafo toBegin = element->getEdgeToBegin() * element->getCSTrafoGlobal2Local();
+        CoordinateSystemTrafo toEnd = element->getEdgeToEnd() * element->getCSTrafoGlobal2Local();
         Vector_t entry3D = toBegin.getOrigin();
         Vector_t exit3D = toEnd.getOrigin();
 
@@ -388,7 +388,7 @@ void OpalBeamline::save3DLattice() {
 
             Bend2D * bendElement = static_cast<Bend2D*>(element.get());
             std::vector<Vector_t> designPath = bendElement->getDesignPath();
-            toEnd = bendElement->getBeginToEnd_local() * (*it).getCoordTransformationTo();
+            toEnd = bendElement->getBeginToEnd_local() * element->getCSTrafoGlobal2Local();
             exit3D = toEnd.getOrigin();
 
             unsigned int size = designPath.size();
@@ -402,7 +402,7 @@ void OpalBeamline::save3DLattice() {
                 << std::setw(18) << std::setprecision(10) << entry3D(1)
                 << "\n";
 
-            Vector_t position = (*it).getCoordTransformationTo().transformFrom(designPath.front());
+            Vector_t position = element->getCSTrafoGlobal2Local().transformFrom(designPath.front());
             pos << std::setw(30) << std::left << std::string("\"BEGIN: ") + element->getName() + std::string("\"")
                 << std::setw(18) << std::setprecision(10) << position(2)
                 << std::setw(18) << std::setprecision(10) << position(0)
@@ -411,7 +411,7 @@ void OpalBeamline::save3DLattice() {
 
             for (unsigned int i = frequency; i + 1 < size; i += frequency) {
 
-                position = (*it).getCoordTransformationTo().transformFrom(designPath[i]);
+                position = element->getCSTrafoGlobal2Local().transformFrom(designPath[i]);
                 pos << std::setw(30) << std::left << std::string("\"MID: ") + element->getName() + std::string("\"")
                     << std::setw(18) << std::setprecision(10) << position(2)
                     << std::setw(18) << std::setprecision(10) << position(0)
@@ -419,7 +419,7 @@ void OpalBeamline::save3DLattice() {
                     << std::endl;
             }
 
-            position = (*it).getCoordTransformationTo().transformFrom(designPath.back());
+            position = element->getCSTrafoGlobal2Local().transformFrom(designPath.back());
             pos << std::setw(30) << std::left << std::string("\"END: ") + element->getName() + std::string("\"")
                 << std::setw(18) << std::setprecision(10) << position(2)
                 << std::setw(18) << std::setprecision(10) << position(0)
@@ -534,15 +534,16 @@ void OpalBeamline::save3DInput() {
     std::ofstream pos(fname);
 
     for (; it != end; ++ it) {
-        std::string element = (*it).getElement()->getName();
-        const boost::regex replacePSI("(" + element + "\\s*:[^\\n]*)PSI\\s*=[^,;]*,?", boost::regex::icase);
+        std::shared_ptr<Component> element = (*it).getElement();
+        std::string elementName = element->getName();
+        const boost::regex replacePSI("(" + elementName + "\\s*:[^\\n]*)PSI\\s*=[^,;]*,?", boost::regex::icase);
         input = boost::regex_replace(input, replacePSI, "\\1\\2");
 
-        const boost::regex replaceELEMEDGE("(" + element + "\\s*:[^\\n]*)ELEMEDGE\\s*=[^,;]*(.)", boost::regex::icase);
+        const boost::regex replaceELEMEDGE("(" + elementName + "\\s*:[^\\n]*)ELEMEDGE\\s*=[^,;]*(.)", boost::regex::icase);
 
-        CoordinateSystemTrafo cst = (*it).getCoordTransformationTo();
+        CoordinateSystemTrafo cst = element->getCSTrafoGlobal2Local();
         Vector_t origin = cst.getOrigin();
-        Vector_t orient = Util::getTaitBryantAngles(cst.getRotation().conjugate(), element);
+        Vector_t orient = Util::getTaitBryantAngles(cst.getRotation().conjugate(), elementName);
         for (unsigned int d = 0; d < 3; ++ d)
             orient(d) *= Physics::rad2deg;
 
@@ -562,20 +563,20 @@ void OpalBeamline::save3DInput() {
 
         input = boost::regex_replace(input, replaceELEMEDGE, position);
 
-        if ((*it).getElement()->getType() == ElementBase::RBEND ||
-            (*it).getElement()->getType() == ElementBase::SBEND) {
-            const Bend2D* dipole = static_cast<const Bend2D*>((*it).getElement().get());
+        if (element->getType() == ElementBase::RBEND ||
+            element->getType() == ElementBase::SBEND) {
+            const Bend2D* dipole = static_cast<const Bend2D*>(element.get());
             double angle = dipole->getBendAngle();
             double E1 = dipole->getEntranceAngle();
             double E2 = dipole->getExitAngle();
 
-            const boost::regex angleR("(" + element + "\\s*:[^\\n]*ANGLE\\s*=)[^,;]*(.)");
+            const boost::regex angleR("(" + elementName + "\\s*:[^\\n]*ANGLE\\s*=)[^,;]*(.)");
             const std::string angleF("\\1 " + round2string(angle * 180 / Physics::pi, 6) + " / 180 * PI\\2");
-            const boost::regex E1R("(" + element + "\\s*:[^\\n]*E1\\s*=)[^,;]*(.)");
+            const boost::regex E1R("(" + elementName + "\\s*:[^\\n]*E1\\s*=)[^,;]*(.)");
             const std::string E1F("\\1 " + round2string(E1 * 180 / Physics::pi, 6) + " / 180 * PI\\2");
-            const boost::regex E2R("(" + element + "\\s*:[^\\n]*E2\\s*=)[^,;]*(.)");
+            const boost::regex E2R("(" + elementName + "\\s*:[^\\n]*E2\\s*=)[^,;]*(.)");
             const std::string E2F("\\1 " + round2string(E2 * 180 / Physics::pi, 6) + " / 180 * PI\\2");
-            const boost::regex noRotation("(" + element + "\\s*:[^\\n]*),\\s*ROTATION\\s*=[^,;]*(.)");
+            const boost::regex noRotation("(" + elementName + "\\s*:[^\\n]*),\\s*ROTATION\\s*=[^,;]*(.)");
             const std::string noRotationFormat("\\1\\2  ");
 
             input = boost::regex_replace(input, angleR, angleF);
diff --git a/src/Elements/OpalCavity.cpp b/src/Elements/OpalCavity.cpp
index 3f56dce7779fc2cbca2e799b4f9c1ac62bcfed3f..8133ad09215166c337d4f7942618b0ad3bebe910 100644
--- a/src/Elements/OpalCavity.cpp
+++ b/src/Elements/OpalCavity.cpp
@@ -40,16 +40,6 @@ OpalCavity::OpalCavity():
                    ("LAG", "Phase lag (rad)");
     itsAttr[DLAG] = Attributes::makeReal
                     ("DLAG", "Phase lag error (rad)");
-    itsAttr[HARMON] = Attributes::makeReal
-                      ("HARMON", "Harmonic number");
-    itsAttr[BETARF] = Attributes::makeReal
-                      ("BETRF", "beta_RF");
-    itsAttr[PG] = Attributes::makeReal
-                  ("PG", "RF power in MW");
-    itsAttr[ZSHUNT] = Attributes::makeReal
-                      ("SHUNT", "Shunt impedance in MOhm");
-    itsAttr[TFILL] = Attributes::makeReal
-                     ("TFILL", "Fill time in microseconds");
     itsAttr[FMAPFN] = Attributes::makeString
                       ("FMAPFN", "Filename of the fieldmap");
     itsAttr[GEOMETRY] = Attributes::makeString
@@ -95,8 +85,7 @@ OpalCavity::OpalCavity(const std::string &name, OpalCavity *parent):
 
 
 OpalCavity::~OpalCavity() {
-    if(owk_m)
-        delete owk_m;
+    delete owk_m;
 }
 
 
diff --git a/src/Elements/OpalCavity.h b/src/Elements/OpalCavity.h
index bc4694d7b874956d1c02f3b314f3f2a6356d30a6..12e8076aaf42fc06a9e75f4983b435ac6c588b0e 100644
--- a/src/Elements/OpalCavity.h
+++ b/src/Elements/OpalCavity.h
@@ -35,11 +35,6 @@ public:
         FREQ,           // The RF frequency.
         LAG,            // The phase lag.
         DLAG,           // The phase lag error.
-        HARMON,         // The harmonic number.
-        BETARF,         // The beta_RF.
-        PG,             // The RF power.
-        ZSHUNT,         // The shunt impedance.
-        TFILL,          // The filling time.
         FMAPFN,         // The filename of the fieldmap
         FAST,           // Faster but less accurate
         APVETO,         // Do not use this cavity in the Autophase procedure
diff --git a/src/Elements/OpalElement.h b/src/Elements/OpalElement.h
index 4c43fae214f70adcf37e2ea26aaafff0fbc7a729..c5eb7390bb28db25b4accc3eefc601b8cd77190c 100644
--- a/src/Elements/OpalElement.h
+++ b/src/Elements/OpalElement.h
@@ -21,6 +21,7 @@
 #include "AbstractObjects/Element.h"
 #include "MemoryManagement/OwnPtr.h"
 #include <map>
+#include <string>
 
 class Statement;
 
diff --git a/src/Elements/OpalFlexibleCollimator.cpp b/src/Elements/OpalFlexibleCollimator.cpp
index 00c71d6808601fdf6a7434c3f4afaaad6840000b..0f3bbf70da09d7c9f7cb08ccf4a1434c682aaffe 100644
--- a/src/Elements/OpalFlexibleCollimator.cpp
+++ b/src/Elements/OpalFlexibleCollimator.cpp
@@ -25,7 +25,7 @@
 
 OpalFlexibleCollimator::OpalFlexibleCollimator():
     OpalElement(SIZE, "FLEXIBLECOLLIMATOR",
-                "The \"FLEXIBLECOLLIMATOR\" element defines a slit."),
+                "The \"FLEXIBLECOLLIMATOR\" element defines a flexible collimator."),
     partMatInt_m(NULL) {
     itsAttr[FNAME] = Attributes::makeString
                      ("FNAME", "File name containing description of holes");
diff --git a/src/Elements/OpalPepperPot.cpp b/src/Elements/OpalPepperPot.cpp
index 29177e0b58067790977eacdb4f58783b01006c7e..4cdd1b19723536d2438f1164a26d88d4fdc39a05 100644
--- a/src/Elements/OpalPepperPot.cpp
+++ b/src/Elements/OpalPepperPot.cpp
@@ -1,7 +1,7 @@
 //
 // Class OpalPepperPot
 //   The PEPPERPOT element.
-//   The class of OPAL elliptic collimators.
+//   The class of OPAL pepperpot collimators.
 //
 // Copyright (c) 200x - 2020, Paul Scherrer Institut, Villigen PSI, Switzerland
 // All rights reserved
@@ -24,7 +24,7 @@
 
 OpalPepperPot::OpalPepperPot():
     OpalElement(SIZE, "PEPPERPOT",
-                "The \"PEPPERPOT\" element defines an elliptic collimator."),
+                "The \"PEPPERPOT\" element defines an pepperpot collimator."),
     parmatint_m(NULL) {
     itsAttr[XSIZE] = Attributes::makeReal
                      ("XSIZE", "Size in x of the pepperpot in m");
diff --git a/src/Elements/OpalQuadrupole.cpp b/src/Elements/OpalQuadrupole.cpp
index 2c8a2bc71c02e7992266b93e55f79fd9776ed56d..c7ae4190390a004085ecf056c62a28c34c8d7fb2 100644
--- a/src/Elements/OpalQuadrupole.cpp
+++ b/src/Elements/OpalQuadrupole.cpp
@@ -39,10 +39,9 @@ OpalQuadrupole::OpalQuadrupole():
                   ("DK1", "Normalised upright quadrupole coefficient error in m^(-2)");
     itsAttr[K1S] = Attributes::makeReal
                    ("K1S", "Normalised skew quadrupole coefficient in m^(-2)");
-
     itsAttr[DK1S] = Attributes::makeReal
                    ("DK1S", "Normalised skew quadrupole coefficient error in m^(-2)");
-                   
+
     itsAttr[NSLICES] = Attributes::makeReal
                       ("NSLICES",
                       "The number of slices/ steps for this element in Map Tracking", 1);
@@ -61,8 +60,7 @@ OpalQuadrupole::OpalQuadrupole(const std::string &name, OpalQuadrupole *parent):
 
 
 OpalQuadrupole::~OpalQuadrupole() {
-    if(parmatint_m)
-        delete parmatint_m;
+    delete parmatint_m;
 }
 
 
diff --git a/src/Elements/OpalTravelingWave.cpp b/src/Elements/OpalTravelingWave.cpp
index 48761df3b4e14cda50b17050110dbb681b118ef6..eda5d282fdd7a4c29f35a3b5d3cfd10eb5b470a0 100644
--- a/src/Elements/OpalTravelingWave.cpp
+++ b/src/Elements/OpalTravelingWave.cpp
@@ -36,24 +36,12 @@ OpalTravelingWave::OpalTravelingWave():
                    ("LAG", "Phase lag in rad");
     itsAttr[DLAG] = Attributes::makeReal
                     ("DLAG", "Phase lag error in rad");
-    itsAttr[HARMON] = Attributes::makeReal
-                      ("HARMON", "Harmonic number");
-    itsAttr[BETARF] = Attributes::makeReal
-                      ("BETRF", "beta_RF");
-    itsAttr[PG] = Attributes::makeReal
-                  ("PG", "RF power in MW");
-    itsAttr[ZSHUNT] = Attributes::makeReal
-                      ("SHUNT", "Shunt impedance in MOhm");
-    itsAttr[TFILL] = Attributes::makeReal
-                     ("TFILL", "Fill time in microseconds");
     itsAttr[FMAPFN] = Attributes::makeString
                       ("FMAPFN", "Filename for the fieldmap");
     itsAttr[FAST] = Attributes::makeBool
                     ("FAST", "Faster but less accurate", true);
     itsAttr[APVETO] = Attributes::makeBool
                     ("APVETO", "Do not use this cavity in the Autophase procedure", false);
-    itsAttr[CAVITYTYPE] = Attributes::makeString
-                          ("CAVITYTYPE", "STANDING or TRAVELING wave cavity in photoinjector and LINAC; SINGLEGAP or DOUBLEGAP cavity in cyclotron");
     itsAttr[NUMCELLS] = Attributes::makeReal
                         ("NUMCELLS", "Number of cells in a TW structure");
     itsAttr[DESIGNENERGY] = Attributes::makeReal
@@ -75,8 +63,7 @@ OpalTravelingWave::OpalTravelingWave(const std::string &name, OpalTravelingWave
 
 
 OpalTravelingWave::~OpalTravelingWave() {
-    if(owk_m)
-        delete owk_m;
+    delete owk_m;
 }
 
 
diff --git a/src/Elements/OpalTravelingWave.h b/src/Elements/OpalTravelingWave.h
index 2456e934cb7eccc1ae73a7f47c6dcd07d80b8bfc..c462b6b192f13b430c8b9ce6a7fa133c2e406a20 100644
--- a/src/Elements/OpalTravelingWave.h
+++ b/src/Elements/OpalTravelingWave.h
@@ -33,15 +33,9 @@ public:
         FREQ,           // The RF frequency.
         LAG,            // The phase lag.
         DLAG,           // The phase lag error
-        HARMON,         // The harmonic number.
-        BETARF,         // The beta_RF.
-        PG,             // The RF power.
-        ZSHUNT,         // The shunt impedance.
-        TFILL,          // The filling time.
         FMAPFN,         // The filename of the fieldmap
         APVETO,         // Do not use this cavity in the Autophase procedure
         FAST,           // Faster but less accurate
-        CAVITYTYPE,     // STANDING or TRAVELING wave structure
         NUMCELLS,       // Number of cells in a TW structure
         DESIGNENERGY,   // The mean kinetic energy at exit
         MODE,           // The phase shift between cells
diff --git a/src/Expressions/Expressions.cpp b/src/Expressions/Expressions.cpp
index 8f0170bb4fd8b6ef7e4c44ea20b1d0e5bb51ce8d..b6289a991c4daee6f32eee6d36a00d80d6e29c22 100644
--- a/src/Expressions/Expressions.cpp
+++ b/src/Expressions/Expressions.cpp
@@ -744,7 +744,7 @@ namespace Expressions {
                     array.push_back(SNull<double>::make(*fun));
                     result = new AList<double>(array);
                 } else if(const ArrayFun *fun = find(tablea, frstName)) {
-                    PtrToArray<double> arg1 = parseRealArray(stat);
+                    arg1 = parseRealArray(stat);
                     ArrayOfPtrs<double> array;
                     array.push_back(new ASUnary<double>(*fun, arg1));
                     result = new AList<double>(array);
diff --git a/src/Expressions/SDeferred.h b/src/Expressions/SDeferred.h
index 1bc8db0d8004ad0a0f04b12ef8eccab65d922ba8..ee8c324f012b3de422dd9cf6df9b0bf3ca8ee307 100644
--- a/src/Expressions/SDeferred.h
+++ b/src/Expressions/SDeferred.h
@@ -125,12 +125,12 @@ namespace Expressions {
                                    this->getImage() + "\": " + ex.what());
             } catch(std::exception &ex) {
                 in_evaluation = false;
-                throw LogicalError("ADeferred::evaluate()",
+                throw LogicalError("SDeferred::evaluate()",
                                    "Standard C++ exception while evaluating \"" +
                                    this->getImage() + "\": " + ex.what());
             } catch(...) {
                 in_evaluation = false;
-                throw LogicalError("ADeferred::evaluate()",
+                throw LogicalError("SDeferred::evaluate()",
                                    "Unknown exception while evaluating \"" +
                                    this->getImage() + "\": ");
             }
diff --git a/src/Expressions/SRefAttr.h b/src/Expressions/SRefAttr.h
index 7c601258aa84497497dace4384a040d2e2feb790..c32e5d7efd0cddb82bb301ddd68357a14dffe0d3 100644
--- a/src/Expressions/SRefAttr.h
+++ b/src/Expressions/SRefAttr.h
@@ -174,7 +174,7 @@ namespace Expressions {
 
     template <class T>
     double SRefAttr<T>::getReal() {
-        throw ParseError("SValue<T>::getReal()",
+        throw ParseError("SRefAttr<T>::getReal()",
                          "Attribute is not of real type.");
     }
 
diff --git a/src/Lines/SequenceMember.h b/src/Lines/SequenceMember.h
index a8f4d38c0748f760640b9070f22bfd7a0677fed7..837e2b98a8ea1604bcd13da55c5febfae5c84a13 100644
--- a/src/Lines/SequenceMember.h
+++ b/src/Lines/SequenceMember.h
@@ -71,7 +71,7 @@ public:
     MemberType itsType;
 
     // ada 4.5 2000 to speed up matching, add a pointer to
-    // opal elements in order to avoid serching the opal elements
+    // opal elements in order to avoid searching the opal elements
     Pointer<Element> OpalElement;
 
 
diff --git a/src/Main.cpp b/src/Main.cpp
index 59fd4ac7743818ad320ca20e530f3412bba3aa8b..0e286dcf058e64bbec7589c629b37e1084e41ffc 100644
--- a/src/Main.cpp
+++ b/src/Main.cpp
@@ -17,9 +17,6 @@
 
 #include "opal.h"
 
-Ippl *ippl;
-Inform *gmsg;
-
 #include "H5hut.h"
 
 #include "AbstractObjects/OpalData.h"
@@ -33,52 +30,37 @@ Inform *gmsg;
 
 #include "BasicActions/Option.h"
 #include "Utilities/Options.h"
-#include "Utilities/Options.h"
 #include "Utilities/OpalException.h"
 #include "Utilities/EarlyLeaveException.h"
 #include "Utilities/Util.h"
 
+#include "Util/SDDSParser/SDDSParserException.h"
+
 #include "OPALconfig.h"
 
 #ifdef ENABLE_AMR
 #include <AMReX_ParallelDescriptor.H>
 #endif
-/*
-  Includes related to the optimizer
-*/
-#include "boost/smart_ptr.hpp"
-
-#include "Pilot/Pilot.h"
-#include "Util/CmdArguments.h"
-#include "Util/OptPilotException.h"
-
-#include "Optimizer/EA/FixedPisaNsga2.h"
-#include "Optimizer/EA/BlendCrossover.h"
-#include "Optimizer/EA/IndependentBitMutation.h"
-
-#include "Optimize/OpalSimulation.h"
-
-#include "Comm/CommSplitter.h"
-#include "Comm/Topology/NoCommTopology.h"
-#include "Comm/Splitter/ManyMasterSplit.h"
-#include "Comm/MasterGraph/SocialNetworkGraph.h"
-
-#include "Expression/Parser/function.hpp"
-#include "Expression/FromFile.h"
-#include "Expression/SumErrSq.h"
-#include "Expression/SDDSVariable.h"
-#include "Expression/RadialPeak.h"
-#include "Expression/SumErrSqRadialPeak.h"
-#include "Expression/ProbeVariable.h"
+
+// IPPL
+#include "Message/Communicate.h"
+#include "Utility/Inform.h"
+#include "Utility/IpplException.h"
+#include "Utility/IpplInfo.h"
+#include "Utility/IpplTimings.h"
 
 #include <gsl/gsl_errno.h>
 
 #include <boost/filesystem.hpp>
-#include <boost/algorithm/string/predicate.hpp>
+#include <boost/system/error_code.hpp>
 
 #include <cstring>
+#include <iomanip>
+#include <iostream>
 #include <set>
-#include <algorithm>
+
+Ippl *ippl;
+Inform *gmsg;
 
 namespace {
     void errorHandlerGSL(const char *reason,
@@ -416,7 +398,6 @@ int main(int argc, char *argv[]) {
     } catch(SDDSParserException &ex) {
         Inform errorMsg("Error", std::cerr, INFORM_ALL_NODES);
 
-        std::stringstream msg;
         errorMsg << "\n*** Error detected by function \""
                  << ex.where() << "\"\n";
         std::string what = ex.what();
@@ -432,7 +413,6 @@ int main(int argc, char *argv[]) {
     } catch(IpplException &ex) {
         Inform errorMsg("Error", std::cerr, INFORM_ALL_NODES);
 
-        std::stringstream msg;
         errorMsg << "\n*** Error detected by function \""
                  << ex.where() << "\"\n";
         std::string what = ex.what();
diff --git a/src/OpalParser/IfStatement.cpp b/src/OpalParser/IfStatement.cpp
index f0483dbf1ca643f58fd7302badd131d120277907..aec7f27a97d3b1f37c8835abd423367826adcd25 100644
--- a/src/OpalParser/IfStatement.cpp
+++ b/src/OpalParser/IfStatement.cpp
@@ -26,6 +26,7 @@
 #include "Parser/TokenStream.h"
 #include "Utilities/ParseError.h"
 
+#include "Utility/IpplInfo.h"
 
 // class IfStatement
 //   Statement of the form "IF ( <condition> ) <statement>".
diff --git a/src/OpalParser/OpalParser.cpp b/src/OpalParser/OpalParser.cpp
index 8cd8ecbc022814922c8a689a9b78d639cafda26e..839af98d10aa89d153ad706e08e85d72ce895ec1 100644
--- a/src/OpalParser/OpalParser.cpp
+++ b/src/OpalParser/OpalParser.cpp
@@ -41,7 +41,9 @@
 #include <new>
 #include <boost/algorithm/string.hpp>
 
-#include <Ippl.h>
+#include "Message/GlobalComm.h"
+#include "Utility/Inform.h"
+#include "Utility/IpplInfo.h"
 
 using namespace Expressions;
 
diff --git a/src/OpalParser/WhileStatement.cpp b/src/OpalParser/WhileStatement.cpp
index cd453c945e0f225ba080bd746f29f262d5925660..7f16066f67e155c068bd9a101d9a8609ca28ae4a 100644
--- a/src/OpalParser/WhileStatement.cpp
+++ b/src/OpalParser/WhileStatement.cpp
@@ -17,6 +17,7 @@
 // ------------------------------------------------------------------------
 
 #include "OpalParser/WhileStatement.h"
+
 #include "AbstractObjects/OpalData.h"
 #include "AbstractObjects/Attribute.h"
 #include "Attributes/Attributes.h"
@@ -26,6 +27,8 @@
 #include "Parser/TokenStream.h"
 #include "Utilities/ParseError.h"
 
+#include "Utility/IpplInfo.h"
+
 // class WhileStatement
 //   Statement of the form "WHILE ( <condition> ) <statement>".
 // ------------------------------------------------------------------------
diff --git a/src/Sample/Sampler.cpp b/src/Sample/Sampler.cpp
index 1facdcfe9d812aac70fbe9090083e205a6604b8f..ebfd8185010517f130f9bff7ebcc142fb7a35350 100644
--- a/src/Sample/Sampler.cpp
+++ b/src/Sample/Sampler.cpp
@@ -32,6 +32,7 @@
 #include "Util/MPIHelper.h"
 
 #include <boost/property_tree/json_parser.hpp>
+#include <boost/property_tree/ptree.hpp>
 
 #include <boost/filesystem.hpp>
 
diff --git a/src/Sample/Sampler.h b/src/Sample/Sampler.h
index a8db3f192fdc0388f8dceceac4951e401d473e1f..2f77350f951eeb93aa451e3690c0420e0fdcc92d 100644
--- a/src/Sample/Sampler.h
+++ b/src/Sample/Sampler.h
@@ -29,6 +29,8 @@
 #include <sstream>
 #include <vector>
 #include <map>
+#include <memory>
+#include <queue>
 #include <utility>
 #include <fstream>
 #include <list>
@@ -44,9 +46,6 @@
 #include "Sample/SamplingMethod.h"
 
 #include <boost/smart_ptr.hpp>
-#include <boost/chrono.hpp>
-#include <boost/property_tree/ptree.hpp>
-
 
 class Sampler : public Optimizer {
 
diff --git a/src/Solvers/BoxCornerDomain.h b/src/Solvers/BoxCornerDomain.h
index 1bc097033fdf8d4df360c4e4915e2f0b206b0853..02bbc1a9bed7131da5153643b1b7d9522adf80ab 100644
--- a/src/Solvers/BoxCornerDomain.h
+++ b/src/Solvers/BoxCornerDomain.h
@@ -28,14 +28,13 @@
 
 #include <map>
 #include <string>
-#include <cmath>
-#include "Solvers/RegularDomain.h"
+#include <utility>
 
+#include "Solvers/RegularDomain.h"
 
 /*
 
-    A and B are the half apperture of the box
-
+    A and B are the half aperture of the box
 
                                      / (A,B)
                                     /
@@ -85,7 +84,7 @@ public:
                     std::string interpl);
     ~BoxCornerDomain();
 
-    /// as a function of z, determine the hight (B) of the geometry
+    /// as a function of z, determine the height (B) of the geometry
     inline double getB(double z) const {
       if((z < getZRangeMin()) || (z > getZRangeMax()))
             return getYRangeMax();
@@ -123,14 +122,9 @@ private:
 
     double actBMax_m;
 
-    /// length of the structure
-    double length_m;
-
     /// height of the corner
     double C_m;
 
-
-
     inline double getXIntersection(double cx, int /*z*/) const {
         return (cx < 0) ? getXRangeMin() : getXRangeMax();
     }
@@ -170,4 +164,4 @@ private:
 // c-basic-offset: 4
 // indent-tabs-mode: nil
 // require-final-newline: nil
-// End:
+// End:
\ No newline at end of file
diff --git a/src/Solvers/FFTBoxPoissonSolver.h b/src/Solvers/FFTBoxPoissonSolver.h
index 66dbb9f5464ce92f909508f891e11fc2642e67f8..61876efb68d462920dff4aab715a774e6258fb1a 100644
--- a/src/Solvers/FFTBoxPoissonSolver.h
+++ b/src/Solvers/FFTBoxPoissonSolver.h
@@ -23,11 +23,16 @@
 
 //////////////////////////////////////////////////////////////
 #include "PoissonSolver.h"
+
+#include "FFT/FFT.h"
+
 class PartBunch;
 //////////////////////////////////////////////////////////////
 
 class FFTBoxPoissonSolver : public PoissonSolver {
 public:
+    typedef FFT<SineTransform, 3, double>            SINE_t;
+
     // constructor and destructor
     FFTBoxPoissonSolver(PartBunch &bunch, std::string greensFuntion);
 
diff --git a/src/Solvers/FFTPoissonSolver.h b/src/Solvers/FFTPoissonSolver.h
index 2ead1b25d59c38bb909dcf6654ddb1abad2f5c64..8fb703bbced8cbba9c4b5f1b9faf560ffc24422b 100644
--- a/src/Solvers/FFTPoissonSolver.h
+++ b/src/Solvers/FFTPoissonSolver.h
@@ -32,12 +32,16 @@
 //////////////////////////////////////////////////////////////
 #include "PoissonSolver.h"
 
+#include "FFT/FFT.h"
+
 class PartBunch;
 
 //////////////////////////////////////////////////////////////
 
 class FFTPoissonSolver : public PoissonSolver {
 public:
+    typedef FFT<RCTransform, 3, double>              FFT_t;
+
     // constructor and destructor
     FFTPoissonSolver(PartBunch &bunch, std::string greensFuntion);
 
diff --git a/src/Solvers/IrregularDomain.h b/src/Solvers/IrregularDomain.h
index fc991c4d61cf4c45780fe9df38122e554c67e0ed..03dba24299bdbaf422a9e7d8f25414cd5cc7779c 100644
--- a/src/Solvers/IrregularDomain.h
+++ b/src/Solvers/IrregularDomain.h
@@ -26,9 +26,10 @@
 #ifndef IRREGULAR_DOMAIN_H
 #define IRREGULAR_DOMAIN_H
 
-#include <vector>
+#include <map>
 #include <string>
-#include "Algorithms/PBunchDefs.h"
+#include "Algorithms/Vektor.h"
+#include "Algorithms/Quaternion.h"
 
 /// enumeration corresponding to different interpolation methods at the boundary
 enum {
diff --git a/src/Solvers/P3MPoissonSolver.h b/src/Solvers/P3MPoissonSolver.h
index 20ea43d164ef3cb8ccda3d383ba3032bd4257d69..12c4336ddc82ac615d38636f507da33c3b157ee0 100644
--- a/src/Solvers/P3MPoissonSolver.h
+++ b/src/Solvers/P3MPoissonSolver.h
@@ -33,7 +33,10 @@ const unsigned Dim = 3;
 #include <memory>
 //////////////////////////////////////////////////////////////
 #include "PoissonSolver.h"
-#include "Algorithms/PartBunchBase.h"
+
+#include "FFT/FFT.h"
+
+//#include "Algorithms/PartBunchBase.h"
 
 template <class T, unsigned Dim>
 class PartBunchBase;
@@ -42,6 +45,9 @@ class PartBunchBase;
 
 class P3MPoissonSolver : public PoissonSolver {
 public:
+
+    typedef FFT<CCTransform, 3, double>              FFTC_t;
+
     // constructor and destructor
     P3MPoissonSolver(Mesh_t *mesh, FieldLayout_t *fl, double interaction_radius, double alpha, double eps);
 
diff --git a/src/Solvers/PoissonSolver.h b/src/Solvers/PoissonSolver.h
index 84aa754cee851194d88d2da0b47501c89b172ed4..a82fadf4aec05e697868fb21f0cd03db5c7eca5e 100644
--- a/src/Solvers/PoissonSolver.h
+++ b/src/Solvers/PoissonSolver.h
@@ -4,6 +4,8 @@
 //////////////////////////////////////////////////////////////
 #include "Algorithms/PBunchDefs.h"
 
+#include "Field/Field.h"
+
 #ifdef ENABLE_AMR
     #include "Utilities/OpalException.h"
 #endif
@@ -12,6 +14,11 @@ template <class T, unsigned Dim>
 class PartBunchBase;
 
 class PoissonSolver {
+
+protected:
+    typedef Field<int, 3, Mesh_t, Center_t>                  IField_t;
+    typedef Field<std::complex<double>, 3, Mesh_t, Center_t> CxField_t;
+
 public:
 
     // given a charge-density field rho and a set of mesh spacings hr,
diff --git a/src/Structure/Beam.cpp b/src/Structure/Beam.cpp
index 1327c31298143bd5091fe55adee9e60398d07f25..deb647b362b6ba361f154e03ee04f50fff5bebf3 100644
--- a/src/Structure/Beam.cpp
+++ b/src/Structure/Beam.cpp
@@ -46,9 +46,6 @@ namespace {
 
         // BEAM CURRENT AND EMITTANCES:
         BCURRENT,   // Beam current in A
-        EX,         // Horizontal emittance
-        EY,         // Vertical emittance
-        ET,         // Longitudinal emittance
 
         // BEAM FREQUENCY
         BFREQ,  // Beam frequency in MHz
@@ -88,12 +85,6 @@ Beam::Beam():
     // BEAM CURRENT AND EMITTANCES:
     itsAttr[BCURRENT] = Attributes::makeReal
                         ("BCURRENT", "Beam current in A (all bunches)");
-    itsAttr[EX] = Attributes::makeReal
-                  ("EX", "Horizontal emittance");
-    itsAttr[EY] = Attributes::makeReal
-                  ("EY", "Vertical emittance");
-    itsAttr[ET] = Attributes::makeReal
-                  ("ET", "Longitudinal emittance");
 
     // BEAM FREQUENCY
     itsAttr[BFREQ] = Attributes::makeReal
@@ -158,21 +149,6 @@ size_t Beam::getNumberOfParticles() const {
     return (size_t)Attributes::getReal(itsAttr[NPART]);
 }
 
-double Beam::getEX() const {
-    return Attributes::getReal(itsAttr[EX]);
-}
-
-
-double Beam::getEY() const {
-    return Attributes::getReal(itsAttr[EY]);
-}
-
-
-double Beam::getET() const {
-    return Attributes::getReal(itsAttr[ET]);
-}
-
-
 const PartData &Beam::getReference() const {
     // Cast away const, to allow logically constant Beam to update.
     const_cast<Beam *>(this)->update();
@@ -209,21 +185,6 @@ double Beam::getMassPerParticle() const {
     return getMass() * getChargePerParticle() / (getCharge() * Physics::q_e);
 }
 
-void Beam::setEX(double value) {
-    Attributes::setReal(itsAttr[EX], value);
-}
-
-
-void Beam::setEY(double value) {
-    Attributes::setReal(itsAttr[EY], value);
-}
-
-
-void Beam::setET(double value) {
-    Attributes::setReal(itsAttr[ET], value);
-}
-
-
 void Beam::update() {
     // Find the particle name.
     if(itsAttr[PARTICLE]) {
@@ -266,6 +227,7 @@ void Beam::update() {
     double charge = itsAttr[CHARGE] ? Attributes::getReal(itsAttr[CHARGE]) : 1.0;
     reference = PartData(charge, mass, 1.0);
 
+    // Checks
     if(itsAttr[GAMMA]) {
         double gamma = Attributes::getReal(itsAttr[GAMMA]);
         if(gamma > 1.0) {
diff --git a/src/Structure/Beam.h b/src/Structure/Beam.h
index f67512744fe6f2e4a769849850815fb83864df68..5f221a50c236208451f6fe61b85e80ffe4a1825c 100644
--- a/src/Structure/Beam.h
+++ b/src/Structure/Beam.h
@@ -22,6 +22,7 @@
 #include "Algorithms/PartData.h"
 
 #include <ostream>
+#include <string>
 
 class Inform;
 
@@ -54,15 +55,6 @@ public:
     /// Find named BEAM.
     static Beam *find(const std::string &name);
 
-    /// Return emittance for mode 1.
-    double getEX() const;
-
-    /// Return emittance for mode 2.
-    double getEY() const;
-
-    /// Return emittance for mode 3.
-    double getET() const;
-
     //ff => get gamma value
     double getGamma() const;
 
@@ -96,15 +88,6 @@ public:
     /// Mass per macro particle in GeV/c^2
     double getMassPerParticle() const;
 
-    /// Store emittance for mode 1.
-    void setEX(double);
-
-    /// Store emittance for mode 2.
-    void setEY(double);
-
-    /// Store emittance for mode 3.
-    void setET(double);
-
     /// Update the BEAM data.
     virtual void update();
 
diff --git a/src/Structure/BoundaryGeometry.cpp b/src/Structure/BoundaryGeometry.cpp
index 4fd93edb990830bfcc52128d661bdb17dbe35e15..b157bce4c2f05ee2b24cf597200a093d2cfed6a6 100644
--- a/src/Structure/BoundaryGeometry.cpp
+++ b/src/Structure/BoundaryGeometry.cpp
@@ -785,9 +785,6 @@ BoundaryGeometry::BoundaryGeometry() :
          "Shift in z direction",
          0.0);
 
-    itsAttr[APERTURE]  = Attributes::makeRealArray
-        ("APERTURE", "The element aperture");
-
     itsAttr[INSIDEPOINT] = Attributes::makeRealArray
         ("INSIDEPOINT", "A point inside the geometry");
 
@@ -1772,15 +1769,6 @@ Change orientation if diff is:
     *gmsg << "* Initializing Boundary Geometry..." << endl;
     IpplTimings::startTimer (Tinitialize_m);
 
-    apert_m = Attributes::getRealArray(itsAttr[APERTURE]);
-    if (hasApperture()) {
-        *gmsg << "* Found additional aperture." << endl;
-        for (unsigned int i=0; i<apert_m.size(); i=i+3)
-            *gmsg << "* zmin = " << apert_m[i]
-                  << " zmax = " << apert_m[i+1]
-                  << " r= " << apert_m[i+2] << endl;
-    }
-
     *gmsg << "* Filename: " << h5FileName_m.c_str() << endl;
 
     double xscale = Attributes::getReal(itsAttr[XSCALE]);
diff --git a/src/Structure/BoundaryGeometry.h b/src/Structure/BoundaryGeometry.h
index 2ec308c6307b3e1ffb257f9a9116c6035fb54e0e..3590434ec97c6487e6c82d7459741c3858b5891f 100644
--- a/src/Structure/BoundaryGeometry.h
+++ b/src/Structure/BoundaryGeometry.h
@@ -167,19 +167,6 @@ public:
 
     bool findInsidePoint (void);
 
-    inline bool isOutsideApperture(Vector_t x) {
-        if (hasApperture()) {
-            for (size_t i = 0; i < apert_m.size(); i += 3) {
-                if ((apert_m[i] <= x(2)) && (x(2) < apert_m[i+1])) {
-                    // yes we are inside the interval
-                    const double r = apert_m[i+2] * apert_m[i+2];
-                    return ((x(0)*x(0)) + (x(1)*x(1))) > r;
-                }
-            }
-        }
-        return false;
-    }
-
     int intersectRayBoundary (
         const Vector_t& P,
         const Vector_t& v,
@@ -259,13 +246,6 @@ private:
     bool haveInsidePoint_m;
     Vector_t insidePoint_m;             // attribute INSIDEPOINT
 
-    /*
-       An additional structure to hold apperture information
-       to prevent that particles go past the geometry. The user
-       can specify n trippel with the form: (zmin, zmax, r)
-    */
-    std::vector<double> apert_m;
-
     gsl_rng *randGen_m;         //
 
     IpplTimings::TimerRef Tinitialize_m; // initialize geometry
@@ -280,10 +260,6 @@ private:
     // Clone constructor.
     BoundaryGeometry(const std::string& name, BoundaryGeometry* parent);
 
-    inline bool hasApperture() {
-        return (apert_m.size() != 0);
-    }
-
     inline const Vector_t& getPoint (const int triangle_id, const int vertex_id) {
         PAssert (1 <= vertex_id && vertex_id <=3);
         return Points_m[Triangles_m[triangle_id][vertex_id]];
@@ -322,7 +298,6 @@ private:
         XSCALE,   // Multiplicative scaling factor for x-coordinates
         YSCALE,   // Multiplicative scaling factor for y-coordinates
         ZSCALE,   // Multiplicative scaling factor for z-coordinates
-        APERTURE,    // in addition to the geometry
         INSIDEPOINT,
         SIZE
     };
diff --git a/src/Structure/DataSink.cpp b/src/Structure/DataSink.cpp
index 017025569742f17affaa2372f90b082351f475a4..a23503889dfd1aa23db2ca38c02c5e35bb53ee02 100644
--- a/src/Structure/DataSink.cpp
+++ b/src/Structure/DataSink.cpp
@@ -28,6 +28,8 @@
 
 #include "Structure/DataSink.h"
 
+#include "Utility/FieldDebugFunctions.h"
+
 #include "OPALconfig.h"
 #include "AbstractObjects/OpalData.h"
 #include "Utilities/Options.h"
@@ -39,6 +41,8 @@
 
 #ifdef __linux__
     #include "MemoryProfiler.h"
+#else
+    #include "MemoryWriter.h"
 #endif
 
 
@@ -49,17 +53,11 @@
 
 
 #include "LBalWriter.h"
-#include "MemoryWriter.h"
 
 #ifdef ENABLE_AMR
     #include "GridLBalWriter.h"
 #endif
 
-
-#include <boost/filesystem.hpp>
-#include <boost/regex.hpp>
-
-#include <queue>
 #include <sstream>
 
 DataSink::DataSink()
@@ -176,8 +174,6 @@ void DataSink::writeImpactStatistics(const PartBunchBase<double, 3> *beam, long
 
         std::unique_ptr<Inform> ofp(new Inform(NULL, ffn.c_str(), Inform::APPEND, 0));
         Inform &fid = *ofp;
-        setInform(fid);
-
         fid.precision(6);
         fid << std::setiosflags(std::ios::scientific);
         double t = beam->getT() * 1.0e9;
diff --git a/src/Structure/DataSink.h b/src/Structure/DataSink.h
index f33e6ca397dbe0458ad8564a4e1288c6a19adc56..7e3abf0daa8bd80add7beb4c9afbac977e80a584 100644
--- a/src/Structure/DataSink.h
+++ b/src/Structure/DataSink.h
@@ -28,26 +28,33 @@
 #ifndef _OPAL_DATA_SINK_H
 #define _OPAL_DATA_SINK_H
 
-#include "Algorithms/PBunchDefs.h"
+#include "Algorithms/Vektor.h"
 
+#include "SDDSWriter.h"
 #include "StatWriter.h"
 #include "H5Writer.h"
 #include "MultiBunchDump.h"
 
+#include <iomanip>
+#include <memory>
+#include <string>
+#include <vector>
+
 template <class T, unsigned Dim>
 class PartBunchBase;
 class BoundaryGeometry;
 class H5PartWrapper;
+class MultiBunchHandler;
 
 class DataSink {
-public:
+private:
     typedef StatWriter::losses_t            losses_t;
     typedef std::unique_ptr<StatWriter>     statWriter_t;
     typedef std::unique_ptr<SDDSWriter>     sddsWriter_t;
     typedef std::unique_ptr<H5Writer>       h5Writer_t;
     typedef std::unique_ptr<MultiBunchDump> mbWriter_t;
     
-    
+public:
     /** \brief Default constructor.
      *
      * The default constructor is called at the start of a new calculation (as
diff --git a/src/Structure/ElementPositionWriter.h b/src/Structure/ElementPositionWriter.h
index c58b7a43d6d5eae752059c380b85478affb04159..2dba113f18281f36c12a56ab4bbdc94d09d4ccf8 100644
--- a/src/Structure/ElementPositionWriter.h
+++ b/src/Structure/ElementPositionWriter.h
@@ -6,7 +6,7 @@
 class ElementPositionWriter : public SDDSWriter {
 
 public:
-    ElementPositionWriter(const std::string& fname);
+    explicit ElementPositionWriter(const std::string& fname);
 
     void addRow(double spos,
                 const std::vector<double>& row,
diff --git a/src/Structure/FieldSolver.cpp b/src/Structure/FieldSolver.cpp
index c5c90e2e9c8b8b894df40f650cac275f020cabd6..738dadc945ab1ac230cf771a8d4756ca3841825e 100644
--- a/src/Structure/FieldSolver.cpp
+++ b/src/Structure/FieldSolver.cpp
@@ -73,10 +73,10 @@ namespace {
         // FOR FFT BASED SOLVER
         MX,         // mesh sixe in x
         MY,         // mesh sixe in y
-        MT,         //  mesh sixe in z
-        PARFFTX,    // parallelized grind in x
-        PARFFTY,    // parallelized grind in y
-        PARFFTT,    // parallelized grind in z
+        MT,         // mesh sixe in z
+        PARFFTX,    // parallelized grid in x
+        PARFFTY,    // parallelized grid in y
+        PARFFTT,    // parallelized grid in z
         BCFFTX,     // boundary condition in x [FFT + AMR_MG only]
         BCFFTY,     // boundary condition in y [FFT + AMR_MG only]
         BCFFTZ,     // boundary condition in z [FFT + AMR_MG only]
@@ -135,7 +135,6 @@ FieldSolver::FieldSolver():
                                                       "FFT, "
                                                       "FFTPERIODIC, "
                                                       "SAAMG, "
-                                                      "AMR, "
                                                       "NONE ");
 
     itsAttr[MX] = Attributes::makeReal("MX", "Meshsize in x");
@@ -248,15 +247,15 @@ FieldSolver::FieldSolver():
                                                  16);
 
     itsAttr[AMR_BFX] = Attributes::makeReal("AMR_BFX",
-                                            "Blocking factor in x for AMR (AMR_MAXGRIDX needs to be a multiple",
+                                            "Blocking factor in x for AMR (AMR_MAXGRIDX needs to be a multiple)",
                                             8);
 
     itsAttr[AMR_BFY] = Attributes::makeReal("AMR_BFY",
-                                            "Blocking factor in y for AMR (AMR_MAXGRIDY needs to be a multiple",
+                                            "Blocking factor in y for AMR (AMR_MAXGRIDY needs to be a multiple)",
                                             8);
 
     itsAttr[AMR_BFZ] = Attributes::makeReal("AMR_BFZ",
-                                            "Blocking factor in y for AMR (AMR_MAXGRIDZ needs to be a multiple",
+                                            "Blocking factor in y for AMR (AMR_MAXGRIDZ needs to be a multiple)",
                                             8);
 
     itsAttr[AMR_TAGGING] = Attributes::makeUpperCaseString("AMR_TAGGING",
@@ -278,7 +277,7 @@ FieldSolver::FieldSolver():
     itsAttr[AMR_SCALING] = Attributes::makeReal("AMR_SCALING",
                                                 "Scaling value for maximum value tagging "
                                                 "(only POTENTIAL / CHARGE_DENSITY / "
-                                                "MOMENTA", 0.75);
+                                                "MOMENTA)", 0.75);
 
     itsAttr[AMR_DOMAIN_RATIO] = Attributes::makeRealArray("AMR_DOMAIN_RATIO",
                                                          "Box ratio of AMR computation domain. Default: [-1, 1]^3");
diff --git a/src/Structure/H5PartWrapper.h b/src/Structure/H5PartWrapper.h
index 9daceaf8088d74a14438d089a6876a93336225dc..e21368c8c4145c748599ac17e7d466ed0bae620d 100644
--- a/src/Structure/H5PartWrapper.h
+++ b/src/Structure/H5PartWrapper.h
@@ -6,15 +6,19 @@
 //
 
 /*!
-  H5PartWrapper: a class that manages a calls to H5Part
+  H5PartWrapper: a class that manages calls to H5Part
 */
 
-#include "Algorithms/PBunchDefs.h"
-#include "Algorithms/PartBunchBase.h"
-#include "Utilities/OpalException.h"
+template <class T, unsigned Dim>
+class PartBunchBase;
+
+#include "Utility/IpplInfo.h"
 
 #include "H5hut.h"
 
+#include <map>
+#include <string>
+
 #define REPORTONERROR(rc) H5PartWrapper::reportOnError(rc, __FILE__, __LINE__)
 #define READFILEATTRIB(type, file, name, value) REPORTONERROR(H5ReadFileAttrib##type(file, name, value));
 #define WRITESTRINGFILEATTRIB(file, name, value) REPORTONERROR(H5WriteFileAttribString(file, name, value));
diff --git a/src/Structure/H5PartWrapperForPC.cpp b/src/Structure/H5PartWrapperForPC.cpp
index 09fc259388965d6faed06d8822852a14dee4b1d0..58c5454c2b586bd3012352eab1ae93573e9468fa 100644
--- a/src/Structure/H5PartWrapperForPC.cpp
+++ b/src/Structure/H5PartWrapperForPC.cpp
@@ -11,8 +11,6 @@
 #include "Utilities/Util.h"
 #include "Physics/Physics.h"
 
-#include <boost/filesystem.hpp>
-
 #include <sstream>
 #include <set>
 
diff --git a/src/Structure/H5PartWrapperForPC.h b/src/Structure/H5PartWrapperForPC.h
index 0b40133ddd12dfad93b8174ec97cde282b0eaf71..9abe5eaffd9b783a2fb97cbe5f407ee096da8d25 100644
--- a/src/Structure/H5PartWrapperForPC.h
+++ b/src/Structure/H5PartWrapperForPC.h
@@ -7,8 +7,7 @@
 
 #include "Structure/H5PartWrapper.h"
 
-#include "Algorithms/PBunchDefs.h"
-#include "Utilities/OpalException.h"
+#include "Algorithms/Vektor.h"
 
 #include "H5hut.h"
 
diff --git a/src/Structure/H5PartWrapperForPT.cpp b/src/Structure/H5PartWrapperForPT.cpp
index 8fe3529b4308a97f2fd90ae006f1aac7c8dc3dfe..9f7e02e3365f4c108fbaeb485f65748d4975768c 100644
--- a/src/Structure/H5PartWrapperForPT.cpp
+++ b/src/Structure/H5PartWrapperForPT.cpp
@@ -6,12 +6,13 @@
 
 #include "OPALconfig.h"
 #include "AbstractObjects/OpalData.h"
+#include "Algorithms/PartBunchBase.h"
+#include "Algorithms/Vektor.h"
 #include "Utilities/Options.h"
 #include "Utilities/Util.h"
 #include "Physics/Physics.h"
 
 #include "h5core/h5_types.h"
-#include <boost/filesystem.hpp>
 
 #include <sstream>
 #include <set>
diff --git a/src/Structure/H5PartWrapperForPT.h b/src/Structure/H5PartWrapperForPT.h
index 7d7e0924b6d29e65457aa68a6a975352c350159c..80022896068a7e9569cbd41f25ba52b2f61ecf04 100644
--- a/src/Structure/H5PartWrapperForPT.h
+++ b/src/Structure/H5PartWrapperForPT.h
@@ -11,9 +11,6 @@
 
 #include "Structure/H5PartWrapper.h"
 
-#include "Algorithms/PBunchDefs.h"
-#include "Utilities/OpalException.h"
-
 #include "H5hut.h"
 
 class H5PartWrapperForPT: public H5PartWrapper {
diff --git a/src/Structure/IpplInfoWrapper.h b/src/Structure/IpplInfoWrapper.h
index 31a3195aac6ea114bd197dd2b1c0780f1b3536e4..cd4fa1478533ce2162073d411b18e9de923eafe0 100644
--- a/src/Structure/IpplInfoWrapper.h
+++ b/src/Structure/IpplInfoWrapper.h
@@ -9,7 +9,7 @@
   Class documentation
 */
 
-#include "Ippl.h"
+#include "Utility/IpplInfo.h"
 
 class IpplInfoWrapper {
 public:
diff --git a/src/Structure/MemoryProfiler.h b/src/Structure/MemoryProfiler.h
index 18e123d60631cadce5073a54d9feb615f4be4677..e35a46d9b367b84091e41697dcc3c4ba80cd1071 100644
--- a/src/Structure/MemoryProfiler.h
+++ b/src/Structure/MemoryProfiler.h
@@ -66,7 +66,6 @@ private:
     void compute(vm_t& vmMin, vm_t& vmMax, vm_t& vmAvg);
     
 private:
-    std::string fname_m;
     std::map<std::string, int> procinfo_m;
     vm_t vmem_m;
     units_t unit_m;
diff --git a/src/Structure/SDDSWriter.h b/src/Structure/SDDSWriter.h
index 757dad16f61ccc52ba8f3a7cfd9417f98425311e..39e1d1a4f85c3f1784334c6197335007bacdfbd5 100644
--- a/src/Structure/SDDSWriter.h
+++ b/src/Structure/SDDSWriter.h
@@ -31,7 +31,6 @@
 #include <sstream>
 
 #include <boost/filesystem.hpp>
-#include <boost/variant.hpp>
 
 #include "Structure/SDDSColumn.h"
 #include "Structure/SDDSColumnSet.h"
diff --git a/src/Track/TrackCmd.cpp b/src/Track/TrackCmd.cpp
index 98c3266dd51fd52925dffa0e8a56c6801ec6d55b..bdb86ed11f38f8cec4aa31cbf3688f554605d850 100644
--- a/src/Track/TrackCmd.cpp
+++ b/src/Track/TrackCmd.cpp
@@ -84,8 +84,6 @@ TrackCmd::TrackCmd():
 
     registerOwnership(AttributeHandler::COMMAND);
     AttributeHandler::addAttributeOwner("TRACK", AttributeHandler::COMMAND, "RUN");
-    AttributeHandler::addAttributeOwner("TRACK", AttributeHandler::COMMAND, "START");
-    AttributeHandler::addAttributeOwner("TRACK", AttributeHandler::COMMAND, "TSAVE");
     AttributeHandler::addAttributeOwner("TRACK", AttributeHandler::COMMAND, "ENDTRACK");
 }
 
diff --git a/src/Track/TrackEnd.cpp b/src/Track/TrackEnd.cpp
index 7eb418e3fe0d2af2de8e376ca600adb90e62bd98..177c222e4fb5b91a78d26ddf1eb8d8a9acb131ee 100644
--- a/src/Track/TrackEnd.cpp
+++ b/src/Track/TrackEnd.cpp
@@ -7,7 +7,7 @@
 // ------------------------------------------------------------------------
 //
 // Class: TrackEnd
-//   The class fore the OPAL ENDTRACK command.
+//   The class for the OPAL ENDTRACK command.
 //
 // ------------------------------------------------------------------------
 //
diff --git a/src/Track/TrackEnd.h b/src/Track/TrackEnd.h
index dfe5debb7a440df437e62e7db81dad98c950b1a6..48496a9eb67fac57a1acb368b5879337b689cc1e 100644
--- a/src/Track/TrackEnd.h
+++ b/src/Track/TrackEnd.h
@@ -21,7 +21,6 @@
 #include "AbstractObjects/Action.h"
 
 class Sequence;
-class TrackParser;
 
 
 // Class TrackEnd
diff --git a/src/opal.cpp b/src/opal.cpp
index 09961c5b034999fb97be8d70784c63f278e65a45..bb8625b6cdd2f66d53418bff7495167a3942cce3 100644
--- a/src/opal.cpp
+++ b/src/opal.cpp
@@ -3,7 +3,6 @@
 extern Ippl *ippl;
 extern Inform *gmsg;
 
-
 #include "AbstractObjects/OpalData.h"
 #include "OpalConfigure/Configure.h"
 #include "OpalParser/OpalParser.h"
@@ -19,6 +18,12 @@ extern Inform *gmsg;
     #include <AMReX.H>
 #endif
 
+#include "Message/Communicate.h"
+
+#include <fstream>
+#include <iostream>
+#include <limits>
+#include <string>
 
 int run_opal(char */*args*/[], std::string inputfile, int restartStep,
              int infoLevel, int warnLevel, MPI_Comm comm)
diff --git a/src/opal.h b/src/opal.h
index a53b5d872c110a45ace5b6098452a507a8bae146..15e46cc579adfd6d3e7a470166a8b619f785a312 100644
--- a/src/opal.h
+++ b/src/opal.h
@@ -1,8 +1,7 @@
 #ifndef __OPAL_H__
 #define __OPAL_H__
 
-#include "Ippl.h"
-
+#include "Utility/IpplInfo.h"
 
 int run_opal(char *arg[],
              std::string inputfile,
diff --git a/tests/classic_src/AbsBeamline/MultipoleTTest.cpp b/tests/classic_src/AbsBeamline/MultipoleTTest.cpp
index 241707e25cce60041a807876bf3cfed100de5b8b..b98c4f58d67b8d84a9e4d940dd52605714495fc7 100644
--- a/tests/classic_src/AbsBeamline/MultipoleTTest.cpp
+++ b/tests/classic_src/AbsBeamline/MultipoleTTest.cpp
@@ -157,8 +157,8 @@ TEST(MultipoleTTest, CurvedMagnet) {
         curlMag += gsl_sf_pow_int(curl[1], 2.0);
         curlMag += gsl_sf_pow_int(curl[2], 2.0);
         curlMag = sqrt(curlMag);
-        coordinatetransform::CoordinateTransform t(x[n], z, y[n], 2.2, 0.3, 0.3, 4.4 / 0.628);
-        std::vector<double> r = t.getTransformation();
+        coordinatetransform::CoordinateTransform ct(x[n], z, y[n], 2.2, 0.3, 0.3, 4.4 / 0.628);
+        std::vector<double> r = ct.getTransformation();
         EXPECT_NEAR(div, 0, 2e-2)
                      << "R: " << r[0] << " " << r[1] << " " << r[2] << std::endl
                      << "R: " << x[n] << " " << z << " " << y[n] << std::endl
@@ -237,7 +237,6 @@ TEST(MultipoleTTest, CurvedConstRadius) {
     double stepSize = 1e-3;
     double radius = 4.4 / 0.628;
     double z = 0.2;
-    Vector_t R(0.0, 0.0, 0.0), P(3), E(3);
     for (double theta = 0; theta <= 0.3001; theta += 0.2) {
         double x = radius * cos(theta) - radius;
         double y = radius * sin(theta);
diff --git a/tests/ippl_src/Index/Index.cpp b/tests/ippl_src/Index/Index.cpp
index 6f66973b97f8e136e721b53c5db7032fbe6acb81..ed58fded35e28aa350332c52a846b2b6cff47db3 100644
--- a/tests/ippl_src/Index/Index.cpp
+++ b/tests/ippl_src/Index/Index.cpp
@@ -2,6 +2,7 @@
 
 #include "opal_test_utilities/SilenceTest.h"
 
+#include "Field/Field.h"
 #include "Index/SOffset.h"
 
 #include <iostream>
diff --git a/tests/ippl_src/Meshes/Average.cpp b/tests/ippl_src/Meshes/Average.cpp
index 362f6384f0147a0718918bd6d77d07ba24022f77..dbecef9876d12de59897a40bfda542a7de128bab 100644
--- a/tests/ippl_src/Meshes/Average.cpp
+++ b/tests/ippl_src/Meshes/Average.cpp
@@ -4,6 +4,7 @@
 
 #include "gtest/gtest.h"
 
+#include "Field/Field.h"
 #include "Meshes/UniformCartesian.h"
 
 // set dimensionality and problem size
diff --git a/tests/ippl_src/Meshes/CartesianCentering.cpp b/tests/ippl_src/Meshes/CartesianCentering.cpp
index 6fe18d7e430a15768927e92c4be5d3e589c8f32d..beb12ee8a6502ddaf98668203b54606e1f248c2f 100644
--- a/tests/ippl_src/Meshes/CartesianCentering.cpp
+++ b/tests/ippl_src/Meshes/CartesianCentering.cpp
@@ -14,10 +14,10 @@
 namespace {
     void hardCodedOutput(std::string filename); // Prototype of function defined below.
     bool thediff(std::string filename1, std::string filename2);
-
-    CenteringEnum zz[2] = {CELL, VERTEX};
 }
 
+CenteringEnum zz[2] = {CELL, VERTEX};
+
 // template definitions
 CenteringEnum CCCEnums<2U,1U,0U>::allCell[2U*1U];
 CenteringEnum CCCEnums<3U,1U,1U>::allFace[3U*1U];
diff --git a/tests/ippl_src/Particle/EdgeCentering.cpp b/tests/ippl_src/Particle/EdgeCentering.cpp
index 12fc7770b279c29fada29a16176270b45edeb5c3..dec83389691ce2bd38db6766d2de56ae1cf55312 100644
--- a/tests/ippl_src/Particle/EdgeCentering.cpp
+++ b/tests/ippl_src/Particle/EdgeCentering.cpp
@@ -2,7 +2,7 @@
 // #include "Algorithms/PBunchDefs.h"
 // #include "Algorithms/PartBunch.h"
 // #include "Algorithms/PartData.h"
-#include "Particle/IntCIC.h"
+//#include "Particle/IntCIC.h"
 #include "Particle/ParticleSpatialLayout.h"
 #include "Particle/ParticleAttrib.h"
 #include "Meshes/UniformCartesian.h"
@@ -16,13 +16,10 @@
 #define GUARDCELLSIZE 1
 #define DIM 3
 
-typedef IntCIC                                                IntrplCIC_t;
-
 typedef Vektor<double, DIM>                                   Vector_t;
 typedef ParticleSpatialLayout<double, DIM>::ParticlePos_t     Ppos_t;
 typedef ParticleSpatialLayout<double, DIM>::ParticleIndex_t   PID_t;
 typedef ParticleAttrib<double>                                Pscalar_t;
-typedef InterpolatorTraits<double, DIM, IntrplCIC_t>::Cache_t Pcache_t;
 
 typedef UniformCartesian<DIM>                                 Mesh_t;
 typedef ParticleSpatialLayout< double, DIM, Mesh_t>           PLayout_t;
diff --git a/tools/README b/tools/README
index 6dd0e68448a0f3aef9ed9f3507d380bfc4f7c3af..aca80dd560113b806cd76de92f254330c7a55245 100644
--- a/tools/README
+++ b/tools/README
@@ -3,4 +3,7 @@ at https://www.aps.anl.gov/Accelerator-Operations-Physics/Software#SDDS%20Source
 Unpack the sources, change to the directory epics/extensions/src/ and then upack the archive SDDSCMakeLists.tar.gz
 in this directory. Finally apply the patch SDDS.patch with the command
 $ patch -p1 < /path/to/patch/SDDS.patch
-Now you can use cmake to compile and install the SDDS library.
\ No newline at end of file
+Now you can use cmake to compile and install the SDDS library.
+
+Comment from Christof:
+These two programs (not scripts) export particle positions and momenta from HDF5 files to SDDS and from SDDS to ASCII (which then can be used to as FROMFILE distribution)
\ No newline at end of file
diff --git a/tools/opal2sdds/main.cpp b/tools/opal2sdds/main.cpp
index ad8e4637c997381dd9c423821ab29f759d106638..766193495f886d27471fbc1a663c2d7c905f9e4b 100644
--- a/tools/opal2sdds/main.cpp
+++ b/tools/opal2sdds/main.cpp
@@ -260,7 +260,6 @@ void writeSDDSFile(const std::string &fname, const data_t &data, const attribute
                                                         {"p", "p"}};
     SDDS_DATASET SDDS_dataset;
     const long rows = data.at("x").size();
-    std::vector<std::vector<double> > fileData;
 
     char buffer0[256];
     char buffer1[64];