Added optimizations to run script.