mostly improved logging