Implemented Misha's algorithm.