correct switch logic