Found out MIME type required padding characters for base64 encoding and decoding. My functions have been updated