More refactoring for namespacing, finally partially working