Added word count
Fixed bug in word count output