refactored .digest