cleaning up some javascript