updated some javascript code