and the above for loop should be repeated before the update.