Move most functionality to o2p_aggregate_relation