format and reorder