diff --git a/src/map.c b/src/map.c
index fbe57fde7b1e29c49b0f27d86d177245dd9a27e2..cb911c36f30cfb19d82868f0333b3ff705bab8e9 100644
--- a/src/map.c
+++ b/src/map.c
@@ -18,9 +18,18 @@
  *
  ******************************************************************************/
 
-#include "map.h"
+/* Config parameters. */
+#include "../config.h"
+
+/* Some standard headers. */
 #include <stdio.h>
 #include <stdlib.h>
+
+/* This object's header. */
+#include "map.h"
+
+/* Local headers. */
+#include "atomic.h"
 #include "error.h"
 
 /**
@@ -97,7 +106,7 @@ void map_cells_plot(struct cell *c, void *data) {
 void map_cellcheck(struct cell *c, void *data) {
 
   int *count = (int *)data;
-  __sync_fetch_and_add(count, c->count);
+  atomic_add(count, c->count);
 
   /* Loop over all parts and check if they are in the cell. */
   for (int k = 0; k < c->count; k++) {
diff --git a/src/queue.c b/src/queue.c
index a62ded2561fc683bf2f44abcf1110b0fb7eebd0c..57aa5701d9cc7bbf34d7f1ea54066da093fc99d1 100644
--- a/src/queue.c
+++ b/src/queue.c
@@ -38,13 +38,6 @@
 #include "const.h"
 #include "error.h"
 
-/* Counter macros. */
-#ifdef COUNTER
-#define COUNT(c) (__sync_add_and_fetch(&queue_counter[c], 1))
-#else
-#define COUNT(c)
-#endif
-
 /* The counters. */
 int queue_counter[queue_counter_count];