Changes environment detection to use environment vars