loop counter in closure