Reimplemented the iterator() method in Handler using a stack rather than a std::map