scoping and looping