refactoring of xml eml builder