Generalized the case-splitting routine.