diff --git a/corsika/detail/framework/core/ParticleProperties.inl b/corsika/detail/framework/core/ParticleProperties.inl
index 0671a0db6453204feef2448055cc520b8f7c30a1..40edbeb439b616278990eb82b0613ef86e97b0bd 100644
--- a/corsika/detail/framework/core/ParticleProperties.inl
+++ b/corsika/detail/framework/core/ParticleProperties.inl
@@ -34,19 +34,19 @@ namespace corsika {
 
   inline bool constexpr is_nucleus(Code const code) { return code >= Code::Nucleus; }
 
-  inline Code constexpr get_nucleus_code(unsigned int const A,
-                                         unsigned int const Z) { // 10LZZZAAAI
+  inline Code constexpr get_nucleus_code(size_t const A,
+                                         size_t const Z) { // 10LZZZAAAI
     if (Z > A) { throw std::runtime_error("Z cannot be larger than A in nucleus."); }
     return static_cast<Code>(static_cast<CodeIntType>(Code::Nucleus) + Z * 10000 +
                              A * 10);
   }
 
-  inline unsigned int constexpr get_nucleus_Z(Code const code) {
+  inline size_t constexpr get_nucleus_Z(Code const code) {
     return (static_cast<CodeIntType>(code) % static_cast<CodeIntType>(Code::Nucleus)) /
            10000;
   }
 
-  inline unsigned int constexpr get_nucleus_A(Code const code) {
+  inline size_t constexpr get_nucleus_A(Code const code) {
     return (static_cast<CodeIntType>(code) % 10000) / 10;
   }
 
@@ -54,8 +54,8 @@ namespace corsika {
     if (code < Code::Nucleus) {
       return particle::detail::pdg_codes[static_cast<CodeIntType>(code)];
     }
-    unsigned int const Z = get_nucleus_Z(code);
-    unsigned int const A = get_nucleus_A(code);
+    size_t const Z = get_nucleus_Z(code);
+    size_t const A = get_nucleus_A(code);
     return static_cast<PDGCode>(static_cast<CodeIntType>(Code::Nucleus) + Z * 10000 +
                                 A * 10); // 10LZZZAAAI
   }
@@ -124,8 +124,8 @@ namespace corsika {
   }
 
   inline std::string_view get_nucleus_name(Code const code) {
-    unsigned int const A = get_nucleus_A(code);
-    unsigned int const Z = get_nucleus_Z(code);
+    size_t const A = get_nucleus_A(code);
+    size_t const Z = get_nucleus_Z(code);
     return fmt::format("Nucleus_A{}_Z{}", A, Z);
   }
 
diff --git a/corsika/detail/framework/process/InteractionProcess.hpp b/corsika/detail/framework/process/InteractionProcess.hpp
index 7319027194015b5caaf23946a1c12d2b4fd79c84..4b6fe86988412ccb8f92a6fdeeb08e39b6d6634d 100644
--- a/corsika/detail/framework/process/InteractionProcess.hpp
+++ b/corsika/detail/framework/process/InteractionProcess.hpp
@@ -14,9 +14,7 @@
 namespace corsika {
 
   /**
-   * @file InteractionProcess.hpp
-   *
-   * traits test for InteractionProcess::doInteraction methods etc.
+   *  traits test for InteractionProcess::doInteraction method.
    */
 
   template <class TProcess, typename TReturn, typename TTemplate, typename... TArgs>
@@ -41,7 +39,7 @@ namespace corsika {
   public:
     /**
      *  @name traits results
-     * @{
+     *  @{
      */
     using type = decltype(test<std::decay_t<TProcess>>(nullptr));
     static const bool value = type::value;
@@ -80,7 +78,7 @@ namespace corsika {
   public:
     /**
      *  @name traits results
-     * @{
+     *  @{
      */
     using type = decltype(test<std::decay_t<TProcess>>(nullptr));
     static const bool value = type::value;
diff --git a/corsika/detail/media/LinearApproximationIntegrator.inl b/corsika/detail/media/LinearApproximationIntegrator.inl
index 8ee60d9844b200b9d46ebb71af938698a2b6d2f2..0c964b62f7ebe5f495c4450ab12af26d17ac25c4 100644
--- a/corsika/detail/media/LinearApproximationIntegrator.inl
+++ b/corsika/detail/media/LinearApproximationIntegrator.inl
@@ -13,12 +13,13 @@
 namespace corsika {
 
   template <typename TDerived>
-  inline auto const& LinearApproximationIntegrator<TDerived>::getImplementation() const {
+  inline TDerived const& LinearApproximationIntegrator<TDerived>::getImplementation()
+      const {
     return *static_cast<TDerived const*>(this);
   }
 
   template <typename TDerived>
-  inline auto LinearApproximationIntegrator<TDerived>::getIntegrateGrammage(
+  inline GrammageType LinearApproximationIntegrator<TDerived>::getIntegrateGrammage(
       BaseTrajectory const& line) const {
     LengthType const length = line.getLength();
     auto const c0 = getImplementation().evaluateAt(line.getPosition(0));
@@ -31,7 +32,7 @@ namespace corsika {
   }
 
   template <typename TDerived>
-  inline auto LinearApproximationIntegrator<TDerived>::getArclengthFromGrammage(
+  inline LengthType LinearApproximationIntegrator<TDerived>::getArclengthFromGrammage(
       BaseTrajectory const& line, GrammageType grammage) const {
     auto const c0 = getImplementation().rho_(line.getPosition(0));
     auto const c1 = getImplementation().rho_.getFirstDerivative(line.getPosition(0),
@@ -41,7 +42,7 @@ namespace corsika {
   }
 
   template <typename TDerived>
-  inline auto LinearApproximationIntegrator<TDerived>::getMaximumLength(
+  inline LengthType LinearApproximationIntegrator<TDerived>::getMaximumLength(
       BaseTrajectory const& line, [[maybe_unused]] double relError) const {
     [[maybe_unused]] auto const c1 = getImplementation().rho_.getSecondDerivative(
         line.getPosition(0), line.getDirection(0));
diff --git a/corsika/detail/media/UniformRefractiveIndex.inl b/corsika/detail/media/UniformRefractiveIndex.inl
index d6e5f5a9d753c9ccf5e6d1154c50433a1ae482d2..0ff0370f1b11f67130a0a9f653abc622b1c7cebb 100644
--- a/corsika/detail/media/UniformRefractiveIndex.inl
+++ b/corsika/detail/media/UniformRefractiveIndex.inl
@@ -24,7 +24,7 @@ namespace corsika {
   }
 
   template <typename T>
-  inline void UniformRefractiveIndex<T>::setRefractiveIndex(double const& n) {
+  inline void UniformRefractiveIndex<T>::setRefractiveIndex(double const n) {
     n_ = n;
   }
 
diff --git a/corsika/framework/core/Cascade.hpp b/corsika/framework/core/Cascade.hpp
index ac7a899eb52538c432995375ea3657df89add166..e9b6fbaf2599fc3b41bcf1ad0976ef2e426e7c85 100644
--- a/corsika/framework/core/Cascade.hpp
+++ b/corsika/framework/core/Cascade.hpp
@@ -28,10 +28,6 @@
 #include <limits>
 #include <type_traits>
 
-/**
- * The cascade namespace assembles all objects needed to simulate full particles cascades.
- */
-
 namespace corsika {
 
   /**
@@ -43,15 +39,14 @@ namespace corsika {
    * <b>TTracking</b> must be a class according to the
    * TrackingInterface providing the functions:
    *
-   * <code>
+   * @code
    * auto getTrack(particle_type const& p)</auto>,
    * with the return type <code>geometry::Trajectory<Line>
-   * </code>
+   * @endcode
    *
    * <b>TProcessList</b> must be a ProcessSequence.   *
    * <b>Stack</b> is the storage object for particle data, i.e. with
-   * particle class type <code>Stack::particle_type</code>
-   *
+   * particle class type `Stack::particle_type`.
    */
   template <typename TTracking, typename TProcessList, typename TOutput, typename TStack>
   class Cascade {
@@ -67,8 +62,8 @@ namespace corsika {
 
   public:
     /**
-     * \group constructors
-     * \{
+     * @name constructors
+     * @{
      * Cascade class cannot be default constructed, but needs a valid
      * list of physics processes for configuration at construct time.
      */
@@ -93,7 +88,7 @@ namespace corsika {
         CORSIKA_LOG_INFO("Stack - with full cascade HISTORY.");
       }
     }
-    //! \}
+    //! @}
 
     /**
      * set the nodes for all particles on the stack according to their numerical
diff --git a/corsika/framework/core/Logging.hpp b/corsika/framework/core/Logging.hpp
index d127040b036dab150ce06a40644050f20a3fab2a..64fe792a6aa9d4c861a322659950907610442448 100644
--- a/corsika/framework/core/Logging.hpp
+++ b/corsika/framework/core/Logging.hpp
@@ -103,7 +103,7 @@ namespace corsika {
     /**
      * Set the default log level for all *newly* created loggers.
      *
-     *  @param name    The minimum log level required to print.
+     *  @param minlevel The minimum log level required to print.
      *
      */
     auto set_default_level(level::level_enum const minlevel) -> void;
diff --git a/corsika/framework/core/ParticleProperties.hpp b/corsika/framework/core/ParticleProperties.hpp
index b26fdb26d4b9993f345cb807e7a92a8868aff11c..8f6391fee658264c0c830f823285cfc7efa02021 100644
--- a/corsika/framework/core/ParticleProperties.hpp
+++ b/corsika/framework/core/ParticleProperties.hpp
@@ -7,9 +7,9 @@
  */
 
 /**
-   @file ParticleProperties.hpp
-
-   Interface to particle properties
+ *   @file ParticleProperties.hpp
+ *
+ * Interface to particle properties.
  */
 
 #pragma once
@@ -59,17 +59,34 @@ namespace corsika {
    */
 
   /**
-   * @brief  The Code enum is the actual place to define CORSIKA 8 particle codes.
+   * @enum Code
+   *
+   * The Code enum is the actual place to define CORSIKA 8 particle codes.
    */
   enum class Code : int32_t;
 
   /**
-   * @brief Specifically for PDG ids.
+   * @enum PDGCode
+   *
+   * Specifically for PDG ids.
    */
   enum class PDGCode : int32_t;
 
-  using CodeIntType = std::underlying_type<Code>::type;
-  using PDGCodeIntType = std::underlying_type<PDGCode>::type;
+  /**
+   * Internal integer type for enum Code.
+   */
+  typedef std::underlying_type<Code>::type CodeIntType;
+
+  /**
+   * Internal integer type for enum PDGCode.
+   */
+  typedef std::underlying_type<PDGCode>::type PDGCodeIntType;
+} // namespace corsika
+
+// data arrays, etc., as generated automatically
+#include <corsika/framework/core/GeneratedParticleProperties.inc>
+
+namespace corsika {
 
   // forward declarations to be used in GeneratedParticleProperties
   int16_t constexpr get_charge_number(Code const);     //!< electric charge in units of e
@@ -96,19 +113,20 @@ namespace corsika {
   std::string_view constexpr get_name(Code const); //!< name of the particle as string
   TimeType constexpr get_lifetime(Code const);     //!< lifetime
 
-  bool constexpr is_hadron(Code const); //!< true iff particle is hadron
-  bool constexpr is_em(Code const); //!< true iff particle is electron, positron or photon
-  bool constexpr is_muon(Code const);     //!< true iff particle is mu+ or mu-
-  bool constexpr is_neutrino(Code const); //!< true iff particle is (anti-) neutrino
+  bool constexpr is_hadron(Code const); //!< true if particle is hadron
+  bool constexpr is_em(Code const); //!< true if particle is electron, positron or photon
+  bool constexpr is_muon(Code const);     //!< true if particle is mu+ or mu-
+  bool constexpr is_neutrino(Code const); //!< true if particle is (anti-) neutrino
 
   /**
    * @brief Creates the Code for a nucleus of type 10LZZZAAAI.
    *
    * @return internal nucleus Code
    */
-  Code constexpr get_nucleus_code(unsigned int const A, unsigned int const Z);
+  Code constexpr get_nucleus_code(size_t const A, size_t const Z);
+
   /**
-   * @brief Checks if Code corresponds to a nucleus.
+   * Checks if Code corresponds to a nucleus.
    *
    * @return true if nucleus.
    * @return false  if not nucleus.
@@ -116,19 +134,19 @@ namespace corsika {
   bool constexpr is_nucleus(Code const);
 
   /**
-   * @brief Get the mass number A for nucleus.
+   * Get the mass number A for nucleus.
    *
    * @return int size of nucleus.
    */
-  unsigned int constexpr get_nucleus_A(
+  size_t constexpr get_nucleus_A(
       Code const); //!< returns A for hard-coded nucleus, otherwise 0
 
   /**
-   * @brief Get the charge number Z for nucleus.
+   * Get the charge number Z for nucleus.
    *
    * @return int charge of nucleus.
    */
-  unsigned int constexpr get_nucleus_Z(
+  size_t constexpr get_nucleus_Z(
       Code const); //!< returns Z for hard-coded nucleus, otherwise 0
 
   /**
@@ -149,7 +167,7 @@ namespace corsika {
    * @brief Get the nucleus name.
    *
    * @param code
-   * @return std::string
+   * @return std::string_view
    */
   inline std::string_view get_nucleus_name(Code const code);
 
@@ -180,9 +198,6 @@ namespace corsika {
 
 } // namespace corsika
 
-// data arrays, etc., as generated automatically
-#include <corsika/framework/core/GeneratedParticleProperties.inc>
-
 #include <corsika/detail/framework/core/ParticleProperties.inl>
 
 // constants in namespaces-like static classes, generated automatically
diff --git a/corsika/framework/geometry/LeapFrogTrajectory.hpp b/corsika/framework/geometry/LeapFrogTrajectory.hpp
index ddccc83c80165713130e216b7118e984b5875281..64bd5015916a9d953d0a689f1ba22ceef667d603 100644
--- a/corsika/framework/geometry/LeapFrogTrajectory.hpp
+++ b/corsika/framework/geometry/LeapFrogTrajectory.hpp
@@ -21,7 +21,7 @@ namespace corsika {
    *
    * The leap-frog algorithm uses two half-steps and is used in magnetic
    * field tracking. The LeapFrogTrajectory will solve the leap-frog
-   * algorithm equation for a given constant $k$ that has to be
+   * algorithm equation for a given constant @f$k@f$ that has to be
    * specified during construction (essentially fixing the magnetic
    * field). Thus, different steps (length) can be dynamically
    * generated here. The velocity vector will correctly point into the
@@ -29,17 +29,18 @@ namespace corsika {
    * intermediate position.
    *
    * One complete leap-frog step is
-   * $
-   * \vec{x}(t_{i+0.5}) = \vec{x}(t_{i}) + \vec{v(t_{i})} * \Delta t / 2 \\
-   * \vec{v}(t_{i+1}) = \vec{v}(t_{i}) + \vec{v}(t_{i})\cross\vec{B}(x_{i}, t_{i}) *
+   * @f{eqnarray*}{
+   * \vec{x}(t_{i+0.5}) &=& \vec{x}(t_{i}) + \vec{v(t_{i})} * \Delta t / 2 \\
+   * \vec{v}(t_{i+1}) &=& \vec{v}(t_{i}) + \vec{v}(t_{i})\times\vec{B}(x_{i}, t_{i}) *
    * \Delta t \\
-   * \vec{x}(t_{i+1}) = \vec{x}(t_{i+0.5}) + \vec{v}(t_{i+1}) * \Delta t /2 \\
-   * $
+   * \vec{x}(t_{i+1}) &=& \vec{x}(t_{i+0.5}) + \vec{v}(t_{i+1}) * \Delta t /2 \\
+   * @f}
    *
-   * The volocity update has the characteristics $|\vec{v}(t_{i+1})|>1$, thus final
+   * The volocity update has the characteristics @f$|\vec{v}(t_{i+1})|>1@f$, thus final
    * velocities are renormalised. The full leap-frog steplength is thus
-   * $L = |\vec{v}(t_{i+1})| * \Delta t / 2  + |\vec{v}(t_{i+1})| *\Delta t / 2$
-   **/
+   * @f[ L = |\vec{v}(t_{i+1})| \cdot \Delta t / 2  + |\vec{v}(t_{i+1})| \cdot \Delta t /
+   * 2 @f]
+   */
 
   class LeapFrogTrajectory : public BaseTrajectory {
 
diff --git a/corsika/framework/process/BaseProcess.hpp b/corsika/framework/process/BaseProcess.hpp
index a871a065e4e2fe8d810bbed469ca3a50a7cf4c21..5fb6d554fe0787ba9f9d239dddfbc8388a92d2a8 100644
--- a/corsika/framework/process/BaseProcess.hpp
+++ b/corsika/framework/process/BaseProcess.hpp
@@ -11,22 +11,23 @@
 #include <corsika/framework/process/ProcessTraits.hpp>
 
 #include <type_traits>
+#include <cstddef>
 
 //! @file BaseProcess.hpp
 
 namespace corsika {
 
   /**
-     @ingroup Processes
-     @{
-
-     Each process in C8 must derive from BaseProcess
-
-     The structural base type of a process object in a
-     ProcessSequence. Both, the ProcessSequence and all its elements
-     are of type BaseProcess
-
-     @todo rename BaseProcess into just Process
+   * @ingroup Processes
+   * @{
+   *
+   * Each process in C8 must derive from BaseProcess
+   *
+   * The structural base type of a process object in a
+   * ProcessSequence. Both, the ProcessSequence and all its elements
+   * are of type BaseProcess.
+   *
+   * @todo rename BaseProcess into just Process
    */
 
   template <typename TDerived>
@@ -39,7 +40,7 @@ namespace corsika {
                              // BaseProcess itself
 
     /** @name getRef Return reference to underlying type
-        @{
+     *  @{
      */
     TDerived& getRef() { return static_cast<TDerived&>(*this); }
     const TDerived& getRef() const { return static_cast<const TDerived&>(*this); }
@@ -50,15 +51,15 @@ namespace corsika {
     static bool const is_switch_process_sequence = false;
 
     //! Default number of processes is just one, obviously
-    static unsigned int constexpr getNumberOfProcesses() { return 1; }
+    static size_t constexpr getNumberOfProcesses() { return 1; }
 
     //! Base processor type for use in other template classes
     using process_type = TDerived;
   };
 
   /**
-     is_process traits specialization to indicate inheritance from BaseProcess
-  */
+   * is_process traits specialization to indicate inheritance from BaseProcess.
+   */
   template <typename TProcess>
   struct is_process<
       TProcess,
@@ -67,14 +68,14 @@ namespace corsika {
       : std::true_type {};
 
   /**
-     count_processes traits specialization to increase process count by one.
+   * count_processes traits specialization to increase process count by one.
    */
   template <typename TProcess, int N>
   struct count_processes<
       TProcess, N,
       typename std::enable_if_t<is_process_v<std::decay_t<TProcess>> &&
                                 !std::decay_t<TProcess>::is_process_sequence>> {
-    static unsigned int constexpr count = N + 1;
+    static size_t constexpr count = N + 1;
   };
 
   //! @}
diff --git a/corsika/framework/process/NullModel.hpp b/corsika/framework/process/NullModel.hpp
index cdaa3753e0369574eb067e218096613f4c3a3c5d..473455005e8ef513d829328fdfa870ce5008493f 100644
--- a/corsika/framework/process/NullModel.hpp
+++ b/corsika/framework/process/NullModel.hpp
@@ -14,11 +14,11 @@
 namespace corsika {
 
   /**
-     @ingroup Processes
-     @{
-
-     Process that does nothing. It is not even derived from
-     BaseProcess. But it can be added to a ProcessSequence.
+   * @ingroup Processes
+   * @{
+   *
+   * Process that does nothing. It is not even derived from
+   * BaseProcess. But it can be added to a ProcessSequence.
    */
 
   class NullModel {
@@ -31,23 +31,23 @@ namespace corsika {
     static bool const is_switch_process_sequence = false;
 
     //! Default number of processes is zero, obviously
-    static unsigned int constexpr getNumberOfProcesses() { return 0; }
+    static size_t constexpr getNumberOfProcesses() { return 0; }
   };
 
   /**
-     is_process traits specialization to indicate compatibility with BaseProcess
-  */
+   * is_process traits specialization to indicate compatibility with BaseProcess.
+   */
   template <typename TNull>
   struct is_process<
       TNull, std::enable_if_t<std::is_base_of_v<NullModel, typename std::decay_t<TNull>>>>
       : std::true_type {};
 
   /**
-     count_processes traits specialization to increase process count by one.
+   * count_processes traits specialization to increase process count by one.
    */
   template <int N>
   struct count_processes<NullModel, N, void> {
-    static unsigned int constexpr count = N;
+    static size_t constexpr count = N;
   };
 
   //! @}
diff --git a/corsika/framework/process/ProcessSequence.hpp b/corsika/framework/process/ProcessSequence.hpp
index e6d3600b8cff72e305a1b57f64a526a39772341f..4246a062127961166af14a83dbc79268353042ab 100644
--- a/corsika/framework/process/ProcessSequence.hpp
+++ b/corsika/framework/process/ProcessSequence.hpp
@@ -45,8 +45,7 @@ namespace corsika {
       TProcess, N,
       typename std::enable_if_t<is_process_v<std::decay_t<TProcess>> &&
                                 std::decay_t<TProcess>::is_process_sequence>> {
-    static unsigned int constexpr count =
-        N + std::decay_t<TProcess>::getNumberOfProcesses();
+    static size_t constexpr count = N + std::decay_t<TProcess>::getNumberOfProcesses();
   };
 
   /**
@@ -56,8 +55,8 @@ namespace corsika {
    * SwitchProcessSequence containers. The former is a mere (ordered) collection, while
    * the latter has the option to switch between two alternative ProcessSequences.
    *
-   * Depending on the type of data to act on and on the allowed actions of
-   * processes there are several interface options:
+   * Depending on the type of data to act on and on the allowed actions of processes
+   * there are several interface options:
    * - InteractionProcess
    * - DecayProcess
    * - ContinuousProcess
@@ -71,7 +70,7 @@ namespace corsika {
    * Processes of any type (e.g. p1, p2, p3,...) can be assembled into a ProcessSequence
    * using the `make_sequence` factory function.
    *
-   * @code{.cpp}
+   * @code
    *   auto sequence1 = make_sequence(p1, p2, p3);
    *   auto sequence2 = make_sequence(p4, p5, p6, p7);
    *   auto sequence3 = make_sequence(sequence1, sequemce2, p8, p9);
@@ -128,30 +127,30 @@ namespace corsika {
    *
    *   Definition of a static process list/sequence.
    *
-   *  A compile time static list of processes. The compiler will
-   *  generate a new type based on template logic containing all the
-   *  elements provided by the user.
+   *   A compile time static list of processes. The compiler will
+   *   generate a new type based on template logic containing all the
+   *   elements provided by the user.
    *
-   *  TProcess1 and TProcess2 must both be derived from BaseProcess,
-   *  and are both references if possible (lvalue), otherwise (rvalue)
-   *  they are just classes. This allows us to handle both, rvalue as
-   *  well as lvalue Processes in the ProcessSequence.
+   *   TProcess1 and TProcess2 must both be derived from BaseProcess,
+   *   and are both references if possible (lvalue), otherwise (rvalue)
+   *   they are just classes. This allows us to handle both, rvalue as
+   *   well as lvalue Processes in the ProcessSequence.
    *
-   *  (For your potential interest,
-   *  the static version of the
-   *  ProcessSequence and all Process
-   *  types are based on the CRTP C++
-   *  design pattern).
+   *   (For your potential interest,
+   *   the static version of the
+   *   ProcessSequence and all Process
+   *   types are based on the CRTP C++
+   *   design pattern).
    *
-   * Template parameters:
-   *   @tparam TProcess1 is of type BaseProcess, either a dedicatd process, or a
-   *           ProcessSequence.
-   *   @tparam TProcess2 is of type BaseProcess, either a dedicatd process, or a
-   *           ProcessSequence.
-   * @tparam IndexFirstProcess to count and index each Process in the entire
-   *         process-chain. The offset is the starting value for this ProcessSequence.
-   *  @tparam IndexOfProcess1 index of TProcess1 (counting of Process).
-   *  @tparam IndexOfProcess2 index of TProcess2 (counting of Process).
+   *  Template parameters:
+   *  @tparam TProcess1 is of type BaseProcess, either a dedicatd process, or a
+   *           ProcessSequence
+   *  @tparam TProcess2 is of type BaseProcess, either a dedicatd process, or a
+   *           ProcessSequence
+   *  @tparam IndexFirstProcess to count and index each Process in the entire
+   *          process-chain. The offset is the starting value for this ProcessSequence
+   *  @tparam IndexOfProcess1 index of TProcess1 (counting of Process)
+   *  @tparam IndexOfProcess2 index of TProcess2 (counting of Process)
    */
 
   template <typename TProcess1, typename TProcess2 = NullModel,
@@ -183,8 +182,8 @@ namespace corsika {
      * use object, l-value references or r-value references to
      * construct sequences.
      *
-     * @param in_A BaseProcess or switch/process list.
-     * @param in_B BaseProcess or switch/process list.
+     * @param in_A BaseProcess or switch/process list
+     * @param in_B BaseProcess or switch/process list
      */
     ProcessSequence(TProcess1 in_A, TProcess2 in_B);
 
@@ -252,6 +251,10 @@ namespace corsika {
      * The maximum allowed step length is the minimum of the allowed track lenght over all
      * ContinuousProcess-es in the ProcessSequence.
      *
+     * @tparam TParticle particle type.
+     * @tparam TTrack the trajectory type.
+     * @param particle The particle data object.
+     * @param track The track data object.
      * @return ContinuousProcessStepLength which contains the step length itself in
      *          LengthType, and a unique identifier of the related ContinuousProcess.
      */
@@ -321,7 +324,7 @@ namespace corsika {
     /**
      * static counter to uniquely index (count) all ContinuousProcess in switch sequence.
      */
-    static unsigned int constexpr getNumberOfProcesses() { return numberOfProcesses_; }
+    static size_t constexpr getNumberOfProcesses() { return numberOfProcesses_; }
 
 #ifdef CORSIKA_UNIT_TESTING
     TProcess1 getProcess1() const { return A_; }
@@ -332,7 +335,7 @@ namespace corsika {
     TProcess1 A_; //! process/list A, this is a reference, if possible
     TProcess2 B_; //! process/list B, this is a reference, if possible
 
-    static unsigned int constexpr numberOfProcesses_ = IndexOfProcess1; // static counter
+    static size_t constexpr numberOfProcesses_ = IndexOfProcess1; // static counter
   };
 
   /**
@@ -359,10 +362,10 @@ namespace corsika {
    * types derived from BaseProcess. Also the ProcessSequence itself
    * is derived from type BaseProcess.
    *
-   * @tparam TProcesses parameter pack with objects of type BaseProcess.
-   * @tparam TProcess1 another BaseProcess.
-   * @param vA needs to derive from BaseProcess.
-   * @param vB paramter-pack, needs to derive BaseProcess.
+   * @tparam TProcesses parameter pack with objects of type BaseProcess
+   * @tparam TProcess1 another BaseProcess
+   * @param vA needs to derive from BaseProcess
+   * @param vB paramter-pack, needs to derive BaseProcess
    */
   template <typename... TProcesses, typename TProcess1>
   ProcessSequence<TProcess1, decltype(make_sequence(std::declval<TProcesses>()...))>
diff --git a/corsika/framework/process/ProcessTraits.hpp b/corsika/framework/process/ProcessTraits.hpp
index 24910fece0f821a7ac21b4e271ac0bb2c72f8140..6534ede288d6a531c313d9af22b4d9c7441d3356 100644
--- a/corsika/framework/process/ProcessTraits.hpp
+++ b/corsika/framework/process/ProcessTraits.hpp
@@ -13,6 +13,7 @@
  */
 
 #include <type_traits>
+#include <cstddef>
 
 namespace corsika {
 
@@ -103,7 +104,7 @@ namespace corsika {
    */
   template <typename TProcess, int N = 0, typename Enable = void>
   struct count_processes {
-    static unsigned int constexpr count = N;
+    static size_t constexpr count = N;
   };
 
 } // namespace corsika
diff --git a/corsika/framework/process/StackProcess.hpp b/corsika/framework/process/StackProcess.hpp
index 34a9c50bceef5412a6b5f1b19cda29e02b03f8bd..7569396043aa4893d1a84dcbfd28cff51d68e93a 100644
--- a/corsika/framework/process/StackProcess.hpp
+++ b/corsika/framework/process/StackProcess.hpp
@@ -35,13 +35,19 @@ namespace corsika {
    * Where, of course, Stack is the valid
    * class to access particles on the Stack. This methods does
    * not need to be templated, they could use the types
-   * e.g. corsika::setup::Stack directly -- but by the cost of
+   * e.g. `corsika::setup::Stack` directly -- but by the cost of
    * loosing all flexibility otherwise provided.
    *
    * A StackProcess has only one constructor `StackProcess::StackProcess(unsigned int
-   * const nStep)` where nStep is the number of steps of the cascade stepping after which
-   * the stack process should be run. Good values are on the order of 1000, which will not
-   * compromise run time in the end, but provide all the benefits of the StackProcess.
+   * const nStep)` where nStep (@f$n_{step}@f$) is the number of steps of the cascade
+   * stepping after which the stack process should be run. Good values are on the order of
+   * 1000, which will not compromise run time in the end, but provide all the benefits of
+   * the StackProcess.
+   *
+   * The number of *steps* during the cascade processing after
+   * which a StackProcess is going to be executed is determined from `iStep_` and `nStep_`
+   * using the modulo: @f$ !(iStep\_ \; \% \; nStep\_) @f$. And `iStep_` is increased
+   * for each evaluation (step).
    */
 
   template <typename TDerived>
@@ -64,9 +70,7 @@ namespace corsika {
 
   private:
     /**
-     * @name The number of "steps" during the cascade processing after
-     * which this StackProcess is going to be executed. The logic is
-     * "iStep_ modulo nStep_"
+     * @name Execution control and counters.
      * @{
      */
     unsigned int nStep_ = 0;
diff --git a/corsika/framework/process/SwitchProcessSequence.hpp b/corsika/framework/process/SwitchProcessSequence.hpp
index 2b619036994b57ba62586980589cbe1888f5d8cc..c61d4340bcc989796a98164b7030f40787b46143 100644
--- a/corsika/framework/process/SwitchProcessSequence.hpp
+++ b/corsika/framework/process/SwitchProcessSequence.hpp
@@ -115,16 +115,16 @@ namespace corsika {
     static bool const is_switch_process_sequence = true;
 
     /**
-      Only valid user constructor will create fully initialized object
-
-      SwitchProcessSequence supports and encourages move semantics. You can
-      use object, l-value references or r-value references to
-      construct sequences.
-
-      @param sel functor to switch between branch A and B
-      @param in_A process branch A
-      @param in_A process branch B
-     **/
+     * Only valid user constructor will create fully initialized object.
+     *
+     * SwitchProcessSequence supports and encourages move semantics. You can
+     * use object, l-value references or r-value references to
+     * construct sequences.
+     *
+     * @param sel functor to switch between branch A and B
+     * @param in_A process branch A
+     * @param in_B process branch B
+     */
     SwitchProcessSequence(TCondition sel, TSequence in_A, USequence in_B)
         : select_(sel)
         , A_(in_A)
@@ -172,8 +172,8 @@ namespace corsika {
 
     /**
      * static counter to uniquely index (count) all ContinuousProcess in switch sequence.
-     **/
-    static unsigned int constexpr getNumberOfProcesses() { return numberOfProcesses_; }
+     */
+    static size_t constexpr getNumberOfProcesses() { return numberOfProcesses_; }
 
 #ifdef CORSIKA_UNIT_TESTING
     TCondition getCondition() const { return select_; }
diff --git a/corsika/framework/random/ExponentialDistribution.hpp b/corsika/framework/random/ExponentialDistribution.hpp
index 7bd855632d3c6a4de0ceb4a10109c98f02472a9f..ce075ece3d9948f7e5e3729a3a86f4dc98bdf898 100644
--- a/corsika/framework/random/ExponentialDistribution.hpp
+++ b/corsika/framework/random/ExponentialDistribution.hpp
@@ -13,6 +13,13 @@
 
 namespace corsika {
 
+  /**
+   * Describes a random distribution with \f[ \beta e^{-X} \f] for a physical quantity of
+   * type Quantity.
+   *
+   * @tparam Quantity is the type of the physical quantity.
+   */
+
   template <typename Quantity>
   class ExponentialDistribution {
 
@@ -38,30 +45,25 @@ namespace corsika {
     }
 
     /**
-     * @fn value_type getBeta()const
-     * @brief Get parameter of exponential distribution \f[ \beta e^{-X}\f]
-     * @pre
-     * @post
+     * @fn value_type getBeta() const
+     * @brief Get parameter of exponential distribution \f[ \beta e^{-X}\f].
+     *
      * @return  value_type
      */
     value_type getBeta() const { return beta_; }
 
     /**
      * @fn void setBeta(value_type)
-     * @brief Set parameter of exponential distribution \f[ \beta e^{-X}\f]
+     * @brief Set parameter of exponential distribution \f[ \beta e^{-X}\f].
      *
-     * @pre
-     * @post
      * @param vBeta
      */
     void setBeta(value_type const& beta) { beta_ = beta; }
 
     /**
      * @fn value_type operator ()(Generator&)
-     * @brief Generate a random number distributed like \f[ \beta e^{-X}\f]
+     * @brief Generate a random number distributed like \f[ \beta e^{-X}\f].
      *
-     * @pre
-     * @post
      * @tparam Generator
      * @param g
      * @return
diff --git a/corsika/framework/random/UniformRealDistribution.hpp b/corsika/framework/random/UniformRealDistribution.hpp
index 76f147de53008e534c76da5c1157d319c0c35e52..de3b0914de6c3a9737b903fc038b288d5a9e6783 100644
--- a/corsika/framework/random/UniformRealDistribution.hpp
+++ b/corsika/framework/random/UniformRealDistribution.hpp
@@ -45,57 +45,42 @@ namespace corsika {
     }
 
     /**
-     * @fn quantity_type getMax()const
-     * @brief Get the upper limit.
+     * Get the upper limit.
      *
-     * @pre
-     * @post
-     * @return quantity_type
+     * @return value_type
      */
     value_type getMax() const { return max_; }
 
     /**
-     * @fn void setMax(quantity_type)
-     * @brief Set the upper limit.
+     * Set the upper limit.
      *
-     * @pre
-     * @post
      * @param vMax
      */
     void setMax(value_type const& pmax) { max_ = pmax; }
 
     /**
-     * @fn quantity_type getMin()const
-     * @brief Get the lower limit.
+     * Get the lower limit.
      *
-     * @pre
-     * @post
-     * @return
+     * @return The minimum possible value.
      */
     value_type getMin() const { return min_; }
 
     /**
-     * @fn void setMin(quantity_type)
-     * @brief  Set the lower limit.
+     * Set the lower limit.
      *
-     * @pre
-     * @post
-     * @param vMin
+     * @param pmin is the new lower bound.
      */
     void setMin(value_type const& pmin) { min_ = pmin; }
 
     /**
-     * @fn quantity_type operator ()(Generator&)
-     * @brief Generate a random numberin the range [min, max]
+     * Generate a random number in the range [min, max].
      *
-     * @pre
-     * @post
-     * @tparam Generator
+     * @tparam TGenerator
      * @param g
-     * @return quantity_type
+     * @return value_type
      */
-    template <class Generator>
-    value_type operator()(Generator& g) {
+    template <class TGenerator>
+    value_type operator()(TGenerator& g) {
       return min_ + dist_(g) * (max_ - min_);
     }
 
diff --git a/corsika/framework/stack/StackIteratorInterface.hpp b/corsika/framework/stack/StackIteratorInterface.hpp
index 88e6b8f988062ab29262c37496a56ca89e6ec370..28c65fdbe3bf7a86b3c792dc7fb060209c9de03c 100644
--- a/corsika/framework/stack/StackIteratorInterface.hpp
+++ b/corsika/framework/stack/StackIteratorInterface.hpp
@@ -33,42 +33,44 @@ namespace corsika {
   class ConstStackIteratorInterface; // forward decl
 
   /**
-     The StackIteratorInterface is the main interface to iterator over
-     particles on a stack.
-
-     At the same time StackIteratorInterface is a
-     Particle object by itself, thus there is no difference between
-     type and ref_type for convenience of the physicist.
-
-     This allows to write code like
-     \verbatim
-     for (auto& p : theStack) { p.SetEnergy(newEnergy); }
-     \endverbatim
-
-     The template argument Stack determines the type of Stack object
-     the data is stored in. A pointer to the Stack object is part of
-     the StackIteratorInterface. In addition to Stack the iterator only knows
-     the index index_ in the Stack data.
-
-     The template argument `TParticleInterface` acts as a policy to provide
-     readout function of Particle data from the stack. The TParticleInterface
-     class must know how to retrieve information from the Stack data
-     for a particle entry at any index index_.
-
-     The TParticleInterface class must be written and provided by the
-     user, it contains methods like <code> auto getData() const {
-     return getStackData().getData(getIndex()); }</code>, where
-     StackIteratorInterface::getStackData() return a reference to the
-     object storing the particle data of type TStackData. And
-     StackIteratorInterface::getIndex() provides the iterator index to
-     be readout. The TStackData is another user-provided class to
-     store data and must implement functions compatible with
-     TParticleInterface, in this example TStackData::getData(const unsigned int
-     vIndex).
-
-     For two examples see stack_example.cc, or the
-     corsikaes::sibyll::SibStack class
-  */
+   * The StackIteratorInterface is the main interface to iterator over
+   * particles on a stack.
+   *
+   * At the same time StackIteratorInterface is a
+   * Particle object by itself, thus there is no difference between
+   * type and ref_type for convenience of the physicist.
+   *
+   * This allows to write code like:
+   * @code
+   * for (auto& p : theStack) {
+   *    p.setEnergy(newEnergy);
+   * }
+   * @endcode
+   *
+   * The template argument Stack determines the type of Stack object
+   * the data is stored in. A pointer to the Stack object is part of
+   * the StackIteratorInterface. In addition to Stack the iterator only knows
+   * the index index_ in the Stack data.
+   *
+   * The template argument `TParticleInterface` acts as a policy to provide
+   * readout function of Particle data from the stack. The TParticleInterface
+   * class must know how to retrieve information from the Stack data
+   * for a particle entry at any index index_.
+   *
+   * The TParticleInterface class must be written and provided by the
+   * user, it contains methods like <code> auto getData() const {
+   * return getStackData().getData(getIndex()); }</code>, where
+   * StackIteratorInterface::getStackData() return a reference to the
+   * object storing the particle data of type TStackData. And
+   * StackIteratorInterface::getIndex() provides the iterator index to
+   * be readout. The TStackData is another user-provided class to
+   * store data and must implement functions compatible with
+   * TParticleInterface, in this example TStackData::getData(const unsigned int
+   * vIndex).
+   *
+   * For two examples see stack_example.cc, or the
+   * corsika::sibyll::SibStack class.
+   */
 
   template <typename TStackData, template <typename> typename TParticleInterface,
             template <typename T1, template <class> class T2> class MSecondaryProducer,
@@ -105,20 +107,24 @@ namespace corsika {
       return *this;
     }
 
-    /** iterator must always point to data, with an index:
-          @param data reference to the stack [rw]
-          @param index index on stack
-       */
+    /**
+     *  Iterator must always point to data, with an index.
+     *
+     *    @param data reference to the stack [rw]
+     *    @param index index on stack
+     */
     StackIteratorInterface(stack_type& data, unsigned int const index)
         : index_(index)
         , data_(&data) {}
 
-    /** constructor that also sets new values on particle data object
-        @param data reference to the stack [rw]
-        @param index index on stack
-        @param args variadic list of data to initialize stack entry, this must be
-       consistent with the definition of the user-provided
-       particle_interface_type::setParticleData(...) function
+    /**
+     *  Constructor that also sets new values on particle data object.
+     *
+     *  @param data reference to the stack [rw].
+     *  @param index index on stack.
+     *  @param args variadic list of data to initialize stack entry, this must be
+     *        consistent with the definition of the user-provided
+     *        particle_interface_type::setParticleData(...) function.
      */
     template <typename... TArgs>
     StackIteratorInterface(stack_type& data, unsigned int const index,
@@ -129,16 +135,18 @@ namespace corsika {
       (**this).setParticleData(args...);
     }
 
-    /** constructor that also sets new values on particle data object, including reference
-        to parent particle
-        @param data reference to the stack [rw]
-        @param index index on stack
-        @param reference to parent particle [rw]. This can be used for thinning, particle
-       counting, history, etc.
-        @param args variadic list of data to initialize stack entry, this must be
-       consistent with the definition of the user-provided
-       particle_interface_type::setParticleData(...) function
-    */
+    /**
+     * Constructor that also sets new values on particle data object, including reference
+     * to parent particle.
+     *
+     *  @param data reference to the stack [rw]
+     *  @param index index on stack
+     *  @param parent to parent particle [rw]. This can be used for thinning, particle
+     *         counting, history, etc.
+     *   @param args variadic list of data to initialize stack entry, this must be
+     *        consistent with the definition of the user-provided
+     *         particle_interface_type::setParticleData(...) function.
+     */
     template <typename... TArgs>
     StackIteratorInterface(stack_type& data, unsigned int const index,
                            StackIteratorInterface& parent, const TArgs... args)
@@ -151,9 +159,10 @@ namespace corsika {
     bool isErased() const { return getStack().isErased(*this); }
 
   public:
-    /** @name Iterator interface
-        @{
-    **/
+    /**
+     * @name Iterator interface
+     * @{
+     */
     StackIteratorInterface& operator++() {
       do {
         ++index_;
@@ -187,26 +196,26 @@ namespace corsika {
 
     /**
      * Convert iterator to value type, where value type is the user-provided particle
-     * readout class
-     **/
+     * readout class.
+     */
     particle_interface_type& operator*() {
       return static_cast<particle_interface_type&>(*this);
     }
 
     /**
      * Convert iterator to const value type, where value type is the user-provided
-     * particle readout class
-     **/
+     * particle readout class.
+     */
     particle_interface_type const& operator*() const {
       return static_cast<particle_interface_type const&>(*this);
     }
-    ///@}
+    //! @}
 
   protected:
     /**
      * @name Stack data access
      * @{
-     **/
+     */
     /// Get current particle index
     unsigned int getIndex() const { return index_; }
     /// Get current particle Stack object
@@ -221,7 +230,7 @@ namespace corsika {
     unsigned int getIndexFromIterator() const {
       return data_->getIndexFromIterator(index_);
     }
-    ///@}
+    //! @}
 
     // friends are needed for access to protected methods
     friend class Stack<TStackData, TParticleInterface,
@@ -252,17 +261,17 @@ namespace corsika {
   }; // end class StackIterator
 
   /**
-     This is the iterator class for const-access to stack data.
-
-     The const counterpart of StackIteratorInterface, which is used
-     for read-only iterator access on particle stack:
-
-     \verbatim
-     for (auto const& p : theStack) { E += p.getEnergy(); }
-     \endverbatim
-
-     See documentation of StackIteratorInterface for more details:
-     \sa StackIteratorInterface
+   * This is the iterator class for const-access to stack data.
+   *
+   * The const counterpart of StackIteratorInterface, which is used
+   * for read-only iterator access on particle stack:
+   *
+   * @code
+   * for (auto const& p : theStack) { E += p.getEnergy(); }
+   * @endcode
+   *
+   * See documentation of StackIteratorInterface for more details:
+   * \sa StackIteratorInterface.
    */
 
   template <typename TStackData, template <typename> typename TParticleInterface,
@@ -295,8 +304,9 @@ namespace corsika {
 
     bool isErased() const { return getStack().isErased(*this); }
 
-    /** @name Iterator interface
-        @{
+    /**
+     * @name Iterator interface
+     * @{
      */
     ConstStackIteratorInterface& operator++() {
       do {
@@ -336,12 +346,13 @@ namespace corsika {
     particle_interface_type const& operator*() const {
       return static_cast<particle_interface_type const&>(*this);
     }
-    ///@}
+    //! @}
 
   protected:
-    /** @name Stack data access
-        Only the const versions for read-only access
-        @{
+    /**
+     * @name Stack data access
+     * Only the const versions for read-only access
+     * @{
      */
     unsigned int getIndex() const { return index_; }
     stack_type const& getStack() const { return *data_; }
@@ -350,7 +361,7 @@ namespace corsika {
     unsigned int getIndexFromIterator() const {
       return data_->getIndexFromIterator(index_);
     }
-    ///@}
+    //! @}
 
     // friends are needed for access to protected methods
     friend class Stack<stack_data_type, TParticleInterface,
diff --git a/corsika/media/BaseExponential.hpp b/corsika/media/BaseExponential.hpp
index 7e8aae9f7526d314a247275a53fc7a009d31da18..43ba2fb3077ccfe5e966e27bc047135dad1f5734 100644
--- a/corsika/media/BaseExponential.hpp
+++ b/corsika/media/BaseExponential.hpp
@@ -24,6 +24,8 @@ namespace corsika {
   /**
    * This class provides the grammage/length conversion functionality for
    * (locally) flat exponential atmospheres.
+   *
+   * The density is described according to \f[ \varrho() \f]
    */
   template <typename TDerived>
   class BaseExponential {
@@ -37,6 +39,12 @@ namespace corsika {
   protected:
     auto const& getImplementation() const;
 
+    /**
+     * Returns the mass density at altitude "height".
+     *
+     * @param height
+     * @return MassDensityType
+     */
     MassDensityType getMassDensity(LengthType const height) const;
 
     // clang-format off
diff --git a/corsika/media/HomogeneousMedium.hpp b/corsika/media/HomogeneousMedium.hpp
index 16331957db5334d042e0f4f4ff6e8f67d1fd471b..d41c0bffa3df0e5bccebc0ce146079a297c43302 100644
--- a/corsika/media/HomogeneousMedium.hpp
+++ b/corsika/media/HomogeneousMedium.hpp
@@ -14,12 +14,12 @@
 #include <corsika/media/NuclearComposition.hpp>
 #include <corsika/framework/geometry/BaseTrajectory.hpp>
 
-/**
- * a homogeneous medium
- */
-
 namespace corsika {
 
+  /**
+   * a homogeneous medium
+   */
+
   template <typename T>
   class HomogeneousMedium : public T {
 
diff --git a/corsika/media/InhomogeneousMedium.hpp b/corsika/media/InhomogeneousMedium.hpp
index 66cf00f731af3a3ef9d4940ce6de9c10f3b63287..d490f3025f063c8661952a4e2d9beba7d8974bc5 100644
--- a/corsika/media/InhomogeneousMedium.hpp
+++ b/corsika/media/InhomogeneousMedium.hpp
@@ -14,13 +14,13 @@
 #include <corsika/media/NuclearComposition.hpp>
 #include <corsika/framework/geometry/BaseTrajectory.hpp>
 
-/**
- * A general inhomogeneous medium. The mass density distribution TDensityFunction must be
- * a \f$C^2\f$-function.
- */
-
 namespace corsika {
 
+  /**
+   * A general inhomogeneous medium. The mass density distribution TDensityFunction must
+   * be a \f$C^2\f$-function.
+   */
+
   template <typename T, typename TDensityFunction>
   class InhomogeneousMedium : public T {
 
diff --git a/corsika/media/LinearApproximationIntegrator.hpp b/corsika/media/LinearApproximationIntegrator.hpp
index ef442ebdb10882d82b9c8ed02323f76c5de20148..d20cdaf2b2a454cb5dbbe83c3929de99f553fd78 100644
--- a/corsika/media/LinearApproximationIntegrator.hpp
+++ b/corsika/media/LinearApproximationIntegrator.hpp
@@ -15,18 +15,58 @@
 
 namespace corsika {
 
+  /**
+   * Helper class to integrate 1D density functions.
+   *
+   * Integrated density (grammage) can be calculated along a Trajectory. Also the inverse
+   * (arclength) for a specified grammage can be calculated. In addition, also a maximum
+   * possible length for a maximum allowed uncertainty can be evaluated.
+   *
+   * @tparam TDerived Must provide the **evaluateAt** and **getFirstDerivative**
+   * methods.
+   */
+
   template <typename TDerived>
   class LinearApproximationIntegrator {
-    auto const& getImplementation() const;
+
+    /**
+     * Return the type TDerived of this object.
+     *
+     * @return TDerived const&
+     */
+    TDerived const& getImplementation() const;
 
   public:
-    auto getIntegrateGrammage(BaseTrajectory const& line) const;
+    /**
+     * Get the integrated Grammage along line.
+     *
+     * Calculated as \f[ X=(\varrho_0 + 0.5* d\varrho/dl \cdot l ) l \f].
+     *
+     * @param line
+     * @return GrammageType
+     */
+    GrammageType getIntegrateGrammage(BaseTrajectory const& line) const;
 
-    auto getArclengthFromGrammage(BaseTrajectory const& line,
-                                  GrammageType grammage) const;
+    /**
+     * Get the arclength from Grammage along line.
+     *
+     * Calculate as \f[ (1 - 0.5 * X * d\varrho/dl / (\varrho_0^2)) * X / \varrho_0 \f].
+     *
+     * @param line
+     * @param grammage
+     * @return LengthType
+     */
+    LengthType getArclengthFromGrammage(BaseTrajectory const& line,
+                                        GrammageType grammage) const;
 
-    auto getMaximumLength(BaseTrajectory const& line,
-                          [[maybe_unused]] double relError) const;
+    /**
+     * Get the maximum length l to keep uncertainty below \f[ relError \f].
+     *
+     * @param line
+     * @param relError
+     * @return LengthType
+     */
+    LengthType getMaximumLength(BaseTrajectory const& line, double relError) const;
   };
 
 } // namespace corsika
diff --git a/corsika/media/MediumProperties.hpp b/corsika/media/MediumProperties.hpp
index c936df85b15abf595ead7e9689436118fb0d1b6a..69144b23d4b19483cf6bd6c5e153d5b7e8a6ece2 100644
--- a/corsika/media/MediumProperties.hpp
+++ b/corsika/media/MediumProperties.hpp
@@ -11,54 +11,55 @@
 namespace corsika {
 
   /**
-     @defgroup MediaProperties Media Properties
-
-     Medium types are useful most importantly for effective models
-     like energy losses. a particular medium (mixture of components)
-     may have specif properties not reflected by its mixture of
-     components.
-
-     The data provided here is automatically parsed from the file
-     properties8.dat from NIST.
-
-     The data of each known medium can be access via the global functions in namespace
-     corsika, or via a static class object with the following interface (here at the
-     example of the class HydrogenGas):
-
-     @code{.cpp}
-     static constexpr Medium medium() { return Medium::HydrogenGas; }
-
-     static std::string const getName() { return data_.getName(); }
-     static std::string const getPrettyName() { return data_.getPrettyName(); }
-     static double getWeight() { return data_.getWeight (); }
-     static int weight_significant_figure() { return data_.weight_significant_figure (); }
-     static int weight_error_last_digit() { return data_.weight_error_last_digit(); }
-     static double Z_over_A() { return data_.Z_over_A(); }
-     static double getSternheimerDensity() { return data_.getSternheimerDensity(); }
-     static double getCorrectedDensity() { return data_.getCorrectedDensity(); }
-     static StateOfMatter getStateOfMatter() { return data_.getStateOfMatter(); }
-     static MediumType getType() { return data_.getType(); }
-     static std::string const getSymbol() { return data_.getSymbol(); }
-
-     static double getIeff() { return data_.getIeff(); }
-     static double getCbar() { return data_.getCbar(); }
-     static double getX0() { return data_.getX0(); }
-     static double getX1() { return data_.getX1(); }
-     static double getAA() { return data_.getAA(); }
-     static double getSK() { return data_.getSK(); }
-     static double getDlt0() { return data_.getDlt0(); }
-
-     inline static const MediumData data_ { "hydrogen_gas", "hydrogen gas (H%2#)", 1.008,
-     3, 7, 0.99212,
-     8.3748e-05, 8.3755e-05, StateOfMatter::DiatomicGas,
-     MediumType::Element, "H", 19.2, 9.5835, 1.8639, 3.2718, 0.14092, 5.7273, 0.0 };
-     @endcode
-
-     The numeric data known to CORSIKA 8 (and obtained from NIST) can be browsed below.
-
-     @ingroup MediaProperties
-     @{
-  */
+   * @defgroup MediaProperties Media Properties
+   *
+   * Medium types are useful most importantly for effective models
+   * like energy losses. a particular medium (mixture of components)
+   * may have specif properties not reflected by its mixture of
+   * components.
+   *
+   * The data provided here is automatically parsed from the file
+   * properties8.dat from NIST.
+   *
+   * The data of each known medium can be access via the global functions in namespace
+   * corsika, or via a static class object with the following interface (here at the
+   * example of the class HydrogenGas):
+   *
+   * @code
+   * static constexpr Medium medium() { return Medium::HydrogenGas; }
+   *
+   * static std::string const getName() { return data_.getName(); }
+   * static std::string const getPrettyName() { return data_.getPrettyName(); }
+   * static double getWeight() { return data_.getWeight (); }
+   * static int weight_significant_figure() { return data_.weight_significant_figure (); }
+   * static int weight_error_last_digit() { return data_.weight_error_last_digit(); }
+   * static double Z_over_A() { return data_.Z_over_A(); }
+   * static double getSternheimerDensity() { return data_.getSternheimerDensity(); }
+   * static double getCorrectedDensity() { return data_.getCorrectedDensity(); }
+   * static StateOfMatter getStateOfMatter() { return data_.getStateOfMatter(); }
+   * static MediumType getType() { return data_.getType(); }
+   * static std::string const getSymbol() { return data_.getSymbol(); }
+   *
+   * static double getIeff() { return data_.getIeff(); }
+   * static double getCbar() { return data_.getCbar(); }
+   * static double getX0() { return data_.getX0(); }
+   * static double getX1() { return data_.getX1(); }
+   * static double getAA() { return data_.getAA(); }
+   * static double getSK() { return data_.getSK(); }
+   * static double getDlt0() { return data_.getDlt0(); }
+   *
+   * inline static const MediumData data_ { "hydrogen_gas", "hydrogen gas (H%2#)", 1.008,
+   * 3, 7, 0.99212,
+   * 8.3748e-05, 8.3755e-05, StateOfMatter::DiatomicGas,
+   * MediumType::Element, "H", 19.2, 9.5835, 1.8639, 3.2718, 0.14092, 5.7273, 0.0 };
+   * @endcode
+   *
+   * The numeric data known to CORSIKA 8 (and obtained from NIST) can be browsed in
+   * @ref MediaPropertiesClasses.
+   *
+   * @ingroup MediaProperties
+   * @{
+   */
 
   //! General type of medium
   enum class MediumType {
@@ -75,15 +76,20 @@ namespace corsika {
   //! Physical state of medium
   enum class StateOfMatter { Unknown, Solid, Liquid, Gas, DiatomicGas };
 
+  /**
+   * Enum for all known Media types.
+   */
   enum class Medium : int16_t;
 
-  using MediumIntType = std::underlying_type<Medium>::type;
+  /**
+   * The internal integer type of a medium enum.
+   */
+  typedef std::underlying_type<Medium>::type MediumIntType;
 
   /**
    *
    * Simple object to group together the properties of a medium.
-   *
-   **/
+   */
   struct MediumData {
     std::string name_;
     std::string pretty_name_;
@@ -145,12 +151,12 @@ namespace corsika {
 namespace corsika {
 
   /**
-     @file MediaProperties.hpp
-
-     @ingroup MediaProperties
-     @{
-
-     Returns MediumData object for medium identifed by enum Medium.
+   * @file MediaProperties.hpp
+   *
+   * @ingroup MediaProperties
+   * @{
+   *
+   * Returns MediumData object for medium identifed by enum Medium.
    */
 
   constexpr MediumData const& mediumData(Medium const m) {
diff --git a/corsika/media/UniformMagneticField.hpp b/corsika/media/UniformMagneticField.hpp
index 2f08499dc7d91dc6366e3ca69fda9dc92baa5d40..02f45304a850de4edff4acea500d6d4642f61690 100644
--- a/corsika/media/UniformMagneticField.hpp
+++ b/corsika/media/UniformMagneticField.hpp
@@ -19,7 +19,6 @@ namespace corsika {
    *
    * This class returns the same magnetic field vector
    * for all evaluated locations.
-   *
    */
   template <typename T>
   class UniformMagneticField : public T {
@@ -31,28 +30,30 @@ namespace corsika {
      * This is initialized with a fixed magnetic field
      * and returns this magnetic field at all locations.
      *
-     * @param field    The fixed magnetic field to return.
+     * @param field   The fixed magnetic field to return.
      */
     template <typename... Args>
-    UniformMagneticField(MagneticFieldVector const& B, Args&&... args)
+    UniformMagneticField(MagneticFieldVector const& field, Args&&... args)
         : T(std::forward<Args>(args)...)
-        , B_(B) {}
+        , B_(field) {}
 
     /**
      * Evaluate the magnetic field at a given location.
      *
-     * @param  point    The location to evaluate the field at.
+     * @param  point    The location to evaluate the field at (not used internally).
      * @returns    The magnetic field vector.
      */
-    MagneticFieldVector getMagneticField(Point const&) const final override { return B_; }
+    MagneticFieldVector getMagneticField([
+        [maybe_unused]] Point const& point) const final override {
+      return B_;
+    }
 
     /**
      * Set the magnetic field returned by this instance.
      *
-     * @param  point    The location to evaluate the field at.
-     * @returns    The magnetic field vector.
+     * @param  Bfield    The new vaue of the global magnetic field.
      */
-    auto setMagneticField(MagneticFieldVector const& Bfield) -> void { B_ = Bfield; }
+    void setMagneticField(MagneticFieldVector const& Bfield) { B_ = Bfield; }
 
   private:
     MagneticFieldVector B_; ///< The constant magnetic field we use.
diff --git a/corsika/media/UniformRefractiveIndex.hpp b/corsika/media/UniformRefractiveIndex.hpp
index 2dc5c790a2006893da59dcbfc87c82b814d1456f..a86afa05f7c5d82948394a6ff375991ef1c3282d 100644
--- a/corsika/media/UniformRefractiveIndex.hpp
+++ b/corsika/media/UniformRefractiveIndex.hpp
@@ -17,7 +17,6 @@ namespace corsika {
    *
    * This class returns the same refractive index
    * for all evaluated locations.
-   *
    */
   template <typename T>
   class UniformRefractiveIndex final : public T {
@@ -31,26 +30,26 @@ namespace corsika {
      * This is initialized with a fixed refractive index
      * and returns this refractive index at all locations.
      *
-     * @param field    The refractive index to return everywhere.
+     * @param n  The refractive index to return everywhere.
      */
     template <typename... Args>
     UniformRefractiveIndex(double const n, Args&&... args);
 
     /**
-     * Evaluate the refractive index at a given location.
+     * Evaluate the refractive index at a given location. Note: since this
+     * is *uniform* model, it has no position-dependence.
      *
-     * @param  point    The location to evaluate at.
+     * @param  point    The location to evaluate at (not used internally).
      * @returns    The refractive index at this point.
      */
-    double getRefractiveIndex(Point const&) const override;
+    double getRefractiveIndex(Point const& point) const override;
 
     /**
      * Set the refractive index returned by this instance.
      *
-     * @param  point    The location to evaluate at.
-     * @returns    The refractive index at this location.
+     * @param  n  The global refractive index.
      */
-    void setRefractiveIndex(double const& n);
+    void setRefractiveIndex(double const n);
 
   }; // END: class RefractiveIndex
 
diff --git a/corsika/modules/StackInspector.hpp b/corsika/modules/StackInspector.hpp
index 174e8e05c335af7e4c5f89ed4e621767a13abea6..6723ec3d9bedb0ff3097463133cc5d1a5e8dbe7c 100644
--- a/corsika/modules/StackInspector.hpp
+++ b/corsika/modules/StackInspector.hpp
@@ -15,6 +15,17 @@
 
 namespace corsika {
 
+  /**
+   * StackProcess that will act each @f$n_{step}@f$ steps to perform diagnostics on the
+   * full stack.
+   *
+   * The StackInspector can dump the entrie stack content for debugging, or also just
+   * determine the total energy remaining on the stack. From the decrease of energy on the
+   * stack an ETA for the completion of the simulation is determined.
+   *
+   * @tparam TStack Is the type of the particle stack.
+   */
+
   template <typename TStack>
   class StackInspector : public StackProcess<StackInspector<TStack>> {
 
@@ -23,15 +34,15 @@ namespace corsika {
     using StackProcess<StackInspector<TStack>>::getStep;
 
   public:
-    StackInspector(const int vNStep, const bool vReportStack, const HEPEnergyType vE0);
+    StackInspector(int const nStep, bool const reportStack, HEPEnergyType const vE0);
     ~StackInspector();
 
     void doStack(TStack const&);
 
     /**
-     * To set a new E0, for example when a new shower event is started
+     * To set a new E0, for example when a new shower event is started.
      */
-    void setE0(const HEPEnergyType vE0) { E0_ = vE0; }
+    void setE0(HEPEnergyType const E0) { E0_ = E0; }
 
   private:
     bool ReportStack_;
diff --git a/corsika/modules/conex/CONEX_f.hpp b/corsika/modules/conex/CONEX_f.hpp
index 493f427ea5bd404bb670bb53d8c2ca1acb0deebb..db80137ad9537ca7e1f01ce7240cd4c8473955d1 100644
--- a/corsika/modules/conex/CONEX_f.hpp
+++ b/corsika/modules/conex/CONEX_f.hpp
@@ -22,21 +22,17 @@ namespace conex {
   // the CORSIKA 8 random number interface
 
   /**
-   * \function epos::rndm_interface
-   *
-   * this is the random number hook to external packages.
+   * This is the random number hook to external packages.
    *
    * CORSIKA8, for example, has to provide an implementation of this.
-   **/
+   */
   extern float rndm_interface();
 
   /**
-   * \function epos::double_rndm_interface
-   *
-   * this is the random number hook to external packages.
+   * This is the random number hook to external packages.
    *
    * CORSIKA8, for example, has to provide an implementation of this.
-   **/
+   */
 
   extern double double_rndm_interface();
 
diff --git a/corsika/modules/epos/InteractionModel.hpp b/corsika/modules/epos/InteractionModel.hpp
index 0f08a919b7cc640d20351235dfc2164b155dbe50..b6701bfb5423669018975ea6edc47ff33a6b192b 100644
--- a/corsika/modules/epos/InteractionModel.hpp
+++ b/corsika/modules/epos/InteractionModel.hpp
@@ -23,28 +23,45 @@ namespace corsika::epos {
                      bool const epos_printout_on = false);
     ~InteractionModel();
 
-    //! returns production and elastic cross section for hadrons in epos. Inputs are:
-    //! CorsikaId of beam particle, CorsikaId of target particle, center-of-mass energy.
-    //!  Allowed targets are: nuclei or single nucleons (p,n,hydrogen). This routine
-    //!  calculates the cross sections from scratch. Very slow!
+    /**
+     * Returns production and elastic cross section for hadrons in epos.
+     *
+     * Allowed targets are: nuclei or single nucleons (p,n,hydrogen). This routine
+     * calculates the cross sections from scratch.
+     *
+     * Note: **Very slow!**, use tabulation for any performance application.
+     *
+     * @param corsikaId - PID of beam particle,
+     * @param targetId - PID of target particle
+     * @param sqrtS - center-of-mass energy.
+     */
     std::tuple<CrossSectionType, CrossSectionType> calcCrossSectionCoM(
-        Code const, int const, int const, Code const, int const, int const,
-        HEPEnergyType const) const;
+        Code const corsikaId, int const, int const, Code const targetId, int const,
+        int const, HEPEnergyType const sqrtS) const;
 
-    //! returns production and elastic cross section for hadrons in epos by reading
-    //! pre-calculated tables from epos.
+    /**
+     * Returns production and elastic cross section for hadrons in epos by reading
+     * pre-calculated tables from epos.
+     */
     std::tuple<CrossSectionType, CrossSectionType> readCrossSectionTableLab(
         Code const, int const, int const, Code const, HEPEnergyType const) const;
 
-    //! returns production and elastic cross section. Allowed configurations are
-    //! hadron-nucleon, hadron-nucleus and nucleus-nucleus. Inputs are particle id's mass
-    //! and charge numbers and total energy in the lab.
+    /**
+     * Returns production and elastic cross section.
+     *
+     * Allowed configurations are
+     * hadron-nucleon, hadron-nucleus and nucleus-nucleus. Inputs are particle id's mass
+     * and charge numbers and total energy in the lab.
+     */
     std::tuple<CrossSectionType, CrossSectionType> getCrossSectionInelEla(
         Code const projectileId, Code const targetId, FourMomentum const& projectileP4,
         FourMomentum const& targetP4) const;
 
     /**
      * Checks validity of projectile, target and energy combination.
+     *
+     * EPOSLHC only accepts nuclei with X<=A<=Y as targets, or protons aka Hydrogen or
+     * neutrons (p,n == nucleon).
      */
     bool isValid(Code const projectileId, Code const targetId,
                  HEPEnergyType const sqrtS) const;
@@ -66,8 +83,7 @@ namespace corsika::epos {
     }
 
     /**
-     * In this function EPOSLHC is called to produce one event. The
-     * event is copied into the shower lab frame.
+     * Calculate one hadron-hadron interaction.
      */
     template <typename TSecondaries>
     void doInteraction(TSecondaries&, Code const projectileId, Code const targetId,
diff --git a/corsika/modules/qgsjetII/qgsjet-II-04.hpp b/corsika/modules/qgsjetII/qgsjet-II-04.hpp
index 9d3b884fb71a5f0e15801f994021a325bdbaba49..388f4e2849ab3f1ad683f2d21e83141357c83252 100644
--- a/corsika/modules/qgsjetII/qgsjet-II-04.hpp
+++ b/corsika/modules/qgsjetII/qgsjet-II-04.hpp
@@ -42,7 +42,7 @@ extern struct {
 } qgarr55_;
 
 /**
-   Small helper class to provide a data-directory name in the format qgsjetII expects
+ * Small helper class to provide a data-directory name in the format qgsjetII expects.
  */
 class datadir {
 private:
@@ -60,33 +60,33 @@ void qgaini_(
     const char* datdir); // Note: there is a length limiation 132 from fortran-qgsjet here
 
 /**
-   additional initialization procedure per event
-
-   @param e0n  - interaction energy (per hadron/nucleon),
-   @param icp0 - hadron type (+-1 - pi+-, +-2 - p(p~), +-3 - n(n~), +-4 - K+-, +-5 -
-   K_l/s),
-   @param iap  - projectile mass number (1 - for a hadron),
-   @param iat  - target mass number
-*/
+ * Additional initialization procedure per event.
+ *
+ * @param e0n  - interaction energy (per hadron/nucleon),
+ * @param icp0 - hadron type (+-1 - pi+-, +-2 - p(p~), +-3 - n(n~), +-4 - K+-, +-5 -
+ *               K_l/s),
+ * @param iap  - projectile mass number (1 - for a hadron),
+ * @param iat  - target mass number
+ */
 void qgini_(const double& e0n, const int& icp0, const int& iap, const int& iat);
 
 /**
-   generate one event configuration
-*/
+ * Generate one event configuration.
+ */
 void qgconf_();
 
 /**
-   hadron-nucleus (hadron-nucleus) particle production cross section
-
-   @param e0n lab. energy per projectile nucleon (hadron)
-   @param icz hadron class (1 - pion, 2 - nucleon, 3 - kaon)
-   @param iap projectile mass number (1=<iap<=iapmax),
-   @param iat target mass number     (1=<iat<=iapmax)
+ * Hadron-nucleus (hadron-nucleus) particle production cross section.
+ *
+ * @param e0n lab. energy per projectile nucleon (hadron)
+ * @param icz hadron class (1 - pion, 2 - nucleon, 3 - kaon)
+ * @param iap0 projectile mass number (1=<iap<=iapmax),
+ * @param iat0 target mass number     (1=<iat<=iapmax)
  */
 double qgsect_(const double& e0n, const int& icz, const int& iap0, const int& iat0);
 
 /**
-   link to random number generation
+ * Link to random number generation.
  */
 double qgran_(int&);
 }
diff --git a/corsika/output/OutputManager.hpp b/corsika/output/OutputManager.hpp
index 2582220520454d028b660ca06f5ac93ed8a18b73..c3e570749a0c3e04702a65cadb95b13a0900461b 100644
--- a/corsika/output/OutputManager.hpp
+++ b/corsika/output/OutputManager.hpp
@@ -79,9 +79,8 @@ namespace corsika {
     /**
      * Register an existing output to this manager.
      *
-     * @param name    The unique name of this output.
-     * @param args... These are perfect forwarded to the
-     *                constructor of the output.
+     * @param name   The unique name of this output.
+     * @param output The output module.
      */
     template <typename TOutput>
     void add(std::string const& name, TOutput& output);
diff --git a/modules/qgsjetII/qgsjet-II-04.hpp b/modules/qgsjetII/qgsjet-II-04.hpp
index cf58e8dd72a008a385bb7e8a0cae3bf2a9d691b7..7bb68ba184e974e5b5c610a63d80c3d8af6542cb 100644
--- a/modules/qgsjetII/qgsjet-II-04.hpp
+++ b/modules/qgsjetII/qgsjet-II-04.hpp
@@ -10,18 +10,22 @@
 
 #include <string>
 
+/**
+ * @file qgsjet-II.04.hpp
+ *
+ * The interface to the fortran code.
+ */
+
 namespace qgsjetII {
 
   /**
-   * \function qgsjetII::rndm_interface
-   *
-   * this is the random number hook to external packages.
+   * This is the random number hook to external packages.
    *
    * CORSIKA8, for example, has to provide an implementation of this.
-   **/
+   */
   extern double rndm_interface();
 
-} // namespace sibyll
+} // namespace qgsjetII
 
 //----------------------------------------------
 //  C++ interface for the QGSJetII event generator
@@ -55,7 +59,7 @@ extern struct {
 } qgarr55_;
 
 /**
-   Small helper class to provide a data-directory name in the format qgsjetII expects
+ * Small helper class to provide a data-directory name in the format qgsjetII expects.
  */
 class datadir {
 private:
@@ -73,41 +77,33 @@ void qgaini_(
     const char* datdir); // Note: there is a length limiation 132 from fortran-qgsjet here
 
 /**
-   @function qgini_
-
-   additional initialization procedure per event
-
-   @parameter e0n  - interaction energy (per hadron/nucleon),
-   @parameter icp0 - hadron type (+-1 - pi+-, +-2 - p(p~), +-3 - n(n~), +-4 - K+-, +-5 -
-   K_l/s),
-   @parameter iap  - projectile mass number (1 - for a hadron),
-   @parameter iat  - target mass number
-*/
+ * Additional initialization procedure per event.
+ *
+ * @param e0n  - interaction energy (per hadron/nucleon),
+ * @param icp0 - hadron type (+-1 - pi+-, +-2 - p(p~), +-3 - n(n~), +-4 - K+-, +-5 -
+ *               K_l/s),
+ * @param iap  - projectile mass number (1 - for a hadron),
+ * @param iat  - target mass number
+ */
 void qgini_(const double& e0n, const int& icp0, const int& iap, const int& iat);
 
 /**
-   @function qgconf_
-
-   generate one event configuration
-*/
+ * Generate one event configuration.
+ */
 void qgconf_();
 
 /**
-   @function qgsect_
-
-   hadron-nucleus (hadron-nucleus) particle production cross section
-
-   @parameter e0n lab. energy per projectile nucleon (hadron)
-   @parameter icz hadron class (1 - pion, 2 - nucleon, 3 - kaon)
-   @parameter iap0 projectile mass number (1=<iap0<=iapmax),
-   @parameter iat0 target mass number     (1=<iat0<=iapmax)
+ * Hadron-nucleus (hadron-nucleus) particle production cross section.
+ *
+ * @param e0n lab. energy per projectile nucleon (hadron)
+ * @param icz hadron class (1 - pion, 2 - nucleon, 3 - kaon)
+ * @param iap0 projectile mass number (1=<iap0<=iapmax),
+ * @param iat0 target mass number     (1=<iat0<=iapmax)
  */
 double qgsect_(const double& e0n, const int& icz, const int& iap0, const int& iat0);
 
 /**
-   @function qgran
-
-   link to random number generation
+ * Link to random number generation.
  */
 double qgran_(int&);
 }
diff --git a/src/corsika.hpp.in b/src/corsika.hpp.in
index 3f683d93607a2e7e9c0138f86290ff0964991be0..71c5a4be392b972f853f767df0df6f228e8b306f 100644
--- a/src/corsika.hpp.in
+++ b/src/corsika.hpp.in
@@ -10,6 +10,10 @@
 
 #include <string>
 
+/**
+ * The namespace for the CORSIKA framework.
+ */
+
 namespace corsika {
 
   /**