added a method to iterate over an inventory