Refactor template method