"One thing I noticed is that you pass in the array by reference (good idea), but the first thing you do is copy it entirely into a local variable. Why not keep accessing it by reference, like this: (I changed some other things around too)"
Wow! I keep accessing it by reference, it runs in no time. Fantastic. Thanks a lot.