Added support for running script with environment settings