Move state-changing logic out of scheduler and be more explicit about waitpid-status vs. state.