Added HasEnv() and Tests.