better use of Getenv;  tidy a logging statement