local switch now uses function