code cleanup on contentscript