Changed word count function