replacing by templates