                         (do
                           (set! node (aget (.-children node) ix))
                           (set! ix 0)
-                          (recur))))))))))))
+                          (recur)))))))))))
+  (mark [this]
+        (apush marked-nodes node)
+        (apush marked-ixes ix))
+  (reset [this]
+         (assert (> (alength marked-nodes) 0))
+         (assert (> (alength marked-ixes) 0))
+         (set! node (.pop nodes))
+         (set! ix (.pop marked-ixes))))
 
 (defn iterator [tree]
   (loop [node (.-root tree)]
     (if (nil? (.-children node))
       (if (> (alength (.-keys node)) 0)
-        (Iterator. (.-max-keys tree) node 0 false)
-        (Iterator. (.-max-keys tree) node 0 true))
+        (Iterator. (.-max-keys tree) node 0 #js [] #js [] false)
+        (Iterator. (.-max-keys tree) node 0 #js [] #js [] true))
       (recur (aget (.-children node) 0)))))
 
 (deftype Trieterator [iterator seek-key ^:mutable pinned-key ^:mutable pinned-key-ix ^:mutable moving-key-ix ^:mutable end?]

      (.push results (.key iterator))
      (.next iterator))
    results))

;; TESTS


          (.maintain this)))
  (down [this]
        (assert (false? end?))
        (assert (< moving-key-ix (- (alength seek-key) 1)))
        (let [moving-key (.key this)]
          (aset seek-key moving-key-ix moving-key)
          (set! pinned-key moving-key)
