Split up javascript file into model, view, and controller.js files. Working solution.