You have not done yourself, or anyone else, any favours by not using code tags when you posted your code. As a result much of it is in italics, the most common cause of which is using i as an index to an array. This is seen by the forum software as an italics tag which causes all subsequent text to be shown in italics.
Please edit your post to use code tags.