template method refactored to strategy