 
 
 (defn replace-ps
-  "Step 1 of ESK - replace all p nodes with segments and merge segment containers"
+  "Step 1 of ESK - replace all p nodes with edges and merge segment containers"
   [graph layer]
   (->> (:ordered layer)
        (map #(if (contains? (:p graph) %)

      (assoc layer :positions positions)
      (let [item (first minus-ps)
            c-p (if (instance? SegmentContainer item)
                  (+ current-position (count (:segments item)))
                  (inc current-position))]
        (recur (rest minus-ps) c-p (assoc positions item (inc current-position)))))))


                           node-measure (get measures node-1)
                           seg-position (get pos seg-1)
                           node-first (<= node-measure seg-position)
                           seg-first (>= node-measure (+ seg-position (count (:edges seg-1))))]
                       (cond node-first (recur (rest nodes) segments pos (conj ord node-1))
                             seg-first (recur nodes (rest segments) pos (conj ord seg-1))
                             :else (let [k (.ceil js/Math (- node-measure seg-position))
                                         s-1 (update-in seg-1 [:edges] rrb/subvec 0 k)
                                         s-2 (update-in seg-1 [:edges] rrb/subvec k)]
                                     (recur
                                      (rest nodes)
                                      (cons s-2 segments)
