Implemented the switch feature.
fixed merge conflicts