   (reset! browser (create-browser))
   (MMImageCache/addImageStorageListener (create-image-storage-listener))
   (.setModel (:table @browser) (create-browser-table-model tags))
-  (load-data-and-settings (load-last-collection))
+  (let [collection-name (get-last-collection-name)]
+    (apply-data-and-settings collection-name (load-data-and-settings collection-name)))
   (.show (@browser :frame))
   browser)
 

       (when-let [sort-key (->> table .getRowSorter .getSortKeys seq first)]
         {:order ({SortOrder/ASCENDING 1 SortOrder/DESCENDING -1}
                   (.getSortOrder sort-key))
          :model-column (.getColumnName model (.getColumn sort-key))})
     }))

(defn apply-data-and-settings [settings]
  (awt-event
    (let [table (@browser :table)
          model (.getModel table)

;; collection files


(defn set-last-collection-name [name]
  (write-value-to-prefs prefs "last-collection" name))

(defn get-last-collection-name []
  (or (read-value-from-prefs prefs "last-collection")
    (System/getProperty "user.name")))

