ADVANCED CONTRACTS: THEORY AND APPLICATION