     (prop ($ "#earlier") "disabled" (= (inc new-index) (count @snapshot-list)))
     (prop ($ "#later") "disabled" (zero? new-index))))
 
-(add-watch snapshot-index :_ on-snapshot-index-change)
-
-(defn on-selected-time-change [_ _ _ new-time]
-  (let [hour (.getHours new-time)
-        meridian (if (> 11 hour) "PM" "AM")
-        hour (if (> 12 hour) (- hour 12) hour)]
-    (val ($ "#hour") (pad hour))
-    (val ($ "#minute") (pad (.getMinutes new-time)))
-    (val ($ "#meridian") meridian)
-    (.datepicker ($ "#datepicker") "update" new-time)))
-
 (add-watch timestamp :_ on-selected-time-change)
 
 ;;------------------------------------------------------------------------------
 ;; Events
 ;;------------------------------------------------------------------------------
 
-(defn on-popstate! [])
-
-(defn on-datetime-change! []
-  ); todo
-
-(defn on-keydown! [e]
+(defn on-popstate [e]
+  (if (.-state e)
+    (swap! selected-time #(.-time e))))
+
+(defn on-datetime-change []
+  (let [date (.datepicker ($ "#datepicker") "getDate")
+        new-time (doto date
+                    (.setMinutes (.getMinutes @selected-time))
+                    (.setHours (.getHours @selected-time)))]
+    (swap! selected-time #(new-time))))
+
+(defn on-keydown [e]
   (let [key (.-which e)]
     (cond
-      (= key 37) (click-earlier!)
-      (= key 39) (click-later!))))
-
-(defn click-toggle-meridian! []
+      (= key 37) (click-earlier)
+      (= key 39) (click-later))))
+
+(defn click-toggle-meridian []
   (let [hours (+ (get-hours) 12)
         hours (if (>= 24 ) (- 24 hours) hours)]
     (set-hours! hours)))
 
-(defn click-decrement-hour! []
+(defn click-decrement-hour []
   (set-hours! (dec (get-hours))))
 
-(defn click-increment-hour! []
+(defn click-increment-hour []
   (set-hours! (inc (get-hours))))
 
-(defn click-decrement-Minute! []
+(defn click-decrement-Minute []
   (set-minutes! (dec (get-minutes))))
 
-(defn click-increment-minute! []
+(defn click-increment-minute []
   (set-minutes! (inc (get-minutes)))))
 
-(defn click-later! []
+(defn click-later []
   (if (pos? @snapshot-index)
-    (do
-      (swap! snapshot-index dec)
-      (sync-time-with-snapshot!))))
-
-(defn click-earlier! []
-  (if (>= @snapshot-index (count @snapshot-list))
-    (do
-      (swap! snapshot-index inc)
-      (sync-time-with-snapshot!))))
+    (use-index-time! (dec @snapshot-index))))
+
+(defn click-earlier []
+  (if (>= @snapshot-index (count @snapshot-list)
+    (use-index-time! (inc @snapshot-index)))))
 
 (defn add-events []
-  (aset js/window "onpopstate" on-popstate!)
-  (on ($ "datepicker") "changeDate" on-datetime-change!)
-  (on ($ js/document) "keydown" on-keydown!)
+  (aset js/window "onpopstate" on-popstate)
+  (on ($ "datepicker") "changeDate" on-datetime-change)
+  (on ($ js/document) "keydown" on-keydown)
 
   (-> ($ "body")
-    (on "click" ".toggle-meridian" click-toggle-meridian!)
-    (on "click" ".decrement-hour" click-decremen-hour!)
-    (on "click" ".increment-hour" click-increment-hour!)
-    (on "click" ".decrement-minute" click-decrement-Minute!)
-    (on "click" ".increment-minute" click-increment-minute!)
-    (on "click" "#later" click-later!)
-    (on "click" "#earlier" click-earlier!)))
+    (on "click" ".toggle-meridian" click-toggle-meridian)
+    (on "click" ".decrement-hour" click-decremen-hour)
+    (on "click" ".increment-hour" click-increment-hour)
+    (on "click" ".decrement-minute" click-decrement-Minute)
+    (on "click" ".increment-minute" click-increment-minute)
+    (on "click" "#later" click-later)
+    (on "click" "#earlier" click-earlier)))
 
 ;;------------------------------------------------------------------------------
 ;; App Init

        "endDate" end-date))))

(defn init-timepicker []
  )

(defn init-snapshot-list []
  (swap! snapshot-list (fn []

  (:require-macros [hiccups.core :as hiccups])
  (:require
    [hiccups.runtime :as hiccupsrt])
  (:use [jayq.core :only [$ document-ready html on attr prop text]]))

;;------------------------------------------------------------------------------
;; Atoms
;;------------------------------------------------------------------------------

(def snapshots (atom nil))
(def selected-time (atom nil))
(def url-update-timout (atom nil)) ; This probably doesn't need to be atom, maybe be clojure feature that handles this

