I don't mean to criticise your work; I'm just trying to understand what it is you're doing. I do hope that comes across.
Did you have a look at this? It uses the same keypress counting method and responds to single, double, triple (or more) taps and a long press, but runs very fast.
I apologise for my confusion. Do you mean that sometimes this doesn't work in your macro?
As you can see, I've given the same problem a fair bit of thought, so this comes from a place of friendly curiosity.