JS reorganization to imporve page load time