general improvement in the code. add discretizamodel() and few other stuff