some basic refactoring for namespaces - more needed