added improvements, now works with openfire