Begin to implement scheduling algorithm. Partially in comments.