                       (<= (count s) (core getPropertySequenceMaxLength d p)))))))
     (apply = (map :exposure channels))))
  
-(defn select-triggerable-sequences [property-sequences]
+(defn select-triggerable-sequences
+  "Select only those sequences that can and must be triggered."
+  [property-sequences]
   (into (sorted-map)
     (filter #(let [[[d p] vs] %]
                (and (core isPropertySequenceable d p)
                     (not (apply = vs))))
             property-sequences)))
 
-(defn make-dimensions [settings]
+(defn make-dimensions
+  "Create a structure describing the order and extent of each dimension in
+   a multi-dimensional acquisition given the acquisition settings generated
+   from the Acquisition Dialog input."
+  [settings]
   (let [{:keys [slices channels frames positions
                 slices-first time-first]} settings
         a [[slices :slice :slice-index] [channels :channel :channel-index]]

        dim (if (= dim-index-kw :frame-index) i (get dim-vals i))))
    (map #(assoc % dim-index-kw 0) events)))

(defn create-loops [dimensions]
  (reduce #(apply (partial nest-loop %1) %2) [{}] dimensions))

(defn make-main-loops [settings]
  (create-loops (make-dimensions settings)))

(defn build-event [settings event]
  (assoc event
    :exposure (if (:channel event)
                (get-in event [:channel :exposure])
                (:default-exposure settings))
    :relative-z (:relative-slices settings)))

(defn process-skip-z-stack [events slices]
  (if (pos? (count slices))
    (let [middle-slice (get slices (unchecked-divide-int (count slices) 2))]
      (filter

        b (if time-first b (reverse b))]
    (concat a b)))
        
(defn nest-loop
  "Create a loop for a given dimension, as generated by make-dimensions."
  [events dim-vals dim dim-index-kw]
  (if (and dim-vals (pos? (count dim-vals)))
    (for [i (range (count dim-vals)) event events]
      (assoc event
