Added more efficient backward iteration code