Added automatic host detection.