Data type of loop counter changed to NSUinteger. Minor fixes.