MessageIterator code cleanup and style fixing