diff --git a/.clang-format b/.clang-format
index a10309a64d31e65d126363ffb6e8caf0b5a733cc..542c97e89adce40066f0b9a96cc8be9746640d65 100644
--- a/.clang-format
+++ b/.clang-format
@@ -1,6 +1,5 @@
 ---
 Language:        Cpp
 BasedOnStyle:  Google
-SortIncludes:    false
 KeepEmptyLinesAtTheStartOfBlocks: true
 ...
diff --git a/examples/main.c b/examples/main.c
index d7f0f2aa793713f0e3d14ca06cb7d7be72dcbf52..9f371d64dde9c66f118477beb145f426946fc9d9 100644
--- a/examples/main.c
+++ b/examples/main.c
@@ -27,10 +27,10 @@
 
 /* Some standard headers. */
 #include <fenv.h>
-#include <unistd.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
 
 /* MPI headers. */
 #ifdef WITH_MPI
@@ -125,8 +125,7 @@ int main(int argc, char *argv[]) {
 
 /* Let's pin the main thread */
 #if defined(HAVE_SETAFFINITY) && defined(HAVE_LIBNUMA) && defined(_GNU_SOURCE)
-  if (((ENGINE_POLICY) & engine_policy_setaffinity) ==
-      engine_policy_setaffinity)
+  if (((ENGINE_POLICY)&engine_policy_setaffinity) == engine_policy_setaffinity)
     engine_pin();
 #endif
 
diff --git a/format.sh b/format.sh
old mode 100644
new mode 100755
diff --git a/src/cell.c b/src/cell.c
index 29072173b060a936fe6f4f43c091581d522985b3..97a67583a7872999d7b7e7c5a0eb9787c83b4bd3 100644
--- a/src/cell.c
+++ b/src/cell.c
@@ -50,8 +50,8 @@
 #include "atomic.h"
 #include "error.h"
 #include "gravity.h"
-#include "hydro_properties.h"
 #include "hydro.h"
+#include "hydro_properties.h"
 #include "space.h"
 #include "timers.h"
 
diff --git a/src/common_io.h b/src/common_io.h
index 6dbb83e74771dacf6b61f697a5c177781db443ec..ed1c96801c904d9952c7b3ca995b847afdc3fb43 100644
--- a/src/common_io.h
+++ b/src/common_io.h
@@ -52,10 +52,7 @@ enum DATA_TYPE {
  *start a run or optional.
  *
  */
-enum DATA_IMPORTANCE {
-  COMPULSORY = 1,
-  OPTIONAL = 0
-};
+enum DATA_IMPORTANCE { COMPULSORY = 1, OPTIONAL = 0 };
 
 /**
  * @brief The different particle types present in a GADGET IC file
diff --git a/src/cycle.h b/src/cycle.h
index 1278c83e8b43324662bdeb0de75eec08faf4fd82..4925808f5a4c4ea7828bc1a6b7a9490d2d2ca255 100644
--- a/src/cycle.h
+++ b/src/cycle.h
@@ -334,7 +334,7 @@ typedef unsigned __int64 ticks;
 extern "C"
 #endif
     ticks
-        __getReg(int whichReg);
+    __getReg(int whichReg);
 #pragma intrinsic(__getReg)
 
 static __inline ticks getticks(void) {
@@ -481,9 +481,9 @@ INLINE_ELAPSED(inline)
 /* MIPS ZBus */
 #if HAVE_MIPS_ZBUS_TIMER
 #if defined(__mips__) && !defined(HAVE_TICK_COUNTER)
+#include <fcntl.h>
 #include <sys/mman.h>
 #include <unistd.h>
-#include <fcntl.h>
 
 typedef uint64_t ticks;
 
diff --git a/src/debug.c b/src/debug.c
index a962e2a4c1df6ed8c72731694af4bf28e393ecb2..a3647915d96a9456cb6d8177d144dab56fd0b97e 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -24,8 +24,8 @@
 
 #include "config.h"
 #include "const.h"
-#include "part.h"
 #include "debug.h"
+#include "part.h"
 
 /* Import the right hydro definition */
 #if defined(MINIMAL_SPH)
diff --git a/src/drift.h b/src/drift.h
index 48edab9f9cc2b360b4d3e5d53a809ab6f59e682d..05b09bb7910e8cddaf9fb24bb248f120f9db9eea 100644
--- a/src/drift.h
+++ b/src/drift.h
@@ -25,6 +25,7 @@
 /* Local headers. */
 #include "const.h"
 #include "debug.h"
+#include "hydro.h"
 
 /**
  * @brief Perform the 'drift' operation on a #gpart
@@ -58,9 +59,9 @@ __attribute__((always_inline)) INLINE static void drift_gpart(
  * @param ti_old Integer start of time-step
  * @param ti_current Integer end of time-step
  */
-__attribute__((always_inline))
-    INLINE static void drift_part(struct part* p, struct xpart* xp, float dt,
-                                  double timeBase, int ti_old, int ti_current) {
+__attribute__((always_inline)) INLINE static void drift_part(
+    struct part* p, struct xpart* xp, float dt, double timeBase, int ti_old,
+    int ti_current) {
   /* Useful quantity */
   const float h_inv = 1.0f / p->h;
 
diff --git a/src/engine.c b/src/engine.c
index 29f06ce0f0762d326fd0f997677a30f7b32eca07..733e5e787357289afcf68dcddef3b0ae286d2ce3 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -29,11 +29,11 @@
 #include <float.h>
 #include <limits.h>
 #include <sched.h>
+#include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#include <stdbool.h>
 
 /* MPI headers. */
 #ifdef WITH_MPI
@@ -56,18 +56,26 @@
 #include "error.h"
 #include "hydro.h"
 #include "minmax.h"
+#include "parallel_io.h"
 #include "part.h"
 #include "partition.h"
-#include "parallel_io.h"
 #include "serial_io.h"
 #include "single_io.h"
 #include "timers.h"
 
-const char *engine_policy_names[13] = {
-    "none",                 "rand",   "steal",        "keep",
-    "block",                "fix_dt", "cpu_tight",    "mpi",
-    "numa_affinity",        "hydro",  "self_gravity", "external_gravity",
-    "cosmology_integration"};
+const char *engine_policy_names[13] = {"none",
+                                       "rand",
+                                       "steal",
+                                       "keep",
+                                       "block",
+                                       "fix_dt",
+                                       "cpu_tight",
+                                       "mpi",
+                                       "numa_affinity",
+                                       "hydro",
+                                       "self_gravity",
+                                       "external_gravity",
+                                       "cosmology_integration"};
 
 /** The rank of the engine as a global variable (for messages). */
 int engine_rank;
diff --git a/src/engine.h b/src/engine.h
index 06343d76c7b0b32eec1ac2baa810eaf931c8a0a9..6c17de54ba62a95c4a5feb3c126390a5b5877d05 100644
--- a/src/engine.h
+++ b/src/engine.h
@@ -39,15 +39,15 @@
 /* Includes. */
 #include "hydro_properties.h"
 #include "lock.h"
+#include "parser.h"
+#include "partition.h"
+#include "physical_constants.h"
+#include "potentials.h"
 #include "proxy.h"
 #include "runner.h"
 #include "scheduler.h"
 #include "space.h"
 #include "task.h"
-#include "parser.h"
-#include "partition.h"
-#include "physical_constants.h"
-#include "potentials.h"
 #include "units.h"
 
 /* Some constants. */
diff --git a/src/gravity/Default/gravity.h b/src/gravity/Default/gravity.h
index 4dd8d5b7c7194ae072f90e7703907500c208b9b9..0f62511eced181fbf3b5b781a50314dd08f7c0ef 100644
--- a/src/gravity/Default/gravity.h
+++ b/src/gravity/Default/gravity.h
@@ -31,11 +31,10 @@
  * @param phys_const The physical constants in internal units.
  * @param gp Pointer to the g-particle data.
  */
-__attribute__((always_inline))
-    INLINE static float gravity_compute_timestep_external(
-        const struct external_potential* potential,
-        const struct phys_const* const phys_const,
-        const struct gpart* const gp) {
+__attribute__((always_inline)) INLINE static float
+gravity_compute_timestep_external(const struct external_potential* potential,
+                                  const struct phys_const* const phys_const,
+                                  const struct gpart* const gp) {
 
   float dt = FLT_MAX;
 
@@ -55,10 +54,9 @@ __attribute__((always_inline))
  * @param phys_const The physical constants in internal units.
  * @param gp Pointer to the g-particle data.
  */
-__attribute__((always_inline))
-    INLINE static float gravity_compute_timestep_self(
-        const struct phys_const* const phys_const,
-        const struct gpart* const gp) {
+__attribute__((always_inline)) INLINE static float
+gravity_compute_timestep_self(const struct phys_const* const phys_const,
+                              const struct gpart* const gp) {
 
   float dt = FLT_MAX;
 
@@ -73,8 +71,8 @@ __attribute__((always_inline))
  *
  * @param gp The particle to act upon
  */
-__attribute__((always_inline))
-    INLINE static void gravity_first_init_gpart(struct gpart* gp) {}
+__attribute__((always_inline)) INLINE static void gravity_first_init_gpart(
+    struct gpart* gp) {}
 
 /**
  * @brief Prepares a g-particle for the gravity calculation
@@ -84,8 +82,8 @@ __attribute__((always_inline))
  *
  * @param gp The particle to act upon
  */
-__attribute__((always_inline))
-    INLINE static void gravity_init_part(struct gpart* gp) {
+__attribute__((always_inline)) INLINE static void gravity_init_part(
+    struct gpart* gp) {
 
   /* Zero the acceleration */
   gp->a_grav[0] = 0.f;
@@ -100,8 +98,8 @@ __attribute__((always_inline))
  *
  * @param gp The particle to act upon
  */
-__attribute__((always_inline))
-    INLINE static void gravity_end_force(struct gpart* gp) {}
+__attribute__((always_inline)) INLINE static void gravity_end_force(
+    struct gpart* gp) {}
 
 /**
  * @brief Computes the gravitational acceleration induced by external potentials
diff --git a/src/gravity/Default/gravity_debug.h b/src/gravity/Default/gravity_debug.h
index 72ae5fd55f399448d78c6f2d1533c7f007f16dd1..21d775d703c8bd7000ad03386fe818124642a8f1 100644
--- a/src/gravity/Default/gravity_debug.h
+++ b/src/gravity/Default/gravity_debug.h
@@ -17,8 +17,8 @@
  *
  ******************************************************************************/
 
-__attribute__((always_inline))
-    INLINE static void gravity_debug_particle(struct gpart* p) {
+__attribute__((always_inline)) INLINE static void gravity_debug_particle(
+    struct gpart* p) {
   printf(
       "x=[%.3e,%.3e,%.3e], "
       "v_full=[%.3e,%.3e,%.3e] \n a=[%.3e,%.3e,%.3e],\n "
diff --git a/src/hydro.h b/src/hydro.h
index aacbb6ac1d16b38133ee573ee2b7ad95918fc9e5..b2ae9d57c399ecea818e9f3dc7db238e01487a9a 100644
--- a/src/hydro.h
+++ b/src/hydro.h
@@ -19,20 +19,24 @@
 #ifndef SWIFT_HYDRO_H
 #define SWIFT_HYDRO_H
 
-#include "./const.h"
+/* Includes. */
+#include "const.h"
+#include "hydro_properties.h"
+#include "kernel_hydro.h"
+#include "part.h"
 
 /* Import the right functions */
 #if defined(MINIMAL_SPH)
-#include "./hydro/Minimal/hydro_iact.h"
 #include "./hydro/Minimal/hydro.h"
+#include "./hydro/Minimal/hydro_iact.h"
 #define SPH_IMPLEMENTATION "Minimal version of SPH (e.g. Price 2010)"
 #elif defined(GADGET2_SPH)
-#include "./hydro/Gadget2/hydro_iact.h"
 #include "./hydro/Gadget2/hydro.h"
+#include "./hydro/Gadget2/hydro_iact.h"
 #define SPH_IMPLEMENTATION "Gadget-2 version of SPH (Springel 2005)"
 #elif defined(DEFAULT_SPH)
-#include "./hydro/Default/hydro_iact.h"
 #include "./hydro/Default/hydro.h"
+#include "./hydro/Default/hydro_iact.h"
 #define SPH_IMPLEMENTATION "Default version of SPH"
 #else
 #error "Invalid choice of SPH variant"
diff --git a/src/hydro/Default/hydro.h b/src/hydro/Default/hydro.h
index e7e5e0f5cae4a7b13a922b1e7986cb47e2f78101..4a6b1900374eb6b422e6fa7422901293b36fd5eb 100644
--- a/src/hydro/Default/hydro.h
+++ b/src/hydro/Default/hydro.h
@@ -53,9 +53,8 @@ __attribute__((always_inline)) INLINE static float hydro_compute_timestep(
  * @param p The particle to act upon
  * @param xp The extended particle data to act upon
  */
-__attribute__((always_inline))
-    INLINE static void hydro_first_init_part(struct part* p, struct xpart* xp) {
-}
+__attribute__((always_inline)) INLINE static void hydro_first_init_part(
+    struct part* p, struct xpart* xp) {}
 
 /**
  * @brief Prepares a particle for the density calculation.
@@ -65,8 +64,8 @@ __attribute__((always_inline))
  *
  * @param p The particle to act upon
  */
-__attribute__((always_inline))
-    INLINE static void hydro_init_part(struct part* p) {
+__attribute__((always_inline)) INLINE static void hydro_init_part(
+    struct part* p) {
   p->density.wcount = 0.f;
   p->density.wcount_dh = 0.f;
   p->rho = 0.f;
@@ -86,8 +85,8 @@ __attribute__((always_inline))
  * @param p The particle to act upon
  * @param time The current time
  */
-__attribute__((always_inline))
-    INLINE static void hydro_end_density(struct part* p, float time) {
+__attribute__((always_inline)) INLINE static void hydro_end_density(
+    struct part* p, float time) {
 
   /* Some smoothing length multiples. */
   const float h = p->h;
@@ -171,8 +170,8 @@ __attribute__((always_inline)) INLINE static void hydro_prepare_force(
  *
  * @param p The particle to act upon
  */
-__attribute__((always_inline))
-    INLINE static void hydro_reset_acceleration(struct part* p) {
+__attribute__((always_inline)) INLINE static void hydro_reset_acceleration(
+    struct part* p) {
 
   /* Reset the acceleration. */
   p->a_hydro[0] = 0.0f;
@@ -218,8 +217,8 @@ __attribute__((always_inline)) INLINE static void hydro_predict_extra(
  *
  * @param p The particle to act upon
  */
-__attribute__((always_inline))
-    INLINE static void hydro_end_force(struct part* p) {}
+__attribute__((always_inline)) INLINE static void hydro_end_force(
+    struct part* p) {}
 
 /**
  * @brief Kick the additional variables
@@ -239,8 +238,8 @@ __attribute__((always_inline)) INLINE static void hydro_kick_extra(
  *
  * @param p The particle to act upon
  */
-__attribute__((always_inline))
-    INLINE static void hydro_convert_quantities(struct part* p) {}
+__attribute__((always_inline)) INLINE static void hydro_convert_quantities(
+    struct part* p) {}
 
 /**
  * @brief Returns the internal energy of a particle
diff --git a/src/hydro/Default/hydro_debug.h b/src/hydro/Default/hydro_debug.h
index 2e7c3d683aa18eee7a550ac89517e3bd01e42107..79ee392d46ca75a2c097bf045b2d82c9f3dc96c0 100644
--- a/src/hydro/Default/hydro_debug.h
+++ b/src/hydro/Default/hydro_debug.h
@@ -17,8 +17,8 @@
  *
  ******************************************************************************/
 
-__attribute__((always_inline))
-    INLINE static void hydro_debug_particle(struct part* p, struct xpart* xp) {
+__attribute__((always_inline)) INLINE static void hydro_debug_particle(
+    struct part* p, struct xpart* xp) {
   printf(
       "x=[%.3e,%.3e,%.3e], "
       "v=[%.3e,%.3e,%.3e],v_full=[%.3e,%.3e,%.3e] \n a=[%.3e,%.3e,%.3e],\n "
diff --git a/src/hydro/Default/hydro_iact.h b/src/hydro/Default/hydro_iact.h
index 4f85299b9d61b3a66389bac3527a63068ab96db9..4d651b61bd934388414d54fa813820111d26e682 100644
--- a/src/hydro/Default/hydro_iact.h
+++ b/src/hydro/Default/hydro_iact.h
@@ -268,11 +268,9 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_density(
  * @brief Density loop (non-symmetric vectorized version)
  */
 
-__attribute__((always_inline))
-    INLINE static void runner_iact_nonsym_vec_density(float *R2, float *Dx,
-                                                      float *Hi, float *Hj,
-                                                      struct part **pi,
-                                                      struct part **pj) {
+__attribute__((always_inline)) INLINE static void
+runner_iact_nonsym_vec_density(float *R2, float *Dx, float *Hi, float *Hj,
+                               struct part **pi, struct part **pj) {
 
 #ifdef VECTORIZE
 
diff --git a/src/hydro/Gadget2/hydro.h b/src/hydro/Gadget2/hydro.h
index 55652338a6a8a1c38c03e5bdbce7c75e02df0646..0973acb0fb46411c778f2551fbe91621825f0278 100644
--- a/src/hydro/Gadget2/hydro.h
+++ b/src/hydro/Gadget2/hydro.h
@@ -46,9 +46,8 @@ __attribute__((always_inline)) INLINE static float hydro_compute_timestep(
  * @param p The particle to act upon
  * @param xp The extended particle data to act upon
  */
-__attribute__((always_inline))
-    INLINE static void hydro_first_init_part(struct part* p, struct xpart* xp) {
-}
+__attribute__((always_inline)) INLINE static void hydro_first_init_part(
+    struct part* p, struct xpart* xp) {}
 
 /**
  * @brief Prepares a particle for the density calculation.
@@ -58,8 +57,8 @@ __attribute__((always_inline))
  *
  * @param p The particle to act upon
  */
-__attribute__((always_inline))
-    INLINE static void hydro_init_part(struct part* p) {
+__attribute__((always_inline)) INLINE static void hydro_init_part(
+    struct part* p) {
   p->density.wcount = 0.f;
   p->density.wcount_dh = 0.f;
   p->rho = 0.f;
@@ -79,8 +78,8 @@ __attribute__((always_inline))
  * @param p The particle to act upon
  * @param ti_current The current time (on the integer timeline)
  */
-__attribute__((always_inline))
-    INLINE static void hydro_end_density(struct part* p, int ti_current) {
+__attribute__((always_inline)) INLINE static void hydro_end_density(
+    struct part* p, int ti_current) {
 
   /* Some smoothing length multiples. */
   const float h = p->h;
@@ -148,8 +147,8 @@ __attribute__((always_inline)) INLINE static void hydro_prepare_force(
  *
  * @param p The particle to act upon
  */
-__attribute__((always_inline))
-    INLINE static void hydro_reset_acceleration(struct part* p) {
+__attribute__((always_inline)) INLINE static void hydro_reset_acceleration(
+    struct part* p) {
 
   /* Reset the acceleration. */
   p->a_hydro[0] = 0.0f;
@@ -193,8 +192,8 @@ __attribute__((always_inline)) INLINE static void hydro_predict_extra(
  *
  * @param p The particle to act upon
  */
-__attribute__((always_inline))
-    INLINE static void hydro_end_force(struct part* p) {
+__attribute__((always_inline)) INLINE static void hydro_end_force(
+    struct part* p) {
 
   p->entropy_dt *=
       (const_hydro_gamma - 1.f) * powf(p->rho, -(const_hydro_gamma - 1.f));
@@ -230,8 +229,8 @@ __attribute__((always_inline)) INLINE static void hydro_kick_extra(
  *
  * @param p The particle to act upon
  */
-__attribute__((always_inline))
-    INLINE static void hydro_convert_quantities(struct part* p) {
+__attribute__((always_inline)) INLINE static void hydro_convert_quantities(
+    struct part* p) {
 
   p->entropy = (const_hydro_gamma - 1.f) * p->entropy *
                powf(p->rho, -(const_hydro_gamma - 1.f));
diff --git a/src/hydro/Gadget2/hydro_debug.h b/src/hydro/Gadget2/hydro_debug.h
index 4f00d8e020f9eaac30fe7f272ca1248d7e4eec58..31e89d438bc96c0f0f2ba56249664d28036cb607 100644
--- a/src/hydro/Gadget2/hydro_debug.h
+++ b/src/hydro/Gadget2/hydro_debug.h
@@ -17,8 +17,8 @@
  *
  ******************************************************************************/
 
-__attribute__((always_inline))
-    INLINE static void hydro_debug_particle(struct part* p, struct xpart* xp) {
+__attribute__((always_inline)) INLINE static void hydro_debug_particle(
+    struct part* p, struct xpart* xp) {
   printf(
       "x=[%.3e,%.3e,%.3e], "
       "v=[%.3e,%.3e,%.3e],v_full=[%.3e,%.3e,%.3e] \n a=[%.3e,%.3e,%.3e],\n "
diff --git a/src/hydro/Gadget2/hydro_io.h b/src/hydro/Gadget2/hydro_io.h
index d15ef65cf959302055c228650036c69a9a3d391b..b977f25386fab0787c925635297a48fa85a8df24 100644
--- a/src/hydro/Gadget2/hydro_io.h
+++ b/src/hydro/Gadget2/hydro_io.h
@@ -112,5 +112,4 @@ void writeSPHflavour(hid_t h_grpsph) {
                    "Legacy Gadget-2 as in Springel (2005)");
   writeAttribute_f(h_grpsph, "Viscosity alpha", const_viscosity_alpha);
   writeAttribute_f(h_grpsph, "Viscosity beta", 3.f);
-
 }
diff --git a/src/hydro/Gizmo/hydro.h b/src/hydro/Gizmo/hydro.h
index f3553a009c22a2f6353796e8a278f0db7d66d294..f69dc3f1798f014e895c4a63760805b1739cec94 100644
--- a/src/hydro/Gizmo/hydro.h
+++ b/src/hydro/Gizmo/hydro.h
@@ -39,17 +39,16 @@ __attribute__((always_inline)) INLINE static float hydro_compute_timestep(
  * @param p The particle to act upon
  * @param xp The extended particle data to act upon
  */
-__attribute__((always_inline))
-    INLINE static void hydro_first_init_part(struct part* p, struct xpart* xp) {
-}
+__attribute__((always_inline)) INLINE static void hydro_first_init_part(
+    struct part* p, struct xpart* xp) {}
 
 /**
  * @brief Prepares a particle for the volume calculation.
  *
  * @param p The particle to act upon
  */
-__attribute__((always_inline))
-    INLINE static void hydro_init_part(struct part* p) {
+__attribute__((always_inline)) INLINE static void hydro_init_part(
+    struct part* p) {
 
 #ifdef SPH_GRADIENTS
   /* use the old volumes to estimate new primitive variables to be used for the
@@ -127,8 +126,8 @@ __attribute__((always_inline))
  *
  * @param p The particle to act upon
  */
-__attribute__((always_inline))
-    INLINE static void hydro_end_volume(struct part* p) {
+__attribute__((always_inline)) INLINE static void hydro_end_volume(
+    struct part* p) {
 
   /* Some smoothing length multiples. */
   const float h = p->h;
@@ -387,8 +386,8 @@ __attribute__((always_inline)) INLINE static void hydro_prepare_gradient(
  *
  * @param p The particle to act upon
  */
-__attribute__((always_inline))
-    INLINE static void hydro_end_gradient(struct part* p) {
+__attribute__((always_inline)) INLINE static void hydro_end_gradient(
+    struct part* p) {
 
 #ifndef SPH_GRADIENTS
   float h, ih, ih2, ih3;
@@ -531,8 +530,8 @@ __attribute__((always_inline))
  * @param p The particle to act upon
  * @param xp The extended particle data to act upon
  */
-__attribute__((always_inline))
-    INLINE static void hydro_prepare_fluxes(struct part* p, struct xpart* xp) {
+__attribute__((always_inline)) INLINE static void hydro_prepare_fluxes(
+    struct part* p, struct xpart* xp) {
 
   /* initialize variables used for timestep calculation */
   p->timestepvars.vmax = 0.0f;
@@ -546,8 +545,8 @@ __attribute__((always_inline))
  *
  * @param p The particle to act upon
  */
-__attribute__((always_inline))
-    INLINE static void hydro_reset_acceleration(struct part* p) {
+__attribute__((always_inline)) INLINE static void hydro_reset_acceleration(
+    struct part* p) {
 
   /* figure out what to put here */
 }
@@ -559,8 +558,8 @@ __attribute__((always_inline))
  *
  * @param p The particle to act upon
  */
-__attribute__((always_inline))
-    INLINE static void hydro_end_fluxes(struct part* p) {
+__attribute__((always_inline)) INLINE static void hydro_end_fluxes(
+    struct part* p) {
 
   /* do nothing */
 }
@@ -572,8 +571,8 @@ __attribute__((always_inline))
  *
  * @param p The particle to act upon
  */
-__attribute__((always_inline))
-    INLINE static void hydro_convert_quantities(struct part* p) {
+__attribute__((always_inline)) INLINE static void hydro_convert_quantities(
+    struct part* p) {
 
   float volume;
   GFLOAT m;
@@ -605,17 +604,17 @@ __attribute__((always_inline))
 }
 
 // MATTHIEU
-__attribute__((always_inline))
-    INLINE static void hydro_end_density(struct part* p, float time) {}
+__attribute__((always_inline)) INLINE static void hydro_end_density(
+    struct part* p, float time) {}
 __attribute__((always_inline)) INLINE static void hydro_prepare_force(
     struct part* p, struct xpart* xp, int ti_current, double timeBase) {}
 __attribute__((always_inline)) INLINE static void hydro_predict_extra(
     struct part* p, struct xpart* xp, int t0, int t1, double timeBase) {}
-__attribute__((always_inline))
-    INLINE static void hydro_end_force(struct part* p) {}
+__attribute__((always_inline)) INLINE static void hydro_end_force(
+    struct part* p) {}
 __attribute__((always_inline)) INLINE static void hydro_kick_extra(
     struct part* p, struct xpart* xp, float dt, float half_dt) {}
-__attribute__((always_inline))
-    INLINE static float hydro_get_internal_energy(struct part* p) {
+__attribute__((always_inline)) INLINE static float hydro_get_internal_energy(
+    struct part* p) {
   return 0.f;
 }
diff --git a/src/hydro/Gizmo/hydro_debug.h b/src/hydro/Gizmo/hydro_debug.h
index 2cc957ed883436ce57e9d53d00a073693c9495df..365d85a2f651cf98b0713e8d82f11ae70fa9beaa 100644
--- a/src/hydro/Gizmo/hydro_debug.h
+++ b/src/hydro/Gizmo/hydro_debug.h
@@ -17,8 +17,8 @@
  *
  ******************************************************************************/
 
-__attribute__((always_inline))
-    INLINE static void hydro_debug_particle(struct part* p, struct xpart* xp) {
+__attribute__((always_inline)) INLINE static void hydro_debug_particle(
+    struct part* p, struct xpart* xp) {
   printf(
       "x=[%.16e,%.16e,%.16e], "
       "v=[%.3e,%.3e,%.3e], a=[%.3e,%.3e,%.3e], volume=%.3e\n",
diff --git a/src/hydro/Gizmo/hydro_iact.h b/src/hydro/Gizmo/hydro_iact.h
index 4fe875d3d07315051ef8b3051665a9ea0ef261b8..30a8d6cbebc851b44a5ee2339950aec9e15057c0 100644
--- a/src/hydro/Gizmo/hydro_iact.h
+++ b/src/hydro/Gizmo/hydro_iact.h
@@ -194,11 +194,9 @@ __attribute__((always_inline)) INLINE static void runner_iact_hydro_loop1(
 }
 
 /* this corresponds to task_subtype_hydro_loop1 */
-__attribute__((always_inline))
-    INLINE static void runner_iact_nonsym_hydro_loop1(float r2, float *dx,
-                                                      float hi, float hj,
-                                                      struct part *pi,
-                                                      struct part *pj) {
+__attribute__((always_inline)) INLINE static void
+runner_iact_nonsym_hydro_loop1(float r2, float *dx, float hi, float hj,
+                               struct part *pi, struct part *pj) {
 
   float r;
   float xi;
@@ -487,11 +485,9 @@ __attribute__((always_inline)) INLINE static void runner_iact_hydro_loop2(
 #endif
 }
 
-__attribute__((always_inline))
-    INLINE static void runner_iact_nonsym_hydro_loop2(float r2, float *dx,
-                                                      float hi, float hj,
-                                                      struct part *pi,
-                                                      struct part *pj) {
+__attribute__((always_inline)) INLINE static void
+runner_iact_nonsym_hydro_loop2(float r2, float *dx, float hi, float hj,
+                               struct part *pi, struct part *pj) {
 
 #ifndef SPH_GRADIENTS
 
@@ -1025,11 +1021,9 @@ __attribute__((always_inline)) INLINE static void runner_iact_hydro_loop3(
 }
 
 /* this corresponds to task_subtype_fluxes */
-__attribute__((always_inline))
-    INLINE static void runner_iact_nonsym_hydro_loop3(float r2, float *dx,
-                                                      float hi, float hj,
-                                                      struct part *pi,
-                                                      struct part *pj) {
+__attribute__((always_inline)) INLINE static void
+runner_iact_nonsym_hydro_loop3(float r2, float *dx, float hi, float hj,
+                               struct part *pi, struct part *pj) {
 
   runner_iact_fluxes_common(r2, dx, hi, hj, pi, pj, 0);
 }
diff --git a/src/hydro/Minimal/hydro.h b/src/hydro/Minimal/hydro.h
index c86b4c0ab86bb2fed1b9c447af42a0bc0f8ac0ee..4222daafe82e7dc977cd87f57a5b9a235d505f00 100644
--- a/src/hydro/Minimal/hydro.h
+++ b/src/hydro/Minimal/hydro.h
@@ -53,8 +53,8 @@ __attribute__((always_inline)) INLINE static float hydro_compute_timestep(
  * @param p The particle to act upon
  * @param xp The extended particle data to act upon
  */
-__attribute__((always_inline))
-    INLINE static void hydro_first_init_part(struct part* p, struct xpart* xp) {
+__attribute__((always_inline)) INLINE static void hydro_first_init_part(
+    struct part* p, struct xpart* xp) {
 
   xp->u_full = p->u;
 }
@@ -68,8 +68,8 @@ __attribute__((always_inline))
  *
  * @param p The particle to act upon
  */
-__attribute__((always_inline))
-    INLINE static void hydro_init_part(struct part* p) {
+__attribute__((always_inline)) INLINE static void hydro_init_part(
+    struct part* p) {
   p->density.wcount = 0.f;
   p->density.wcount_dh = 0.f;
   p->rho = 0.f;
@@ -88,8 +88,8 @@ __attribute__((always_inline))
  * @param p The particle to act upon
  * @param time The current time
  */
-__attribute__((always_inline))
-    INLINE static void hydro_end_density(struct part* p, float time) {
+__attribute__((always_inline)) INLINE static void hydro_end_density(
+    struct part* p, float time) {
 
   /* Some smoothing length multiples. */
   const float h = p->h;
@@ -143,8 +143,8 @@ __attribute__((always_inline)) INLINE static void hydro_prepare_force(
  *
  * @param p The particle to act upon
  */
-__attribute__((always_inline))
-    INLINE static void hydro_reset_acceleration(struct part* p) {
+__attribute__((always_inline)) INLINE static void hydro_reset_acceleration(
+    struct part* p) {
 
   /* Reset the acceleration. */
   p->a_hydro[0] = 0.0f;
@@ -187,8 +187,8 @@ __attribute__((always_inline)) INLINE static void hydro_predict_extra(
  *
  * @param p The particle to act upon
  */
-__attribute__((always_inline))
-    INLINE static void hydro_end_force(struct part* p) {}
+__attribute__((always_inline)) INLINE static void hydro_end_force(
+    struct part* p) {}
 
 /**
  * @brief Kick the additional variables
@@ -221,8 +221,8 @@ __attribute__((always_inline)) INLINE static void hydro_kick_extra(
  *
  * @param p The particle to act upon
  */
-__attribute__((always_inline))
-    INLINE static void hydro_convert_quantities(struct part* p) {}
+__attribute__((always_inline)) INLINE static void hydro_convert_quantities(
+    struct part* p) {}
 
 /**
  * @brief Returns the internal energy of a particle
diff --git a/src/hydro/Minimal/hydro_debug.h b/src/hydro/Minimal/hydro_debug.h
index 85fdbac0a7893d575e52629600a5407c1bf77fcc..127ba75e99418b6a5dc197a44ccdc77de3cdef15 100644
--- a/src/hydro/Minimal/hydro_debug.h
+++ b/src/hydro/Minimal/hydro_debug.h
@@ -17,8 +17,8 @@
  *
  ******************************************************************************/
 
-__attribute__((always_inline))
-    INLINE static void hydro_debug_particle(struct part* p, struct xpart* xp) {
+__attribute__((always_inline)) INLINE static void hydro_debug_particle(
+    struct part* p, struct xpart* xp) {
   printf(
       "x=[%.3e,%.3e,%.3e], "
       "v=[%.3e,%.3e,%.3e],v_full=[%.3e,%.3e,%.3e] \n a=[%.3e,%.3e,%.3e], "
diff --git a/src/hydro/Minimal/hydro_iact.h b/src/hydro/Minimal/hydro_iact.h
index b05691c2d69ead0ed95140d3839645d35d50eb10..f453d8fa1c495472af27ccf98356a3dab0894e98 100644
--- a/src/hydro/Minimal/hydro_iact.h
+++ b/src/hydro/Minimal/hydro_iact.h
@@ -131,10 +131,9 @@ __attribute__((always_inline)) INLINE static void runner_iact_force(
   const float P_over_rho_j = pressurej / (rhoj * rhoj) * pj->rho_dh;
 
   /* Compute dv dot r. */
-  const float dvdr = (pi->v[0] - pj->v[0]) * dx[0]
-                   + (pi->v[1] - pj->v[1]) * dx[1]
-                   + (pi->v[2] - pj->v[2]) * dx[2];
-
+  const float dvdr = (pi->v[0] - pj->v[0]) * dx[0] +
+                     (pi->v[1] - pj->v[1]) * dx[1] +
+                     (pi->v[2] - pj->v[2]) * dx[2];
 
   /* Compute sound speeds */
   const float ci = sqrtf(const_hydro_gamma * pressurei / rhoi);
@@ -209,7 +208,6 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_force(
                      (pi->v[1] - pj->v[1]) * dx[1] +
                      (pi->v[2] - pj->v[2]) * dx[2];
 
-
   /* Compute sound speeds */
   const float ci = sqrtf(const_hydro_gamma * pressurei / rhoi);
   const float cj = sqrtf(const_hydro_gamma * pressurej / rhoj);
diff --git a/src/hydro_properties.c b/src/hydro_properties.c
index b96eb1cc7171224c4004b0d63360946edcb0d522..b4e37d672408ad3c0adf1f37fcd4fcbd50095d92 100644
--- a/src/hydro_properties.c
+++ b/src/hydro_properties.c
@@ -26,8 +26,8 @@
 
 /* Local headers. */
 #include "error.h"
-#include "kernel_hydro.h"
 #include "hydro.h"
+#include "kernel_hydro.h"
 
 void hydro_props_init(struct hydro_props *p,
                       const struct swift_params *params) {
diff --git a/src/intrinsics.h b/src/intrinsics.h
index 21b8c8e68bc45d8799db496ff30ac0cfb289acea..27e0bcc729b58493aed8c7eae7dfcdfc8f0855aa 100644
--- a/src/intrinsics.h
+++ b/src/intrinsics.h
@@ -26,8 +26,8 @@
  * This is a wrapper for the GCC intrinsics with an implementation (from
  * Hacker's Delight) if the compiler intrinsics are not available.
  */
-__attribute__((always_inline))
-    INLINE static int intrinsics_clz(unsigned int x) {
+__attribute__((always_inline)) INLINE static int intrinsics_clz(
+    unsigned int x) {
 
 #ifdef __GNUC__
   /* Use GCC intrinsics if possible */
@@ -66,8 +66,8 @@ __attribute__((always_inline))
  * This is a wrapper for the GCC intrinsics with an implementation (from
  * Hacker's Delight) if the compiler intrinsics are not available.
  */
-__attribute__((always_inline))
-    INLINE static int intrinsics_popcount(unsigned int x) {
+__attribute__((always_inline)) INLINE static int intrinsics_popcount(
+    unsigned int x) {
 
 #ifdef __GNUC__
   /* Use GCC intrinsics if possible */
diff --git a/src/kernel_gravity.h b/src/kernel_gravity.h
index cca449efa6dde73eac428d1e20fa5c28156360fa..fedc046eed3bc64ed09120537cf6863179b171a6 100644
--- a/src/kernel_gravity.h
+++ b/src/kernel_gravity.h
@@ -26,11 +26,11 @@
 #include "vector.h"
 
 #define const_iepsilon (1. / const_epsilon)
-#define const_iepsilon2 (const_iepsilon *const_iepsilon)
-#define const_iepsilon3 (const_iepsilon2 *const_iepsilon)
-#define const_iepsilon4 (const_iepsilon2 *const_iepsilon2)
-#define const_iepsilon5 (const_iepsilon3 *const_iepsilon2)
-#define const_iepsilon6 (const_iepsilon3 *const_iepsilon3)
+#define const_iepsilon2 (const_iepsilon * const_iepsilon)
+#define const_iepsilon3 (const_iepsilon2 * const_iepsilon)
+#define const_iepsilon4 (const_iepsilon2 * const_iepsilon2)
+#define const_iepsilon5 (const_iepsilon3 * const_iepsilon2)
+#define const_iepsilon6 (const_iepsilon3 * const_iepsilon3)
 
 /* The gravity kernel is defined as a degree 6 polynomial in the distance
    r. The resulting value should be post-multiplied with r^-3, resulting
@@ -42,18 +42,28 @@
 #define kernel_grav_degree 6
 #define kernel_grav_ivals 2
 #define kernel_grav_scale (2 * const_iepsilon)
-static float kernel_grav_coeffs
-    [(kernel_grav_degree + 1) * (kernel_grav_ivals + 1)] = {
-        32.0f * const_iepsilon6,         -192.0f / 5.0f * const_iepsilon5,
-        0.0f,                            32.0f / 3.0f * const_iepsilon3,
-        0.0f,                            0.0f,
-        0.0f,                            -32.0f / 3.0f * const_iepsilon6,
-        192.0f / 5.0f * const_iepsilon5, -48.0f * const_iepsilon4,
-        64.0f / 3.0f * const_iepsilon3,  0.0f,
-        0.0f,                            -1.0f / 15.0f,
-        0.0f,                            0.0f,
-        0.0f,                            0.0f,
-        0.0f,                            0.0f,
+static float
+    kernel_grav_coeffs[(kernel_grav_degree + 1) * (kernel_grav_ivals + 1)] = {
+        32.0f * const_iepsilon6,
+        -192.0f / 5.0f * const_iepsilon5,
+        0.0f,
+        32.0f / 3.0f * const_iepsilon3,
+        0.0f,
+        0.0f,
+        0.0f,
+        -32.0f / 3.0f * const_iepsilon6,
+        192.0f / 5.0f * const_iepsilon5,
+        -48.0f * const_iepsilon4,
+        64.0f / 3.0f * const_iepsilon3,
+        0.0f,
+        0.0f,
+        -1.0f / 15.0f,
+        0.0f,
+        0.0f,
+        0.0f,
+        0.0f,
+        0.0f,
+        0.0f,
         1.0f};
 
 /**
@@ -76,8 +86,8 @@ __attribute__((always_inline)) INLINE static void kernel_grav_eval(float x,
  * version).
  */
 
-__attribute__((always_inline))
-    INLINE static void kernel_grav_eval_vec(vector *x, vector *w) {
+__attribute__((always_inline)) INLINE static void kernel_grav_eval_vec(
+    vector *x, vector *w) {
 
   vector ind, c[kernel_grav_degree + 1];
   int j, k;
@@ -179,8 +189,8 @@ __attribute__((always_inline)) INLINE static void blender_eval_vec(vector *x,
  * distance x (Vectorized version). Gives a sensible answer only if x<2.
  */
 
-__attribute__((always_inline))
-    INLINE static void blender_deval_vec(vector *x, vector *w, vector *dw_dx) {
+__attribute__((always_inline)) INLINE static void blender_deval_vec(
+    vector *x, vector *w, vector *dw_dx) {
 
   vector ind, c[blender_degree + 1];
   int j, k;
diff --git a/src/kernel_hydro.h b/src/kernel_hydro.h
index 06f950b0e2f3aec68055ba7976b32dc00980589e..b1774d8f35b7eddb6c2fdb0c341fa6299de74582 100644
--- a/src/kernel_hydro.h
+++ b/src/kernel_hydro.h
@@ -137,22 +137,22 @@ static const float kernel_coeffs[(kernel_degree + 1) * (kernel_ivals + 1)]
 /* Ok, now comes the real deal. */
 
 /* First some powers of gamma = H/h */
-#define kernel_gamma2 ((float)(kernel_gamma *kernel_gamma))
-#define kernel_gamma3 ((float)(kernel_gamma *kernel_gamma *kernel_gamma))
+#define kernel_gamma2 ((float)(kernel_gamma * kernel_gamma))
+#define kernel_gamma3 ((float)(kernel_gamma * kernel_gamma * kernel_gamma))
 #define kernel_gamma4 \
-  ((float)(kernel_gamma *kernel_gamma *kernel_gamma *kernel_gamma))
+  ((float)(kernel_gamma * kernel_gamma * kernel_gamma * kernel_gamma))
 #define kernel_igamma ((float)(1. / kernel_gamma))
-#define kernel_igamma2 ((float)(kernel_igamma *kernel_igamma))
-#define kernel_igamma3 ((float)(kernel_igamma *kernel_igamma *kernel_igamma))
+#define kernel_igamma2 ((float)(kernel_igamma * kernel_igamma))
+#define kernel_igamma3 ((float)(kernel_igamma * kernel_igamma * kernel_igamma))
 #define kernel_igamma4 \
-  ((float)(kernel_igamma *kernel_igamma *kernel_igamma *kernel_igamma))
+  ((float)(kernel_igamma * kernel_igamma * kernel_igamma * kernel_igamma))
 
 /* The number of branches */
 #define kernel_ivals_f ((float)(kernel_ivals))
 
 /* Kernel self contribution (i.e. W(0,h)) */
 #define kernel_root \
-  ((float)(kernel_coeffs[kernel_degree]) * kernel_constant *kernel_igamma3)
+  ((float)(kernel_coeffs[kernel_degree]) * kernel_constant * kernel_igamma3)
 
 /**
  * @brief Computes the kernel function and its derivative.
@@ -200,8 +200,8 @@ __attribute__((always_inline)) INLINE static void kernel_deval(
  * @param u The ratio of the distance to the smoothing length $u = x/h$.
  * @param W (return) The value of the kernel function $W(x,h)$.
  */
-__attribute__((always_inline))
-    INLINE static void kernel_eval(float u, float *restrict W) {
+__attribute__((always_inline)) INLINE static void kernel_eval(
+    float u, float *restrict W) {
   /* Go to the range [0,1[ from [0,H[ */
   const float x = u * kernel_igamma;
 
@@ -246,8 +246,8 @@ static const vector kernel_igamma4_vec = FILL_VEC((float)kernel_igamma4);
  * @param w (return) The value of the kernel function $W(x,h)$.
  * @param dw_dx (return) The norm of the gradient of $|\\nabla W(x,h)|$.
  */
-__attribute__((always_inline))
-    INLINE static void kernel_deval_vec(vector *u, vector *w, vector *dw_dx) {
+__attribute__((always_inline)) INLINE static void kernel_deval_vec(
+    vector *u, vector *w, vector *dw_dx) {
 
   /* Go to the range [0,1[ from [0,H[ */
   vector x;
diff --git a/src/map.c b/src/map.c
index da13fbfb4ac00ed58184f7fe818826c82265a1de..fbe57fde7b1e29c49b0f27d86d177245dd9a27e2 100644
--- a/src/map.c
+++ b/src/map.c
@@ -18,10 +18,10 @@
  *
  ******************************************************************************/
 
+#include "map.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include "error.h"
-#include "map.h"
 
 /**
  * @brief Mapping function to draw a specific cell (gnuplot).
diff --git a/src/map.h b/src/map.h
index 0753c2641af6deb050c1dcef6bcd3ae4621ae6aa..950a5fd96ebdc7177b41912b1565163f33de8701 100644
--- a/src/map.h
+++ b/src/map.h
@@ -22,8 +22,8 @@
 #ifndef SWIFT_MAP_H
 #define SWIFT_MAP_H
 
-#include "part.h"
 #include "cell.h"
+#include "part.h"
 
 void map_cells_plot(struct cell *c, void *data);
 void map_check(struct part *p, struct cell *c, void *data);
diff --git a/src/parser.c b/src/parser.c
index 28acb4f7530d1aab6be577b005978df7e05bef0e..74c277f036c733b5b1fbff4f2cb477b52169e2c6 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -22,16 +22,16 @@
 
 /* Some standard headers. */
 /* Needs to be included so that strtok returns char * instead of a int *. */
-#include <string.h>
-#include <stdlib.h>
 #include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
 
 /* This object's header. */
 #include "parser.h"
 
 /* Local headers. */
-#include "error.h"
 #include "common_io.h"
+#include "error.h"
 
 #define PARSER_COMMENT_STRING "#"
 #define PARSER_COMMENT_CHAR '#'
@@ -256,7 +256,7 @@ static void parse_value(char *line, struct swift_params *params) {
   /* Check that it is a parameter inside a section.*/
   if (*line == ' ' || *line == '\t') {
     parse_section_param(line, &isFirstParam, section, params);
-  } else {/*Else it is the start of a new section or standalone parameter. */
+  } else { /*Else it is the start of a new section or standalone parameter. */
     /* Take first token as the parameter name. */
     token = strtok(line, " :\t");
     strcpy(tmpStr, token);
diff --git a/src/partition.c b/src/partition.c
index 70249a679edfe72bda97eddfc918a8526659d995..432943f05f78b41086c7d0d9cc29b1456f094d54 100644
--- a/src/partition.c
+++ b/src/partition.c
@@ -31,11 +31,11 @@
 #include "../config.h"
 
 /* Standard headers. */
+#include <float.h>
 #include <math.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <strings.h>
-#include <float.h>
 
 /* MPI headers. */
 #ifdef WITH_MPI
@@ -59,13 +59,12 @@
 
 /* Simple descriptions of initial partition types for reports. */
 const char *initial_partition_name[] = {
-    "gridded cells",                 "vectorized point associated cells",
+    "gridded cells", "vectorized point associated cells",
     "METIS particle weighted cells", "METIS unweighted cells"};
 
 /* Simple descriptions of repartition types for reports. */
 const char *repartition_name[] = {
-    "no",
-    "METIS edge and vertex time weighted cells",
+    "no", "METIS edge and vertex time weighted cells",
     "METIS particle count vertex weighted cells",
     "METIS time edge weighted cells",
     "METIS particle count vertex and time edge cells"};
@@ -782,8 +781,9 @@ void partition_initial_partition(struct partition *initial_partition,
     struct cell *c;
 
     /* If we've got the wrong number of nodes, fail. */
-    if (nr_nodes != initial_partition->grid[0] * initial_partition->grid[1] *
-                        initial_partition->grid[2])
+    if (nr_nodes !=
+        initial_partition->grid[0] * initial_partition->grid[1] *
+            initial_partition->grid[2])
       error("Grid size does not match number of nodes.");
 
     /* Run through the cells and set their nodeID. */
@@ -792,8 +792,9 @@ void partition_initial_partition(struct partition *initial_partition,
       c = &s->cells[k];
       for (j = 0; j < 3; j++)
         ind[j] = c->loc[j] / s->dim[j] * initial_partition->grid[j];
-      c->nodeID = ind[0] + initial_partition->grid[0] *
-                               (ind[1] + initial_partition->grid[1] * ind[2]);
+      c->nodeID = ind[0] +
+                  initial_partition->grid[0] *
+                      (ind[1] + initial_partition->grid[1] * ind[2]);
       // message("cell at [%e,%e,%e]: ind = [%i,%i,%i], nodeID = %i", c->loc[0],
       // c->loc[1], c->loc[2], ind[0], ind[1], ind[2], c->nodeID);
     }
diff --git a/src/potentials.h b/src/potentials.h
index 50a8903095a8a8218e8d02e3f42af07e40be5b43..c3db5a3d2231c93b1d83aa94bca83f7f7d7106bc 100644
--- a/src/potentials.h
+++ b/src/potentials.h
@@ -30,8 +30,8 @@
 /* Local includes. */
 #include "const.h"
 #include "error.h"
-#include "part.h"
 #include "parser.h"
+#include "part.h"
 #include "physical_constants.h"
 #include "units.h"
 
@@ -58,11 +58,10 @@ struct external_potential {
  * @param phys_const The physical constants in internal units.
  * @param g Pointer to the g-particle data.
  */
-__attribute__((always_inline))
-    INLINE static float external_gravity_pointmass_timestep(
-        const struct external_potential* potential,
-        const struct phys_const* const phys_const,
-        const struct gpart* const g) {
+__attribute__((always_inline)) INLINE static float
+external_gravity_pointmass_timestep(const struct external_potential* potential,
+                                    const struct phys_const* const phys_const,
+                                    const struct gpart* const g) {
 
   const float G_newton = phys_const->const_newton_G;
   const float dx = g->x[0] - potential->point_mass.x;
diff --git a/src/proxy.c b/src/proxy.c
index 02263a5653bdcdd2d1bf0a86523ed1a599d4bf21..efe3a3eec108d44d5b9bf8b4718dc025464f8762 100644
--- a/src/proxy.c
+++ b/src/proxy.c
@@ -249,8 +249,8 @@ void proxy_parts_exch2(struct proxy *p) {
     } while (p->nr_parts_in > p->size_parts_in);
     free(p->parts_in);
     free(p->xparts_in);
-    if ((p->parts_in = (struct part *)malloc(
-             sizeof(struct part) *p->size_parts_in)) == NULL ||
+    if ((p->parts_in = (struct part *)malloc(sizeof(struct part) *
+                                             p->size_parts_in)) == NULL ||
         (p->xparts_in = (struct xpart *)malloc(sizeof(struct xpart) *
                                                p->size_parts_in)) == NULL)
       error("Failed to re-allocate parts_in buffers.");
@@ -310,7 +310,7 @@ void proxy_parts_load(struct proxy *p, const struct part *parts,
     } while (p->nr_parts_out + N > p->size_parts_out);
     struct part *tp;
     struct xpart *txp;
-    if ((tp = (struct part *)malloc(sizeof(struct part) *p->size_parts_out)) ==
+    if ((tp = (struct part *)malloc(sizeof(struct part) * p->size_parts_out)) ==
             NULL ||
         (txp = (struct xpart *)malloc(sizeof(struct xpart) *
                                       p->size_parts_out)) == NULL)
@@ -395,8 +395,8 @@ void proxy_init(struct proxy *p, int mynodeID, int nodeID) {
   /* Allocate the part send and receive buffers, if needed. */
   if (p->parts_in == NULL) {
     p->size_parts_in = proxy_buffinit;
-    if ((p->parts_in = (struct part *)malloc(
-             sizeof(struct part) *p->size_parts_in)) == NULL ||
+    if ((p->parts_in = (struct part *)malloc(sizeof(struct part) *
+                                             p->size_parts_in)) == NULL ||
         (p->xparts_in = (struct xpart *)malloc(sizeof(struct xpart) *
                                                p->size_parts_in)) == NULL)
       error("Failed to allocate parts_in buffers.");
@@ -404,8 +404,8 @@ void proxy_init(struct proxy *p, int mynodeID, int nodeID) {
   p->nr_parts_in = 0;
   if (p->parts_out == NULL) {
     p->size_parts_out = proxy_buffinit;
-    if ((p->parts_out = (struct part *)malloc(
-             sizeof(struct part) *p->size_parts_out)) == NULL ||
+    if ((p->parts_out = (struct part *)malloc(sizeof(struct part) *
+                                              p->size_parts_out)) == NULL ||
         (p->xparts_out = (struct xpart *)malloc(sizeof(struct xpart) *
                                                 p->size_parts_out)) == NULL)
       error("Failed to allocate parts_out buffers.");
diff --git a/src/riemann.h b/src/riemann.h
index ad37490d7249bafe776b58a609064cbd0bc23abe..d647b021167317d14f4cd7316d09c247794f3d23 100644
--- a/src/riemann.h
+++ b/src/riemann.h
@@ -21,11 +21,11 @@
 
 /* gives us const_hydro_gamma and tells us which floating point type to use */
 #include "const.h"
+#include "error.h"
+#include "float.h"
 #include "math.h"
 #include "stdio.h"
-#include "float.h"
 #include "stdlib.h"
-#include "error.h"
 
 #define HLLC_SOLVER
 
diff --git a/src/riemann/riemann_exact.h b/src/riemann/riemann_exact.h
index b768cde5f4f5dfd0463cc8a582a1af0a17607bbe..a2f3c30fb1daf5d53bf35abe4ca7e73eafba6018 100644
--- a/src/riemann/riemann_exact.h
+++ b/src/riemann/riemann_exact.h
@@ -78,9 +78,9 @@ __attribute__((always_inline)) INLINE static GFLOAT riemann_fb(GFLOAT p,
  * @param aL The left sound speed
  * @param aR The right sound speed
  */
-__attribute__((always_inline))
-    INLINE static GFLOAT riemann_f(GFLOAT p, GFLOAT* WL, GFLOAT* WR, GFLOAT vL,
-                                   GFLOAT vR, GFLOAT aL, GFLOAT aR) {
+__attribute__((always_inline)) INLINE static GFLOAT riemann_f(
+    GFLOAT p, GFLOAT* WL, GFLOAT* WR, GFLOAT vL, GFLOAT vR, GFLOAT aL,
+    GFLOAT aR) {
 
   return riemann_fb(p, WL, aL) + riemann_fb(p, WR, aR) + (vR - vL);
 }
diff --git a/src/riemann/riemann_hllc.h b/src/riemann/riemann_hllc.h
index 3fcc8b534ce65d4d364c400dc43e1992f39264b9..6c583f6410f53ed64d630082926d816129768fab 100644
--- a/src/riemann/riemann_hllc.h
+++ b/src/riemann/riemann_hllc.h
@@ -63,13 +63,15 @@ __attribute__((always_inline)) INLINE static void riemann_solve_for_flux(
      all these speeds are along the interface normal, since uL and uR are */
   qL = 1.;
   if (pstar > WL[4]) {
-    qL = sqrtf(1. + 0.5 * (const_hydro_gamma + 1.) / const_hydro_gamma *
-                        (pstar / WL[4] - 1.));
+    qL = sqrtf(1. +
+               0.5 * (const_hydro_gamma + 1.) / const_hydro_gamma *
+                   (pstar / WL[4] - 1.));
   }
   qR = 1.;
   if (pstar > WR[4]) {
-    qR = sqrtf(1. + 0.5 * (const_hydro_gamma + 1.) / const_hydro_gamma *
-                        (pstar / WR[4] - 1.));
+    qR = sqrtf(1. +
+               0.5 * (const_hydro_gamma + 1.) / const_hydro_gamma *
+                   (pstar / WR[4] - 1.));
   }
   SL = uL - aL * qL;
   SR = uR + aR * qR;
diff --git a/src/runner.c b/src/runner.c
index c382da9b8eaed017ed84636f17d04c09f7cf3c5a..97191a7430335bb56c4114c4d208378ed585544a 100644
--- a/src/runner.c
+++ b/src/runner.c
@@ -42,12 +42,12 @@
 #include "atomic.h"
 #include "const.h"
 #include "debug.h"
+#include "drift.h"
 #include "engine.h"
 #include "error.h"
 #include "gravity.h"
-#include "hydro_properties.h"
 #include "hydro.h"
-#include "drift.h"
+#include "hydro_properties.h"
 #include "kick.h"
 #include "minmax.h"
 #include "scheduler.h"
@@ -58,19 +58,46 @@
 
 /* Orientation of the cell pairs */
 const float runner_shift[13 * 3] = {
-    5.773502691896258e-01, 5.773502691896258e-01,  5.773502691896258e-01,
-    7.071067811865475e-01, 7.071067811865475e-01,  0.0,
-    5.773502691896258e-01, 5.773502691896258e-01,  -5.773502691896258e-01,
-    7.071067811865475e-01, 0.0,                    7.071067811865475e-01,
-    1.0,                   0.0,                    0.0,
-    7.071067811865475e-01, 0.0,                    -7.071067811865475e-01,
-    5.773502691896258e-01, -5.773502691896258e-01, 5.773502691896258e-01,
-    7.071067811865475e-01, -7.071067811865475e-01, 0.0,
-    5.773502691896258e-01, -5.773502691896258e-01, -5.773502691896258e-01,
-    0.0,                   7.071067811865475e-01,  7.071067811865475e-01,
-    0.0,                   1.0,                    0.0,
-    0.0,                   7.071067811865475e-01,  -7.071067811865475e-01,
-    0.0,                   0.0,                    1.0, };
+    5.773502691896258e-01,
+    5.773502691896258e-01,
+    5.773502691896258e-01,
+    7.071067811865475e-01,
+    7.071067811865475e-01,
+    0.0,
+    5.773502691896258e-01,
+    5.773502691896258e-01,
+    -5.773502691896258e-01,
+    7.071067811865475e-01,
+    0.0,
+    7.071067811865475e-01,
+    1.0,
+    0.0,
+    0.0,
+    7.071067811865475e-01,
+    0.0,
+    -7.071067811865475e-01,
+    5.773502691896258e-01,
+    -5.773502691896258e-01,
+    5.773502691896258e-01,
+    7.071067811865475e-01,
+    -7.071067811865475e-01,
+    0.0,
+    5.773502691896258e-01,
+    -5.773502691896258e-01,
+    -5.773502691896258e-01,
+    0.0,
+    7.071067811865475e-01,
+    7.071067811865475e-01,
+    0.0,
+    1.0,
+    0.0,
+    0.0,
+    7.071067811865475e-01,
+    -7.071067811865475e-01,
+    0.0,
+    0.0,
+    1.0,
+};
 
 /* Does the axis need flipping ? */
 const char runner_flip[27] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
diff --git a/src/scheduler.c b/src/scheduler.c
index 278b1d0cedb7dde293bda1765120111e1be27903..0db5f33e7048a5c301ef45da10ac74672fe41f61 100644
--- a/src/scheduler.c
+++ b/src/scheduler.c
@@ -66,8 +66,8 @@ void scheduler_addunlock(struct scheduler *s, struct task *ta,
     struct task **unlocks_new;
     int *unlock_ind_new;
     s->size_unlocks *= 2;
-    if ((unlocks_new = (struct task **)malloc(
-             sizeof(struct task *) *s->size_unlocks)) == NULL ||
+    if ((unlocks_new = (struct task **)malloc(sizeof(struct task *) *
+                                              s->size_unlocks)) == NULL ||
         (unlock_ind_new = (int *)malloc(sizeof(int) * s->size_unlocks)) == NULL)
       error("Failed to re-allocate unlocks.");
     memcpy(unlocks_new, s->unlocks, sizeof(struct task *) * s->nr_unlocks);
@@ -95,13 +95,11 @@ void scheduler_addunlock(struct scheduler *s, struct task *ta,
 
 void scheduler_splittasks(struct scheduler *s) {
 
-  const int pts[7][8] = {{-1, 12, 10, 9, 4, 3, 1, 0},
-                         {-1, -1, 11, 10, 5, 4, 2, 1},
-                         {-1, -1, -1, 12, 7, 6, 4, 3},
-                         {-1, -1, -1, -1, 8, 7, 5, 4},
-                         {-1, -1, -1, -1, -1, 12, 10, 9},
-                         {-1, -1, -1, -1, -1, -1, 11, 10},
-                         {-1, -1, -1, -1, -1, -1, -1, 12}};
+  const int pts[7][8] = {
+      {-1, 12, 10, 9, 4, 3, 1, 0},     {-1, -1, 11, 10, 5, 4, 2, 1},
+      {-1, -1, -1, 12, 7, 6, 4, 3},    {-1, -1, -1, -1, 8, 7, 5, 4},
+      {-1, -1, -1, -1, -1, 12, 10, 9}, {-1, -1, -1, -1, -1, -1, 11, 10},
+      {-1, -1, -1, -1, -1, -1, -1, 12}};
   const float sid_scale[13] = {0.1897, 0.4025, 0.1897, 0.4025, 0.5788,
                                0.4025, 0.1897, 0.4025, 0.1897, 0.4025,
                                0.5788, 0.4025, 0.5788};
@@ -833,7 +831,8 @@ void scheduler_reset(struct scheduler *s, int size) {
     if (s->tasks_ind != NULL) free(s->tasks_ind);
 
     /* Allocate the new lists. */
-    if ((s->tasks = (struct task *)malloc(sizeof(struct task) *size)) == NULL ||
+    if ((s->tasks = (struct task *)malloc(sizeof(struct task) * size)) ==
+            NULL ||
         (s->tasks_ind = (int *)malloc(sizeof(int) * size)) == NULL)
       error("Failed to allocate task lists.");
   }
@@ -1338,7 +1337,7 @@ void scheduler_init(struct scheduler *s, struct space *space, int nr_tasks,
 
   /* Init the unlocks. */
   if ((s->unlocks = (struct task **)malloc(
-           sizeof(struct task *) *scheduler_init_nr_unlocks)) == NULL ||
+           sizeof(struct task *) * scheduler_init_nr_unlocks)) == NULL ||
       (s->unlock_ind =
            (int *)malloc(sizeof(int) * scheduler_init_nr_unlocks)) == NULL)
     error("Failed to allocate unlocks.");
diff --git a/src/single_io.c b/src/single_io.c
index 14f7209dd41f03abe3a66f38511029edab40fc2e..fb3bf4368feed9892b098228d85c99f0bc3e724b 100644
--- a/src/single_io.c
+++ b/src/single_io.c
@@ -35,8 +35,8 @@
 #include "single_io.h"
 
 /* Local includes. */
-#include "const.h"
 #include "common_io.h"
+#include "const.h"
 #include "error.h"
 
 /*-----------------------------------------------------------------------------
diff --git a/src/space.c b/src/space.c
index d87107a80add1b04674b74a8af55004427ddeac3..ffb39dcf51cefc1b3bfc6d2ce8f3f3af972eb6d5 100644
--- a/src/space.c
+++ b/src/space.c
@@ -28,8 +28,8 @@
 #include <float.h>
 #include <limits.h>
 #include <math.h>
-#include <string.h>
 #include <stdlib.h>
+#include <string.h>
 
 /* MPI headers. */
 #ifdef WITH_MPI
diff --git a/src/task.c b/src/task.c
index 31e33ebcaccb0f1420033c416c4b7d3d43094403..1aad53f103c0f1ca600c7b093575923284bce3b5 100644
--- a/src/task.c
+++ b/src/task.c
@@ -53,8 +53,8 @@ const char *taskID_names[task_type_count] = {
     "grav_down", "grav_external", "part_sort", "gpart_sort", "split_cell",
     "rewait"};
 
-const char *subtaskID_names[task_type_count] = {"none",  "density",
-                                                "force", "grav"};
+const char *subtaskID_names[task_type_count] = {"none", "density", "force",
+                                                "grav"};
 
 /**
  * @brief Computes the overlap between the parts array of two given cells.
diff --git a/src/tools.c b/src/tools.c
index 7b468426b894044dc8e215f5150d9536fa2d4cdd..0363100331ad5b298279e9ebadcf87eab5f9e896 100644
--- a/src/tools.c
+++ b/src/tools.c
@@ -20,15 +20,15 @@
  ******************************************************************************/
 
 #include <math.h>
-#include <stdlib.h>
 #include <stddef.h>
 #include <stdio.h>
+#include <stdlib.h>
 
+#include "cell.h"
 #include "error.h"
 #include "part.h"
-#include "cell.h"
-#include "tools.h"
 #include "swift.h"
+#include "tools.h"
 
 /**
  *  Factorize a given integer, attempts to keep larger pair of factors.
diff --git a/src/tools.h b/src/tools.h
index 8e0212652922fb4afd1ac89a64d4a01c71ecd4a9..5f9f41d033ab03983bde3bb37e87f8a39d2deecd 100644
--- a/src/tools.h
+++ b/src/tools.h
@@ -22,8 +22,8 @@
 #ifndef SWIFT_TOOL_H
 #define SWIFT_TOOL_H
 
-#include "runner.h"
 #include "cell.h"
+#include "runner.h"
 
 void factor(int value, int *f1, int *f2);
 void density_dump(int N);
diff --git a/tests/test27cells.c b/tests/test27cells.c
index 35e11fab04173e48f5250ff191470550bb25b1fa..3e2f11c7aabac0a7ff2df19f2c48f9f81ea55df5 100644
--- a/tests/test27cells.c
+++ b/tests/test27cells.c
@@ -18,9 +18,9 @@
  ******************************************************************************/
 
 #include <fenv.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <stdio.h>
 #include <unistd.h>
 #include "swift.h"
 
diff --git a/tests/testKernel.c b/tests/testKernel.c
index d74fe1ec538f3fc62a4626230198d006ef98a572..182bae5334e1a5061e584212a31186dc4e7f0818 100644
--- a/tests/testKernel.c
+++ b/tests/testKernel.c
@@ -19,8 +19,8 @@
  ******************************************************************************/
 
 #define NO__AVX__
-#include "vector.h"
 #include "kernel_hydro.h"
+#include "vector.h"
 
 #include <stdlib.h>
 #include <strings.h>
diff --git a/tests/testPair.c b/tests/testPair.c
index a70cb381fd9a6dec061a100eeba17bfd54b0e973..f9539fc1a444828c65b39e56618eb7bb98bd67de 100644
--- a/tests/testPair.c
+++ b/tests/testPair.c
@@ -18,9 +18,9 @@
  ******************************************************************************/
 
 #include <fenv.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <stdio.h>
 #include <unistd.h>
 #include "swift.h"
 
diff --git a/tests/testParser.c b/tests/testParser.c
index 0b08d20c9e2d48de1858877cf186eaa9d0ac84c0..31979a0a572415af04c11063bad9202a0c313426 100644
--- a/tests/testParser.c
+++ b/tests/testParser.c
@@ -17,11 +17,11 @@
  *
  ******************************************************************************/
 
-#include "parser.h"
 #include <assert.h>
-#include <string.h>
-#include <stdio.h>
 #include <math.h>
+#include <stdio.h>
+#include <string.h>
+#include "parser.h"
 
 int main(int argc, char *argv[]) {
   const char *input_file = argv[1];
diff --git a/tests/testReading.c b/tests/testReading.c
index 33aeb5095ba499bc0fd18ba15b513e351692432e..2fa88855a70a12265f180cd97528dda855322d1d 100644
--- a/tests/testReading.c
+++ b/tests/testReading.c
@@ -17,9 +17,12 @@
  *
  ******************************************************************************/
 
-#include "swift.h"
+/* Some standard headers. */
 #include <stdlib.h>
 
+/* Includes. */
+#include "swift.h"
+
 int main() {
 
   size_t Ngas = 0, Ngpart = 0;
diff --git a/tests/testSingle.c b/tests/testSingle.c
index eb49a570b93b14734c9e6af37d3d8a2b90d04078..d37f20908a28fb2e1098043dd7fbbcf76bd8c247 100644
--- a/tests/testSingle.c
+++ b/tests/testSingle.c
@@ -22,15 +22,15 @@
 #include "../config.h"
 
 /* Some standard headers. */
+#include <fenv.h>
+#include <float.h>
+#include <limits.h>
+#include <math.h>
+#include <pthread.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <unistd.h>
 #include <string.h>
-#include <pthread.h>
-#include <math.h>
-#include <float.h>
-#include <limits.h>
-#include <fenv.h>
+#include <unistd.h>
 
 /* Conditional headers. */
 #ifdef HAVE_LIBZ