Refactor using util to check if word is valid.