How can I avoid errors using a complex snippet when I need to re-run the snippet because I want to change an initial variable?

@George_Marinos - I think I've nailed it. Look at this:

Please double-check that all of the advice is rendering properly, in case I messed something up lol.