Cleaned up namespaces and removed some defunct code