Adding some functions to model.js