Modified script.js

General cleanup work done on file, including adding comments