Refactor base64 functions into a seperate file