xmodel function