extended the test case 7 logic to test case 8