Add sorting to remain_units array