refine scripts.js