Simpler logic to get current virtual environment