Added switch and when