Refactor content scripts