Improvements to environment script