Simplify and fix job scheduler, especially with respect to the priority system.