Add functionality to get total number of events