       for handler in result_handlers
         return if handler.call run_context, object
 
-    lead.define_functions functions, graphite_function_names
     try
       compiled = CoffeeScript.compile(string, bare: true) + "\n//@ sourceURL=console-coffeescript.js"
     catch e
       if e instanceof SyntaxError
         error "Syntax Error: #{e.message} at #{e.location.first_line + 1}:#{e.location.first_column + 1}"
       else
-        handle_exception e, compiled
+        run_context.handle_exception e, compiled
 
     if compiled?
       try
-        `with (cli) { with (functions) { with (vars) {`
+        `with (run_context.cli) { with (run_context.functions) { with (run_context.vars) {`
         result = eval compiled
         `}}}`
         display_object result
       catch e
-        handle_exception e, compiled
+        run_context.handle_exception e, compiled
 
       scroll_to_result $top
 


    run_context.cli = cli = bind_cli run_context

    functions = {}
    vars = lead: {github, graphite, colors}

    handle_exception = (e, compiled) ->
      console.error e.stack
      cli.error printStackTrace({e}).join('\n')
      cli.text 'Compiled JavaScript:'
      cli.source 'javascript', compiled

    error = (message) ->
      $pre = $ '<pre class="error"/>'
      $pre.text message

      current_options: {}
      default_options: notebook.default_options
      output: output output_cell.$el
      functions: lead.define_functions {}, graphite_function_names
      vars: lead: {github, graphite, colors}
      set_code: (code) ->
        cell = add_input_cell notebook, code: code, after: run_context.cell
        focus_cell cell
