Change aggregate to use flag