Refactor out the common functionality
Add #fn_base64