Finally broke the program out into functions. It's now much cleaner and easier to underntand.