A little re-factoring to make sure unit-tests work even if we are looking for env variables