         (events/listen timer goog.Timer/TICK do-timer))))
 
 (defn do-track-button-clicked []
-  (do (do-timer)
+  (do (let [listeners (:listeners @state)]
+        (reset! state (assoc initial-state :listeners listeners :search-tag (search-tag))))
+      (do-timer)
       (send-event :track-clicked)))
 
 (defn do-refresh-button-clicked []
   (send-event :refresh-clicked))
 
 (defn start-app []
-  (events/listen (dom/getElement "twitter-search-button")
-                 "click"
-                 do-track-button-clicked)
-  (events/listen (dom/getElement "refresh-button")
-                 "click"
-                 do-refresh-button-clicked))
+  (do (poll)
+      (events/listen (dom/getElement "twitter-search-button")
+                     "click"
+                     do-track-button-clicked)
+      (events/listen (dom/getElement "refresh-button")
+                     "click"
+                     do-refresh-button-clicked)))
 
-;; this should be rolled up into one and the polling should only start
-;; when the track button is clicked.
 (start-app)
-(poll)
 
 (comment
 

            [goog.events :as events]
            [goog.dom :as dom]))

(def state (atom {:max-id 1
                  :graph {}
                  :listeners {:new-tweets []
                              :graph-update []
                              :track-clicked []
                              :refresh-clicked []}
                  :tweet-count 0}))

(defn add-listener [old-state k f]
  (let [l (-> old-state :listeners k)]

  (swap! state add-listener event f))

(def twitter-uri (goog.Uri. "http://twitter.com/search.json"))

(defn search-tag
  "Get the current tag value from the page."
  []
  (.value (dom/getElement "twitter-search-tag")))

(defn retrieve [payload callback]
  (.send (goog.net.Jsonp. twitter-uri)
