Add branch swapping functions