digest email minor refactoring