           (dosync (ref-set live-mode-running true))
           (core startContinuousSequenceAcquisition 0)
           (.start (Thread.
-                    #(do
-                       (while @live-mode-running
-                         (let [img (annotate-image (core getLastImage) event state)]
-                           (reset-snap-window img)
-                             (show-image @snap-window img)))
-                       (core stopSequenceAcquisition)))))
+                    #(do (while @live-mode-running
+                           (let [img (annotate-image (core getLastImage) event state)]
+                              (reset-snap-window img)
+                              (show-image @snap-window img)))
+                         (core stopSequenceAcquisition)))))
         (dosync (ref-set live-mode-running false))))
 
 ;; java interop

           [org.json JSONObject JSONArray]
           [java.util Date UUID]
           [java.text SimpleDateFormat]
           [ij ImagePlus])
   (:gen-class
     :name org.micromanager.AcqEngine


(def live-mode-running (ref false))


(defn enable-live-mode [^Boolean on]
      (if on
        (let [event (create-basic-event)
