Refactor in worker