Changed logic for switches