Added custom function for base64 encoding