Add totalEvents and test