Guarantee the same sort order every time
Incorporate latest updates from Jim