sort & format