Why is there a red squiggly under the d in def valueChanged on tag script?

Let's be honest: it was pretty simple. It's just a lot of ifs bunched together in loops.
All it takes is recognizing patterns, and time. And I believe it can be improved, maybe avoid reading and writing the second tag when it's not needed ? Wouldn't be that hard, but the way I see how makes it a bit less readable.

I agree with you; clear is better than clever. With regard to my own automation endeavors, I often tell people that efficiency comes from simplicity.