Define loop counter variables near their usage
Remove unused include files