Sorting algorithm for LDS Church