template and def mapping