made some minor changes to the javascript code