sort: some cleanup