   (let [qs (:qs next-layer)
         flat (->> (:minus-qs next-layer)
                   (mapcat #(if (instance? SegmentContainer %)
-                             (:segments %)
+                             (:edges %)
                              [%]))
                   (map #(if (and (instance? Edge %)
                                  (contains? qs (:dest %)))

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



               %))
       (reduce #(if (and (instance? SegmentContainer (peek %1))
                         (instance? SegmentContainer %2))
                  (update-in %1 [(dec (count %1)) :edges] rrb/catvec (:edges %2))
                  (conj %1 %2))
               [])
       (assoc layer :minus-ps)))
