How to write a contract