first version of scheduler debugged