I can't tell you for sure, what's going wrong.
What I can tell you is that you really should use sub-events (How events work).
I'm pretty sure a strict reorganisation of the code and less splitting/includes (you really don't need to split the code so much) will help settle things down.
For a better organisation readability of the code, use groups.
There's not much to be done there to help but massively rewrite the whole thing, which I'm not willing/able to do right now.
With a cleaner structure, the code is likely to behave as expected.