Replace deprecated getenv(X) with environment[X].
Gah, need to use .get to handle case when environment variable isn't defined.

Otherwise it would throw a runtime exception. :-(