finish matching algorithm
sort result list