Adds more code checks, was missing some for iterators causing
depth.remove() to fire twice and stuff.