Add implementation and test cases.