refactoring second case