UNTESTED: improved logging