Amendments to Greedy Algorithm due to changed iterator