More test cases added and bug fixes