Refactoring and adding namespaces