Refactoring to namespaces