minor changes to the javascript code