     AUTOSAVE_DELAY = 100
     aceChangedDebounced = _.debounce(aceChanged, AUTOSAVE_DELAY, false)
 
-    aceLoaded = (editor) ->
+    setup = (editor) ->
       promised.editor = editor
-      setupAce()
-      console.log 'Ace editor loaded!'
+      editor.setShowPrintMargin(false)
+      loadLocalSave()
+      editor.focus()
 
       editor.getSelection().on('changeCursor', aceChangedDebounced)
 
-    # Quick fix to prevent aceLoaded from being fired twice in quick succession.
+    # Quick fix to prevent setup from being fired twice in quick succession.
     # Eventually we should figure out what's causing it to be fired in quick
     # succession in the first place.
-    aceLoadedDebounced = _.debounce(aceLoaded, 100, true)
+    setupDebounced = _.debounce(setup, 100, true)
 
     $scope.aceChanged = -> aceChangedDebounced()
-    $scope.aceLoaded = (args...) -> aceLoadedDebounced(args...)
+    $scope.aceLoaded = (args...) -> setupDebounced(args...)
     $scope.sendEditorData = ->
       editor = promised.editor
       value = editor.getValue()

      else
        editor.setValue DEFAULT_VALUE
        editor.gotoLine 0, 0
      #value = localStorage.edit__autosave_value || DEFAULT_VALUE
      #line = localStorage.edit__autosave_line || 0
      #column = localStorage.edit__autosave_column || 0
      
    doLocalSave = ->
      storage = DataStore.create 'simple'
      editor = promised.editor

      position = editor.getCursorPosition()
      line = position.row + 1
      column = position.column
      editor_state = {
        value: value
        line: line
        column: column
      }
      storage.set('student_code', editor_state)

    setupAce = ->

    aceChanged = ->
      doLocalSave()
