Add iter_grams_for_modify for modifying model while iterating; use it