                  (if-not (empty? v) (on-save v))
                  (stop)))]
     (fn [props]
-      (let [p {:type "text" :value @val :on-blur save
-               :on-change #(reset! val (-> % .-target .-value))
-               :on-key-up #(case (.-which %)
-                             13 (save)
-                             27 (stop)
-                             nil)}]
-        [:input (cloact/merge-props props p)]))))
+      [:input (merge props
+                     {:type "text" :value @val :on-blur save
+                      :on-change #(reset! val (-> % .-target .-value))
+                      :on-key-up #(case (.-which %)
+                                    13 (save)
+                                    27 (stop)
+                                    nil)})])))
 
 (def todo-input (with-meta todo-input-render
                   {:component-did-mount #(.focus (:dom-node %))}))
 
-(defn todo-item [{:keys [todo editing is-editing
-                         on-toggle on-save on-destroy]}]
-  (dbg "rendering item")
-  (let [{:keys [id done title]} todo]
-    [:li {:class (str (if done "completed ") (if is-editing "editing"))}
+(defn todo-item [{:keys [todo on-toggle on-save on-destroy]} this]
+  (dbg "Rendering item")
+  (let [{:keys [id done title]} todo
+        {:keys [editing]} @this]
+    [:li {:class (str (if done "completed ")
+                      (if editing "editing"))}
      [:div.view
       [:input.toggle {:type "checkbox" :checked done :on-change on-toggle}]
-      [:label {:on-double-click #(reset! editing id)} title]
+      [:label {:on-double-click #(swap! this assoc :editing true)} title]
       [:button.destroy {:on-click on-destroy}]]
-     (when is-editing
+     (when editing
        [todo-input {:class "edit" :title title :on-save on-save
-                    :on-stop #(reset! editing nil)}])]))
+                    :on-stop #(swap! this assoc :editing false)}])]))
 
 (defn todo-stats [{:keys [filter clear]}]
   (let [props-for (fn [name]

            pred (case @filt
                     :active (complement :done)
                     :done :done
                     :all identity)
            curedit @editing]
        (dbg "rendering main")
        [:section#todoapp
         [:header#header
          [:h1 "todos"]

(defn complete-all [todos v] (swap! todos mod-map map #(assoc-in % [1 :done] v)))
(defn clear-done [todos] (swap! todos mod-map remove #(get-in % [1 :done])))

(defn todo-app [props]
  (let [todos (or (:todos props)
                  (let [t (atom (sorted-map))]
                    (dotimes [x 5]
                      (add-todo t (str "Some todo " x)))
                    t))
        filt (atom :all)]
    (fn []
      (let [items (vals @todos)
            done (->> items (filter :done) count)
