Fixed scripts 

Fixed Scritps laoding, wrapped in function