diff --git a/src/cell.c b/src/cell.c
index 25624a2004118e0c71d24195b9f802453f8e3143..573272d05839d6d082dac61c97f6abd18d8eb41a 100644
--- a/src/cell.c
+++ b/src/cell.c
@@ -757,16 +757,9 @@ void cell_convert_hydro(struct cell *c, void *data) {
  */
 void cell_clean_links(struct cell *c, void *data) {
   c->density = NULL;
-  c->nr_density = 0;
-
   c->gradient = NULL;
-  c->nr_gradient = 0;
-
   c->force = NULL;
-  c->nr_force = 0;
-
   c->grav = NULL;
-  c->nr_grav = 0;
 }
 
 /**
diff --git a/src/cell.h b/src/cell.h
index ae22de0cb268bb5240c480b2eed9435ec218adf8..9e5bed091178b59e1b757c420bc1d5fde0b9ce42 100644
--- a/src/cell.h
+++ b/src/cell.h
@@ -79,127 +79,191 @@ struct pcell {
 
 } SWIFT_STRUCT_ALIGN;
 
-/* Structure to store the data of a single cell. */
+/**
+ * @brief Cell within the tree structure.
+ *
+ * Contains particles, links to tasks, a multipole object and counters.
+ */
 struct cell {
 
-  /* The cell location on the grid. */
+  /*! This cell's multipole. */
+  struct multipole multipole;
+
+  /*! The cell location on the grid. */
   double loc[3];
 
-  /* The cell dimensions. */
+  /*! The cell dimensions. */
   double width[3];
 
-  /* Max smoothing length in this cell. */
+  /*! Max smoothing length in this cell. */
   double h_max;
 
-  /* Minimum and maximum end of time step in this cell. */
-  int ti_end_min, ti_end_max;
-
-  /* Last time the cell's content was drifted forward in time. */
-  int ti_old;
-
-  /* Minimum dimension, i.e. smallest edge of this cell. */
-  float dmin;
-
-  /* Maximum slack allowed for particle movement. */
-  float slack;
-
-  /* Maximum particle movement in this cell since last construction. */
-  float dx_max;
-
-  /* The depth of this cell in the tree. */
-  int depth, split, maxdepth;
-
-  /* Nr of parts. */
-  int count, gcount;
+  /*! Linking pointer for "memory management". */
+  struct cell *next;
 
-  /* Pointers to the particle data. */
+  /*! Pointer to the #part data. */
   struct part *parts;
 
-  /* Pointers to the extra particle data. */
+  /*! Pointer to the #xpart data. */
   struct xpart *xparts;
 
-  /* Pointers to the gravity particle data. */
+  /*! Pointer to the #gpart data. */
   struct gpart *gparts;
 
-  /* Pointers for the sorted indices. */
+  /*! Pointer for the sorted indices. */
   struct entry *sort;
-  unsigned int sorted;
 
-  /* Pointers to the next level of cells. */
+  /*! Pointers to the next level of cells. */
   struct cell *progeny[8];
 
-  /* Parent cell. */
+  /*! Parent cell. */
   struct cell *parent;
 
-  /* Super cell, i.e. the highest-level supercell that has pair/self tasks */
+  /*! Super cell, i.e. the highest-level parent cell that has pair/self tasks */
   struct cell *super;
 
-  /* The task computing this cell's sorts. */
+  /*! The task computing this cell's sorts. */
   struct task *sorts;
-  int sortsize;
 
-  /* The tasks computing this cell's density. */
-  struct link *density, *gradient, *force, *grav;
-  int nr_density, nr_gradient, nr_force, nr_grav;
+  /*! Linked list of the tasks computing this cell's hydro density. */
+  struct link *density;
 
-  /* The hierarchical tasks. */
-  struct task *extra_ghost, *ghost, *init, *kick;
+  /* Linked list of the tasks computing this cell's hydro gradients. */
+  struct link *gradient;
 
-#ifdef WITH_MPI
+  /*! Linked list of the tasks computing this cell's hydro forces. */
+  struct link *force;
 
-  /* Task receiving data. */
-  struct task *recv_xv, *recv_rho, *recv_gradient, *recv_ti;
+  /*! Linked list of the tasks computing this cell's gravity forces. */
+  struct link *grav;
 
-  /* Task send data. */
-  struct link *send_xv, *send_rho, *send_gradient, *send_ti;
+  /*! The initialistation task */
+  struct task *init;
 
-#endif
+  /*! The ghost task */
+  struct task *ghost;
+
+  /*! The extra ghost task for complex hydro schemes */
+  struct task *extra_ghost;
+
+  /*! The kick task */
+  struct task *kick;
+
+  /*! Task constructing the multipole from the particles */
+  struct task *grav_up;
 
-  /* Tasks for gravity tree. */
-  struct task *grav_up, *grav_down;
+  /*! Task propagating the multipole to the particles */
+  struct task *grav_down;
 
-  /* Task for cooling */
+  /*! Task for cooling */
   struct task *cooling;
 
-  /* Task for source terms */
+  /*! Task for source terms */
   struct task *sourceterms;
 
-  /* Number of tasks that are associated with this cell. */
-  int nr_tasks;
+#ifdef WITH_MPI
 
-  /* Is the data of this cell being used in a sub-cell? */
-  int hold, ghold;
+  /* Task receiving data (positions). */
+  struct task *recv_xv;
 
-  /* Spin lock for various uses. */
-  swift_lock_type lock, glock;
+  /* Task receiving data (density). */
+  struct task *recv_rho;
 
-  /* ID of the previous owner, e.g. runner. */
-  int owner;
+  /* Task receiving data (gradient). */
+  struct task *recv_gradient;
 
-  /* Number of particles updated in this cell. */
-  int updated, g_updated;
+  /* Task receiving data (time-step). */
+  struct task *recv_ti;
 
-  /* Linking pointer for "memory management". */
-  struct cell *next;
+  /* Linked list for sending data (positions). */
+  struct link *send_xv;
 
-  /* This cell's multipole. */
-  struct multipole multipole;
+  /* Linked list for sending data (density). */
+  struct link *send_rho;
 
-  /* ID of the node this cell lives on. */
-  int nodeID;
+  /* Linked list for sending data (gradient). */
+  struct link *send_gradient;
 
-#ifdef WITH_MPI
+  /* Linked list for sending data (time-step). */
+  struct link *send_ti;
 
-  /* Bit mask of the proxies this cell is registered with. */
+  /*! Bit mask of the proxies this cell is registered with. */
   unsigned long long int sendto;
 
-  /* Pointer to this cell's packed representation. */
+  /*! Pointer to this cell's packed representation. */
   struct pcell *pcell;
+
+  /*! Size of the packed representation */
   int pcell_size;
+
+  /*! MPI tag associated with this cell */
   int tag;
 
 #endif
 
+  /*! Minimum end of (integer) time step in this cell. */
+  int ti_end_min;
+
+  /*! Maximum end of (integer) time step in this cell. */
+  int ti_end_max;
+
+  /*! Last (integer) time the cell's content was drifted forward in time. */
+  int ti_old;
+
+  /*! Minimum dimension, i.e. smallest edge of this cell (min(width)). */
+  float dmin;
+
+  /*! Maximum particle movement in this cell since last construction. */
+  float dx_max;
+
+  /*! Nr of #part in this cell. */
+  int count;
+
+  /*! Nr of #gpart in this cell. */
+  int gcount;
+
+  /*! The size of the sort array */
+  int sortsize;
+
+  /*! Bit-mask indicating the sorted directions */
+  unsigned int sorted;
+
+  /*! Spin lock for various uses (#part case). */
+  swift_lock_type lock;
+
+  /*! Spin lock for various uses (#gpart case). */
+  swift_lock_type glock;
+
+  /*! ID of the previous owner, e.g. runner. */
+  int owner;
+
+  /*! Number of #part updated in this cell. */
+  int updated;
+
+  /*! Number of #gpart updated in this cell. */
+  int g_updated;
+
+  /*! ID of the node this cell lives on. */
+  int nodeID;
+
+  /*! Is the #part data of this cell being used in a sub-cell? */
+  int hold;
+
+  /*! Is the #gpart data of this cell being used in a sub-cell? */
+  int ghold;
+
+  /*! Number of tasks that are associated with this cell. */
+  short int nr_tasks;
+
+  /*! The depth of this cell in the tree. */
+  char depth;
+
+  /*! Is this cell split ? */
+  char split;
+
+  /*! The maximal depth of this cell and its progenies */
+  char maxdepth;
+
 } SWIFT_STRUCT_ALIGN;
 
 /* Convert cell location to ID. */
diff --git a/src/engine.c b/src/engine.c
index e77148ad944cc9c30dfd9e811790f1dff0f2aac9..84ad45d284af5fa33d6fd7d00361e608e3ad3749 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -1359,15 +1359,12 @@ void engine_count_and_link_tasks(struct engine *e) {
       atomic_inc(&ci->nr_tasks);
       if (t->subtype == task_subtype_density) {
         engine_addlink(e, &ci->density, t);
-        atomic_inc(&ci->nr_density);
       }
       if (t->subtype == task_subtype_grav) {
         engine_addlink(e, &ci->grav, t);
-        atomic_inc(&ci->nr_grav);
       }
       if (t->subtype == task_subtype_external_grav) {
         engine_addlink(e, &ci->grav, t);
-        atomic_inc(&ci->nr_grav);
       }
 
       /* Link pair tasks to cells. */
@@ -1376,15 +1373,11 @@ void engine_count_and_link_tasks(struct engine *e) {
       atomic_inc(&cj->nr_tasks);
       if (t->subtype == task_subtype_density) {
         engine_addlink(e, &ci->density, t);
-        atomic_inc(&ci->nr_density);
         engine_addlink(e, &cj->density, t);
-        atomic_inc(&cj->nr_density);
       }
       if (t->subtype == task_subtype_grav) {
         engine_addlink(e, &ci->grav, t);
-        atomic_inc(&ci->nr_grav);
         engine_addlink(e, &cj->grav, t);
-        atomic_inc(&cj->nr_grav);
       }
 
       /* Link sub-self tasks to cells. */
@@ -1392,15 +1385,12 @@ void engine_count_and_link_tasks(struct engine *e) {
       atomic_inc(&ci->nr_tasks);
       if (t->subtype == task_subtype_density) {
         engine_addlink(e, &ci->density, t);
-        atomic_inc(&ci->nr_density);
       }
       if (t->subtype == task_subtype_grav) {
         engine_addlink(e, &ci->grav, t);
-        atomic_inc(&ci->nr_grav);
       }
       if (t->subtype == task_subtype_external_grav) {
         engine_addlink(e, &ci->grav, t);
-        atomic_inc(&ci->nr_grav);
       }
 
       /* Link sub-pair tasks to cells. */
@@ -1409,22 +1399,16 @@ void engine_count_and_link_tasks(struct engine *e) {
       atomic_inc(&cj->nr_tasks);
       if (t->subtype == task_subtype_density) {
         engine_addlink(e, &ci->density, t);
-        atomic_inc(&ci->nr_density);
         engine_addlink(e, &cj->density, t);
-        atomic_inc(&cj->nr_density);
       }
       if (t->subtype == task_subtype_grav) {
         engine_addlink(e, &ci->grav, t);
-        atomic_inc(&ci->nr_grav);
         engine_addlink(e, &cj->grav, t);
-        atomic_inc(&cj->nr_grav);
       }
       if (t->subtype == task_subtype_external_grav) {
         error("Found a sub-pair/external-gravity task...");
         engine_addlink(e, &ci->grav, t);
-        atomic_inc(&ci->nr_grav);
         engine_addlink(e, &cj->grav, t);
-        atomic_inc(&cj->nr_grav);
       }
     }
   }
@@ -1650,9 +1634,7 @@ void engine_make_extra_hydroloop_tasks(struct engine *e) {
 
       /* Add the link between the new loops and the cell */
       engine_addlink(e, &t->ci->gradient, t2);
-      atomic_inc(&t->ci->nr_gradient);
       engine_addlink(e, &t->ci->force, t3);
-      atomic_inc(&t->ci->nr_force);
 
       /* Now, build all the dependencies for the hydro */
       engine_make_hydro_loops_dependencies(sched, t, t2, t3, t->ci);
@@ -1665,7 +1647,6 @@ void engine_make_extra_hydroloop_tasks(struct engine *e) {
 
       /* Add the link between the new loop and the cell */
       engine_addlink(e, &t->ci->force, t2);
-      atomic_inc(&t->ci->nr_force);
 
       /* Now, build all the dependencies for the hydro */
       engine_make_hydro_loops_dependencies(sched, t, t2, t->ci);
@@ -1684,13 +1665,9 @@ void engine_make_extra_hydroloop_tasks(struct engine *e) {
 
       /* Add the link between the new loop and both cells */
       engine_addlink(e, &t->ci->gradient, t2);
-      atomic_inc(&t->ci->nr_gradient);
       engine_addlink(e, &t->cj->gradient, t2);
-      atomic_inc(&t->cj->nr_gradient);
       engine_addlink(e, &t->ci->force, t3);
-      atomic_inc(&t->ci->nr_force);
       engine_addlink(e, &t->cj->force, t3);
-      atomic_inc(&t->cj->nr_force);
 
       /* Now, build all the dependencies for the hydro for the cells */
       /* that are local and are not descendant of the same super-cells */
@@ -1709,9 +1686,7 @@ void engine_make_extra_hydroloop_tasks(struct engine *e) {
 
       /* Add the link between the new loop and both cells */
       engine_addlink(e, &t->ci->force, t2);
-      atomic_inc(&t->ci->nr_force);
       engine_addlink(e, &t->cj->force, t2);
-      atomic_inc(&t->cj->nr_force);
 
       /* Now, build all the dependencies for the hydro for the cells */
       /* that are local and are not descendant of the same super-cells */
@@ -1742,9 +1717,7 @@ void engine_make_extra_hydroloop_tasks(struct engine *e) {
 
       /* Add the link between the new loop and the cell */
       engine_addlink(e, &t->ci->gradient, t2);
-      atomic_inc(&t->ci->nr_gradient);
       engine_addlink(e, &t->ci->force, t3);
-      atomic_inc(&t->ci->nr_force);
 
       /* Now, build all the dependencies for the hydro for the cells */
       /* that are local and are not descendant of the same super-cells */
@@ -1760,7 +1733,6 @@ void engine_make_extra_hydroloop_tasks(struct engine *e) {
 
       /* Add the link between the new loop and the cell */
       engine_addlink(e, &t->ci->force, t2);
-      atomic_inc(&t->ci->nr_force);
 
       /* Now, build all the dependencies for the hydro for the cells */
       /* that are local and are not descendant of the same super-cells */
@@ -1786,13 +1758,9 @@ void engine_make_extra_hydroloop_tasks(struct engine *e) {
 
       /* Add the link between the new loop and both cells */
       engine_addlink(e, &t->ci->gradient, t2);
-      atomic_inc(&t->ci->nr_gradient);
       engine_addlink(e, &t->cj->gradient, t2);
-      atomic_inc(&t->cj->nr_gradient);
       engine_addlink(e, &t->ci->force, t3);
-      atomic_inc(&t->ci->nr_force);
       engine_addlink(e, &t->cj->force, t3);
-      atomic_inc(&t->cj->nr_force);
 
       /* Now, build all the dependencies for the hydro for the cells */
       /* that are local and are not descendant of the same super-cells */
@@ -1811,9 +1779,7 @@ void engine_make_extra_hydroloop_tasks(struct engine *e) {
 
       /* Add the link between the new loop and both cells */
       engine_addlink(e, &t->ci->force, t2);
-      atomic_inc(&t->ci->nr_force);
       engine_addlink(e, &t->cj->force, t2);
-      atomic_inc(&t->cj->nr_force);
 
       /* Now, build all the dependencies for the hydro for the cells */
       /* that are local and are not descendant of the same super-cells */
diff --git a/src/space.c b/src/space.c
index 86c8cc36eacd58c89181831b3c5472026281043c..e59b18795e85f77501d1245a328d8fed23bef270 100644
--- a/src/space.c
+++ b/src/space.c
@@ -392,10 +392,6 @@ void space_regrid(struct space *s, double cell_max, int verbose) {
       space_rebuild_recycle(s, &s->cells_top[k]);
       s->cells_top[k].sorts = NULL;
       s->cells_top[k].nr_tasks = 0;
-      s->cells_top[k].nr_density = 0;
-      s->cells_top[k].nr_gradient = 0;
-      s->cells_top[k].nr_force = 0;
-      s->cells_top[k].nr_grav = 0;
       s->cells_top[k].density = NULL;
       s->cells_top[k].gradient = NULL;
       s->cells_top[k].force = NULL;
@@ -1444,6 +1440,7 @@ void space_split_mapper(void *map_data, int num_cells, void *extra_data) {
 
     const int count = c->count;
     const int gcount = c->gcount;
+    const int depth = c->depth;
     int maxdepth = 0;
     float h_max = 0.0f;
     int ti_end_min = max_nr_timesteps, ti_end_max = 0;
@@ -1453,8 +1450,8 @@ void space_split_mapper(void *map_data, int num_cells, void *extra_data) {
     struct xpart *xparts = c->xparts;
 
     /* Check the depth. */
-    while (c->depth > (maxdepth = s->maxdepth)) {
-      atomic_cas(&s->maxdepth, maxdepth, c->depth);
+    while (depth > (maxdepth = s->maxdepth)) {
+      atomic_cas(&s->maxdepth, maxdepth, depth);
     }
 
     /* If the depth is too large, we have a problem and should stop. */