Added some notes to the code so that whoever read it can know whats going on
Added some minor changes
Added some notes to the javascript