refactored the word count a bit more