Implemented In function with test cases.