Avoid using btoa as older IE browsers don't have it