Completed code for event