switching branch functionality