sort and link