why do we need to do measurements inside the loop?