Refactor/xmpp resource model

#155 needs to come before this