@trillbilly Write it out as a list, in English.
Then do this,
If this, do this,
Otherwise do this
It might make it easier to figure out the flow of the program.