I think you meant to do `table[i]` here and in the rest of the loop body.