optimized script