Added back expansions, now much simpler with the subquery system.