   (seek [this key]
         (.seek iterator key)))
 
+(defn magic-iterator
+  ([tree] (let [itr (iterator tree)]
+            (MagicIteratorWrapper. itr (.key itr) (.-root tree))))
+  ([tree map]
+   (let [itr (MagicIterator. (iterator tree) map (alength map) (array) (array) (.-root tree))]
+     (.set-key itr)
+     itr)))
+
 (defn ->keys [iterators keys len]
   (dotimes [x len]
     (aset keys x (.key (aget iterators x)))))

                (dotimes [x tuple-len]
                  (.push arr false))
                arr)]
    (loop [key start]
      (when key
        (println "key: " key)
        (when (seek-all iterators len key)
          (->keys iterators keys len)
          (println keys)
          (find-least keys len tuple-len min-fill)
          (println "Min: " min-fill)
          (recur (find-greatest iterators keys len results min-fill)))))
    results
    ))


  fill)

(defn find-greatest [iterators keys len results min-fill]
  (loop [ix 0
         greatest (aget keys 0)
         found? true]
    (if (>= ix len)
      (if found?
        (let [root (aget iterators 0)]
          (.push results (fill! (.slice greatest 0) min-fill))
          (.next root)
          (.key root))
        (fill! (.slice greatest 0) min-fill))
      (let [comped (filled-key-compare greatest (aget keys ix) min-fill)
            comped-v (or comped greatest)]
        (println "greatest: " comped-v comped (and found? (not comped)))
        (recur (inc ix) comped-v (and found? (not comped)))))))



(defn seek-all [iterators len key]
  (loop [ix 0]
    (if (< ix len)
      (let [cur (aget iterators ix)
            cur-key (.key cur)]
        (when (key-lt (fill! (.slice cur-key 0) key) key)
          (.seek cur key))
        (when-not (.-iterator.end? cur)
          (recur (inc ix))))
      true)))

