          (.reset iterator)))
 
 (defn trieterator [iterator]
-  (let [trieterator (Trieterator. iterator (greatest-key (.-key-len iterator)) (greatest-key (.-key-len iterator)) 0 false (.-key-len iterator))]
+  (let [trieterator (Trieterator. iterator (least-key (.-key-len iterator)) (greatest-key (.-key-len iterator)) 0 false (.-key-len iterator))]
     (.maintain trieterator)
     trieterator))
 

      (assert (> moving-key-ix 0))
      (when (false? end?)
        (.seek iterator pinned-key))
      (aset seek-key moving-key-ix greatest)
      (set! moving-key-ix (- moving-key-ix 1))
      (when (>= moving-key-ix 0)
        (aset pinned-key moving-key-ix greatest))

  (search [this current]
          (when (false? end?)
            (loop [current current]
              (prn :current current (.key this))
              (let [max-key (.key (aget iterators (mod (- current 1) (alength iterators))))
                    min-key (.key (aget iterators current))]
                (when-not (== min-key max-key)
