Abstracted out the 'i' and 'portId' variables to Config