included openfire, refactored a bit