 (defn- step-nine! [current-cluster updated-state* pos-idx biggest-neighbor char-vec]
   (if (= "NO_CLASS" current-cluster)
     ;;step 10
-    (swap! updated-state* assoc-in [::grid-cells pos-idx]
-           (do
-             ;(log-it pos-idx ::move-grid-to-biggest-neighboring-cluster
-             ;        biggest-neighbor)
-             (assoc char-vec ::cluster biggest-neighbor)))
+    (update-char-vec-in-state! updated-state* pos-idx (assoc char-vec ::cluster biggest-neighbor))
     (swap! updated-state* assoc-in [::grid-cells]
            (merge (::grid-cells @updated-state*)
                   (if (> (cluster->size current-cluster @updated-state*)

                                                   (sort-by :cluster-size)
                                                   last)]
                     (when biggest
                       (swap! updated-state* assoc-in [::grid-cells pos-idx]
                              (do
                                ;(log-it pos-idx ::move-current-grid-to-biggest-neighboring-cluster-ensuring-it-is-an-outside-grid
                                ;        {:from (::cluster char-vec)
                                ;         :to   (:cluster biggest)})
                                (assoc char-vec ::cluster (:cluster biggest)))))))))))))
    @updated-state*))

(defn detect-and-remove-sporadic-grids [state t]

    (when (and (not (= "NO_CLASS" current-cluster))
               (> (cluster->size current-cluster @updated-state*)
                  (cluster->size biggest-neighbor @updated-state*)))
      (update-char-vec-in-state!
        updated-state*
        (first grid-w-biggest-neighbor)
        (assoc
          (second grid-w-biggest-neighbor)
          ::cluster
          current-cluster)))))

(defn adjust-clustering [state t]
  (log-it [state t] ::adjust-clustering [{:t t}])
