added sorting, changed the interface, modified the documents, added some test case