Trying to modify the loop to make it work
progress