added logic for test cases