Updated with base64 encoding to prevent unterminated quotes