use internal loop index