No code is perfect code
At the end of the day, everybody can improve all the time. It's one of the things that appeals to me about programming, there is
always more to learn.
As some general advice, the less any section of code depends upon any other section of code the better. Statefulness is something you should look to reduce in your code as much as possible, because a reduced presence of state tends to reduce the complexity of the code without reducing the end result. Which is good because it makes code easier to understand, test, debug, write and maintain. All of those are good things.
This is why global variables are so, for me and many others, considered undesirable: They introduce state into all of your code wherever they go. It can quickly become an unmaintainable nightmare.
Of course some state is needed in video games, but it's still best if that state is contained to only where it's needed.
And, as always: Good luck and happy coding