More xml output logic