added more scheduling code