Add hosts to array before iterating over hosts