refactoring (task logic moved to Worker)