     (annotate-image image event @state time-stamp)))
 
 (defn produce-burst-images
-  "Pops images from circular buffer and sends them to output queue."
+  "Pops images from circular buffer, tags them, and sends them to output queue."
   [burst-events camera-channel-names timeout-ms out-queue]
   (let [total (* (count burst-events)
                  (count camera-channel-names))
         camera-index-tag (str (. mmc getCameraDevice) "-CameraChannelIndex")
         image-number-offset (if (first-trigger-missing?) -1 0)
         image-queue (pop-burst-images total timeout-ms)]
-    (doseq [_ (range total) :while (not (@state :stop))]
+    (doseq [i (range total) :while (not (@state :stop))]
+      ;(println i)
       (.put out-queue
             (-> (.take image-queue)
                 (tag-burst-image burst-events camera-channel-names camera-index-tag

   burst-events))

(defn burst-cleanup []
  (when (core isBufferOverflowed)
    (throw-exception "Circular buffer overflowed."))
  (core stopSequenceAcquisition)


;; globals

(def ^:dynamic state nil)

(def attached-runnables (atom (vec nil)))

