Refactor doWork()