Changed array index to int. Huge improvement.
Rewrote array index function.