first pass of using smart pointers, cleaned up namespaces