Added writing out XML files