Refactor usage of environment info