does not vectorize the inner loop