Made a few changes to the javascript