implmented base64 rewrite