added working xml write