add sort and update search function