 
   (pause incrementer)
   (unpause incrementer)
-  (:kn @incrementer)
+  (-> @incrementer :kn :old)
 
   (def fetcher (run-env {:kn #{{:name "content" :value "Click button to fetch google"}}
-                         :tick-rules [(rule {:name :ui/text :id "content-ui-0" :text text}
-                                             (- {:name :ui/text :id "content-ui-0" :text text}))
-                                       (rule {:name :http-get :url "https://google.com" :id "google"}
-                                             (- {:name :http-get :url "https://google.com" :id "google"}))
-                                       (rule {:name :ui/onClick :id "fetch-button"}
-                                             (+ {:name :http-get :url "https://google.com" :id "google"}))
-                                       (rule {:name :http-response :id "google" :data data}
-                                             {:name "content" :value v}
-                                             (- {:name "content" :value v})
-                                             (+ {:name "content" :value data}))
-                                       ]
+                         :cleanup-rules (concat ui-cleanup-rules timer-cleanup-rules io-cleanup-rules
+                                                [])
+                         :tick-rules [(rule {:name :ui/onClick :id "fetch-button"}
+                                            (+ {:name :http-get :url "https://google.com" :id "google"}))
+                                      (rule {:name :http-response :id "google" :data data}
+                                            (> {:name "content"} {:value data}))
+                                      ]
                          :rules [[(rule {:name "content" :value v}
                                         (+s (hiccup
                                              [:p {:id "content-ui"} v]

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

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

                             (- {:name :ui/event-listener :id id :entity entity :event event}))
                       ])

  (def timer-cleanup-rules [(rule {:name :wait :time t :id i}
                                  (- {:name :wait :time t :id i}))])

  (def io-cleanup-rules [(rule ^get {:name :http-get}
                               (- get))])


  (def tick (run-env {:kn #{[3 5] [9 8 7] [:tick]}
                      :cleanup-rules (concat ui-cleanup-rules timer-cleanup-rules
                                             [])
                      :tick-rules [(rule [:tick]
                                         (- [:tick])
                                         (+ {:name :wait :time 1000 :id 1}))]
                      :rules [(rule {:name :tick :id 1 :timestamp ts}
                                    (+ [:tick])
                                    (+ ["hi!" ts]))]}))

  (pause tick)
  (unpause tick)
  @tick

  (def clock (run-env {:kn #{{:name :tick :id "clock"}}
                       :cleanup-rules (concat ui-cleanup-rules timer-cleanup-rules
                                              [])
                       :tick-rules [(rule {:name :tick :id "clock"}
                                          (+ {:name :wait :time 1000 :id "clock"}))]
                       :rules [[(rule {:name :tick :id "clock" :timestamp ts}
                                      (+s (hiccup [:p {:id "time"} (str "time is: " (js/Date. ts))])))]]
                       }))

  (pause clock)
  (unpause clock)
  (-> @clock :kn :old)

  (def incrementer (run-env {:kn #{{:name "counter" :value 0}}
                             :cleanup-rules (concat ui-cleanup-rules timer-cleanup-rules
                                                    [])
                             :tick-rules [(rule {:name :ui/onClick :id "incr-button"}
                                                {:name "counter" :value v}
                                                (= z (inc v))
                                                (> {:name "counter"} {:value z}))]
                             :rules [[(rule {:name "counter" :value v}
                                            (+s (hiccup
                                                 [:p {:id "counter-ui"} v]
