Implemented method to pass the test case