add event code