 
   @load = (obj) ->
     clear()
+    throw 'obj null' unless obj?
     CodeGUI.setCode obj.code if obj.code?
 
     Grid.load obj.grid if obj.grid?

        @mouse = new Coordinate 0,0
      @mouse.x = event.clientX || event.pageX
      @mouse.y = event.clientY || event.pageY


  @mainLoop = () =>

      for key of obj.vars
        CodeGUI.WatchList.addVariable obj.vars[key]

    Grid.GridControls.setSpeed obj.speed if obj.speed?


jQuery () -> # use jQuery to wait until DOM is ready
