Moved authentication related code to an authication.js (background.js)