Add contract function