Begin to refactor script.js in script2.js