Rework environment variables
Merge pull request #2607 from roidrage/patch-1

Rework environment variables