   localStorageName: "apparatus"
 
   saveToLocalStorage: ->
-    jsonString = @save()
+    jsonString = @getJsonStringOfProject()
     window.localStorage[@localStorageName] = jsonString
     return jsonString
 
   loadFromLocalStorage: ->
     jsonString = window.localStorage[@localStorageName]
     if jsonString
-      @load(jsonString)
+      @loadJsonStringIntoProject(jsonString)
 
   resetLocalStorage: ->
     delete window.localStorage[@localStorageName]

    return unless @isUndoable()
    @redoStack.push(@current)
    @current = @undoStack.pop()
    @load(@current)
    @saveToLocalStorage()

  redo: ->
    return unless @isRedoable()
    @undoStack.push(@current)
    @current = @redoStack.pop()
    @load(@current)
    @saveToLocalStorage()

  isUndoable: ->

  # TODO: get version via build process / ENV variable?
  version: "0.4.1"

  loadJsonStringIntoProject: (jsonString) ->
    json = JSON.parse(jsonString)
    # TODO: If the file format changes, this will need to check the version
    # and convert or fail appropriately.
    if json.type == "Apparatus"
      @project = @serializer.dejsonify(json)

  loadJsonStringIntoProjectFromExternalSource: (jsonString) ->
    @loadJsonStringIntoProject(jsonString)
    @checkpoint()
    Apparatus.refresh()  # HACK: calling Apparatus seems funky here.

  getJsonStringOfProject: ->
    json = @serializer.jsonify(@project)
    json.type = "Apparatus"
    json.version = @version
