Some small progress on scheduling.

Most of this code comes from the old Task/L.