Cleaning up namespaces and modules for api documentation

With these changes, the api documentation structure is relatively coherent.