reorganize iterate(), great speedup