Changed algorithm.