Adjust environment type checks to use factored function.
Check for environment variable names while we are at it.