Added most of the structure for ordering units