                   (mapcat #(if (instance? SegmentContainer %)
                              (:segments %)
                              [%]))
-                  (map #(if (and (instance? Segment %)
-                                 (contains? qs (-> % :edge :dest)))
-                          (-> % :edge :dest)
+                  (map #(if (and (instance? Edge %)
+                                 (contains? qs (:dest %)))
+                          (:dest %)
                           %)))
         with-qs (loop [f flat
                        seg-c (take 1 segment-containers)

                      layer
                      (conj layer seg-c))
                    (let [item (first f)]
                      (if (instance? Segment item)
                        (recur (rest f) (update-in seg-c [:segments] conj item) layer)
                        (if (empty? (:segments seg-c))
                          (recur (rest f) seg-c (conj layer item))

(defrecord Edge [src dest characters])
(defrecord Layer [id duration nodes])
(defrecord SegmentContainer [segments])
(defrecord AccumulatorNode [weight node-edges is-seg-c])


