updated to pass test case 2