   waiting = []
   allRegistered = {}
 
+
+
+  beginResolving = (name) ->
+    resolver = allRegistered[name]?.resolveMe
+    if resolver
+      allRegistered[name].resolveMe = null
+      resolver()
+
+
+
   loadModules = (modules, callback) ->
     missing = {}
     resolved = {}

    resolved.forEach (m) ->
      m.callback.call(null, m.modules)

  checkAllRegistered = once ->
    return if lazy

    allModules = Object.keys(allRegistered)
    allDeps = flatten allModules.map (m) -> allRegistered[m].dependencies
    missing = removeAll(unique(allDeps), allModules)

    if missing.length > 0
      onError(new Error("The following dependencies was never defined: " + missing.join(', ')))




        resolved[m] = diModules[m].value
      else
        missing[m] = true
        beginResolving(m)

    if Object.keys(missing).length == 0
      setImm -> callback(resolved)
