updated scheduling algo