io.ports: some cleanup before optimizations.