       # legacy support
       namespace = name
       name = namespace.name
-    @_setChildNamespace name, namespace
-    @[name] = namespace
-    @allNamespaces[namespace.namespacePath] ||= []
-    @namespaces = @allNamespaces[@namespacePath] ||= []
-    @namespaces.push namespace
+    @_setChildNamespaceProps name, namespace
+    @allNamespaces[@namespacePath] = namespace.initAsSubNamespace name, @
     namespace
 
-  @_setChildNamespace: (name, child) ->
+  @_setChildNamespaceProps: (name, child) ->
     if typeof child == "function" && name.match /^[A-Z]/
-      child._name = name
       child.namespace = @
       child.namespacePath = @namespacePath + "." + name
 

      @[k] = v

  @addModules: (map) ->
    @modules = [] unless @hasOwnProperty "modules"
    if @hasOwnProperty "moduleNames"
      console.log("NeptuneNamespaces: alread have moduleNames for #{@getName()}")
    else
      console.log("NeptuneNamespaces: create moduleNames for #{@getName()}")
      @moduleNames = []

    for name, module of map
      @moduleNames.push name
      @modules.push module
      @_setChildNamespace name, module
      @[name] = module unless name.match /^-/
    @


  @package: _package = require "../package.json"
  @version: _package.version

Base.namespace = Neptune
