Refactor for wordbreak II