loadScript function