   (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]))))
 

(defn convert-cell-groups-to-packs [cell-groups]
  (map convert-cell-group-to-pack cell-groups))

(defn generate-packs [number-of-packs unused-cells]
  (if (> (count unused-cells) 0) 
    (let [cell-groups (k-group unused-cells number-of-packs)
          packs (convert-cell-groups-to-packs cell-groups)]
      packs)
    []))


(defn parse-capacities [capacities]
  (map js/parseInt (map clojure.string/trim (clojure.string/split capacities #","))))

      (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]
