clean up the javascript a bit