How to create and use contract templates