refactor for multiple host names