Clean-up on the findFirstPort method.