diff --git a/src/cell.h b/src/cell.h
index 81c930339da0382d6079faebbe0d92c4a060cbe8..ee3a1b65b25491c2cb6eee9f7b2f226a0ca07367 100644
--- a/src/cell.h
+++ b/src/cell.h
@@ -20,6 +20,7 @@
 #define SWIFT_CELL_H
 
 /* Includes. */
+#include "lock.h"
 #include "part.h"
 #include "multipole.h"
 
diff --git a/src/engine.c b/src/engine.c
index 99735a83e7df3011439b0c90b45f7f66e5ceee73..ae93cfefe30f3cb17aecca793a3661563d98acd7 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -25,7 +25,6 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
-#include <pthread.h>
 #include <math.h>
 #include <float.h>
 #include <limits.h>
@@ -43,23 +42,16 @@
 #endif
 
 /* Local headers. */
+#include "engine.h"
 #include "const.h"
 #include "cycle.h"
 #include "atomic.h"
 #include "timers.h"
 #include "const.h"
 #include "vector.h"
-#include "lock.h"
-#include "task.h"
 #include "debug.h"
-#include "space.h"
-#include "multipole.h"
 #include "cell.h"
 #include "queue.h"
-#include "scheduler.h"
-#include "engine.h"
-#include "runner.h"
-#include "proxy.h"
 #include "error.h"
 
 #ifdef LEGACY_GADGET2_SPH
diff --git a/src/engine.h b/src/engine.h
index 1a16c146fbed781104105ab5d15ce40ec7dccdac..149bb434d910a06d8f7705719a8e90abb9d41a94 100644
--- a/src/engine.h
+++ b/src/engine.h
@@ -19,6 +19,17 @@
 #ifndef SWIFT_ENGINE_H
 #define SWIFT_ENGINE_H
 
+/* Some standard headers. */
+#include <pthread.h>
+
+/* Includes. */
+#include "proxy.h"
+#include "space.h"
+#include "task.h"
+#include "lock.h"
+#include "scheduler.h"
+#include "runner.h"
+
 /* Some constants. */
 #define engine_policy_none 0
 #define engine_policy_rand 1
diff --git a/src/kernel.h b/src/kernel.h
index b56155efce3543a1233f6a59377f688da26d52dc..4ffdbd081a3d9f6f89942b868898acee4e59b79d 100644
--- a/src/kernel.h
+++ b/src/kernel.h
@@ -20,14 +20,16 @@
 #ifndef SWIFT_KERNEL_H
 #define SWIFT_KERNEL_H
 
+/* Includes. */
+#include "vector.h"
+#include "const.h"
+
 /**
  * @file kernel.h
  * @brief SPH kernel functions. Compute W(x,h) and the gradient of W(x,h),
  *        as well as the blending function used for gravity.
  */
 
-#include "vector.h"
-
 /* Gravity kernel stuff
  * -----------------------------------------------------------------------------------------------
  */
diff --git a/src/multipole.h b/src/multipole.h
index 42b78bd6177b13049a3d6266672fe300b5be6a31..b99ece504d7fed5e274fdfbed4e36d9cf8d585eb 100644
--- a/src/multipole.h
+++ b/src/multipole.h
@@ -19,7 +19,12 @@
 #ifndef SWIFT_MULTIPOLE_H
 #define SWIFT_MULTIPOLE_H
 
+/* Some standard headers. */
+#include <math.h>
+
 /* Includes. */
+#include "inline.h"
+#include "kernel.h"
 #include "part.h"
 
 /* Some constants. */
@@ -47,9 +52,6 @@ void multipole_addparts(struct multipole *m, struct gpart *p, int N);
 void multipole_init(struct multipole *m, struct gpart *parts, int N);
 void multipole_reset(struct multipole *m);
 
-#include <math.h>
-#include "kernel.h"
-
 /**
  * @brief Compute the pairwise interaction between two multipoles.
  *
diff --git a/src/task.h b/src/task.h
index 6988fe8a46524e22ac1808fd4e51d863f41ddcbe..27193f6ec9fdef022031173447dca14035780ca6 100644
--- a/src/task.h
+++ b/src/task.h
@@ -20,6 +20,7 @@
 #define SWIFT_TASK_H
 
 /* Includes. */
+#include "cycle.h"
 #include "cell.h"
 
 /* Some constants. */