refactoring to strategy