More refactoring to move things into proper namespaces and to help find dead code that is no longer used.