Refactor tpl

TODO :
* Test
* js file