consolidated event listeners for word count