implement template method