add shared_ptr for memory management