Created smaller functions to assist with passing data to the event function.