Changed how environment var is checked... this sure is not made easy