Fixed base64 encoding with a public domain library.
Thanks Sean Starkey