Environment detection.