Improve new algorithm.