         $div = $('<div/>')
         if contents?
           if _.isFunction contents
-            return run_context.nested_item $div, contents
+            return @nested_item $div, contents
           else
             $div.append contents
-        run_context.add_rendered $div
+        @add_rendered $div
         $div
 
       output: (output) ->
         $item = $ '<div class="item"/>'
         if output?
           $item.append output
-        run_context.add_rendered $item
+        @add_rendered $item
         $item
 
       renderable: (o, fn) ->
-        nested_context = run_context.create_nested_context
+        nested_context = @create_nested_context
           renderable_list_builder: add_renderable: -> throw new Error 'Output functions not allowed inside a renderable'
-        o._lead_render = -> run_context.in_context nested_context, fn
+        o._lead_render = -> nested_context.apply_to fn
         o
 
       nested: (className, fn, args...) ->
         $item = $ "<div class='#{className}'/>"
-        run_context.current_context.nested_item $item, fn, args...
+        @nested_item $item, fn, args...
 
       create_nested_renderable_context: ($item) ->
         renderable = delayed_renderable_list_builder $item
-        run_context.create_nested_context
+        @create_nested_context
           renderable_list_builder: renderable
 
       create_nested_context: (overrides) ->
-        nested_context = _.extend {}, run_context, overrides
+        nested_context = _.extend create_new_run_context(@), overrides
 
       detached:  (fn, args) ->
         $item = $ "<div/>"
-        nested_context = run_context.create_nested_renderable_context $item
-        run_context.in_context nested_context, fn, args
+        nested_context = @create_nested_renderable_context $item
+        nested_context.apply_to fn, args
         nested_context.renderable_list_builder
 
       nested_item: ($item, fn, args...) ->
-        nested_context = run_context.create_nested_renderable_context $item
-        run_context.add_renderable nested_context.renderable_list_builder
-        run_context.in_context nested_context, fn, args
+        nested_context = @create_nested_renderable_context $item
+        @add_renderable nested_context.renderable_list_builder
+        nested_context.apply_to fn, args
 
       handle_exception: (e, compiled) ->
         console.error e.stack


      display_object: (object) ->
        for handler in result_handlers
          return if handler.call run_context, object

      value: (value) -> _lead_context_fn_value: value


  bind_context_fns = (run_context, fns, name_prefix='') ->
    bind_fn = (name, op) ->
      bound = (args...) ->
        if @imported_context_fns? and @ != run_context.current_context
          # it looks like this is a context, but not the current one
          console.warn 'mismatched run context'
          console.trace()
        # if the function returned a value, unwrap it. otherwise, ignore it
        op.fn.apply(run_context.current_context, args)?._lead_context_fn_value ? ignore
      bound._lead_context_fn = op
      bound._lead_context_name = name
      bound
