fix inner loop naming for clarity