Split the /etc/hosts stuff to a separate method