Refactor content script