Implemented self executing function.

Implemented self executing function to expose only ModelDef object.