Make port check less restrictive and more re-usable.