Adding the code to get the word count from the query