changed arities from finite sets to numbers