Changing local variable ORD to index
Change while loop to for loop
Put all variables in camelCase
Adjust spacing and indentation