Refactor occurences logic into WordCounter object