rename nested control variable 'i' to 'j'

There is already a control variable 'i' in the outer loop.
Avoid confusion and fix compiler warnings.
Merge pull request #4 from jowave/nested_i_fix

rename nested control variable 'i' to 'j'