1. Fixed order of comment flushing
2. added concept of popping the string context buffer
3. refactored some code to make sense with flushing algorithms (rather than in mem substitutions)