     (js/console.log tree)
     (seq tree))
 
-  (let [tree (Tree. max-keys (Node. nil nil #js [] #js [] #js[]))
+  (let [tree (tree 3)]
+    (dotimes [i 1000]
+      (.assoc! tree i (* 2 i)))
+    (= (map #(.apply vector nil %) (seq tree)) (for [i (range 1000)] [i (* 2 i)])))
+
+  (time
+   (let [tree (tree 1)]
+     (dotimes [i 100000]
+       (.assoc! tree i (* 2 i)))))
+
+  (time
+   (let [tree (tree 3)]
+     (dotimes [i 100000]
+       (.assoc! tree i (* 2 i)))))
+
+  (time
+   (let [tree (tree 10)]
+     (dotimes [i 100000]
+       (.assoc! tree i (* 2 i)))))
+
+  (time
+   (let [tree (tree 1000)]
+     (dotimes [i 100000]
+       (.assoc! tree i (* 2 i)))))
+
+  (let [tree (tree 3)
         iterator (iterator tree)]
-    (take-while identity (repeatedly #(.next iterator))))
-
-  (let [tree (Tree. max-keys (Node. nil nil #js [:a :b :c] #js [0 1 2] #js[]))
+    (take 2000 (take-while identity (repeatedly #(.next iterator)))))
+
+  (let [tree (tree 3)
+        _ (.assoc! tree :a 0)
         iterator (iterator tree)]
-    (take-while identity (repeatedly #(.next iterator))))
-
-  (let [branch (Node. nil nil #js [:a :d :e] #js [0 3 4] #js[])
-        _ (apush (.-children branch) (Node. branch 0 #js [:b :c] #js [1 2]))
-        tree (Tree. max-keys branch)
+    (take 2000 (take-while identity (repeatedly #(.next iterator)))))
+
+  (let [tree (tree 3)
+        _ (dotimes [i 1000]
+            (.assoc! tree i (* 2 i)))
         iterator (iterator tree)]
-    (take-while identity (repeatedly #(.next iterator))))
-
-  (let [branch (Node. nil nil #js [:a :d :f] #js [0 3 4] #js[])
-        _ (apush (.-children branch) (Node. branch 0 #js [:b :c] #js [1 2]))
-        tree (Tree. max-keys branch)
-        iterator (iterator tree)]
-    [(.seek iterator :0) (.seek iterator :c) (.seek iterator :a) (.seek iterator :e) (.seek iterator :e) (.seek iterator :p)])
-
+    (take 2000 (take-while identity (repeatedly #(.next iterator)))))
   )

          nil)))

(defn iterator [tree]
  (Iterator. (.-max-keys tree) (.-root tree) 0))

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

          (apush result #js [(aget keys ix) (aget vals ix)]))
        (when-not (nil? children)
          (.into (aget children (alength keys)) result)))
  ;; TODO worth doing binary search here when nodes are large
  (seek [this key ix]
        (let [len (alength keys)]
          (loop [ix ix]
