improve test case to handle corner cases
implement basic logic without collection support.