Change for loop post-increments to pre-increments