diff --git a/src/engine.c b/src/engine.c
index a626e611bce4dbc929cb80d90499413e3f2bd69c..4eb3126d86a70e7d242ea3de6ba783a7daa09411 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -3349,4 +3349,5 @@ void engine_clean(struct engine *e) {
   free(e->links);
   scheduler_clean(&e->sched);
   space_clean(e->s);
+  threadpool_clean(&e->threadpool);
 }
diff --git a/src/hydro/Gadget2/hydro_iact.h b/src/hydro/Gadget2/hydro_iact.h
index bec6b004a483e094e8ef299956a28ddfc7007a20..0108e0663c0d84ff6b5698456f6be34d5ee08c14 100644
--- a/src/hydro/Gadget2/hydro_iact.h
+++ b/src/hydro/Gadget2/hydro_iact.h
@@ -432,7 +432,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_force(
   const float balsara_j = pj->force.balsara;
 
   /* Are the particles moving towards each others ? */
-  const float omega_ij = (dvdr < 0.f) ? dvdr: 0.f;
+  const float omega_ij = (dvdr < 0.f) ? dvdr : 0.f;
   const float mu_ij = fac_mu * r_inv * omega_ij; /* This is 0 or negative */
 
   /* Signal velocity */
@@ -707,7 +707,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_force(
   const float balsara_j = pj->force.balsara;
 
   /* Are the particles moving towards each others ? */
-  const float omega_ij = (dvdr < 0.f) ? dvdr: 0.f;
+  const float omega_ij = (dvdr < 0.f) ? dvdr : 0.f;
   const float mu_ij = fac_mu * r_inv * omega_ij; /* This is 0 or negative */
 
   /* Signal velocity */
diff --git a/src/runner.c b/src/runner.c
index c9c2ef69f46dba5052a9aba917baef9ecaf519c3..018f1f082e8a3236b01684e8c39e84d365746f75 100644
--- a/src/runner.c
+++ b/src/runner.c
@@ -487,8 +487,8 @@ void runner_do_ghost(struct runner *r, struct cell *c) {
           h_corr = (target_wcount - p->density.wcount) / p->density.wcount_dh;
 
           /* Truncate to the range [ -p->h/2 , p->h ]. */
-	  h_corr = (h_corr < p->h) ? h_corr : p->h;
-	  h_corr = (h_corr > -0.5f * p->h) ? h_corr : -0.5f * p->h;
+          h_corr = (h_corr < p->h) ? h_corr : p->h;
+          h_corr = (h_corr > -0.5f * p->h) ? h_corr : -0.5f * p->h;
         }
 
         /* Did we get the right number density? */
@@ -622,7 +622,7 @@ static void runner_do_drift(struct cell *c, struct engine *e) {
       const float dx2 = gp->x_diff[0] * gp->x_diff[0] +
                         gp->x_diff[1] * gp->x_diff[1] +
                         gp->x_diff[2] * gp->x_diff[2];
-      dx2_max = (dx2_max  > dx2) ? dx2_max : dx2;
+      dx2_max = (dx2_max > dx2) ? dx2_max : dx2;
     }
 
     /* Loop over all the particles in the cell (more work for these !) */
@@ -640,7 +640,7 @@ static void runner_do_drift(struct cell *c, struct engine *e) {
       const float dx2 = xp->x_diff[0] * xp->x_diff[0] +
                         xp->x_diff[1] * xp->x_diff[1] +
                         xp->x_diff[2] * xp->x_diff[2];
-      dx2_max = (dx2_max  > dx2) ? dx2_max : dx2;
+      dx2_max = (dx2_max > dx2) ? dx2_max : dx2;
 
       /* Maximal smoothing length */
       h_max = (h_max > p->h) ? h_max : p->h;
diff --git a/src/serial_io.c b/src/serial_io.c
index 83f1f357468a80a820cfbd95a6afcc95198203bf..d0618ea93e07168274dff02f31ae95c89503859b 100644
--- a/src/serial_io.c
+++ b/src/serial_io.c
@@ -225,11 +225,11 @@ void prepareArray(struct engine* e, hid_t grp, char* fileName, FILE* xmfFile,
   }
 
   /* Impose data compression */
-  if(e->snapshotCompression > 0) {
+  if (e->snapshotCompression > 0) {
     h_err = H5Pset_deflate(h_prop, e->snapshotCompression);
     if (h_err < 0) {
       error("Error while setting compression options for field '%s'.",
-	    props.name);
+            props.name);
     }
   }
 
diff --git a/src/threadpool.c b/src/threadpool.c
index 795fa4d557e4576e7cd71fc7ef554cee880f3974..4ef75954b39603db0d442acc9be2bd95b39614d3 100644
--- a/src/threadpool.c
+++ b/src/threadpool.c
@@ -71,6 +71,12 @@ void *threadpool_runner(void *data) {
   }
 }
 
+/**
+ * @brief Initialises the #threadpool with a given number of threads.
+ *
+ * @param tp The #threadpool.
+ * @param num_threads The number of threads.
+ */
 void threadpool_init(struct threadpool *tp, int num_threads) {
 
   /* Initialize the thread counters. */
@@ -126,7 +132,6 @@ void threadpool_init(struct threadpool *tp, int num_threads) {
  * @param extra_data Addtitional pointer that will be passed to the mapping
  *        function, may contain additional data.
  */
-
 void threadpool_map(struct threadpool *tp, threadpool_map_function map_function,
                     void *map_data, size_t N, int stride, int chunk,
                     void *extra_data) {
@@ -154,3 +159,8 @@ void threadpool_map(struct threadpool *tp, threadpool_map_function map_function,
   }
   pthread_mutex_unlock(&tp->thread_mutex);
 }
+
+/**
+ * @brief Frees up the memory allocated for this #threadpool.
+ */
+void threadpool_clean(struct threadpool *tp) { free(tp->threads); }
diff --git a/src/threadpool.h b/src/threadpool.h
index e07a0613c0595bc3c280f97cd8f28e5705bf313a..76aa0c119610c4d540e117f046b286095a9c676d 100644
--- a/src/threadpool.h
+++ b/src/threadpool.h
@@ -57,5 +57,6 @@ void threadpool_init(struct threadpool *tp, int num_threads);
 void threadpool_map(struct threadpool *tp, threadpool_map_function map_function,
                     void *map_data, size_t N, int stride, int chunk,
                     void *extra_data);
+void threadpool_clean(struct threadpool *tp);
 
 #endif /* SWIFT_THREADPOOL_H */
diff --git a/src/timestep.h b/src/timestep.h
index 582f10a658e0be595a22e1066341de3803afb7fc..d92f88d06451892ce47db4b9468db9714bb52baa 100644
--- a/src/timestep.h
+++ b/src/timestep.h
@@ -74,7 +74,8 @@ __attribute__((always_inline)) INLINE static int get_gpart_timestep(
   /*     gravity_compute_timestep_self(e->physical_constants, gp); */
   const float new_dt_self = FLT_MAX;  // MATTHIEU
 
-  float new_dt = (new_dt_external < new_dt_self) ? new_dt_external : new_dt_self;
+  float new_dt =
+      (new_dt_external < new_dt_self) ? new_dt_external : new_dt_self;
 
   /* Limit timestep within the allowed range */
   new_dt = (new_dt < e->dt_max) ? new_dt : e->dt_max;
@@ -111,11 +112,12 @@ __attribute__((always_inline)) INLINE static int get_part_timestep(
     /*     gravity_compute_timestep_self(e->physical_constants, p->gpart); */
     const float new_dt_self = FLT_MAX;  // MATTHIEU
 
-    new_dt_grav = (new_dt_external < new_dt_self) ? new_dt_external : new_dt_self;
+    new_dt_grav =
+        (new_dt_external < new_dt_self) ? new_dt_external : new_dt_self;
   }
 
   /* Final time-step is minimum of hydro and gravity */
-  float new_dt = (new_dt_hydro < new_dt_grav) ? new_dt_hydro: new_dt_grav;
+  float new_dt = (new_dt_hydro < new_dt_grav) ? new_dt_hydro : new_dt_grav;
 
   /* Limit change in h */
   const float dt_h_change =