Replaced unique_ptr with shared_ptr.