Added macros to simplify output buffer management
Implemented handling of strings with escaped sequences