sorted and correctly printed