cleaned up some javascript