change the hosts strucutre from a list to a dict