this is a second definition of `var k` - can you just take the `var i,k;` out of the for loops above?