Correctly performs word count