Optimise: for-loop counters made local variables