optimized location script loading