added template method pattern