first refactor of xenFormatXM