Use shared_ptr instead of unique_ptr