Updated templates: better function declaration.
Fixed indentation.
Updated current examples to reflect changes on templates.