We need to optimize the algorithm.