Here is the flowchart I promised. Now that I have the rough outline (actually put down on paper) I can more easily rewrite the script.