Use iterator when removing elements during iteration.