SetupEnvironment() - clean commit

Rebased-By: Wladimir J. van der Laan <laanwj@gmail.com>
Rebased-From: 5248ff4