script.js code cleanup