Cleaned up scheduler code to have more coherent comments and <100 char lines.