Use item keys instead of text names

Hi Andrew, I made some minor changes to your code, mainly so we use item keys instead of text names to iterate through each host. Item names can vary wildly, and using their keys makes the code more portable between versions and sites (and will possibly work for other languages than English).