Added the stabilize algorithm.