Move to single state from a few booleans for worker.

Also privatized handle_signals, pid and hostname.
More specs for Worker#work and try to make logic more clear.