template method for strategy pattern