environment detection