refactor default xmpp handler. 200-line methods are hard to read