Essays on contracts