Fixed failing test cases and added new test cases.