changed iteration method