Contract logic