I tried refactoring the class to take input and generate the hosts and data from that each time but ran into problems elsewhere.  Will have another go though.