added multiple port functionality