Minor optimization that seems to make a major difference*

* Without this optimization I would sometimes
  hit `recursion depth exceeded' errors.