Emil's changes to XML package & factories