finished view.js and main.js