case refactoring