diff --git a/examples/main.c b/examples/main.c
index cebfe7f98241e3a67b82e28e22f861d58289ee96..d6a8947ece7191d814f52ab8960d2e44dd27cd21 100644
--- a/examples/main.c
+++ b/examples/main.c
@@ -192,8 +192,8 @@ int main(int argc, char *argv[]) {
         with_outputs = 0;
         break;
       case 'P':
-        /* Partition type is one of "g", "m", "w", or "v"; "g" can be
-         * followed by three numbers defining the grid. */
+/* Partition type is one of "g", "m", "w", or "v"; "g" can be
+ * followed by three numbers defining the grid. */
 #ifdef WITH_MPI
         switch (optarg[0]) {
           case 'g':
@@ -224,8 +224,8 @@ int main(int argc, char *argv[]) {
           error("Error parsing number of queues.");
         break;
       case 'R':
-        /* Repartition type "n", "b", "v", "e" or "x". 
-         * Note only none is available without METIS. */
+/* Repartition type "n", "b", "v", "e" or "x".
+ * Note only none is available without METIS. */
 #ifdef WITH_MPI
         switch (optarg[0]) {
           case 'n':
@@ -468,7 +468,7 @@ int main(int argc, char *argv[]) {
         "[ms]\n");
 
   /* Let loose a runner on the space. */
-  for (j = 0; e.ti_current < max_nr_timesteps; j++) {
+  for (j = 0; !engine_is_done(&e); j++) {
 
 /* Repartition the space amongst the nodes? */
 #ifdef WITH_MPI
diff --git a/src/engine.c b/src/engine.c
index c2f47df0a6ee0685011a126b157f5c93af1cbcc2..e1b7bd6ba550464175ffb18cc5d359217275f6f7 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -1624,6 +1624,13 @@ void engine_step(struct engine *e) {
   // printParticle(e->s->parts, e->s->xparts,515050, e->s->nr_parts);
 }
 
+/**
+ * @brief Returns 1 if the simulation has reached its end point, 0 otherwise
+ */
+int engine_is_done(struct engine *e) {
+  return !(e->ti_current < max_nr_timesteps);
+}
+
 /**
  * @brief Create and fill the proxies.
  *
@@ -1957,7 +1964,7 @@ void engine_init(struct engine *e, struct space *s, float dt, int nr_threads,
       float dt_max = timeEnd - timeBegin;
       while (dt_max > e->dt_max) dt_max /= 2.f;
 
-      message("Minimal timestep size (on time-line): %e", dt_max);
+      message("Maximal timestep size (on time-line): %e", dt_max);
     }
   }
 
diff --git a/src/engine.h b/src/engine.h
index 13c7ec40612713d3771543150763da6924144c1a..cd189f6ac64b0809eec7f9db8cba898a6377cf27 100644
--- a/src/engine.h
+++ b/src/engine.h
@@ -63,7 +63,6 @@ extern const char *engine_policy_names[];
 #define engine_maxproxies 64
 #define engine_tasksreweight 10
 
-
 /* The rank of the engine as a global variable (for messages). */
 extern int engine_rank;
 
@@ -186,5 +185,6 @@ void engine_makeproxies(struct engine *e);
 void engine_redistribute(struct engine *e);
 struct link *engine_addlink(struct engine *e, struct link *l, struct task *t);
 void engine_print_policy(struct engine *e);
+int engine_is_done(struct engine *e);
 
 #endif /* SWIFT_ENGINE_H */