script optimizations