Add ADVANCE macro to encapsulate some iterative operations
Fix conditions for recognizing recursive OSC and ST