Well it looks like the problem was that i was using "i". I thought only nesting for loops in for loops would bring up that kind of problem, but it looks like as long as they're in the same function, it's best to give them separate names. Changing "i" to "ef" fixed the problem. Thanks for the help
