added XML write capability, wrote 2001