work_queue_worker was not returning the correct exit code.
It now correctly parses the status returned by wait4() to extract
the exit code or terminiation signal.
Wraps monitor with category.

Also, move codes around so that the wrapping for the monitor and batch
options get the same scope.
Consolidate monitoring in a single function