altered to shared_ptr