(start of) Major refactoring to support non-index PortIds