I modified to use `shared_ptr`