worker_factory refactor