Write code with template