Add base64 logic