updated some javascript for speed