Added a work dispatcher to handle work in worker processes.
Lots of other tweaks.