   (reify
     om/IInitState
     (init-state [_]
-      {:navigate (chan)
-       :event (chan)})
+      {:chans {:event-chan (chan (sliding-buffer 1))}
+       :navigate (chan)
+       :event (chan (sliding-buffer 1))})
 
     om/IWillMount
     (will-mount [_]
-
-      (defroute "/" []
-        (om/update! app :route
-                    [:view-item "ea72343d-89dc-4dfc-85af-25e1113b0948"]))
-
-      (defroute "/new" []
-        (om/update! app :route [:add-item]))
-
-      (defroute "/search" []
-        (om/update! app :route [:search-item]))
-
-      (defroute "/:id" {id :id}
-        (om/update! app :route [:view-item id])
-        (put! (om/get-state owner :event) {:op :get :data id}))
-
-      (.setEnabled history true)
-
-      ;; routing loop
-      (go (loop []
-            (let [id (<! (om/get-state owner :navigate))]
-              (cond
-               (= id :new)
-               (do
-                 (.setToken history "/new")
-                 (om/update! app :current-item
-                             {:item/title "New item"
-                              :item/text ""}))
-
-               (= id :search)
-               (.setToken history "/search")))
-            (recur)))
-
-      ;; event loop
-      (go (loop []
-            (let [event (om/get-state owner :event)
-                  {:keys [op data]} (<! event)]
+      (prn "MOUNTED.")
+      (let [event-chan (om/get-state owner [:chans :event-chan])]
+        (go
+          (while true
+            (let [{:keys [op data]} (<! event-chan)]
+              (prn "event-chan " op ": " data)
               (condp = op
+
+                :view-new
+                (do
+                  (.setToken history "/new")
+                  (om/update! app :current-item
+                              {:item/title "New item"
+                               :item/text ""}))
+
+                :view-search
+                (do
+                  (.setToken history "/search"))
 
                 :create
                 (let [data (<! (util/edn-chan
                                 {:method :post :url "/items"
                                  :data data}))]
-                  (.setToken history (str "/" (:item/id data))) ;; XXX
+                  (.setToken history (str "/" (:item/id data)))
                   (om/transact! app :current-item #(merge % data)))
 
                 :get

                :search
                (let [data (<! (util/edn-chan
                                {:url (str "/search/" (:subs data))}))]
                  ;; XXX: what if there's no hit?
                  ;;(.setToken history (str "/items")) ;; XXX
                  (om/transact! app :items (fn [_] data))
                  )
                
                (recur))))))
    
    om/IRenderState
    (render-state [_ {:keys [navigate event]}]
      (let [route (:route app)
            opts {:opts {:navigate navigate
                         :event event}}]
        ;; menu bar
        (dom/div nil
          (dom/p nil

               (apply dom/div nil
                      (prepare-item (:item/text item)))))))

(defn item-add-view [item owner]
  (reify
    om/IRenderState
    (render-state [_ state] ;; keys chan as etc?
      (let [event-chan (om/get-state owner [:event-chan])]
        (dom/div #js {:id "item-add-view"}
        (dom/div #js {:id "item-info"}
                 (dom/div #js {:className "item-name editable"}
