Now uses explicit ordered list of ports instead of port.index.
Note that subsystems are still treated in arbitrary order.