Refactor template to make it independent from a web page