Develop

Changes to use XML writer and remove redundant code