Made imports Python3-friendly, added XML export on quit