Simplify digest function.
Add optional daemonization.