Use shared_ptr
Updated tests