refine user define model function
Merge 2 days changes