Added tests for the views; fixed bugs