Adding code to choosePorts to look for collisions