Shorter (nicer) KM code?

Yes, assuming that your objective is:

I just posted the complete macro with example main macro: