reapply namespace change

This PR is to reapply some of the namespace changes for a cleaner history (previous pull was removed due to unnecessary merges).