Add some sanity checks
Maintain a reference instead of enumerating the allObjects call each time.