                         success : (data) ->
                             try
                                 opts.scene = JSON.parse data
-                                cb()
-                            catch err
-                                cb err
+                                callback()
+                            catch error
+                                callback error
                     ).fail ->
-                        cb "error downloading #{opts.scene}"
+                        callback "error downloading #{opts.scene}"
                 when 'object'
-                    cb()
+                    callback()
                 else
-                    cb "bad scene value: #{opts.scene}"
-        (cb) ->
+                    callback "bad scene value: #{opts.scene}"
+        (callback) ->
             # do this initialization *after* we create the 3d renderer
-            init = (err, scene) ->
-                if err
-                    cb err
+            init = (error, scene) ->
+                if error
+                    callback err
                 else
                     scene_obj = scene
                     scene.init()
                     if opts.scene.obj?
                         scene.add_3dgraphics_obj obj : opts.scene.obj
                     scene.init_done()
-                    cb()
+                    callback()
             # create the 3d renderer
-            opts.scene.opts ?= {}
             opts.scene.opts.callback = init
 
             obj = new Math3dThreeJS opts.element, opts.scene.opts
-    ], (err) ->
-        opts.cb? err, scene_obj
+    ], (error) ->
+        opts.callback? error, scene_obj
     )
-
-if $?
-    # jQuery plugin for making a DOM object into a 3d renderer
-    $.fn.math3d = (opts = {}) ->
-        @each ->
-            new Math3dThreeJS @, opts


        @render_scene true


    animate: (opts = {}) ->
        opts = defaults opts,
            fps       : undefined

                run_callback = false
                callback "error loading script #{script.src}"

    script.type = 'text/javascript'
    script.async = true
    script.src = script_src

    document.head.appendChild script

_loading_threejs_callbacks = []

math3d.threejs_src = "http://cdnjs.cloudflare.com/ajax/libs/three.js/r68/three.min.js"
math3d.orbitcontrols_src = "OrbitControls.js"

load_threejs = (callback) ->
    if THREE?.Scene? and THREE?.OrbitControls?
