fixed up the javascript