Namespace refactoring and unit tests