Improved script loading