WIP refactoring setting of environment variables