More switches code moved to switches.cpp
Little correction after the last cherry-pick