Add a template and explaing the code