now using template method pattern instead of strategy pattern