Improve logging, some cleanup