Use shared_ptr for managing events