copying functions from Model.js to view.js