rename 'result' -> 'results' and create |var result = result[i]| and use that.