Ah, I didn't check that it was recursive. Makes sense.

@jasonsanjose - sure, that looks like a good refactoring.