Using the _getWordPos() function and removed the redundant code.