Yet another major refactoring of the constraint solver