implemented new addConstraint method