added the reorder rows function