Make the environment detection much simpler