   (core setAutoShutter (@state :init-auto-shutter))
   (core setExposure (@state :init-exposure))
   (core setPosition (core getFocusDevice) (@state :init-z-position))
+  (when (@state :init-continuous-focus)
+    (core enableContinuousFocus true))
   (return-config))
   
 (defn run-acquisition [this settings out-queue] 

      :init-exposure (core getExposure)
      :init-z-position z
      :init-system-state (get-system-config-cached)
      :z-corrections (get-init-z-corrections (:positions settings) (core getFocusDevice))))
  (binding [state (.state this)]
    (def last-state state)
    (let [acq-seq (generate-acq-sequence settings)]
       (def acq-sequence acq-seq)
       (execute (mapcat #(make-event-fns % out-queue) acq-seq))
       (.put out-queue TaggedImageQueue/POISON)
       (cleanup)

      (set (@state :init-system-state)) 
      (set (get-system-config-cached))))))

(defn prepare []
  (when (@state :init-continuous-focus)
    (core enableContinuousFocus false)))

(defn cleanup []
  (log "cleanup")
  (do-when #(.update %) (:display @state))
