Improving the algorithm for determining maxInterval_5_10