 (defn delete
   [{:keys [cfg] :as tree} key]
   (let [path (lookup-path tree key) ; don't care about the found key or its index
-        {:keys [children] :or {children (sorted-set)}} (peek path)
+        {:keys [children] :or {children (sorted-set-by compare)}} (peek path)
         updated-data-node (data-node cfg (disj children key))]
     (loop [node updated-data-node
            path (pop path)]

            [taoensso.nippy :as nippy]
            [clojure.pprint :as pp])
  (:import java.io.Writer
           java.util.Collections))

(defrecord Config [index-b data-b op-buf-size])

                 (catvec op-buf (:op-buf other))
                 cfg))
  (lookup [root key]
    ;;This is written like so because it's performance critical
    (let [l (dec (count children))
          a (object-array l)
          _ (dotimes [i l]
              (aset a i (last-key (nth children i))))
          x (Arrays/binarySearch a 0 l key compare)]
      (if (neg? x)
        (- (inc x))
        x))))
