cleaned up some of the javascript