updated schedule logic