optimized for loop using index