Remove redundant code from script.js and begin function to save clues.