                         (if (empty? (:segments seg-c))
                           (recur (rest f) seg-c (conj layer item))
                           (recur (rest f) (first segment-containers) (conj layer seg-c item)))))))]
-    (assoc next-layer :with-qs with-qs)))
+    (assoc next-layer :plus-qs plus-qs)))
 
 
 (defn ensure-alternating

  and then a separate algorithm that counts the crossings that result from the
  orderings on those two layers (step 5)."
  [next-layer]
  (->> (:with-qs next-layer)
       (partition-by #(instance? SegmentContainer %))
       (mapcat (fn [items]
                 (if (instance? SegmentContainer (first items))

                                 (contains? qs (:dest %)))
                          (:dest %)
                          %)))
        plus-qs (loop [f flat
                       seg-c (first segment-containers)
                       layer []]
                  (if (empty? f)
