            [:a {:on-click #(cast! :touched-fetched)
                 :role "button"}
             "Fetch docs"]
-           (for [doc (take 100 (reverse (sort-by :last-updated-instant touched-docs)))
-                 :when (:last-updated-instant doc)]
-             [:a {:href (str "/document/" (:db/id doc))}
-              [:img {:src (str "/document/" (:db/id doc) ".svg")
-                     :style {:border "1px solid black"}
-                     :width 300
-                     :height 300}]])]])))))
+
+           (for [[time-bucket bucket-docs] (reverse (sort-by #(:last-updated-instant (first (last %)))
+                                                             (group-by #(date->bucket (:last-updated-instant %)) docs)))]
+             (list*
+              [:div.time-bucket (str "Updated " time-bucket)]
+
+              (for [doc bucket-docs]
+                [:a {:href (str "/document/" (:db/id doc))}
+                 [:img {:src (str "/document/" (:db/id doc) ".svg")
+                        :style {:border "1px solid black"
+                                :margin-bottom 20}
+                        :width 300
+                        :height 300}]])))]])))))

  (:require-macros [frontend.utils :refer [html]])
  (:import [goog.ui IdGenerator]))

(defn doc-viewer [app owner]
  (reify
    om/IRender

      (let [cast! (om/get-shared owner :cast!)
            touched-docs (get-in app [:cust :touched-docs])
            ;; Not showing created for now, since we haven't been storing that until recently
            created-docs (get-in app [:cust :created-docs])
            docs (take 100 (reverse (sort-by :last-updated-instant (filter :last-updated-instant touched-docs))))]
        (html
         [:div.menu-prompt {:class (str "menu-prompt-" "doc-viewer")}
          [:div.menu-header
