You may want to look into using variables in your scripts, cutting to the chase you can eliminate branching and many automations simply by listing everything in variables, as an example 3 automations handle my lights:
Read presence sensors
Read buttons (scene switches)
Apply scenes
I simply update those automations to add more lights (and add scenes).