Moved switch_element to visitor.