Changed most postfix index increments in loops to prefix increments