Added logic for getEvents()