diff --git a/src/io_properties.h b/src/io_properties.h
index 2d4a65163f1ef2bcbaceadee73596d8c0345171a..af0d81aec8cf4901d2bfcce8cd023a2e04b804bf 100644
--- a/src/io_properties.h
+++ b/src/io_properties.h
@@ -27,7 +27,7 @@
  * @brief The two sorts of data present in the GADGET IC files: compulsory to
  * start a run or optional.
  */
-enum DATA_IMPORTANCE { COMPULSORY = 1, OPTIONAL = 0 };
+enum DATA_IMPORTANCE { COMPULSORY = 1, OPTIONAL = 0, UNUSED = -1 };
 
 /**
  * @brief The properties of a given dataset for i/o
@@ -134,7 +134,7 @@ struct io_props io_make_output_field_(char name[FIELD_BUFFER_SIZE],
   strcpy(r.name, name);
   r.type = type;
   r.dimension = dimension;
-  r.importance = 0;
+  r.importance = UNUSED;
   r.units = units;
   r.field = field;
   r.partSize = partSize;
@@ -178,7 +178,7 @@ struct io_props io_make_output_field_convert_part_(
   strcpy(r.name, name);
   r.type = type;
   r.dimension = dimension;
-  r.importance = 0;
+  r.importance = UNUSED;
   r.units = units;
   r.field = field;
   r.partSize = partSize;
@@ -222,7 +222,7 @@ struct io_props io_make_output_field_convert_gpart_(
   strcpy(r.name, name);
   r.type = type;
   r.dimension = dimension;
-  r.importance = 0;
+  r.importance = UNUSED;
   r.units = units;
   r.field = field;
   r.partSize = partSize;
diff --git a/src/parallel_io.c b/src/parallel_io.c
index 2f70b470d959e2fd23a92fcd6f5e357220b2c54d..262ab7d9e4405b54538e5b687c0aadfccf1da2f0 100644
--- a/src/parallel_io.c
+++ b/src/parallel_io.c
@@ -767,7 +767,8 @@ void write_output_parallel(struct engine* e, const char* baseName,
     /* Add the global information for that particle type to
      * the XMF meta-file */
     if (mpi_rank == 0)
-      writeXMFgroupheader(xmfFile, fileName, N_total[ptype], ptype);
+      writeXMFgroupheader(xmfFile, fileName, N_total[ptype],
+                          (enum PARTICLE_TYPE)ptype);
 
     /* Open the particle group in the file */
     char partTypeGroupName[PARTICLE_GROUP_BUFFER_SIZE];
@@ -828,7 +829,7 @@ void write_output_parallel(struct engine* e, const char* baseName,
     H5Gclose(h_grp);
 
     /* Close this particle group in the XMF file as well */
-    if (mpi_rank == 0) writeXMFgroupfooter(xmfFile, ptype);
+    if (mpi_rank == 0) writeXMFgroupfooter(xmfFile, (enum PARTICLE_TYPE)ptype);
   }
 
   /* Write LXMF file descriptor */
diff --git a/src/scheduler.c b/src/scheduler.c
index d760545ea74ddb288887a800c692136682f70d12..a14fe5bed0a1ae78e116d29739428ffcb6f09d06 100644
--- a/src/scheduler.c
+++ b/src/scheduler.c
@@ -498,8 +498,8 @@ void scheduler_splittasks(struct scheduler *s) {
         /* Create the sort for ci. */
         // lock_lock( &ci->lock );
         if (ci->sorts == NULL)
-          ci->sorts =
-              scheduler_addtask(s, task_type_sort, 0, 1 << sid, 0, ci, NULL, 0);
+          ci->sorts = scheduler_addtask(s, task_type_sort, task_subtype_none,
+                                        1 << sid, 0, ci, NULL, 0);
         else
           ci->sorts->flags |= (1 << sid);
         // lock_unlock_blind( &ci->lock );
@@ -508,8 +508,8 @@ void scheduler_splittasks(struct scheduler *s) {
         /* Create the sort for cj. */
         // lock_lock( &cj->lock );
         if (cj->sorts == NULL)
-          cj->sorts =
-              scheduler_addtask(s, task_type_sort, 0, 1 << sid, 0, cj, NULL, 0);
+          cj->sorts = scheduler_addtask(s, task_type_sort, task_subtype_none,
+                                        1 << sid, 0, cj, NULL, 0);
         else
           cj->sorts->flags |= (1 << sid);
         // lock_unlock_blind( &cj->lock );
@@ -534,9 +534,9 @@ void scheduler_splittasks(struct scheduler *s) {
  * @param tight
  */
 
-struct task *scheduler_addtask(struct scheduler *s, int type, int subtype,
-                               int flags, int wait, struct cell *ci,
-                               struct cell *cj, int tight) {
+struct task *scheduler_addtask(struct scheduler *s, enum task_types type,
+                               enum task_subtypes subtype, int flags, int wait,
+                               struct cell *ci, struct cell *cj, int tight) {
 
   /* Get the next free task. */
   const int ind = atomic_inc(&s->tasks_next);
diff --git a/src/scheduler.h b/src/scheduler.h
index 62af23152e7e2d2bc68e0cc4d7122f4dd0483aa1..7d5dd627f82eb6e6dafe1afc5ec1dc9ce7ec2450 100644
--- a/src/scheduler.h
+++ b/src/scheduler.h
@@ -112,9 +112,9 @@ void scheduler_start(struct scheduler *s, unsigned int mask,
 void scheduler_reset(struct scheduler *s, int nr_tasks);
 void scheduler_ranktasks(struct scheduler *s);
 void scheduler_reweight(struct scheduler *s);
-struct task *scheduler_addtask(struct scheduler *s, int type, int subtype,
-                               int flags, int wait, struct cell *ci,
-                               struct cell *cj, int tight);
+struct task *scheduler_addtask(struct scheduler *s, enum task_types type,
+                               enum task_subtypes subtype, int flags, int wait,
+                               struct cell *ci, struct cell *cj, int tight);
 void scheduler_splittasks(struct scheduler *s);
 struct task *scheduler_done(struct scheduler *s, struct task *t);
 struct task *scheduler_unlock(struct scheduler *s, struct task *t);
diff --git a/src/serial_io.c b/src/serial_io.c
index 65f3e4798b71536d79264cfd3ccdc1102bb0084e..c981e5e31db1868e6cd2590c6bb36d51282f94c7 100644
--- a/src/serial_io.c
+++ b/src/serial_io.c
@@ -859,7 +859,8 @@ void write_output_serial(struct engine* e, const char* baseName,
         /* Add the global information for that particle type to the XMF
          * meta-file */
         if (mpi_rank == 0)
-          writeXMFgroupheader(xmfFile, fileName, N_total[ptype], ptype);
+          writeXMFgroupheader(xmfFile, fileName, N_total[ptype],
+                              (enum PARTICLE_TYPE)ptype);
 
         /* Open the particle group in the file */
         char partTypeGroupName[PARTICLE_GROUP_BUFFER_SIZE];
@@ -915,7 +916,8 @@ void write_output_serial(struct engine* e, const char* baseName,
         H5Gclose(h_grp);
 
         /* Close this particle group in the XMF file as well */
-        if (mpi_rank == 0) writeXMFgroupfooter(xmfFile, ptype);
+        if (mpi_rank == 0)
+          writeXMFgroupfooter(xmfFile, (enum PARTICLE_TYPE)ptype);
       }
 
       /* Close file */
diff --git a/src/single_io.c b/src/single_io.c
index 3cc83e852db8dd04f7e4b4de56a76efca49d28ed..93faab6717fb8c136559511ada2c928f185f9f42 100644
--- a/src/single_io.c
+++ b/src/single_io.c
@@ -669,7 +669,8 @@ void write_output_single(struct engine* e, const char* baseName,
     if (numParticles[ptype] == 0) continue;
 
     /* Add the global information for that particle type to the XMF meta-file */
-    writeXMFgroupheader(xmfFile, fileName, numParticles[ptype], ptype);
+    writeXMFgroupheader(xmfFile, fileName, numParticles[ptype],
+                        (enum PARTICLE_TYPE)ptype);
 
     /* Open the particle group in the file */
     char partTypeGroupName[PARTICLE_GROUP_BUFFER_SIZE];
@@ -724,7 +725,7 @@ void write_output_single(struct engine* e, const char* baseName,
     H5Gclose(h_grp);
 
     /* Close this particle group in the XMF file as well */
-    writeXMFgroupfooter(xmfFile, ptype);
+    writeXMFgroupfooter(xmfFile, (enum PARTICLE_TYPE)ptype);
   }
 
   /* Write LXMF file descriptor */
diff --git a/src/units.c b/src/units.c
index 8fa4abfc618dae669bbc7be566a6db085d7be047..5c262ae03639262dfa126b101402b8fbfe41259a 100644
--- a/src/units.c
+++ b/src/units.c
@@ -385,11 +385,11 @@ void units_cgs_conversion_string(char* buffer, const struct UnitSystem* us,
 double units_general_cgs_conversion_factor(const struct UnitSystem* us,
                                            const float baseUnitsExponants[5]) {
   double factor = 1.;
-  int i;
 
-  for (i = 0; i < 5; ++i)
+  for (int i = 0; i < 5; ++i)
     if (baseUnitsExponants[i] != 0)
-      factor *= pow(units_get_base_unit(us, i), baseUnitsExponants[i]);
+      factor *= pow(units_get_base_unit(us, (enum BaseUnits)i),
+                    baseUnitsExponants[i]);
   return factor;
 }
 
@@ -440,13 +440,12 @@ void units_general_cgs_conversion_string(char* buffer,
                                          const struct UnitSystem* us,
                                          const float baseUnitsExponants[5]) {
   char temp[14];
-  double a_exp = units_general_a_factor(us, baseUnitsExponants);
-  double h_exp = units_general_h_factor(us, baseUnitsExponants);
-  int i;
+  const double a_exp = units_general_a_factor(us, baseUnitsExponants);
+  const double h_exp = units_general_h_factor(us, baseUnitsExponants);
 
   /* Check whether we are unitless or not */
   char isAllNonZero = 1;
-  for (i = 0; i < 5; ++i)
+  for (int i = 0; i < 5; ++i)
     if (baseUnitsExponants[i] != 0.) isAllNonZero = 0;
 
   if (isAllNonZero) {
@@ -476,17 +475,20 @@ void units_general_cgs_conversion_string(char* buffer,
   strncat(buffer, temp, 12);
 
   /* Add conversion units */
-  for (i = 0; i < 5; ++i)
+  for (int i = 0; i < 5; ++i)
     if (baseUnitsExponants[i] != 0) {
       if (baseUnitsExponants[i] == 0.)
         sprintf(temp, " ");
       else if (baseUnitsExponants[i] == 1.)
-        sprintf(temp, "%s ", units_get_base_unit_internal_symbol(i));
+        sprintf(temp, "%s ",
+                units_get_base_unit_internal_symbol((enum BaseUnits)i));
       else if (remainder(baseUnitsExponants[i], 1.) == 0)
-        sprintf(temp, "%s^%d ", units_get_base_unit_internal_symbol(i),
+        sprintf(temp, "%s^%d ",
+                units_get_base_unit_internal_symbol((enum BaseUnits)i),
                 (int)baseUnitsExponants[i]);
       else
-        sprintf(temp, "%s^%7.4f ", units_get_base_unit_internal_symbol(i),
+        sprintf(temp, "%s^%7.4f ",
+                units_get_base_unit_internal_symbol((enum BaseUnits)i),
                 baseUnitsExponants[i]);
       strncat(buffer, temp, 12);
     }
@@ -494,17 +496,19 @@ void units_general_cgs_conversion_string(char* buffer,
   /* Add CGS units */
   strncat(buffer, " [ ", 3);
 
-  for (i = 0; i < 5; ++i) {
+  for (int i = 0; i < 5; ++i) {
     if (baseUnitsExponants[i] != 0) {
       if (baseUnitsExponants[i] == 0.)
         continue;
       else if (baseUnitsExponants[i] == 1.)
-        sprintf(temp, "%s ", units_get_base_unit_cgs_symbol(i));
+        sprintf(temp, "%s ", units_get_base_unit_cgs_symbol((enum BaseUnits)i));
       else if (remainder(baseUnitsExponants[i], 1.) == 0)
-        sprintf(temp, "%s^%d ", units_get_base_unit_cgs_symbol(i),
+        sprintf(temp, "%s^%d ",
+                units_get_base_unit_cgs_symbol((enum BaseUnits)i),
                 (int)baseUnitsExponants[i]);
       else
-        sprintf(temp, "%s^%7.4f ", units_get_base_unit_cgs_symbol(i),
+        sprintf(temp, "%s^%7.4f ",
+                units_get_base_unit_cgs_symbol((enum BaseUnits)i),
                 baseUnitsExponants[i]);
       strncat(buffer, temp, 12);
     }
diff --git a/tests/test27cells.c b/tests/test27cells.c
index 7c46743f1d38fd95074560a75db13f26a7e747e7..38d4fb62bcf5b8b5e601173229b6c3f0f6226969 100644
--- a/tests/test27cells.c
+++ b/tests/test27cells.c
@@ -253,7 +253,7 @@ int main(int argc, char *argv[]) {
   double perturbation = 0.;
   char outputFileNameExtension[200] = "";
   char outputFileName[200] = "";
-  int vel = velocity_zero;
+  enum velocity_types vel = velocity_zero;
 
   /* Initialize CPU frequency, this also starts time. */
   unsigned long long cpufreq = 0;