update scheduling algorithm as Nad suggested