Test for sort order and some small clean up.