added models and some functions in models