Since defers aren't executed until the end of the function, I'd have to break the loop body off into a separate function. I'll give that a try.