     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

        block = arg

    block ?= -> # empty function
    top    = AutoexecBat.topLevel #window
    target = AutoexecBat.namespace name

    target.name     = name

root = exports ? window

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