added XML declaration and collection handling