   constructor: (context) ->
     log.info 'CodapConnect: initializing'
     GraphStore = require '../stores/graph-store'
+    @standaloneMode = false
+    @queue = []
     @graphStore = GraphStore.store
     @lastTimeSent = @_timeStamp()
     @sendThrottleMs = 300
 
-    # Create a new case for each experiment:
-    SimulationStore.actions.createExperiment.listen   @_openNewCase.bind(@)
-
-    SimulationStore.actions.recordingFramesCreated.listen  @_addData.bind(@)
+    SimulationStore.actions.recordingFramesCreated.listen  @addData.bind(@)
 
     CodapActions.sendUndoToCODAP.listen @_sendUndoToCODAP.bind(@)
     CodapActions.sendRedoToCODAP.listen @_sendRedoToCODAP.bind(@)

      if ret?.success
        @initGameHandler ret
      else
        @codapPhone.call
          action: 'create',
          resource: 'dataContext',
          values: {
            name: 'Sage Simulation',
            title: 'Sage Simulation'
            collections: [ {
              name: 'Simulation',
              title: 'Sage Simulation',
              labels: {
                singleCase: 'run',
                pluralCase: 'runs'
              },
              attrs: [
                  {
                    name: tr '~CODAP.SIMULATION.EXPERIMENT'
                    type: 'numeric'
                  }
                ]
              },
              {
                parent: "Simulation",
                name: 'Samples',
                title: 'Samples',
                labels: {
                  singleCase: 'sample',
                  pluralCase: 'samples'
                }
                attrs: sampleDataAttrs
              }
            ]
          }
        , @initGameHandler

  _openNewCase: ->
    @caseOpened = true
    caseData = {}
    caseData[tr '~CODAP.SIMULATION.EXPERIMENT'] = SimulationStore.store.settings.experimentNumber
    @currentCaseID = null
    collectionAction = @_createCollection()

    @codapPhone.call([
      collectionAction,
      {
        action: 'create'
        resource: 'dataContext[Sage Simulation].collection[Simulation].case',
        values: { values: caseData }
      }
    ]
    , (result) =>
      if result?
        [collectionResponse, caseResponse] = result

        if caseResponse.success
          @currentCaseID = caseResponse.values[0].id
          @_flushQueue()
          if not @standaloneMode
            @createTable()
        else
          log.info "CODAP returned an error on 'openCase'"
    )

  _createCollection: ->
    nodes = @graphStore.getNodes()

    # First column definition is the time index

      values: {
        operation: 'redoAction'
      }

  sendUndoableActionPerformed: (logMessage) ->
    @codapPhone.call
