Added buildWithConstraint method.