 
     _renderer
 
-remove_element = (element) ->
-    if element is null
-        return
-    if (parent = element.parentElement) is null
-        return
-    parent.removeChild element
-
 class Math3dThreeJS
     constructor: (parent_element, opts) ->
         @opts = defaults opts,

        @renderer_type = 'dynamic'

        # remove the current renderer (if it exists)
        remove_element @opts.element.lastChild

        # place renderer in correct place in the DOM
        @opts.element.appendChild @renderer.domElement

        @renderer.setClearColor @opts.background, 1
        @renderer.setSize @opts.width, @opts.height

        @init_light()

        # set background color
        @element.style.background = @opts.background

        if not @opts.foreground?
            c = @element.style.background
            if not c? or -1 is c.indexOf ')'
                @opts.foreground = "#000"  # e.g., on firefox - this is best we can do for now
            else
