       "Fetches document titles and starts the asynchronous command event 
       dispatch loop which handles all major app state changing events.
       Also attaches a KEYDOWN event listener to the page, for hot keys."
-      (listen-to-hotkeys app)
       (om/update! app :titles (p/get-all-titles))
       (let [channel (:channel app)]
         (go-loop []
           (let [[command params] (<! channel)]
             (dispatch command params app)
             (recur)))))
+    om/IDidMount
+    (did-mount [_]
+      "Sets up event listeners when app has been properly loaded."
+      (listen-to-hotkeys app)
+      (synchronize-scroll))
     om/IRender
     (render [_]
       "Renders the app components in a container."

       (.preventDefault %)
       (put! (:channel @app) [:save nil]))))

;; The main app

(defn wordsmith-app

    :change (change-document app params)
    :new    (new-document app)))

;; Hot keys

(defn listen-to-hotkeys
  "Listens to KEYDOWN events using goog.events and checks for Ctrl+S or 
  Cmd+S. When identified, sends a :save command on app channel."
