modifying the templates to handle Nil values