Some work towards scoping out all shared_ptrs when logging out. Unfinished.