Make loop counter local