Change recursive expandDefinitions() to an interative worklist-based one; we were blowing the stack.  Fixes a segfault reported by Pantazis Deligiannis.