Updating offset in every iteration