More views tests, refactor of some of the views code

All the views are tested now and all tests pass.

Some of the views could probably use a good refactor but I'll do that in another pull request.