Added switch functionality