Refactor to use a Y-combinator.  Global variables are bad\!