reorder middleware