Convert base64 library into an angular service.
Fix lexical errors.