move generic Port stuff to a seperate util module