Implement branch switching.