moved all code into a background page, popupjs.