Attempt some C++ cleanup