     }
 
     func remove(pet: Pet) -> Pet? {
-        let index = animals.indexOf { $0.name == pet.name }
+        let index = animals.indexOf { $0 == pet }
         if index != nil {
             return animals.removeAtIndex(index!)
         }

        closure(item: items[index])
    }
}

iterator(dogs) { (pet) in

    print("\(pet.name) makes a \(pet.makeSound()) sound.")

        return ""
    }
}
class Dog: Animal {

    override func makeSound() -> String {
        return "bark"
    }
}

class Cat: Animal {

    override func makeSound() -> String {
        return "meow"
    }
}

let dogs: [Dog] = [Dog(name: "Fido"), Dog(name: "Spot")]

let cats: [Cat] = [Cat(name: "Snowy"), Cat(name: "Snuffles")]
/*:
 ## Why use Generics
 One of our requirements is to iterate over each animal in the kennel and supply what action should be taken for each animal. Currently we need to create 2 iterator functions, one for dogs and one for cats.
 - example: Implementation of the iterator functions for dogs and cats.
 */
func iteratorDogs(dogs: [Dog], closure: (dog: Dog) -> Void) {
    
    for index in 0..<dogs.count {
