added reordering for clauses