inner loop