implemented register_event method