Fixing the diff view

The diff view currently fails because of a syntax error. The error is now fixed, and I've now written more tests to prevent this from happening. Also, refactored the view code so that it's a bit easier to test now.