fully implemented with test cases
fully implemented with test cases