Might want to pull this out into a module at some point so we can use it everywhere. Or you can just use https://github.com/jmoses/ruby19_stable_sort/blob/master/lib/ruby19_stable_sort.rb