Cleanups, including using unique_ptr and shared_ptr.