Improve result formatting, add class to flatten the xml