Implement sorting by quality.