Cleaning up namespaces and modules for api documentaiton

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