Changed search algorithm.