       (js->clj)
       (clojure.walk/keywordize-keys)))))
 
-(defn init-current-index []
+(defn init-snapshot-index []
   (let [image (attr ($ "#currentSnapshot") "src")
-        starting-index (first (keep-indexed #(if (= image %2) %1) @snapshot-list))]
-    (swap! current-index #(if (pos? starting-index)
+        starting-index (first (keep-indexed #(if (= image (:image %2)) %1) @snapshot-list))]
+    (swap! snapshot-index #(if (pos? starting-index)
                                 starting-index
                                 0))))
 

;;------------------------------------------------------------------------------

(def snapshot-list (atom nil))
(def current-index (atom nil))
(def url-update-timout (atom nil)) ; This probably doesn't need to be atom, maybe be clojure feature that handles this

;;------------------------------------------------------------------------------

  (init-datepicker)
  (init-timepicker) ; seperate namespace?
  (init-snapshot-list)
  (init-snapshot-index) ; current-index change is probably what replaces original update
  (add-events))

(document-ready init)
