Refactoring for strategy pattern