Changed to favor type assertion over type switch