removed definitely necessary inner loop