Add gradual group by
Fix tests, migrate to new record serialization format
Cleanup, simplify error code