Script optimizations