Extract constraint creation to separate method

Client code can handle adding and removing constraints manually.