functional version as disk and xmpp handlers