rewrite Aggregate