tweaks

- used more robust hostname / protocol comparison
- dropped the else and returning early