Improving the algorithm.