     tempStorage = @serialize()
     webSocket.trigger "simulateGrid", tempStorage
     if localStorage? and Config.saveToLocalStorage
-      localStorage.setItem 'simulation', JSON.stringify(tempStorage)
+      localStorage.setItem "simulation.#{Config.language.id}", JSON.stringify(tempStorage)
 
   @stop = () =>
     throw 'already stopped' if @isStopped

    # load elements
    @canvas = document.getElementById "pirateGrid"
    @context = @canvas.getContext "2d"

#    @languageOptions = $('#languageData').html()
#    @languageOptions = JSON.parse(@languageOptions)
#    @language = @languageOptions.name
#    codeMode = @languageOptions.options.codemirror.mode
#    scrips = @languageOptions.scripts[0]
#    console.log(scrips)


    @speed = Math.round Config.maxSimulationSpeed/2 # overriden by load
    Grid.initialize @canvas, 32

    @load tempStorage
    tempStorage = null

  clear = () ->
    CodeGUI.clearHighlighting()
    PacketHandler.clear()
