Namespaces API refactoring