Re-added original loop structure but simplified it.