           wake-time (if (> now (+ target-time 10)) now target-time)]
       (state-assoc! :last-wake-time wake-time)
       (when-not (core isContinuousFocusEnabled)
+        (println "reference z set")
         (state-assoc! :reference-z-position 
                       (get-z-stage-position (core getFocusDevice)))))))
 

        (core loadPropertySequence d p (str-vector s))))
    (reset! active-property-sequences property-sequences)))
  
(defn load-slice-sequence [slice-sequence]
  (when slice-sequence
    (let [z (core getFocusDevice)
          delta-z (- (@state :reference-z-position)
                     (first slice-sequence))
          adjusted-slices (map #(+ delta-z %) slice-sequence)
          new-seq (not= [z adjusted-slices] @active-slice-sequence)]
      (log "adjusted-slices: " adjusted-slices ";" "reference-z-position" (@state :reference-z-position))
      (when new-seq
        (core loadStageSequence z (double-vector adjusted-slices)))
      (reset! active-slice-sequence [z adjusted-slices])

    (condp = (:task event)
      :snap (apply snap-image shutter-states)
      :burst (init-burst (count (:burst-data event))
                         (:trigger-sequence event)
                         (:relative-z event))
      nil)))

(defn collect [event out-queue]
