unique_ptr refactoring