Finished summary and sort functions