refactoring Connect-To-Selected-Host