RPT algorithm