Refactor output/input groups to remove ordering between groups.