reorder queries