cleaning up some of the javascript