How to clean up Serial port buffer

Exactly. It's a kludge. If you want to do something every time you go through loop, just do it.