Adding nonGreedyScheduling function