Refactoring according to the new Worker API.