Update background.js

updated formatting
updated comments 
got rid of unneeded functions

to do:
logically place functions in logical order if possible
put all variables together logically if possible