           (.next (aget iterators 0))
           (if (.-end? (aget iterators 0))
             (set! end? true)
-            (.search (+ current 1)))))
+            (.search this 1))))
   (seek [this key]
         (when (false? end?)
           (.seek (aget iterators 0) key)
           (if (.-end? (aget iterators 0))
             (set! end? true)
-            (.search (+ current 1))))))
+            (.search this 1)))))
 
 (defn intersection [iterators]
   (if (> (alength iterators) 1)

        sorted-map (apply-to-sorted-map (sorted-map-by compare-keys) actions)
        iterator-results (apply-to-iterator (iterator tree) movements)
        elems-results (apply-to-elems (seq sorted-map) movements)]
    (= iterator-results elems-results)))

(def iterator-prop

                  nil)))
            (do
              (set! node (aget (.-children node) (+ ix 1)))
              (set! ix 0)
              (loop []
                (when-not (nil? (.-children node))
                  (set! node (aget (.-children node) 0))
                  (recur)))))))
  (seek [this key]
        (.next this)
        (let [start-node node
              start-ix ix]
          (when (false? end?)
            (loop []
              (let [upper (.-upper node)]
                (if (lt upper key)
                  (if (instance? Node (.-parent node))
                    (do
                      (set! ix (.-parent-ix node))
                      (set! node (.-parent node))
                      (recur))
                    (set! end? true))
                  (loop []
                    (set! ix (.seek node key ix))
                    (if (>= ix (alength (.-keys node)))
                      (do
                        (set! node (aget (.-children node) ix))
                        (set! ix 0)
                        (recur))
                      (if (or (and (identical? node start-node) (== ix start-ix))
                              (== key (aget (.-keys node) ix))
                              (nil? (.-children node))
                              (let [lower (.-upper (aget (.-children node) ix))]
                                (lt lower key)))
                        nil
                        (do
                          (set! node (aget (.-children node) ix))
                          (set! ix 0)
                          (recur))))))))))))

(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))
      (recur (aget (.-children node) 0)))))

(deftype Intersection [iterators ^:mutable end?]
  Object
  (key [this]
       (when (false? end?)
