added type switch