refactor wordBreak