Reformed the algorithms.