Switch to basic for loops for performance.