Preparing work on total number of occurrences. Needs testing.