More refactoring of constraint simplification