pep8 fixes
slight refactor of select_hosts, made the code slightly easier to follow