Changing the event listener to call the functions