Reused var instead of getting length again.
I thought this might not work, but it did so leaving it in for now.