Refactor to use Constraint protocol