       (if (= ::dense (::label char-vec))
         (do
           (my-log state ::dense-grid-creating-cluster {:char-vec char-vec})
-          (reset! state* (assoc-in
-                           @state*
-                           [::grid-cells pos-idx ::cluster]
-                           (str (java.util.UUID/randomUUID)))))
+          (swap! state* assoc-in
+                 [::grid-cells pos-idx ::cluster]
+                 (str (java.util.UUID/randomUUID))))
         (do (my-log state ::not-dense-grid {:char-vec char-vec})
-            (reset! state* (assoc-in
-                             @state*
-                             [::grid-cells pos-idx ::cluster]
-                             "NO_CLASS")))))
+            (swap! state* assoc-in
+                   [::grid-cells pos-idx ::cluster]
+                   "NO_CLASS"))))
     @state*))
 
 (defn- initial-clustering-single-pass [the-state]

  (let [lambda (get-in state [::properties ::lambda])
        state* (atom state)]
    (doseq [[pos-idx char-vec] (::grid-cells @state*)]
      (reset! state* (assoc-in
                       @state*
                       [::grid-cells pos-idx]
                       (update-char-vec-label
                         {::char-vec   (update-char-vec-density char-vec t lambda false)
                          ::properties (::properties state)}))))
    @state*))

(defn dense-grids->unique-clusters [state]

        the-state* (atom state)]
    (if-not (get-in state [::properties ::N])
      (do
        (swap! the-state* assoc-in
               [::state ::properties ::N]
               (phase-space->cell-count
                 (get-in @the-state* [::state ::properties])))))
    (doseq [raw-datum raw-data]
      (reset! the-state*
              (one-dstream-iteration
