Loop fix

Uses a push() to get the length, subtract one, pop() the element off, and then use the value in the for statement. Should not create an infinite loop