Update codes to support registration of multiple events.