refactored the XML writers to be separate classes