fixing sorting and new row addition to deal with paging