uncommented actual scheduling code