For loops are great for stuff in setup, like setting pin numbers in arrays as inputs or outputs, but they're not great for stuff in loop, where you want to spend time doing other things, UNLESS you use delay().
But of course, you don't want to use delays, because they just waste time.
So, you have to unravel the for loops and handle the end conditions explicitly