Significant refactoring

- Improved XMPP registration/connection code.
- Refactored and improved some UI animations.