added conditional scheduling