Implemented new algorithm.