Updating get_hosts with more functionality