refactor if with one root aggregation