Non-compiling intermediate refactoring for removing ref_ptr