refactor testagg