Added multiphase aggregate queries (for Chun).