add sorting and its test case