Added more logging and configuration from environment variables.