Improve sorting of predicates