massive refactoring for new namespaces