     if !@busy
       @onResult = onResult
       @busy = true
-      @last_request_type = type
+      @lastRequestType = type
       @proc.stdin.write(request);
     else
       console.log('Server busy!')
+      @lastRequestWhenBusy = [type, args, onResult]
 
   spawnChildProcess: ->
     options =

    @args        = [path.join(__dirname, "alchemist-server/run.exs"), "dev"]
    @proc        = null
    @busy        = false
    @last_request_type = null

  start: ->
    @proc = @spawnChildProcess()

    buffer = ''

    @proc.stdout.on 'data', (chunk) =>
      if ~chunk.indexOf("END-OF-#{@lastRequestType}")
        [before, after] = chunk.toString().split("END-OF-#{@lastRequestType}")
        @busy = false
        @onResult((buffer + before).trim())
        if after
          buffer = after
        else
          buffer = ''
        if @lastRequestWhenBusy?
          [type, args, onResult] = @lastRequestWhenBusy
          @lastRequestWhenBusy = null
          console.log("Retrying last request when busy")
          @sendRequest(type, args, onResult)
      else
        buffer += chunk.toString()
      return
