Contracts: A Transactional Approach