Refactor slave and jobstat.