Is this check happening for every tag? Can't we somehow check that only once when beginning to parse?