changed type of constraint to include an index argument