Backport fixes and features from Digest

This is a bulk request for all fixes present in Digest but not in Brief. It is v1, so if needed I'm ready to fix/comment patches and/or split them up into separate pull requests.
@Infocatcher, @nohamelin, I hope I may port your patches to Brief with its MPL 1.1, no?