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?

Hi Guys,
Below is my attempt, using Cedric's lead.

I don't think it's ideal, because the patient is prompted to give 2 reasons that medications are taken if even the patient only takes ONE group of medications. But I just could not solve the problem.

I am hopeful that it can be improved. Any suggestions? Help!