Started integrating the occurrences algorithm