     ns = ns.split "." if typeof ns is "string"
     ns.unshift AutoexecBat.topLevel unless ns[0] == AutoexecBat.topLevel
 
-    module = window
+    module = root
     for item in ns
       module = module[item] unless typeof module[item] is 'undefined'
     module

window.AutoexecBat =
  topLevel: "App"
  debug: true
  autoRequire: null
        
  log: (msg) ->
    console?.log msg if AutoexecBat.debug



# Globals
root.AutoexecBat = AutoexecBat
root.define      = AutoexecBat.define
root.require     = AutoexecBat.require
root.namespace   = AutoexecBat.namespace

# Plugins
unless typeof jQuery is 'undefined'
