Continued working on this code to make more compliant XML