changed unique_ptr to shared_ptr