optimize script loading