Update to the scheduler code, so people can review it.
Code update for review.