count_events and count_occurrences implemented