Improved XML parsing and result handling.