Added continuity algorithm