major refactoring of background/content script message handling