Optimization of range checking (with retrospective)