updated to prevent scheduling at the end of the day