added the function of add an event