Refactor XML generator class