Revert "Revert "Revert "Sorting of Terms"""

This reverts commit 28696d3dbda54f7addf9cd9bb2d031547b1ce1f4.
revert