Where is this `i` coming from? At this point there is no `i` defined. Should this have been `j` instead?