                   (when (seq nodes)
                     (apply println (map #(.pretty-print %) nodes))
                     (recur (mapcat #(.-children %) nodes)))))
+  (foreach [this f]
+           (.foreach root f))
   ISeqable
   (-seq [this]
-        (seq (iterator->elems (iterator this)))))
+        (let [results #js []]
+          (.foreach this #(apush results #js [%1 %2]))
+          (seq results))))
 
 (deftype Node [parent parent-ix keys vals children ^:mutable lower ^:mutable upper]
   Object

                (assert (every? #(key-lt (aget keys %) (.-lower (aget children (inc %)))) (range (count keys))))
                (dotimes [i (count children)] (.valid! (aget children i) max-keys))))))
  (pretty-print [this]
                (str "(" parent-ix ")" "|" (pr-str lower) " " (pr-str (vec keys)) " " (pr-str upper) "|")))

(defn tree [min-keys key-len]
  (let [node (Node. nil nil #js [] #js [] nil nil nil)

    tree))

;; ITERATORS
;; .key / .val return key and val currently pointed at. key may be aliased
;; On creation/reset, points to first key
;; On next, either point to next key or set .-end? true.
;; On seek, point to first key greater than or equal to seek-key, or otherwise the last key
;; NOTE iterators are not write-safe unless reset after writing

(deftype Iterator [tree ^:mutable node ^:mutable ix]
  Object
  (reset [this]
         (set! node (.-root tree))
         (while (not (nil? (.-children node)))
           (set! node (aget (.-children node) 0)))
         (set! ix 0)
         (set! end? (<= (alength (.-keys node)) 0)))
  (seek [this key]
        (let [start-node node
              start-ix ix]
