     (om/update! app :last-title title)))
 
 (defn delete-click [title app]
-  (p/remove-document title)
-  (om/update! app :titles (p/get-all-titles)))
+  (put! (:channel @app) [:remove title]))
 
 (defn left-menu [app owner]
   (reify


;; The main app

(defn save-document [app]
  (om/update! app :last-saved (js/Date.))
  (om/update! app :last-title (:title @app))
  (p/set-document (:title @app) (:input @app))
  (om/update! app :titles (p/get-all-titles)))

(defn listen [el type app]
  (events/listen el type


(defn handle-title-blur [event app]
  (let [new-title (.. event -target -value)]
    (put! (:channel @app) [:rename new-title])))

(defn title-field [app owner]
  (reify
