understanding loops