refactoring: solveCases