Begin refactor of script.js.