Added more comments and reformatted some lines in script.js