Improved wordCounter