Split the cases
When a decision alternates between two shapes, two functions calling each other read better than one with a flag.
Both need a base
Every function in a mutual group needs its own base case. A missing base turns the hand-off into an endless loop.