Correct improper order of operations causing recurring elements to not be counted