Updated some javascript functionality