added view, added test cases and minor bug fix