forEach with the possibility to change the next position