loadScript function created