Added functions for the iterator algorithm.