Improve branch switch