                                                {(:url x)
                                                 x}))
                                             {}
-                                            sampled-corpus))]
+                                            sampled-corpus))
+                         new-leaf-clusters (reduce
+                                            (fn [clusters-so-far x]
+                                              (let [to-assign (.indexOf
+                                                               (map
+                                                                (fn [a-cluster]
+                                                                  (some
+                                                                   (fn [c]
+                                                                     (similarity/similar?
+                                                                      (-> c new-corpus :body)
+                                                                      (:body x)))
+                                                                   a-cluster))
+                                                                clusters-so-far)
+                                                               true)]
+                                                (if (neg? to-assign)
+                                                  (into [] (cons [(:url x)] clusters-so-far))
+                                                  (assoc clusters-so-far
+                                                    to-assign
+                                                    (concat
+                                                     [(:url x)]
+                                                     (get clusters-so-far
+                                                          to-assign))))))
+                                            leaf-clusters
+                                            (filter
+                                             :leaf
+                                             sampled-corpus))]
                      (recur new-queue
 
                             ;; new visited list

                 
                  :corpus corpus
                 
                  :prefix (uri/host (uri/uri url))})
               
               :else
               (do (utils/sayln :continuing-crawl)

         (cond (or (empty? url-queue)
                   (stop? {:visited    (count visited)
                           :body       body
                           :corpus     corpus
                           :leaf-clusters leaf-clusters}))
               (do
                 (utils/sayln :crawl-done)
                 {:state  {:url-queue  url-queue
