implemented the lexicographic sorting of reified things