Add word count and fix error messages