renaming i to index for readability