 
 ;; Functions that make use of Allens' Interval Algebra
 
+(defn- update-interval
+  "Update the interval with the timings of the second interval. The
+  purpose of updating is to preserve any extra data in the interval."
+  ([ival times]
+   (vec (concat (take 2 times) (drop 2 ival))))
+  ([ival x y]
+   (update-interval ival (interval x y))))
+
 (defn concur
   "Return the interval representing the interval, if there is one,
   representing the interval of time the given intervals are

    (->> ivals
         (map interval)
         (map (partial concur ival))
         (map (fn [k v] (when v [k (list (augment-interval v ival))])) ivals)
         (remove nil?)
         (into {}))))


  (->> (f ival)
       (map interval)
       (map (partial concur ival))
       (map #(update-interval ival %))
       (remove nil?)))

(defn group-segments-by
