This is the canonical implementation of the conway-weschler algorithm.