Improved XML Generation