working Base64 implementation