I am glad you talked about the repeated conditionals, since they seem like they would be obnoxious to debug and toubleshoot in a larger script. Thanks.
Repetition in general invites all manner of problems (see my other reply further down the thread). Avoid it wherever you can do so with reasonable effort.