updated with some functions in data model