Tidy up the sorting