A bunch of refactoring around namespaces, added tests
Use new ns stuff