updated JS to increase loading speed