moved unnecessary code out of scheduler