I have added the functions for the events.