Add to_xml functionality, some documentation and some more tests. :cat: