                          (-> current-position get-msp (z-in-msp z-drive) not)
                          (or (:autofocus event)
                              (:wait-time-ms event)))]
-    (filter identity
-            (flatten
-              (list
-                #(log event)
-                (for [[axis pos] (:axes (MultiStagePosition-to-map (get-msp current-position))) :when pos]
-                  #(apply set-stage-position axis pos))
-                (for [[d p v] (get-in event [:channel :properties])]
-                  #(set-property [d p v]))
-                #(when-lets [exposure (:exposure event)
-                             camera (core getCameraDevice)]
-                            (device-best-effort camera (core setExposure exposure)))
-                #(when check-z-ref
-                   (set-stage-position z-drive (@state :reference-z)))
-                #(when-let [wait-time-ms (:wait-time-ms event)]
-                   (acq-sleep wait-time-ms))
-                #(when (:autofocus event)
-                   (run-autofocus))
-                #(when check-z-ref
-                   (store-new-z-reference))
-                #(when z-drive
-                   (let [z (compute-z-position event)]
-                     (set-stage-position z-drive z)))
-                (event :runnables)
-                #(do (wait-for-pending-devices)
-                     (expose event)
-                     (collect event out-queue)
-                     (stop-trigger)))))))
+    (flatten
+      (list
+        #(log event)
+        (for [[axis pos] (:axes (MultiStagePosition-to-map (get-msp current-position))) :when pos]
+          #(apply set-stage-position axis pos))
+        (for [[d p v] (get-in event [:channel :properties])]
+          #(set-property [d p v]))
+        #(when-lets [exposure (:exposure event)
+                     camera (core getCameraDevice)]
+           (device-best-effort camera (core setExposure exposure)))
+        #(when check-z-ref
+           (set-stage-position z-drive (@state :reference-z)))
+        #(when-let [wait-time-ms (:wait-time-ms event)]
+           (acq-sleep wait-time-ms))
+        #(when (:autofocus event)
+           (run-autofocus))
+        #(when check-z-ref
+           (store-new-z-reference))
+        #(when z-drive
+           (let [z (compute-z-position event)]
+             (set-stage-position z-drive z)))
+        (event :runnables)
+        #(do (wait-for-pending-devices)
+             (expose event)
+             (collect event out-queue)
+             (stop-trigger))))))
 
 (defn execute [event-fns]
   (doseq [event-fn event-fns :while (not (:stop @state))]

         (@state :burst-init-time)))))

(defn elapsed-time [state]
  (if (state :start-time) (- (clock-ms) (state :start-time)) 0))

;; image metadata



(defn interruptible-sleep [time-ms]
  (let [sleepy (CountDownLatch. 1)]
    (state-assoc! :sleepy sleepy :next-wake-time (+ (jvm-time-ms) time-ms))
    (.await sleepy time-ms TimeUnit/MILLISECONDS)))

(defn acq-sleep [interval-ms]
