How to generate code