Reducing number of comparisions and fixing error which was present when a self terminating tag and a terminated tag were both present in the same item.
Changing version