Changed for loops to be array based. 

Sorry about last commit, description was bad.