added branch switching to pivot table