Fix endless recursion, add persistence, etc

Having main() call itself over and over is a bad idea imho, as eventually your callstack will get HUGE. You typically only want to use recursive functions when there's a finite limit to how many times it will call itself. Python has a much nicer way of iterating through arrays than having an iterator variable, although if you need to have one, you can do 'for x in xrange(len(array))' with 'array[x]'. In this case, simple "for x in array" works.