move (and rename) with_worker into a separate module and file so it can be reused better.