Prepared the code handling all incoming digest types. Added support for listeners.