Optimized script structure