Change post increments to pre increment for speed improvements in loops