Extracted Constraint Solving code