adding optimization for counting word frequencies; when we find a match, break\!