   # Document ready
   # ------------------------------------------------------------------------------------------------------------------
   $document.ready ->
-    # load ace editor
+    # init ace editor
+    vm.init_ace_editor()
+
+    # sync scroll
+    scrollSyncor.syncScroll(vm.ace_editor, $('#md_html_div'))
+
+    noteManager.init_current_note()
+
+    # get note list from local
+    noteManager.reload_local_note_list()
+
+    # get note list from remote
+    noteManager.fetch_note_list()
+
+    # get notebook list from remote
+    noteManager.fetch_notebook_list()
+
+    # take effect the settings
+    vm.set_keyboard_handler(vm.current_keyboard_handler)
+    vm.set_show_gutter(vm.current_show_gutter)
+    vm.set_ace_theme(vm.current_ace_theme)
+
+    # reset app status
+    vm.reset_status()
+
+    # all ready
+    vm.all_ready = true
+
+  # ------------------------------------------------------------------------------------------------------------------
+  # ace editor init
+  # ------------------------------------------------------------------------------------------------------------------
+  vm.init_ace_editor = ->
     $window.ace.config.set('basePath', '/javascripts/ace')
     vm.ace_editor = $window.ace.edit("md_editor_div")
     vm.ace_editor.renderer.setShowGutter(false)

    vm.ace_editor.setTheme('ace/theme/tomorrow_night_eighties')
    vm.ace_editor.on 'change', vm.editor_content_changed
    vm.ace_editor.focus()

    # sync scroll
    scrollSyncor.syncScroll(vm.ace_editor, $('#md_html_div'))

    noteManager.init_current_note()

    # get note list
    noteManager.fetch_note_list()

    # get notebook list
    noteManager.fetch_notebook_list()

    # take effect the settings
    vm.set_keyboard_handler(vm.current_keyboard_handler)
    vm.set_show_gutter(vm.current_show_gutter)
    vm.set_ace_theme(vm.current_ace_theme)

    # reset app status
    vm.reset_status()

    # all ready
    vm.all_ready = true

  # ------------------------------------------------------------------------------------------------------------------
  # ace editor event handlers

  # ------------------------------------------------------------
  init_current_note: () =>
    previous_note_guid = localStorageService.get(@SETTINGS_KEY.CURRENT_NOTE_GUID)
    if not previous_note_guid?
      previous_note_guid = "INVALID_GUID"
    p = @find_note_by_guid(previous_note_guid).then (note) =>
      if note?
