add the updated scheduling logic