diff --git a/src/modules/butterflies/butterflies_dispersal.c b/src/modules/butterflies/butterflies_dispersal.c
index 2187cec7a23cf5104add6749c126093e8babe1c5..47b7c13a9cf1b87ef9da1a76744efd68dcfdbe61 100644
--- a/src/modules/butterflies/butterflies_dispersal.c
+++ b/src/modules/butterflies/butterflies_dispersal.c
@@ -60,7 +60,6 @@ static void inline single_random_walk(struct cats_thread_info *ts, struct cats_g
                 const unsigned long int direction = gsl_rng_uniform_int(ts->rng, N_DIRECTIONS);
 
 
-
                 const cats_dt_coord *offsets = DIRECTION_OFFSETS[direction];
                 const cats_dt_coord row_offset = offsets[0];
                 const cats_dt_coord col_offset = offsets[1];
@@ -72,14 +71,15 @@ static void inline single_random_walk(struct cats_thread_info *ts, struct cats_g
                 col += col_offset;
 
                 if (row >= rows || row < 0 || col >= cols || col < 0) {
-                        if (debug_rw) {fclose(f);}
+                        if (debug_rw) { fclose(f); }
                         return; // we escaped the simulation extent and got lost
                 }
 
                 // is the cell a valid dispersal target location?
                 if (!(data->info_layer[row][col] & BF_CELL_VALID_DISPERSAL_TARGET)) {
                         if (debug_rw) {
-                                fprintf(f, "%d,%d,%d,%d,%d,%d\n",row, col, steps + 1, module_conf->animal_dispersal_max_radius - steps  -1,0, eggs_left);
+                                fprintf(f, "%d,%d,%d,%d,%d,%d\n", row, col, steps + 1,
+                                        module_conf->animal_dispersal_max_radius - steps - 1, 0, eggs_left);
                         }
 
                         continue;
@@ -97,7 +97,8 @@ static void inline single_random_walk(struct cats_thread_info *ts, struct cats_g
                 data->eggs[row][col] += (float) eggs_to_deposit;
                 ts->temp2++;
                 if (debug_rw) {
-                        fprintf(f, "%d,%d,%d,%d,%d,%d\n",row, col, steps + 1, module_conf->animal_dispersal_max_radius - steps - 1, eggs_to_deposit, eggs_left);
+                        fprintf(f, "%d,%d,%d,%d,%d,%d,%d\n", rw_num, row, col, steps + 1,
+                                module_conf->animal_dispersal_max_radius - steps - 1, eggs_to_deposit, eggs_left);
                 }
 
 
@@ -210,12 +211,21 @@ butterflies_cell_dispersal(struct cats_grid *grid, struct cats_thread_info *ts,
 
         if (debug_rw) {
                 FILE *f = fopen(conf->run_name, "w");
-                fprintf(f, "row,col,step,steps left,eggs deposited,eggs left\n");
-                fprintf(f, "%d,%d,0,%d,%d,%d\n",row, col, module_conf->animal_dispersal_max_radius,(int) ceill(eggs_per_female * module_conf->egg_fraction_source), (int) ceill(eggs_to_disperse_per_female));
+                fprintf(f, "id,row,col,step,steps left,eggs deposited,eggs left\n");
+
                 fclose(f);
         }
 
-                for (int32_t rw_number = 0; rw_number < wandering_females; rw_number++) {
+        for (int32_t rw_number = 0; rw_number < wandering_females; rw_number++) {
+                if (debug_rw) {
+                        FILE *f = fopen(conf->run_name, "a");
+                        fprintf(f, "%d,%d,%d,%d,0,%d,%d\n", rw_number, row, col,
+                                module_conf->animal_dispersal_max_radius,
+                                (int) ceill(eggs_per_female * module_conf->egg_fraction_source),
+                                (int) ceill(eggs_to_disperse_per_female));
+                        fclose(f);
+                }
+
 
                 single_random_walk(ts, grid, row, col, eggs_to_disperse_per_female, egg_fraction_step, rw_number);
                 ts->temp1++;