fixing up the javascript