Use the new sorting api. (fixes #55)