I'll cherry-pick this, and add an optional argument for the sorting algorithm.