cleaned up the code and added a conditional to display a message when no events are available