Improve logging, plus few minor improvements.