continue algorithm implementation