code cleanup on scripts.js