Cleanup and minor fix for digest