replace all remaining `for` with `foreach` or `do`