                                      (+s (hiccup
                                           [:li {:id (str "todo" id) :entity id :event-key "todo" :events ["onDoubleClick"]}
                                            text]))
-                                     (+ {:name :ui/child :id "todo-list" :child (str "todo" id) :pos order}))
+                                     (= child-id (str "todo" id))
+                                     (+ {:name :ui/child :id "todo-list" :child child-id :pos order}))
                                (rule {:name "todo" :id id :text text :order order}
                                      {:name "todo-editing" :id id :editing? "true"}
                                      (+s (hiccup
                                           [:input {:id (str "todo-editor") :entity id :event-key "todo-editor" :defaultValue text :events ["onChange" "onKeyDown" "onBlur"]}]))
-                                     (+ {:name :ui/child :id "todo-list" :child (str "todo-editor") :pos order}))
+                                     (+ {:name :ui/child :id "todo-list" :child "todo-editor" :pos order}))
                                ]
                               [(rule {:name :todo/current-text :value v}
                                      (+s (hiccup

                                   (rule {:name :todo/new!}
                                         {:name "counter" :value v}
                                         {:name :todo/current-text :value text}
                                         (- {:name :todo/new!})
                                         (- {:name "counter" :value v})
                                         (- {:name :todo/current-text :value text})
                                         (+ {:name :todo/current-text :value ""})
                                         (+ {:name "counter" :value (inc v)})
                                         (+ {:name "todo" :id (inc v) :text text :order (inc v)})
                                         (+ {:name "todo-editing" :id (inc v) :editing? "false"})
                                         (+ {:name "todo-done" :id (inc v) :done? "false"})
                                         )

                                   ;;todo editing
                                   (rule {:name :ui/onDoubleClick :entity ent}
                                         {:name "todo-editing" :id ent :editing? "false"}
                                         (- {:name "todo-editing" :id ent :editing? "false"})
                                         (+ {:name "todo-editing" :id ent :editing? "true"})
                                         )

                                   (rule {:name :ui/onBlur :entity ent}
                                         {:name "todo-editing" :id ent :editing? "true"}
                                         (- {:name "todo-editing" :id ent :editing? "true"})
                                         (+ {:name "todo-editing" :id ent :editing? "false"})
                                         )


                                   (rule {:name :ui/onChange :id "todo-editor"}
                                         {:name :todo/edit-text :value v}
                                         (- {:name :todo/edit-text :value v}))
                                   (rule {:name :ui/onChange :id "todo-editor" :value v}
                                         (+ {:name :todo/edit-text :value v}))

                                   (rule {:name :ui/onKeyDown :id "todo-editor" :keyCode 13 :entity ent}
                                         {:name "todo" :id ent :text text :order order}
                                         {:name :todo/edit-text :value new-value}
                                         (- {:name "todo" :id ent :text text :order order})
                                         (+ {:name "todo" :id ent :text new-value :order order})
                                         (- {:name "todo-editing" :id ent :editing? "true"})
                                         (+ {:name "todo-editing" :id ent :editing? "false"}))


                                   (rule {:name :ui/onChange :event-key "todo-checkbox" :entity ent}
                                         {:name "todo-done" :id ent :done? done}
                                         (- {:name "todo-done" :id ent :done? done}))
                                   (rule {:name :ui/onChange :event-key "todo-checkbox" :entity ent :value v}
                                         (+ {:name "todo-done" :id ent :done? v}))




                                   ]
                      :rules [
                              [(rule {:name "todo" :id id :text text :order order}
                                     (+s (hiccup
                                           [:input {:id (str "todo-checkbox" id)
                                                    :event-key "todo-checkbox"
                                                    :entity id
                                                    :events ["onChange"]
                                                    :type "checkbox"}]))
                                     (+ {:name :ui/child :id (str "todo" id) :child (str "todo-checkbox" id) :pos -1}))
                               (rule {:name "todo" :id id :text text :order order}
                                     {:name "todo-done" :id id :done? "true"}
                                     (+ {:name :ui/attr :id id :attr "checked" :value "checked"})) ]

                      :cleanup-rules (concat ui-cleanup-rules
                                             [])
                      :tick-rules [;;on change
                                   (rule {:name :ui/onChange :id "todo-input" :value v}
                                         (> {:name :todo/current-text} {:value v}))

                                   ;;submit
                                   (rule {:name :ui/onClick :id "add-todo"}
