Refactored duplicate code in Input/Output.__init__() into Port.__init__()