             pred (case @filt
                      :active (complement :done)
                      :done :done
-                     :all identity)
-            curedit @editing]
-        (dbg "rendering main")
+                     :all identity)]
+        (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-main [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)
        editing (atom nil)]
    (fn []
      (let [items (vals @todos)
            done (->> items (filter :done) count)

          [:label {:for "toggle-all"} "Mark all as complete"]
          [:ul#todo-list
           (for [{id :id :as todo} (filter pred items)]
             [todo-item {:key id :todo todo
                         :on-save (partial save todos id)
                         :on-toggle (partial toggle todos id)
                         :on-destroy (partial delete todos id)}])]]
