   (fn [db [_ id]]
     (let [cells (:cells (first (filter #(= (:id %) id) (:packs db))))
           old-packs (remove #(= (:id %) id) (:packs db))
-          split-packs (generate-packs 2 cells)
+          split-packs (generate-packs cells)
           new-packs (concat old-packs split-packs)]
       (conj db [:packs new-packs]))))
 

          outliers (refine-to-cells-outside-two-std unused-cells)
          cells (remove (set outliers) unused-cells)
          old-packs (:packs db)
          generated-packs (generate-packs 2 cells)
          new-packs (concat old-packs generated-packs)]
      (conj db {:unused-cells outliers :packs new-packs}))))


      (map #(groups data distance %)
           (iterate (iterate-means data distance median) guesses)))))

(defn k-group [cells]
  (let [centers [(apply min-key :capacity cells)(apply max-key :capacity cells)]]
    (last ((k-groups cells) centers))))

(defn refine-to-cells-outside-two-std [unused-cells]
