Refactoring content script.