update pointer and iteration