Refactor tpl template