Added tests. Fixed error in views