Initial commit for views + Refactoring

Refactor so that stuff that requires database and session occur in the model
instead of in the controllers

Refactor so that we use test cases instead of tuple.