Port validation, improved port handling.